Causal Edit Serialization

Louis RobinsonNeurIPS 2026

TL;DR

Standard autoregressive language models write like typewriters without a backspace key: if they make a mistake or need to revise an earlier paragraph, their only native option is to rewrite the entire text from scratch. Causal Edit Serialization (CES) teaches decoder-only models to point backward into their own history and emit compact, executable "edit programs"—inserting, deleting, replacing, copying, or moving text—all while keeping a standard left-to-right causal attention mask. Even better, the model can mentally apply these edits on the fly to improve future predictions without throwing away its KV cache.

What Problem Does This Paper Address?

Humans rarely write in a single, flawless forward pass; we draft, tweak spans, move clauses, and fix typos. Autoregressive LLMs, however, strictly emit tokens left-to-right. If you want an LLM to change one word in a 500-word passage, standard decoding regenerates all 500 words, burning compute and output tokens on unchanged text.

Alternative workarounds have awkward trade-offs. Coding agents emit text-based search-and-replace diffs, which rely on brittle string-matching rules and fail when anchor phrases appear multiple times. Having a model emit raw numeric token indices wastes BPE tokens and forces the model to do arithmetic through its vocabulary head. The core challenge is giving a standard causal Transformer a native, unambiguous way to point to exact past token coordinates and condition its future thoughts on those edits.

Methods

CES leaves the standard Transformer block and causal attention mask intact, appending an "edit stream" right after the original text. Instead of rewriting the passage, the model emits structured edit commands (Delete, Insert, Replace, Copy, Move) broken into tiny causal steps: pick an operation, point to the target source span, and emit any new payload tokens.

Figure 1: Causal edit programs and CES architecture. Left: edit programs and their applied results. Numbers denote stream positions; @ labels give predicted source addresses. Dotted borders mark masked pretraining vocabulary targets; pointer addresses remain supervised. Right: dual-index RoPE and the localization head, with CES additions in red. C denotes model width.

Two lightweight architectural additions (adding just 0.34–0.41% parameters) make this work:

  • Edit Localization Head: Alongside the standard vocabulary head (which predicts what role token to emit, like REPLACE_START), a pointer-network-style head computes dot-product scores between the current hidden state and cached keys of preceding tokens to predict where in the source sequence that operation applies.
  • Dual-Index RoPE: Once a pointer token is emitted and fed back in, the model needs to remember both when it was generated and what earlier token it points to. CES splits each attention head's query and key channels in half: one half gets Rotary Position Embedding (RoPE) for the global stream index, and the other gets RoPE for the referenced source address.

During pretraining, the model minimizes standard cross-entropy for tokens plus an address-prediction cross-entropy loss (weighted by $\lambda_{\text{addr}} = 0.01$). For grammatical error correction (GEC) post-training, the author uses supervised fine-tuning followed by leave-one-out REINFORCE policy gradients over executed token-and-pointer trajectories.

Datasets

  • ClimbMix: Used for pretraining and controlled synthetic repair evaluations. Training data pairs clean text with serialized repair programs derived from three sources: random span corruptions, localized revisions proposed by GPT-5 Mini, and a "copy-mining" pipeline that deletes repeated spans so the model learns to copy them from earlier in the context.
  • CORE: A benchmark aggregate of language-understanding and knowledge tasks used to check general model capabilities.
  • CoEdIT: A text-editing dataset used for supervised fine-tuning and grammatical error correction post-training, including a custom 5,000-pair partition evaluated by a reference-blind GPT-5 Mini judge.

Key Insights and Ideas

  • Vocabulary-encoded coordinates fail where learned pointers succeed: Under the tested pretraining recipe, baseline models trained to output BPE numeric coordinates (AR-DSL) or dedicated backward-offset tokens (Flat-relative) produced 0% valid edit programs on controlled repairs, whereas CES generated valid executable programs over 90% of the time.
  • Knowing where to edit doesn't mean knowing what to write: Even when given oracle target locations (as in Oracle Fill-in-the-Middle or gold-pointer diagnostics), models frequently generate harmful payloads. Localization and content generation are distinct bottlenecks.
  • Models can "read through" unapplied edit scripts: If you leave a corrupted prefix in the context, append a valid CES repair program, and ask the model to continue writing the document without rebuilding the KV cache, its predictions improve—even compared to a "sham" edit program of the exact same length and structure. The model genuinely interprets the edit semantics in-context.

