Carrying a Length and Counting It Are Different Abilities: A Double Dissociation between Recurrence and Attention in Code-Fence Generation

Anonymous release accompanying an ICLR 2027 submission. It holds the code, the run records and checkpoints of the synthetic campaign, the inventories and tables behind every number in the paper, and the generations and scoring of the held-out LLM cohort. The repository is frozen for the review period.

folder content size license
code/ the MBT suite: task generators, models (Mamba, Transformer with six positional encodings, LSTM, GRU, RNN, S4D, Mamba–attention hybrids), training loop, evaluation, the eval-only analyses, tests; cohort/ scores the held-out cohort 3 MB MIT
results/ inventory/ (604-cell inventory, per-seed values of the 243 cited cells, the CSVs behind the tables and figures), tables/ (21 appendix-size tables as Markdown and CSV), cohort/followup/ (generations and scoring of the eight held-out models), figs/ 200 MB CC BY 4.0
runs/ records of the 1,987 runs (config, results, metrics, evaluation JSONs, training log), packed as one <sweep>.tar.gz per sweep, 52 archives that unpack to the run tree 14 MB packed, 162 MB unpacked CC BY 4.0
weights/ best.pt and last.pt of every run, same tree as the unpacked runs/ 8.9 GB CC BY 4.0

The code is also browsable as an anonymized GitHub repository at https://anonymous.4open.science/r/minimal-boundary-transduction-iclr-E180/ (the same files as code/).

Names in the code and names in the paper

The code, the configs, the run directories and the result keys use the internal names in the left column. The paper uses the names in the right column. GLOSSARY.md gives the full glossary with a one-line meaning for every entry, including the training-condition axes, the analysis scripts and the LatentMD labels.

code paper
t2a (generative form, configs/t2a_generative.yaml; every campaign run) Close
t2b level 2 (default) / level 1 / level 3 (fence_mode: designator) Verify / Verify (close-only) / Verify (bound fence)
t2c offline (single-token answer after the content) Open
t2c with content-ID tokens (CID; joint / isolated mixtures) Open-K (knowledge-conditioned Open)
nest_t2a / nest_t2b (configs/t2a_nest.yaml) Close-Nested / Verify-Nested
iid ID (in-distribution)
ood_length (gap factor 12) Distance
ood_ell (untrained opening lengths 7-9) Count
ood_ell_interp (held-out length 5) Count-Interp
ood_depth (nesting depth 3) Depth
ax_prefix / ax_inner / ax_tail / ax_pad / ax_gaps / ax_full (eval_axis*.json) Prefix / Inner / Tail / Pad / Gaps / Full, the segment splits
mamba (d_model 128, 2 layers, state 16, conv 4, expand 2) Mamba
Mamba variants no_conv / res_pe / no_select / sym_conv Mamba-NoConv / Mamba-ResPE / Mamba-NoSelect (linear time-invariant) / Mamba-SymConv
transformer with pe: learned (default) Transformer
pe: sinusoidal / rope / alibi / t5 / none Transformer+Sinusoidal / Transformer+RoPE / Transformer+ALiBi / Transformer+T5 / Transformer-NoPE
attn_window: 32 / 128 Transformer-Local32 / Transformer-Local128
lstm / gru / rnn / s4d LSTM / GRU / RNN / S4D
hybrid with attn_layers (which of the blocks are attention) Mamba-attention hybrid, written as its block pattern with M for a Mamba block and A for an attention block (for example MAMA for attn_layers: [1, 3] of 4)
accuracy over all items (final in results.json; iid, ood_length, ood_ell in cells.csv) accuracy
exact accuracy with answer-0 items excluded (oodL_x0, oodE_x0, the _x0 evaluation files) closing accuracy
gate: seeds with iid >= 0.95 ID gate
safe_close_rate safe-close rate
error taxonomy other_undershoot / no_stop / overshoot / inner_match short close / no-stop / long close / inner-length match (reported as excess over chance)
T2c collision / safe_extra safe-length failure / over-safe opening
T2b causes safe / inner_collision / short_close boundary-correct / premature closure / unclosed
patching metrics tf_exact / M_first / D_stop teacher-forced exact / first-token margin / stop margin

Sweep names (w1_*, w15_*, w2_*, w3_*, w4_*, ray_*) are campaign waves and do not appear in the paper. results/inventory/cells.csv maps every cell to its sweep, and cited_cells.csv (column cited_in) lists where the paper uses each cell.

Quick start

pip install -e code            # Python 3.10+, torch >= 2.0, numpy, pyyaml, matplotlib; Mamba is pure PyTorch, no CUDA kernels needed
pytest code/tests              # fence rule, generator-parser round trips, model sanity, axis splits, patching
(cd runs && for f in *.tar.gz; do tar xzf "$f"; done)   # unpack the run records once: 52 archives -> 28,963 files, 162 MB
cd code && bash scripts/example_run.sh

The run records are packed per sweep because the run tree holds more files than a Hub repository may contain, so unpack them once as above. Every analysis script then reads the run tree from MBT_RUNS (default ../runs) and the inventories from MBT_ANALYSIS (default ../results/inventory), so running them from code/ against this layout works without configuration.

Reproducing the paper's numbers

From code/, in this order (each script names its inputs and outputs in its docstring):

  1. analysis/cells_all.py rebuilds cells.csv from runs/.
  2. analysis/dissociation_table.py, then analysis/paper_table1_dissociation.py and analysis/paper_table_wilson.py (Table 1 and its intervals), analysis/paper_table_cited_cells.py (cited_cells.csv).
  3. analysis/fig_dissociation_scatter.py (Figure 2), analysis/axis_splits_table_x0.py then analysis/paper_fig3_heatmap_x0.py (Figure 3), analysis/table2_chance_column.py (Table 2), analysis/paper_fig4_ladder.py and analysis/paper_fig5_mechanism.py (Figure 4 and the mechanism figures), analysis/paper_x0dense_tables.py and analysis/paper_appendix_tables.py (appendix tables), analysis/zero_close_summary.py.
  4. analysis/paper_fig6_cohort.py --tf9 and analysis/paper_figA_terms.py, paper_figB_fmetrics.py, paper_figC_latentmd_map.py (cohort and appendix figures) after the cohort scoring in code/cohort/ (see its README).

The eval-only analyses (analysis/eval_*.py) re-score existing checkpoints and write eval_*.json into the run directories; runs/ already contains their outputs for every run they were applied to.

Checkpoints

Each .pt file is {"model": state_dict, "config": ..., "seed": ..., "step": ...}; weights/README.md shows how to rebuild the model with mbt.models.build_model and load the weights.

Licenses

Code under code/ is MIT (code/LICENSE). Everything under results/, runs/ and weights/ is CC BY 4.0 (results/LICENSE, weights/LICENSE).

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support