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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: cc-by-4.0
|
| 3 |
+
task_categories:
|
| 4 |
+
- feature-extraction
|
| 5 |
+
language:
|
| 6 |
+
- en
|
| 7 |
+
tags:
|
| 8 |
+
- transformer
|
| 9 |
+
- attention
|
| 10 |
+
- rope
|
| 11 |
+
- power-law
|
| 12 |
+
- scaling-laws
|
| 13 |
+
- interpretability
|
| 14 |
+
- llm
|
| 15 |
+
- benchmark
|
| 16 |
+
pretty_name: TAF Attention-Decay Measurements
|
| 17 |
+
size_categories:
|
| 18 |
+
- n<1K
|
| 19 |
+
configs:
|
| 20 |
+
- config_name: default
|
| 21 |
+
data_files:
|
| 22 |
+
- split: train
|
| 23 |
+
path: taf-attention-decay.jsonl
|
| 24 |
+
---
|
| 25 |
+
|
| 26 |
+
# TAF Attention-Decay Measurements
|
| 27 |
+
|
| 28 |
+
> **First public dataset of attention-decay exponent γ measurements
|
| 29 |
+
> across transformer LLMs.**
|
| 30 |
+
> Companion to the paper *Predicting How Transformers Attend*
|
| 31 |
+
> (Marín 2026, [Zenodo DOI 10.5281/zenodo.19826343](https://zenodo.org/records/19826343)).
|
| 32 |
+
|
| 33 |
+
## What it is
|
| 34 |
+
|
| 35 |
+
Each record is one γ measurement on one (model, corpus, precision) tuple.
|
| 36 |
+
γ is the exponent of the power-law decay of attention weights at distance d:
|
| 37 |
+
|
| 38 |
+
```
|
| 39 |
+
A(d) ∝ d^(-γ)
|
| 40 |
+
```
|
| 41 |
+
|
| 42 |
+
predicted from RoPE geometry by the closed-form Padé formula
|
| 43 |
+
|
| 44 |
+
```
|
| 45 |
+
γ_padé = (2θ - T√2) / (2θ + T√2)
|
| 46 |
+
```
|
| 47 |
+
|
| 48 |
+
where θ is the RoPE base frequency and T is the evaluation context length.
|
| 49 |
+
|
| 50 |
+
## Coverage
|
| 51 |
+
|
| 52 |
+
- **32 models** across 12 families (Pythia, Qwen, Llama, Mistral, Gemma, Phi, OLMo, OLMoE, DeepSeek, StarCoder2, CodeLlama, GPT-J, SmolLM2, Falcon)
|
| 53 |
+
- **58 records** total
|
| 54 |
+
- **2 corpora**: real text (`real_text`, MongoDB English episodes) + random tokens (`random_tokens`)
|
| 55 |
+
- **2 precisions**: 4-bit NF4 (BitsAndBytes) + bfloat16
|
| 56 |
+
- **Includes random-init controls** (E2 falsifier on Pythia 70M/410M/1B with random Gaussian init, no pretraining) — establishes that the slope ν = ∂γ/∂log₁₀(P) ≈ −1/(2π) is genuinely a *training imprint*, not architecture artifact.
|
| 57 |
+
|
| 58 |
+
## Schema
|
| 59 |
+
|
| 60 |
+
Each JSONL row:
|
| 61 |
+
|
| 62 |
+
```json
|
| 63 |
+
{
|
| 64 |
+
"model_id": "EleutherAI/pythia-2.8b",
|
| 65 |
+
"revision": "main",
|
| 66 |
+
"arch": {
|
| 67 |
+
"d_model": 2560, "n_heads": 32, "n_layers": 32, "d_head": 80,
|
| 68 |
+
"n_kv_heads": 32, "n_params_M": 2800, "rope_theta": 10000,
|
| 69 |
+
"T_train": 2048, "family": "pythia",
|
| 70 |
+
"is_instruct": false, "is_moe": false
|
| 71 |
+
},
|
| 72 |
+
"measurement": {
|
| 73 |
+
"gamma": 0.674,
|
| 74 |
+
"gamma_ci95_lo": 0.65, "gamma_ci95_hi": 0.70,
|
| 75 |
+
"method": "pade_d_alias_T",
|
| 76 |
+
"fit": {"log_A": -3.21, "R2": 0.987, "n_points": 9, "delta_R2_power_minus_exp": 0.42},
|
| 77 |
+
"T_eval": 2048,
|
| 78 |
+
"corpus": "real_text",
|
| 79 |
+
"n_prompts_per_distance": 150,
|
| 80 |
+
"seeds": [42, 123, 7],
|
| 81 |
+
"distances": [10, 20, 30, 50, 100, 200, 500, 1000, 2000],
|
| 82 |
+
"precision": "4-bit-NF4"
|
| 83 |
+
},
|
| 84 |
+
"predictions": {
|
| 85 |
+
"gamma_pade": 0.747,
|
| 86 |
+
"gamma_random_pred": null,
|
| 87 |
+
"imprint_constant_nu": -0.1592
|
| 88 |
+
},
|
| 89 |
+
"decision": "MED gamma=0.674 (R²=0.987)",
|
| 90 |
+
"provenance": {
|
| 91 |
+
"taf_version": "0.4",
|
| 92 |
+
"paper_doi": "10.5281/zenodo.19826343",
|
| 93 |
+
"source_file": "EleutherAI--pythia-2.8b_mongo.json",
|
| 94 |
+
"tool": "tafagent/cli/diagnose_model.py + e4_extended_gamma.py",
|
| 95 |
+
"license_data": "CC-BY-4.0",
|
| 96 |
+
"license_code": "Apache-2.0"
|
| 97 |
+
}
|
| 98 |
+
}
|
| 99 |
+
```
|
| 100 |
+
|
| 101 |
+
## Usage
|
| 102 |
+
|
| 103 |
+
```python
|
| 104 |
+
from datasets import load_dataset
|
| 105 |
+
ds = load_dataset("karlexmarin/taf-attention-decay")
|
| 106 |
+
print(ds["train"][0])
|
| 107 |
+
```
|
| 108 |
+
|
| 109 |
+
```python
|
| 110 |
+
import pandas as pd
|
| 111 |
+
df = pd.read_json("taf-attention-decay.jsonl", lines=True)
|
| 112 |
+
df_text = df[df["measurement"].apply(lambda m: m["corpus"] == "real_text")]
|
| 113 |
+
df_text["gamma"] = df_text["measurement"].apply(lambda m: m["gamma"])
|
| 114 |
+
print(df_text.groupby("arch")["gamma"].describe())
|
| 115 |
+
```
|
| 116 |
+
|
| 117 |
+
## Why this dataset exists
|
| 118 |
+
|
| 119 |
+
The attention-decay exponent γ is a single-number diagnostic of how
|
| 120 |
+
"locally" or "globally" a transformer attends. It connects RoPE geometry
|
| 121 |
+
to long-context behavior, KV-cache compression, NIAH retrieval, and
|
| 122 |
+
hallucination rates — see the companion paper for details.
|
| 123 |
+
|
| 124 |
+
Until now, no public dataset of γ measurements existed across LLMs.
|
| 125 |
+
This release closes that gap.
|
| 126 |
+
|
| 127 |
+
## What's NOT in this dataset
|
| 128 |
+
|
| 129 |
+
- **Raw attention tensors** (TB-scale, redundant with model weights)
|
| 130 |
+
- **Per-layer per-head γ-fields** (separate dataset planned)
|
| 131 |
+
- **Training-trajectory γ over checkpoints** (separate, from Pythia ckpts)
|
| 132 |
+
- **Downstream task scores** (use RULER, LongBench-v2, HELM separately)
|
| 133 |
+
|
| 134 |
+
## License
|
| 135 |
+
|
| 136 |
+
- **Data (this dataset)**: CC-BY-4.0
|
| 137 |
+
- **Measurement code**: Apache-2.0 ([github.com/karlesmarin/tafagent](https://github.com/karlesmarin/tafagent))
|
| 138 |
+
- **Underlying model weights**: respective HuggingFace licenses (consult each model's card)
|
| 139 |
+
|
| 140 |
+
## Citation
|
| 141 |
+
|
| 142 |
+
```bibtex
|
| 143 |
+
@dataset{marin2026taf_attention_decay,
|
| 144 |
+
author = {Mar{\'\i}n, Carles},
|
| 145 |
+
title = {TAF Attention-Decay Measurements},
|
| 146 |
+
year = {2026},
|
| 147 |
+
publisher = {HuggingFace},
|
| 148 |
+
url = {https://huggingface.co/datasets/karlexmarin/taf-attention-decay},
|
| 149 |
+
license = {CC-BY-4.0}
|
| 150 |
+
}
|
| 151 |
+
|
| 152 |
+
@article{marin2026predicting,
|
| 153 |
+
author = {Mar{\'\i}n, Carles},
|
| 154 |
+
title = {Predicting How Transformers Attend: Analytic Power-Law Theory,
|
| 155 |
+
Phase Transitions, and Practical Compression Tools},
|
| 156 |
+
year = {2026},
|
| 157 |
+
doi = {10.5281/zenodo.19826343},
|
| 158 |
+
url = {https://zenodo.org/records/19826343}
|
| 159 |
+
}
|
| 160 |
+
```
|
| 161 |
+
|
| 162 |
+
## Acknowledgements
|
| 163 |
+
|
| 164 |
+
This dataset would not exist without:
|
| 165 |
+
|
| 166 |
+
- **EleutherAI** for the Pythia panel (8 sizes from 14M to 2.8B), the
|
| 167 |
+
primary scientific anchor of the framework.
|
| 168 |
+
- **AI2** for OLMo / OLMoE.
|
| 169 |
+
- **Meta**, **Mistral AI**, **Qwen team / Alibaba**, **Google DeepMind**,
|
| 170 |
+
**Microsoft**, **HuggingFace SmolLM team**, **DeepSeek-AI**, **TII**
|
| 171 |
+
(Falcon), and **BigScience** (BLOOM) for releasing weights publicly.
|
| 172 |
+
- The **HuggingFace Hub** for free hosting that made the measurements possible.
|
| 173 |
+
|
| 174 |
+
## Reproducibility
|
| 175 |
+
|
| 176 |
+
The measurement protocol is fully open:
|
| 177 |
+
- Tool: [github.com/karlesmarin/tafagent](https://github.com/karlesmarin/tafagent), `cli/diagnose_model.py`
|
| 178 |
+
- Browser tool: [karlesmarin.github.io/tafagent](https://karlesmarin.github.io/tafagent)
|
| 179 |
+
|
| 180 |
+
Each row in this dataset can be reproduced from the original model weights
|
| 181 |
+
via the open tool. If you find a discrepancy, please open an issue at the
|
| 182 |
+
GitHub repo — refutations are welcome.
|
| 183 |
+
|
| 184 |
+
## Updates
|
| 185 |
+
|
| 186 |
+
- 2026-04-29: Initial release (58 records, 32 models, 2 corpora, 2 precisions)
|
| 187 |
+
- Future: training-trajectory data (Pythia checkpoint γ-flow), per-layer γ-fields,
|
| 188 |
+
fp16 anchor measurements (DeepSeek-chat verification, Llama-3-8B cross-paper anchor)
|