Key Results

Experiments span 72 runs across three NanoChat model scales (approx. 287M, 705M, and 1.389B parameters at depths 12, 18, and 24):

Figure 2: Complete editing, language modeling and representation cost across methods. A/B: clean ClimbMix BPB and CORE performance. C–F: controlled ClimbMix repair. A–F use pretrained checkpoints, showing means and sample SDs over three training seeds; repair suites contain 1,000 inputs per run (250 for adapted CES). C: successful program closure, parsing and application, or text termination for regeneration/FIM. D: exact target recovery. E/F: frequency and mean magnitude of character-similarity improvement. Invalid or unterminated outputs return the source and remain in the denominators; oracle FIM receives gold spans. Clean AR appears only in A/B. G: lengths on 485 CoEdIT pairs. Filled bars encode references; outlines count observed d24 seed-42 outputs after supervised CoEdIT fine-tuning, including failed attempts. Stacked bars combine prompts (grey) and minimum reference completions (striped colour), using fixed templates and token boundaries and excluding COPY/MOVE. The iterative editor’s striped reference and prompt bars measure sequence storage, not autoregressive output. Short observed outputs need not indicate successful editing; Appendix I defines the accounting.
  • Minimal tax on base language modeling: At depth 24 (1.389B), training CES from scratch yields 0.7629 bits per byte (BPB) on clean ClimbMix text vs. 0.7484 BPB for a standard clean autoregressive model—just a ~1.9% relative increase.
  • Controlled repair: Pretrained depth-24 CES produces 90.53% valid programs, brings 53.40% of corrupted inputs closer to the ground truth, and achieves 5.27% exact target recovery across 1-to-8 operation repairs.
  • Compact representations: On CoEdIT pairs, minimum CES completions average 41.8 tokens compared to 56.0 tokens for full-text regeneration.
  • Post-trained grammatical correction: On 5,000 CoEdIT inputs judged blind by GPT-5 Mini, plain greedy CES decoding achieves +4.74 percentage points net improvement (improving 619 sentences, worsening 382). Adding a conservative confidence and length filter boosts net improvement to +9.26 points (68.30% of retained edits improve the text) while mistakenly altering only 1.48% of already-clean inputs.
  • In-context continuation: Conditioning on a supplied repair program lowers teacher-forced negative log-likelihood on the next 128 tokens by 0.02123 nats/token vs. an empty program, and by 0.00641 nats/token vs. a sham edit program.

Limitations and Future Work

The author is admirably transparent about what CES does not yet solve:

  • Scale and exact recovery: Experiments top out at 1.389B parameters and a 2,048-token context using NanoChat, untested on modern frontier LLM families. Exact recovery on dense multi-edit corruptions remains low (5.27%), and inserting missing text is persistently harder than replacing or deleting.
  • Evaluation caveats: The GEC post-training confirmation relies on a single seed, abstains on 82.4% of inputs under the conservative filter, and uses GPT-5 Mini for both synthetic data generation and reference-blind judging without human audits.
  • KV-cache trade-offs: Appending edit programs avoids recomputing the KV cache, but doesn't free up context window tokens; materializing the clean text reclaims space at the cost of a cache rebuild.

For future work, the author suggests unifying role-specific pointers into a single general-purpose pointer token, developing better adaptation recipes to bolt CES onto existing pretrained LLMs, and exploring edit-based discrete diffusion—generating text from random noise by iteratively emitting and applying causal edit programs.

Summary updated

BibTeX
@inproceedings{robinson2026causal,
  author = {Louis Robinson},
  title = {{Causal Edit Serialization}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=Jed6Feg5uv},
}
Figure