A Capacity-Based Rationale for Multi-Head Attention
Paper • 2509.22840 • Published
Error code: StreamingRowsError
Exception: CastError
Message: Couldn't cast
summary: list<item: struct<m: int64, d_model: int64, x: double, D_K_star: int64, h_star: int64, d_k_star: int (... 21 chars omitted)
child 0, item: struct<m: int64, d_model: int64, x: double, D_K_star: int64, h_star: int64, d_k_star: int64, mean_f1 (... 9 chars omitted)
child 0, m: int64
child 1, d_model: int64
child 2, x: double
child 3, D_K_star: int64
child 4, h_star: int64
child 5, d_k_star: int64
child 6, mean_f1: double
per_dk: struct<64_16: struct<8: struct<mean_f1: double, h: int64, d_k: int64>, 12: struct<mean_f1: double, h (... 1777 chars omitted)
child 0, 64_16: struct<8: struct<mean_f1: double, h: int64, d_k: int64>, 12: struct<mean_f1: double, h: int64, d_k: (... 7 chars omitted)
child 0, 8: struct<mean_f1: double, h: int64, d_k: int64>
child 0, mean_f1: double
child 1, h: int64
child 2, d_k: int64
child 1, 12: struct<mean_f1: double, h: int64, d_k: int64>
child 0, mean_f1: double
child 1, h: int64
child 2, d_k: int64
child 1, 64_32: struct<8: struct<mean_f1: double, h: int64, d_k: int64>>
child 0, 8: struct<mean_f1: double, h: int64, d_k: int64>
child 0, mean_f1: double
child 1, h: int64
child 2, d_k: int64
child 2, 64_64: struct<8: struct<mean_f1: double, h: int64, d_k: int64>>
child 0, 8: struct<mean_f1: double, h: int64, d_k: int64>
child 0, mean_f1: double
child 1, h: int64
...
nt64, seed: int64, test_f1: (... 22 chars omitted)
child 0, item: struct<m: int64, d_model: int64, D_K: int64, h: int64, d_k: int64, seed: int64, test_f1: double, ste (... 10 chars omitted)
child 0, m: int64
child 1, d_model: int64
child 2, D_K: int64
child 3, h: int64
child 4, d_k: int64
child 5, seed: int64
child 6, test_f1: double
child 7, steps: int64
fit: struct<slope: double, r2: double, n: int64, slope_excl: double, r2_excl: double, n_excl: int64>
child 0, slope: double
child 1, r2: double
child 2, n: int64
child 3, slope_excl: double
child 4, r2_excl: double
child 5, n_excl: int64
config: struct<seeds: int64, batch: int64, out: string, grid: string, max_steps_cap: int64, limit: null, pus (... 15 chars omitted)
child 0, seeds: int64
child 1, batch: int64
child 2, out: string
child 3, grid: string
child 4, max_steps_cap: int64
child 5, limit: null
child 6, push_repo: string
rows: list<item: struct<B: int64, signal: double, N3_median: double, N3_max: double, pred_Eq1: double, N3_ (... 19 chars omitted)
child 0, item: struct<B: int64, signal: double, N3_median: double, N3_max: double, pred_Eq1: double, N3_over_pred: (... 7 chars omitted)
child 0, B: int64
child 1, signal: double
child 2, N3_median: double
child 3, N3_max: double
child 4, pred_Eq1: double
child 5, N3_over_pred: double
m: int64
d_model: int64
d_k: int64
loglog_slope: double
fit_slope_B: double
to
{'m': Value('int64'), 'd_model': Value('int64'), 'd_k': Value('int64'), 'rows': List({'B': Value('int64'), 'signal': Value('float64'), 'N3_median': Value('float64'), 'N3_max': Value('float64'), 'pred_Eq1': Value('float64'), 'N3_over_pred': Value('float64')}), 'fit_slope_B': Value('float64'), 'loglog_slope': Value('float64')}
because column names don't match
Traceback: Traceback (most recent call last):
File "/src/services/worker/src/worker/utils.py", line 149, in get_rows_or_raise
return get_rows(
dataset=dataset,
...<4 lines>...
column_names=column_names,
)
File "/src/libs/libcommon/src/libcommon/utils.py", line 272, in decorator
return func(*args, **kwargs)
File "/src/services/worker/src/worker/utils.py", line 129, in get_rows
rows_plus_one = list(itertools.islice(safe_iter(ds, dataset=dataset), rows_max_number + 1))
File "/src/services/worker/src/worker/utils.py", line 489, in safe_iter
yield from ds.decode(False) if ds.features else ds
File "/usr/local/lib/python3.14/site-packages/datasets/iterable_dataset.py", line 2818, in __iter__
for key, example in ex_iterable:
^^^^^^^^^^^
File "/usr/local/lib/python3.14/site-packages/datasets/iterable_dataset.py", line 2355, in __iter__
for key, pa_table in self._iter_arrow():
~~~~~~~~~~~~~~~~^^
File "/usr/local/lib/python3.14/site-packages/datasets/iterable_dataset.py", line 2380, in _iter_arrow
for key, pa_table in self.ex_iterable._iter_arrow():
~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
File "/usr/local/lib/python3.14/site-packages/datasets/iterable_dataset.py", line 536, in _iter_arrow
for key, pa_table in iterator:
^^^^^^^^
File "/usr/local/lib/python3.14/site-packages/datasets/iterable_dataset.py", line 419, in _iter_arrow
for key, pa_table in self.generate_tables_fn(**gen_kwags):
~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^
File "/usr/local/lib/python3.14/site-packages/datasets/packaged_modules/json/json.py", line 343, in _generate_tables
self._cast_table(pa_table, json_field_paths=json_field_paths),
~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.14/site-packages/datasets/packaged_modules/json/json.py", line 132, in _cast_table
pa_table = table_cast(pa_table, self.info.features.arrow_schema)
File "/usr/local/lib/python3.14/site-packages/datasets/table.py", line 2369, in table_cast
return cast_table_to_schema(table, schema)
File "/usr/local/lib/python3.14/site-packages/datasets/table.py", line 2297, in cast_table_to_schema
raise CastError(
...<3 lines>...
)
datasets.table.CastError: Couldn't cast
summary: list<item: struct<m: int64, d_model: int64, x: double, D_K_star: int64, h_star: int64, d_k_star: int (... 21 chars omitted)
child 0, item: struct<m: int64, d_model: int64, x: double, D_K_star: int64, h_star: int64, d_k_star: int64, mean_f1 (... 9 chars omitted)
child 0, m: int64
child 1, d_model: int64
child 2, x: double
child 3, D_K_star: int64
child 4, h_star: int64
child 5, d_k_star: int64
child 6, mean_f1: double
per_dk: struct<64_16: struct<8: struct<mean_f1: double, h: int64, d_k: int64>, 12: struct<mean_f1: double, h (... 1777 chars omitted)
child 0, 64_16: struct<8: struct<mean_f1: double, h: int64, d_k: int64>, 12: struct<mean_f1: double, h: int64, d_k: (... 7 chars omitted)
child 0, 8: struct<mean_f1: double, h: int64, d_k: int64>
child 0, mean_f1: double
child 1, h: int64
child 2, d_k: int64
child 1, 12: struct<mean_f1: double, h: int64, d_k: int64>
child 0, mean_f1: double
child 1, h: int64
child 2, d_k: int64
child 1, 64_32: struct<8: struct<mean_f1: double, h: int64, d_k: int64>>
child 0, 8: struct<mean_f1: double, h: int64, d_k: int64>
child 0, mean_f1: double
child 1, h: int64
child 2, d_k: int64
child 2, 64_64: struct<8: struct<mean_f1: double, h: int64, d_k: int64>>
child 0, 8: struct<mean_f1: double, h: int64, d_k: int64>
child 0, mean_f1: double
child 1, h: int64
...
nt64, seed: int64, test_f1: (... 22 chars omitted)
child 0, item: struct<m: int64, d_model: int64, D_K: int64, h: int64, d_k: int64, seed: int64, test_f1: double, ste (... 10 chars omitted)
child 0, m: int64
child 1, d_model: int64
child 2, D_K: int64
child 3, h: int64
child 4, d_k: int64
child 5, seed: int64
child 6, test_f1: double
child 7, steps: int64
fit: struct<slope: double, r2: double, n: int64, slope_excl: double, r2_excl: double, n_excl: int64>
child 0, slope: double
child 1, r2: double
child 2, n: int64
child 3, slope_excl: double
child 4, r2_excl: double
child 5, n_excl: int64
config: struct<seeds: int64, batch: int64, out: string, grid: string, max_steps_cap: int64, limit: null, pus (... 15 chars omitted)
child 0, seeds: int64
child 1, batch: int64
child 2, out: string
child 3, grid: string
child 4, max_steps_cap: int64
child 5, limit: null
child 6, push_repo: string
rows: list<item: struct<B: int64, signal: double, N3_median: double, N3_max: double, pred_Eq1: double, N3_ (... 19 chars omitted)
child 0, item: struct<B: int64, signal: double, N3_median: double, N3_max: double, pred_Eq1: double, N3_over_pred: (... 7 chars omitted)
child 0, B: int64
child 1, signal: double
child 2, N3_median: double
child 3, N3_max: double
child 4, pred_Eq1: double
child 5, N3_over_pred: double
m: int64
d_model: int64
d_k: int64
loglog_slope: double
fit_slope_B: double
to
{'m': Value('int64'), 'd_model': Value('int64'), 'd_k': Value('int64'), 'rows': List({'B': Value('int64'), 'signal': Value('float64'), 'N3_median': Value('float64'), 'N3_max': Value('float64'), 'pred_Eq1': Value('float64'), 'N3_over_pred': Value('float64')}), 'fit_slope_B': Value('float64'), 'loglog_slope': Value('float64')}
because column names don't matchNeed help to make the dataset viewer work? Make sure to review how to configure the dataset viewer, and open a discussion for direct support.
Independent reproduction of ICML 2026 paper #26081 (Micah Adler, arXiv:2509.22840, OpenReview rIbK1X14la).
capacity.py — idealized max-over-heads key-query attention model + permutation-graph RGR task + training/eval (Sec. 6 / App. A.1).theory_audit.py — numerical audit of the lower bound (Thm 9.2) and constructive upper bound (Alg. 1) — Claims 1 & 2.noise_audit.py — N3(B) superposition-noise scaling — Claim 3.sweep.py / job_sweep.py — base-grid capacity sweep to fit D_K* scaling law — Claim 4.variants.py — softmax + value-channel message-retrieval variants — Claim 5 (Sec. 7.1-7.2).gpt2_block.py — full pre-LN Transformer block with frozen GPT-2 embeddings, IOI/induction retrieval — Claim 5 (Sec. 7.3).claim6.py — context-length sensitivity — Claim 6.results_base.json — D_K* per (m,d_model), head counts, fit slope + R².results_gpt2.json — GPT-2 block test accuracy by (D_K, h).results_claim6.json — micro-F1 by context length condition.theory_audit_results.json, noise_audit_results.json — theory audits.