Manuscript Offprint

arXiv:2610.22820

Causal Edit Serialization

Louis Robinson

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

Standard autoregressive language models generate text sequentially, but revision requires referring back to tokens in the input context or those already generated. Causal Edit Serialization (CES) is introduced as a framework for expressing such revisions within the same causal token stream. Special pointer tokens are paired with predicted source addresses, allowing insertion, deletion, replacement, copying and movement to be localized explicitly. A lightweight localization head and dual-index rotary position encoding support both address prediction and conditioning on previously emitted pointers, while retaining a standard causal attention mask. A pretraining procedure combines ordinary language modeling with serialized repairs derived from random corruptions, model-generated edits and repeated text. Across model scales and editing baselines, CES models demonstrate complete applied edits with modestly higher clean-text bits per byte than clean autoregressive models. Supervised and reinforcement-learning post-training provide a grammatical-error-correction proof of concept, producing more beneficial than harmful changes under reference-blind model judging. Correct repair programs also improve subsequent text prediction while the original context and its cached states are retained. CES provides a common interface for generation and localized revision, with potential extensions to iterative refinement and additional pointer-addressed transformations.

1 Introduction

Editing is fundamental in natural language and code: humans revise spans, replace phrases, move clauses, duplicate content, and repair earlier generations [Mallinson et al., 2020, Reid and Neubig, 2022]. Standard autoregressive language models, however, are optimized to emit the next token from left to right [Radford et al., 2019, Brown et al., 2020]. Regenerating a revised passage preserves causal decoding, but re-emits unchanged text, spending output tokens and decoding work on content already available. Emitting a localized edit avoids this repetition. The challenge is to identify the affected source spans and make those references available to subsequent predictions.

Denoising encoder–decoder models reconstruct text from corrupted inputs [Raffel et al., 2023, Song et al., 2019]. FELIX combines tagging and insertion [Mallinson et al., 2020], while insertion-based and iterative editing models relax left-to-right output construction [Stern et al., 2019, Patel et al., 2025, Gu et al., 2019]. Here, explicit edit programs are generated within a single causal token stream. Source locations are predicted directly, and subsequent decisions condition on those references, while the standard causal attention mask is retained. Replacement, copy, and move should be available alongside insertion and deletion.

This paper presents Causal Edit Serialization (CES). CES appends a structured edit stream after the base sequence and factors each edit into a short causal chain: predict an operation token, localize the relevant source span or destination, and then emit any payload tokens. A dual-index rotary scheme lets the model reason both about global token order and about edit addresses in the source sequence, while a lightweight localization head predicts source positions directly from the hidden states. The formulation supports insert, delete, replace, move, and copy, all inside the same decoder-only model.

40th Conference on Neural Information Processing Systems (NeurIPS 2026).

The contributions are:

  1. A representation and training procedure for causal editing. CES combines source-address pointers and dual-index positional encoding with training on random corruptions, model-generated edits, and mined copy examples.

  2. A comparison of pretrained editing models. Three depths and three training seeds compare CES with autoregressive edit scripts using numeric addresses (AR-DSL, an autoregressive domain-specific language) or relative-distance tokens, full-text regeneration, infilling with given or predicted spans, iterative insertion/deletion, and adaptation of a clean decoder.

  3. Beneficial grammatical correction after post-training. Supervised fine-tuning and reinforcement learning produce positive net improvement on grammatical error correction (GEC) under reference-blind GPT-5 Mini judging.

  4. Continuation conditioned on edit programs. Supplied correct repairs improve subsequent clean-text likelihood while the source and edit program remain in the causal history.

