Skip to content

Repository files navigation

Read, Replace, Never Rewrite

The repository for Read, Replace, Never Rewrite: Continuous Thoughts Carry Search Structure, Not Answer Identity [sa bag linkul]

What truly is the thought of an LLM?

​We use these models every day, but how they arrive at an answer is mostly a black box.

​One exciting new topic in mechanistic interpretability is a fairly new way for models to reason: latent thoughts. COCONUT-style models reason through latent chain-of-thought by bypassing the token generation phase at a given step. The superposition hypothesis is an interpretation of the thought as a weighted sum of search branches, but this hypothesis is supported so far only by theoretical construction and observational readouts. We run the first causal, pre-registered test using the theory’s own setting (a two-layer model trained from scratch for graph-reachability tasks). We consider three causal tests: reading, rewriting, and replacing the thought. The readout fully replicates: the frontier is decodable (AUC 0.9979) and the thought is necessary (−42.9). Editing a branch in any pre-specified basis or even under maximal linear-subspace removal has no effect, the only exception being the final readout step. Transplanting entire thoughts redirects the answer to the donor’s if the problem differs in structure (−91.7) and does nothing if the problem differs only in which candidate is correct.

Structure is carried, while identity is bound late.

Repository layout

Path Contents
PREREGISTRATION.md, PREREGISTRATION_M2.md the two registered analysis plans (criteria fixed by commit before data, described in the paper's Appendix A)
DECISIONS.md numbered amendment log containing every post-registration change, dated
LOG.md append-only lab notebook (newest entry first)
src/metis/ training, acceptance, and all analysis code
tests/ equivalence test vs. the reference implementation + diagnostics
results/ every result artifact the paper cites (JSON/JSONL)
scripts/ generate the paper's numbers (make_numbers.py) and figures from results/
paper/ generated numbers.tex and figures
litscan/NOTES.md literature verification notes
brief.txt, review_20260708.md, CLAUDE.md project planning brief, pre-freeze external review, and working-style rules — retained as part of the record

Reproducing the paper's numbers

Every number in the paper is generated from results/ , so nothing is typed by hand.

python scripts/make_numbers.py      # -> paper/numbers.tex (all macros)
python scripts/fig_wave.py          # -> paper/figs/wave.pdf
python scripts/fig_gatea_hist.py    # and the remaining fig_*.py scripts

These need only Python 3 + matplotlib (no GPU, no checkpoints).

Reproducing the experiments

  1. Clone the reference code (Ber666/reasoning-by-superposition) into vendor/ and run tests/test_fast_equivalence.py. It must pass (bit-exact logits, loss, and gradients) before anything else.
  2. Train: src/metis/train_s1.py (check WINDOWS_SETUP.md for the exact design, it takes around 3h on a laptop GPU).
  3. Acceptance: src/metis/accept_s1.py (validity criteria: held-out accuracy and the readout ordering).
  4. Analyses, in paper order: kill_test.py (registered editing test), explore_postverdict.py / explore_jlens.py (documented exploratory arms), explore_patch.py (transplants), m2_gates.py (registered label-swap test), fit_inlp.py + inlp_arm.py (INLP arm).

Provenance

This repository serves as the project's laboratory record and is released as-is, meaning that the notebook, amendment log, and registered documents are unedited, including internal working vocabulary (the paper's Appendix F maps it to thepaper's terminology) and old bugs. AI assistants (Claude) were used for code implementation and drafting support throughout. All experimental design decisions, decision criteria, protocol approvals, and verdicts were made by the author, as documented entry-by-entry in DECISIONS.md and LOG.md.

Citation

@article{stefanescu2026rrr,
  title  = {Read, Replace, Never Rewrite: Continuous Thoughts Carry Search
            Structure, Not Answer Identity},
  author = {{\c{S}}tef{\u{a}}nescu, Ecaterina},
  journal = {arXiv preprint arXiv:TODO},
  year   = {2026}
}

About

Full pipeline, protocol and results for "Read, Replace, Never Rewrite: Continuous Thoughts Carry Search Structure, Not Answer Identity", the first causal test of the COCONUT superposition hypothesis.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages