Commutator Memory: Sparse, Path-Local Reading and Steering in Language Models

John SweeneyNeurIPS 2026

TL;DR

When you train a language model on dataset A and then dataset B, you get a slightly different brain than if you train on B and then A—even with the exact same data and step counts. While you might assume this order-dependent difference is just diffuse optimizer noise smeared thinly across billions of parameters, this paper reveals it is actually concentrated in a tiny, interpretable fraction of the model's vocabulary. Better yet, we can mathematically predict which tokens carry this "training-history memory" before running both training orders, steer the outcome by tweaking just ten tokens, and forensically deduce which dataset came first.

What Problem Does This Paper Address?

Modern LLM post-training is an assembly line: domain pre-training, supervised fine-tuning (SFT), preference tuning, and safety updates. Practitioners have long known that the order of these stages changes final benchmark scores, because gradient descent steps on different loss landscapes don't commute (walk north then east on a curved hill, and you end up somewhere different than walking east then north).

However, aggregate benchmark scores only tell you that the resulting models differ, not where that difference lives in output space. Without a microscope to see where stage interactions land, order sensitivity feels like untargetable, mysterious noise that you can only discover after burning GPU hours on expensive training runs. The author asks: does swapping two data sources leave a clean, readable, and steerable signature in the weights?

Methods

To capture the mathematical essence of "A then B" versus "B then A," the paper uses a classic tool from differential geometry: the Lie bracket.

For small stochastic gradient descent (SGD) steps of size $\eta$, the weight difference between the two training orders ($\theta_{AB} - \theta_{BA}$) is governed to leading order by $\eta^2 b_{AB}$, where $b_{AB} = H_B g_A - H_A g_B$ (the Hessian of loss B times the gradient of A, minus vice versa), computed right at the base model using exact Hessian-vector products. Prior work projected this bracket onto a held-out evaluation gradient to get a single scalar ($\sigma$) predicting which order yields lower loss.

Figure 1: Commutator memory pipeline. One bracket produces an order forecast, token map, intervention target, and endpoint trace.

What’s new here is lifting that single number into commutator memory:

  • Token-level readout ($\tau_k$): Using the chain rule (implemented via central finite differences on the logits), the author decomposes the scalar prediction across the entire output vocabulary. Every token $k$ gets a signed score $\tau_k$ showing how much it contributes to the ordering gap.
  • Causal steering: During training, the author downweights the loss (or scales the output-layer learning rate) on just the top 10 tokens with the largest predicted contribution to see if the gap between AB and BA closes.
  • Forensic order assignment: Given two trained models ($\theta_{AB}$ and $\theta_{BA}$), projecting their weight difference onto $b_{AB}$ creates an antisymmetric test statistic ($\Delta s$) whose sign reveals which model experienced which training order.

Datasets

No new benchmarks are introduced; instead, the paper slices existing datasets into controlled domain pairs:

  • The Pile: Six SFT domains (code, news, math, legal, biomedical, wikipedia) used across 15 domain pairs for training and disjoint held-out evaluation.
  • UltraFeedback: Partitioned into source pairs to test Direct Preference Optimization (DPO).
  • Analytic Reward Surrogate: Frozen matched rollouts scored on math correctness and brevity/format compliance to test a GRPO-style reinforcement learning objective.

Key Insights and Ideas

  • Order residue is shockingly sparse, not diffuse: Instead of smearing evenly across capabilities, 80% of the order-asymmetric mass concentrates into less than 0.4% to 1.5% of the vocabulary.
Figure 2: Concentration diagnostics for the token-level bracket readout. Lorenz curves show the operational finite-difference τ readout across four reported main runs; Table 2 reports the separate fp32 random-direction control subset used for the support-specificity claim.
  • The tokens tell a story about domain collisions: The highest-scoring tokens aren't random quirks; they fall into three intuitive buckets. In code vs. news, lexical proper nouns ("Facebook", "Washington") or syntax (xml, php) dominate. In code vs. legal, digits 0–9 dominate (think array indices colliding with legal section numbers). In code vs. biomedical, shared BPE subword suffixes like -ervation and -ulatory absorb the shock of polysyllabic medical terms.
  • You can beat both training orders: When the symmetric drift between two datasets hurts held-out loss, taking a "bracket-only" step from a shared reference point doesn't just match the better ordering—it beats both pure orders AB and BA to leading order.

Key Results

Tested across four model families (Qwen-3-4B, Qwen-2.5-1.5B, Llama-3.1-8B, and Llama-3.2-1B), commutator memory holds up across localization, steering, and forensic reading:

  • Pinpoint Localization: Passing the actual post-training weight difference ($\theta_{AB} - \theta_{BA}$) through the token readout recovers 82–99% of the base bracket's top-20 tokens, compared to 35–49% for norm-matched random weight directions.
  • Steering with 10 Tokens: In Qwen-3-4B SFT, downweighting just the top 10 predicted tokens closes a median 32.0% of the held-out ordering gap (and 47.9% on above-floor Qwen-2.5-1.5B trials using output-row learning-rate scaling). Frequency-matched random tokens with near-zero $\tau_k$ close virtually 0% (+0.2% and -0.003%).
Table 3: Intervention results on two models (30 trials/pair, held-out evaluation). Qwen-3-4B reports all 90 trials. †Qwen-2.5 denotes Qwen-2.5-1.5B fp32 on the predefined above-floor subset (28/90 trials with |∆baseline| > 10−4). Harmful: the ten tokens whose τk contributes most to the measured gap; Random: frequency-matched tokens with τk ≈0; entries are closure C in %; Winsor. mean: 5/95 winsorized mean, with its bootstrap CI; Gap shrinks: fraction of trials with a smaller ordering gap after the intervention (68/90, 45/90, 27/28, 11/28 by row).
  • Forensic Order Identification: Projecting paired single-step SGD endpoints onto $b_{AB}$ correctly identifies which model was trained in which order 91.7% of the time (66/72 runs across four LLMs, vs. 50% chance)—hitting 100% on Qwen-3-4B and Llama-3.1-8B.
  • Direct Weight Surgery in DPO: Subtracting $\eta^2 b_{AB}$ directly from a trained $\theta_{AB}$ model closes a median 77% of the held-out DPO loss gap toward $\theta_{BA}$ when computed on matched batches.

Limitations and Future Work

The author is refreshingly candid: right now, this is a scientific measurement instrument, not a plug-and-play production tool.

  • Short horizons and small steps: Main SFT experiments operate in a calibrated "BCH-local" window of $k = 1\text{–}8$ SGD steps per source. Under continued training on a third domain (16 extra updates), the aligned commutator trace fades from 27% to 7%.
  • Optimizer state complicates things: Standard LLMs train with AdamW, whose momentum buffers and step counters make reordering a first-order effect rather than second-order. Accounting for AdamW requires lifting the commutator onto the full optimizer state, which is only validated here as a post-hoc endpoint check.
  • Pair-conditioned & NLL-focused: You must supply the two candidate datasets to read the memory (it cannot do open-ended data attribution), DPO/GRPO corrections require exact matched batches/rollouts, and interventions measure NLL gap closure rather than downstream exact-match benchmarks like GSM8K or HumanEval. Cheaper curvature approximations and scaling beyond calibrated local windows remain open frontiers.

Summary updated

BibTeX
@inproceedings{sweeney2026commutator,
  author = {John Sweeney},
  title = {{Commutator Memory: Sparse, Path-Local Reading and Steering in Language Models}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=0vSuVjlB0R},
}
Figure