References (97)

  • Back to basics: Revisiting reinforce-style optimization for learning from human feedback in llms
  • Efficient training of language models to fill in the middle, 2022 (opens arXiv in a new tab)
  • Language Models are Few-Shot Learners
  • Automatic annotation and evaluation of error types for grammatical error correction (opens the publisher in a new tab)
  • Nemotron-climb: Clustering-based iterative data mixture bootstrapping for language model pre-training, 2025 (opens arXiv in a new tab)
  • EditNTS: An neural programmer-interpreter model for sentence simplification through explicit editing (opens the publisher in a new tab)
  • Levenshtein transformer, 2019 (opens arXiv in a new tab)
  • Datacomp-lm: In search of the next generation of training sets for language models, 2025 (opens arXiv in a new tab)
  • Felix: Flexible text editing through tagging and insertion, 2020 (opens arXiv in a new tab)
  • Insertion language models: Sequence generation with arbitrary-position insertions, 2025 (opens arXiv in a new tab)
  • Training language models on synthetic edit sequences improves code synthesis
  • OpenAI blog, 1(8):9, 2019
  • Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformer
  • CoEdIT: Text editing by task-specific instruction tuning (opens the publisher in a new tab)
  • Learning to model editing processes (opens arXiv in a new tab)
  • Mass: Masked sequence to sequence pre-training for language generation, 2019 (opens arXiv in a new tab)
  • Insertion transformer: Flexible sequence generation via insertion operations, 2019 (opens arXiv in a new tab)
  • RoFormer: Enhanced Transformer with Rotary Position Embedding
  • Attention is all you need
  • Pointer networks
  • Context length is 2,048
  • Nine clean AR checkpoints are additionally reported as language-model references
  • Editing-method pretraining uses H100 tensorwise FP8 training and evaluation in the base compute dtype
  • CES pointer accuracy, textual-coordinate accuracy, and exact FIM span accuracy measure different decisions and are not compared as a shared metric
  • For d24 CES on two RTX 5080s (16GB each), the 800-update balanced SFT stage takes approximately 21 minutes, followed by 33 minutes of broad RL (100 updates) and 41 minutes of GEC RL (200 updates)
  • These totals cover recorded completed training segments, excluding the post-training stages above, evaluation, and additional preliminary or unsuccessful experiments
  • The process is parameterized by edit-spacing and edit-length distributions, an insertion-content mixture, and optional protection of a clean prefix as stable context
  • Distances to candidate deletion and insertion events follow geometric distributions, with per-token start probabilities $p_{start}^{del}$ and $p_{start}^{ins}$:
  • Reported random-corruption runs use weights 0.6/0.1/0.2/0.1, renormalized over available sources, with uniform sampling as fallback when no non-uniform source is available
  • A separate pipeline removes later occurrences of repeated spans and creates copy programs that restore them from earlier occurrences
  • Its approximately 1.03M operations comprise 201k insertions, 325k deletions, 482k replacements, and 26k moves
  • Unlike the pretraining structural checks, this audit assesses meaning using an automated judge; it does not replace human validation
  • GPT-generated edits are replacement-heavy and longer than random edits; copy mining supplies long repeated spans
  • Invalid or unfinished programs return the source and remain in evaluation denominators; generation limits and acceptance policies are specified with each evaluation
  • This requires training the return decision and was not evaluated
  • It is computed from the supplied scripts, excluding operation and pointer tokens
  • It provides the strongest human localization, controlled validity and exact recovery, and post-fine-tuning ERRANT $F_{0.5}$, at a modest clean-retention cost
  • Points show means and error bars one sample standard deviation over three training seeds
  • Each stochastic setting uses decoding seeds 12345–12347 from the same seed-42 trained checkpoint; greedy is evaluated once
  • At $T = 1.0$, controlled similarity gain becomes negative
  • The methods map corrupted source text x to revised text $\hat{y}$ using different prediction targets and reconstruction procedures
  • Textual DSLs and FIM use half-open source spans $[i, j)$ and insertion boundaries before token $i$
  • Invalid or incomplete outputs return the source
  • The evaluated grammar closes replacement payloads with $\mathcal{R}_{EOS}$; insertions end at the next operation opener or edit-end, without a separate insertion terminator
  • Token and address decisions follow native grammar and legal-address masks until edit-end
  • The grammar is
  • The ordered loader interleaves clean and edit-bearing regions
  • Generation uses ordinary decoder stopping rules
  • Each numeric coordinate is replaced by a dedicated vocabulary token $BACK_{r-i}$, where $r$ is the coordinate token’s serialized index and i the source boundary
  • This comparison changes the whole CES address mechanism, including both RoPE and the localization head, rather than ablating only the head
  • Only this completion receives vocabulary loss; the instruction and source are conditioning inputs
  • The prompt contains BOS, <fim-prefix>, retained prefix, <fim-suffix>, retained suffix, and <fim-middle>, with newlines around each cue
  • localization is supplied, but payload content must be generated
  • The predicted FIM prompt is appended to the cached source/locator history without removing or prefilling the source again
  • Its bidirectional transformer with ordinary RoPE predicts token deletions, insertion counts per gap, and inserted-token identities
  • Counts range from 0 to 32 per gap; longer insertions span multiple oracle rounds
  • A round with no edits stops refinement; one without insertions skips filling
  • For the supervised CoEdIT fine-tuning comparison, changed coverage is $\Pr(\hat{y} \neq x)$
  • CES retains positive controlled repair but moves farther from the single human reference on $68.45 \pm 2.70\%$ of CoEdIT inputs
  • BPB is measured on validation text
  • Changed, ERRANT, and reference-distance outcomes use 485 GEC pairs; controlled direction uses a stratified 250-example subset
  • Forcing the full operation envelope raises depth-24 ERRANT $F_{0.5}$ to 0.0981 and coverage to 0.868, but harm rises to 0.740
  • The design crosses three operations (replacement, deletion, insertion), span lengths (1, 4, 16 tokens), and edit-to-tail distances (16, 64, 128 clean tokens), with 20 documents per cell
  • \tag {2} $$
  • Histories comprise clean/corrupt plain prefixes, clean/corrupt prefixes with empty programs, and corrupt prefixes with either a gold repair or a valid non-correcting sham
  • Aggregate recovery is
  • Figure 11 shows how the likelihood differences vary across the continuation
  • Longer adaptation is not tested
  • The mature checkpoint’s gold-repair curve remains below the corrupt empty-program curve throughout most of the continuation
  • 0.25 to 0.35 on 20 items), although low clean accuracy, synthetic corruptions, and exact greedy matching limit interpretation as a CORE result
  • Retaining the history therefore requires approximately $N + M$ versus $N + E$ tokens, plus prompt controls
  • FIM reference costs assume correct localization; predicted FIM also includes locator context
  • Mean times are 339 and 1,897 ms: the larger gap is strongly affected by failed regeneration attempts reaching the 640-token cap, compared with 128 for CES. Correction quality differs between systems, so these are not quality-matched speedups
  • 1/0.1, 16/0.5, and 64/0.9 (span in tokens; location as a fraction of the allowable start-position range)
  • >Context (tokens)</td><td rowspan=
  • Cached continuation measures generation from an already-prefilled source, excluding prefill and rebuilding
  • Eager inference retains compute-dtype weights, avoids GPU-to-host cache-position reads, projects only the final prompt state through the vocabulary head, and scores addresses only when needed
  • Multiple operations can share one rebuild; overhead depends on materialization frequency
  • Supervised edit loss covers only the completion after $E_{S}$ , with address supervision at pointer decisions
  • Broad RL draws without replacement from 359,302 eligible pre-training sources
  • Section J.1 reports their exclusion
  • For a corrupted sequence x, known clean target $y^{*}$, and sampled program a, the CES interpreter produces $\hat{y}$
  • Reward uses executable recovery, not an online judge
  • This is an on-policy leave-one-out REINFORCE objective [Ahmadian et al., 2024] with decision normalization and without PPO clipping
  • GEC RL uses 45% on-policy, 20% synthetic completion, 20% human completion, 10% clean autoregressive, and 5% paired first-decision loss
  • “Improves” means a net correction preserving intent; “same” covers cosmetic or net-neutral changes; “worse” means material linguistic or semantic harm
  • Results concern one selected d24 checkpoint and do not isolate an RL advantage: there is no full-curriculum, acceptance-filter-matched SFT comparison or judged regeneration baseline on this set
  • Plain greedy uses zero token/pointer temperatures and no entry gate
  • Unchanged outputs are neutral; identity-input changes use exact text comparison
  • Each arm receives 26,880 updates, 854,219,434 raw tokens, 1,342,019 examples, and 5,355,059 pointer targets, taking approximately 115 minutes on two RTX 5080s
  • Software and Data
  • Public configurations and lineage documentation accompany the code and checkpoints
  • These estimates describe reproduction requirements; additional preliminary experiments are acknowledged rather than included in the recorded totals
  • Impact Statement
  • The public data exclude credential-screened rows and retain applicable upstream restrictions
  • NanoChat MIT attribution and ClimbMix source-text terms are retained; CoEdIT inputs are reconstructed locally rather than redistributed
  • No online LLM judge is used as the selected RL reward