Jet Expansions of Residual Computation

Yihong Chen, Xiangxiang Xu, Yao Lu, Pontus Stenetorp, Luca Franceschi · Submission to ICLR 2025 · Rejected

TL;DR

This paper introduces jet expansions, a mathematical framework based on jet operators (the functional counterpart to Taylor series) that decomposes non-linear residual networks into individual input-to-output computational paths. Crucially, this decomposition is completely data-free—requiring no probing datasets, sampling, or retraining—and subsumes popular interpretability techniques like the Logit Lens while enabling symbolic $n$-gram extraction and model diffing.

What Problem Does This Paper Address?

Most mechanistic interpretability (MI) techniques rely on a hypothesis-and-dataset-driven approach: researchers formulate a conjecture, probe the model with curated data, and measure activation changes using techniques like causal tracing or path patching. However, this confines findings to specific data distributions and makes global exploration difficult.

While past work attempted to unroll residual networks into ensembles of paths (e.g., Veit et al., 2016), they were forced either to study linear models or disregard non-linear operations (such as layer normalization and MLPs). As a result, there has been no mathematically rigorous, data-free way to untangle distinct computational sub-paths in modern non-linear architectures like Transformers.

Methods

The authors use jets (operators from differential geometry that generalize truncated Taylor polynomials to function spaces) to rewrite residual architectures:

  • Jet Expansions (jet_expand): Instead of evaluating vectors on specific inputs, the method applies $k$-th order jet operators to intermediate residual transformations. Using convex combinations of jets across path centers, the forward pass of a residual net is formally expanded into a sum of polynomial "jet paths" plus an explicit remainder term $\delta$.
  • Subsuming the Logit Lens: The authors prove that the standard Logit Lens is simply a zeroth-order ($k=0$) jet expansion of the residual stream. Moving to higher orders ($k \ge 1$) creates iterative jet lenses that capture non-linear and cross-layer effects, while joint jet lenses isolate the individual contribution of each block non-linearity.
  • In-Model $n$-Gram Extraction: By isolating computational paths that bypass self-attention (e.g., Embedding $\to$ MLP $\to$ Unembedding), the authors exhaustively evaluate conditional distributions over vocabulary pairs to extract pure in-model bi-grams and tri-grams without running text prompts.

Datasets

Because the core framework operates strictly on model weights, no datasets are needed for the analysis itself.

To evaluate and validate their findings, the authors used:

  • Models Analyzed: GPT-2, GPT-2-large, GPT-Neo 2.7B, Llama-2-7B, Llama-2-7B-Chat, CodeLlama-7B, CodeLlama-Python-7B, and OLMo-7B (checkpoints from 0 to 555K pretraining steps).
  • Validation Benchmarks: The Dolma dataset (via the Infini-gram API) for empirical unigram distributions, and RealToxicityPrompts (RTP) alongside ToxiGen scores to benchmark toxicity behavior.
  • Evaluation Samples: A test set of 100 sentences used to measure cosine similarity between lens predictions and full-model logits.

Key Insights and Ideas

  • Fixing Logit Lens Failures: Prior work found that standard Logit Lens ($k=0$) fails on models like GPT-Neo. First-order ($k=1$) iterative jet lenses successfully resolve this issue by capturing indirect early-layer impacts, bringing cosine similarity with true logits close to 1.0.
  • Visible Pretraining Dynamics Beyond Loss: During OLMo-7B pretraining, cross-entropy loss plateaus early (~50K steps). However, tracking jet bi-gram progression reveals that the network continually refines internal linguistic representations through 555K steps—suppressing random initialization artifacts (e.g., "ICUirling") and slowly acquiring multi-modal phrases (e.g., "make sure").
  • RLHF Hides, Rather Than Erases, Knowledge: While RLHF drops Llama-2-7B-Chat's ToxiGen score from 21.25 to 0.0, its internal data-free "toxic bi-gram mass" barely changes (0.03445 to 0.03377). This explains why adversarial or explicit prompts still trigger toxic output (84% probability on challenging prompts).
  • Symbolic Model Diffing: Instead of computing uninterpretable parameter-space differences ($\Delta W$), researchers can diff models symbolically by comparing their extracted top-$n$-gram files (e.g., showing Python-specific syntax like "**kwargs" emerging in CodeLlama).

Key Results

  • High Faithfulness: Jet expansions achieve logit cosine similarities $>0.99$ with full-model outputs across various GPT architectures.
  • Functional Role Localization: Ablating components identified via jet paths confirmed specialized roles via notable logit drops ($\Delta\text{logit}$):
  • OLMo-7B's MLP 3 promotes the "-ing" suffix ($\Delta\text{logit} = -0.58$), and MLP 1 promotes "-ly" and "-else" ($\Delta\text{logit} = -4.19$ and $-3.35$).
  • Llama-2-7B's MLP 6 promotes "-ing" ($\Delta\text{logit} = -14.61$).
  • Individual attention heads were mapped to discrete roles, such as LaTeX formatting (OLMo Head 1, $\Delta\text{logit} = -0.1570$) and calendar date composition (Head 26, $\Delta\text{logit} = -0.0093$).

Limitations and Future Work

  • Hyperparameter Sensitivity & Non-vanishing Remainders: Expansions are not unique, and non-linear remainder terms $\delta$ do not strictly vanish as jet order $k$ increases, requiring weight optimization routines.
  • Combinatorial Scalability: While computing jets is efficient via vector-Jacobian products, evaluating paths across all combinations of long sequence lengths remains computationally demanding.
  • Context Scope: The current empirical study ignores positional embeddings and is restricted to bi-grams and tri-grams; expanding to longer context horizons and finer neuron-level granularities remains open for future research.

Summary updated

BibTeX
@misc{chen2024jet,
  author = {Yihong Chen and Xiangxiang Xu and Yao Lu and Pontus Stenetorp and Luca Franceschi},
  title = {{Jet Expansions of Residual Computation}},
  year = {2024},
  eprint = {2410.06024},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2410.06024},
}

Loading related content...

Figure