How Do Transformers Learn to Associate Tokens: Gradient Leading Terms Bring Mechanistic Interpretability

Shawn Im, Changdae Oh, Zhen Fang, Sharon Li

International Conference on Learning Representations 2026 · Oral

Overview

This article delves into a compelling talk presented at ICLR 2026 by Shawn Im and collaborators, which tackles one of the most fundamental questions in modern AI: how do large language models (LLMs), particularly transformers, acquire their remarkable capabilities? The presentation, titled "How Do Transformers Learn to Associate Tokens: Gradient Leading Terms Bring Mechanistic Interpretability," proposes a novel approach to dissecting the internal learning mechanisms of these complex models. The core of their work lies in understanding the early stages of training by analyzing the gradient descent process through the lens of leading terms in a parameter series expansion.

Watch on SlidesLive

Visual summary for How Do Transformers Learn to Associate Tokens: Gradient Leading Terms Bring Mechanistic Interpretability by Shawn Im, Changdae Oh, Zhen Fang, Sharon Li
Visual summary for How Do Transformers Learn to Associate Tokens: Gradient Leading Terms Bring Mechanistic Interpretability by Shawn Im, Changdae Oh, Zhen Fang, Sharon Li

Key moments

  1. 0:00 Introduction: How transformers learn to associate tokens
  2. 2:00 Deriving closed-form expressions for leading terms
  3. 2:15 Three fundamental basis mappings learned by layers
  4. 3:35 How mappings combine to form model weight matrices
  5. 4:20 End-to-end mechanism: Residual and attention pathways
  6. 5:05 Validating findings with real models like Pythia 14B
  7. 5:50 Conclusion: Benefits of leading order approximation analysis
  8. 6:30 Q&A: Relationship to direct gradient analysis

How Do Transformers Learn to Associate Tokens: Gradient Leading Terms Bring Mechanistic Interpretability

Speakers: Shawn Im, Changdae Oh, Zhen Fang, Sharon Li

Conference: ICLR 2026

YouTube: https://slideslive.com/39062204

Overview

This article delves into a compelling talk presented at ICLR 2026 by Shawn Im and collaborators, which tackles one of the most fundamental questions in modern AI: how do large language models (LLMs), particularly transformers, acquire their remarkable capabilities? The presentation, titled "How Do Transformers Learn to Associate Tokens: Gradient Leading Terms Bring Mechanistic Interpretability," proposes a novel approach to dissecting the internal learning mechanisms of these complex models. The core of their work lies in understanding the early stages of training by analyzing the gradient descent process through the lens of leading terms in a parameter series expansion.

The speakers argue that by approximating the model parameters as a series over training steps and focusing on the initial, dominant terms, it becomes possible to derive closed-form expressions that describe the fundamental features learned by attention-based models. This methodology provides a precise, interpretable description of what features are encoded within the model's weights, especially concerning natural language data. The significance of this research extends to the broader field of mechanistic interpretability, offering concrete insights into the internal structures and emergent behaviors of transformers, moving beyond purely correlational observations to a more causal understanding of learning.

This work is particularly crucial for practitioners and researchers grappling with the black-box nature of LLMs. By providing a theoretical framework to understand how basic linguistic associations are formed in the nascent stages of training, the research offers a foundational layer for building more transparent, reliable, and controllable AI systems. It suggests that even in the early, seemingly chaotic phases of learning, identifiable and interpretable patterns emerge that dictate how tokens are associated, laying the groundwork for the complex behaviors observed in fully trained models.

Background

▶ Watch: Introduction: How transformers learn to associate tokens (0:00)

The rapid advancements in large language models have brought with them an increasing demand for interpretability. While models like transformers demonstrate unparalleled performance across a myriad of natural language tasks, the underlying mechanisms that enable these capabilities often remain opaque. Researchers and practitioners alike are keen to understand not just what these models do, but how they do it, and crucially, how these internal structures are learned during training. This quest for understanding is often termed mechanistic interpretability, aiming to reverse-engineer the algorithms learned by neural networks.

Prior work in this domain has explored various facets of model learning, including the study of implicit biases in optimization algorithms and the analysis of training dynamics. These approaches seek to understand what kinds of structures gradient descent tends to pick up, or how the model's internal representations evolve over time. However, a significant gap persists: many existing analyses lack an exact description of what precisely is learned within the model's weights, especially when dealing with the rich and complex distributions of natural language data. This is particularly true for the early stages of training, where the fundamental building blocks of representation are initially formed.

The problem arises from the sheer complexity and non-linearity of transformer architectures and the iterative nature of gradient descent. Tracking every parameter change and its interaction across millions or billions of parameters throughout training is computationally intractable and analytically challenging. Therefore, existing methods often rely on empirical observations or high-level approximations, which may not always yield the precise, mechanistic insights needed to fully demystify token associations. The motivation behind this research is to bridge this gap by offering a more rigorous and analytically tractable approach to characterize the features learned in the early, foundational phases of transformer training, thereby providing a clearer understanding of how tokens become associated.

Key Findings

▶ Watch: Three fundamental basis mappings learned by layers (2:15)

The central discovery of this research is the ability to derive closed-form expressions for the leading terms of weight matrices in attention-only multi-layer transformers during early training. This analytical breakthrough reveals that the features learned across all layers in these early stages converge to the same set of fundamental concepts. This set of features can be distinctly decomposed into three interpretable basis mappings:

  1. Bigram Mapping: This mapping captures direct sequential relationships. Each token is strongly associated with the average distribution of tokens that commonly appear immediately after it. For instance, the token "red" would be mapped to "cars," "balls," or "apples," reflecting common bigram occurrences. This represents a basic statistical regularity of the dataset.
  1. Interchangeability Mapping: This mapping identifies tokens that share similar preceding contexts. Specifically, each token is mapped to other tokens that have a similar distribution of tokens appearing before them. Intuitively, this helps the model find tokens that play similar roles or belong to similar semantic categories. An example provided is "happy" being associated with "excited," "sad," or "curious," as these are all emotions that might appear in similar contexts.
  1. Context Mapping: This mapping is perhaps the most nuanced, associating tokens with those that appear before them across diverse contexts. It captures indirect, contextual relationships rather than direct sequential ones. For example, "flower" might be associated with "beautiful" or "bloom," even if these words don't directly precede "flower" in a simple bigram sense, but are related through the broader context of "gardening." This mapping highlights the model's ability to learn more abstract, conceptual connections.

These three fundamental mappings then compose to form the various weight matrices within the transformer architecture. The output head primarily picks up the bigram mapping, predicting the next token based on direct sequential probability. The value matrices are found to learn a composition of the context mapping and the bigram mapping. The key query matrices, responsible for determining which tokens to attend to, learn a composition of the interchangeability mapping and the context mapping.

Crucially, the research demonstrates that these findings generalize to real, larger models, even those including MLPs which were not part of the initial analytical framework. Empirical validation using Pythia 14B showed strong agreement between the analytically predicted token associations and the empirically observed correlations in the model's embeddings during early training, across different layers. This agreement, while strong initially, was observed to drift as training progressed and the model learned more complex patterns.

Technical Deep Dive

▶ Watch: End-to-end mechanism: Residual and attention pathways (4:20)

The core of this work lies in a sophisticated analytical approach to understanding the learning dynamics of attention-only multi-layer transformers. The fundamental idea is to simplify the complex, non-linear progression of parameters during gradient descent by using a series approximation. The researchers posit that the model's parameters, over the course of training, can be expressed as a series in terms of the learning rate and the number of training steps. By focusing on the leading terms (specifically, the first-order term), they aim to capture the dominant features learned in the early stages of training, where the gradient's influence is most direct and less obscured by higher-order interactions.

This approximation allows for the derivation of closed-form expressions for each weight matrix within the transformer. The analysis reveals that regardless of the layer, the model learns the same fundamental set of features. These features are then decomposed into the three interpretable basis mappings:

  1. Bigram Mapping: Mathematically, this maps a token to its average next token distribution. If we denote a token as $t_i$, its bigram mapping would essentially represent the probability distribution $P(t_{i+1} | t_i)$ averaged over the dataset. This is a direct statistical correlation, reflecting immediate sequential dependencies. For instance, if "red" is frequently followed by "car," "ball," or "apple," the bigram mapping for "red" would emphasize these subsequent tokens.
  1. Interchangeability Mapping: This mapping associates a token $t_i$ with other tokens $t_j$ that have similar preceding token distributions, i.e., $P(t_i | t_{i-1}) \approx P(t_j | t_{i-1})$. This means tokens that can appear in similar preceding contexts are considered interchangeable. For example, if "happy" and "excited" both frequently follow phrases like "I feel" or "she was very," they would be strongly associated through this mapping, indicating their similar grammatical or semantic roles as descriptors of emotion.
  1. Context Mapping: This is a more abstract mapping, linking tokens based on shared preceding contexts across diverse occurrences, even if not directly sequential. It's not just about $P(t_i | t_{i-1})$ but rather about the broader contextual distribution of $t_{i-k}, \ldots, t_{i-1}$ that precedes $t_i$. The example of "flower" being associated with "beautiful" or "bloom" illustrates this. These words might not be direct bigram partners, but they frequently co-occur within the overarching context of discussions about gardening or nature.

These three fundamental mappings are not learned in isolation but compose to form the operational logic of the transformer's attention mechanism:

  • Output Head: This final projection layer primarily learns the bigram mapping. It takes the representation of the current token and directly maps it to the distribution of the most likely next tokens based on simple sequential statistics.
  • Value Matrices: These matrices are responsible for projecting the input into a space where the information to be "valued" or retrieved is stored. The analysis shows they pick up a composition of the context mapping and the bigram mapping. This suggests that the information retrieved by the value matrices is not just about direct next-token prediction but also incorporates broader contextual relevance.
  • Key Query Matrices: These matrices determine the attention scores, essentially deciding which tokens to attend to. They learn a composition of the interchangeability mapping and the context mapping. This implies that attention is guided by finding tokens that are semantically or functionally similar (interchangeability) and contextually relevant.

To make this concrete, the talk illustrates the end-to-end flow in a single-layer model:

  1. Residual Pathway: The input token directly passes through the residual pathway to the output head, contributing its bigram mapping component directly to the next token prediction. This represents a straightforward, statistical prediction baseline.
  2. Attention Module Pathway: Here, the model performs a more sophisticated operation. The key query matrices identify tokens to attend to based on their interchangeability and contextual relevance. The information from these attended tokens is then processed through the value matrices, which leverage a composition of context and bigram mappings. Crucially, the analysis reveals that the features used by the value and output matrices, when combined, form the same set of features used by the key query matrix to attend to tokens. This means the model attends to tokens that it anticipates will be useful for predicting the next token, based on its learned output mapping.

While the analytical framework initially excluded MLPs (Multi-Layer Perceptrons) for simplicity, the empirical results on larger models like Pythia 14B demonstrated that these findings generalize remarkably well, indicating the robustness of the discovered early-stage learning principles. The approximation of parameters with leading terms, therefore, provides a powerful lens to understand the foundational learning steps in complex neural architectures.

Experimental Setup & Results

▶ Watch: Validating findings with real models like Pythia 14B (5:05)

To validate their theoretical predictions, the researchers conducted empirical experiments, primarily focusing on how well the derived leading terms correlate with the actual features learned by real-world transformer models. The primary model used for this validation was Pythia 14B, a large-scale open-source language model, which allowed for testing the generalization of their analytical findings beyond simplified, attention-only architectures.

The experimental setup involved:

  • Comparison Metric: The core of the validation was to compare the predicted associations between tokens, derived from the leading order analysis, with the empirically observed correlations in the model's internal embeddings. This comparison was quantified using cosine similarity between these correlation matrices. Cosine similarity is a common metric to measure the angular difference between two non-zero vectors, effectively indicating how similar their orientations are, and thus how similar the underlying relationships they represent are.
  • Analysis Across Training Steps: The comparison was performed at different stages of training, from very early steps to later stages, to observe the evolution of agreement.
  • Analysis Across Layers: The agreement was also examined across different layers of the Pythia 14B model to ascertain if the learned features were consistent throughout the network's depth, as predicted by the theoretical analysis.

The results yielded compelling evidence supporting their theory:

  • Strong Early Agreement: In the early stages of training, there was a remarkably strong agreement (high cosine similarity) between the token associations predicted by the leading order analysis and those empirically found in the model embeddings of Pythia 14B. This strong correlation was observed consistently across all layers of the model, confirming that the theoretical basis mappings accurately describe the foundational features learned by the model in its nascent stages.
  • Generalization to Complex Models: The fact that these findings held true for Pythia 14B, which includes MLPs and is a significantly more complex architecture than the attention-only models analyzed theoretically, underscores the broad applicability and robustness of the leading term approach. It suggests that the fundamental learning dynamics captured by the initial approximation are indeed dominant even in more intricate setups.
  • Drift Over Time: As training progressed beyond the early stages, the agreement between the predicted and empirical correlations gradually decreased. This drift is expected, as the model learns more complex, higher-order relationships and adapts to the full non-linearity of the dataset and the optimization process. The leading order approximation is designed to capture the initial, dominant learning patterns, not the full spectrum of complex features acquired in later stages.

In essence, the experimental results provide strong empirical backing that the initial, analytically derived bigram, interchangeability, and context mappings are not merely theoretical constructs but genuinely describe the core associative knowledge that transformers acquire in their foundational learning phases. While specific numerical values for cosine similarity were not detailed in the talk, the qualitative description of "strong agreement" and its layer-wise consistency provides robust validation.

Practical Implications

▶ Watch: Q&A: Relationship to direct gradient analysis (6:30)

The findings from this research offer several significant practical implications for practitioners, infrastructure teams, model builders, and deployers working with large language models:

  1. Enhanced Mechanistic Interpretability: This work provides a concrete framework for mechanistic interpretability by offering an analytical method to describe what features are learned in early training. For model builders, understanding these foundational associative patterns can demystify the initial "black box" behavior, potentially leading to better intuition for model design and debugging. It shifts the interpretability paradigm from post-hoc analysis to a more predictive, mechanistic understanding of learning.
  1. Guiding Model Initialization and Early Training: If the early training stages are dominated by these fundamental basis mappings, this insight could inform better initialization strategies or specialized training curricula. For instance, pre-training steps could be designed to explicitly encourage or accelerate the learning of these basic associations, potentially leading to more efficient or stable initial learning phases. Infrastructure teams might optimize data loading or batching strategies to highlight these statistical regularities.
  1. Understanding Model Limitations and Biases: By precisely characterizing the early learned features, researchers can better identify the inherent biases or statistical limitations encoded in the model from the outset. If, for example, the bigram mapping picks up undesirable correlations from the training data, understanding its analytical form allows for targeted interventions or dataset curation to mitigate these issues before they propagate into more complex behaviors.
  1. Foundation for Deeper Interpretability: While this work focuses on early training, it establishes a crucial baseline. Future research can build upon this by analyzing higher-order terms in the parameter series, or by incorporating MLPs into the analytical framework, to understand how these foundational mappings evolve and combine to form the more complex, emergent behaviors observed in fully trained models. This provides a roadmap for progressively unraveling the full complexity of transformer learning.
  1. Tradeoffs and Limitations: It's important to acknowledge the inherent tradeoffs. The leading order approximation is powerful for its interpretability and analytical tractability, but it intentionally simplifies the system. It describes the initial learning dynamics and the dominant features. As training progresses, the model learns more complex, non-linear relationships that go beyond these leading terms. Therefore, this approach might not fully explain all behaviors of a fully converged, highly optimized model. Practitioners should view this as a foundational understanding, not a complete explanation for all aspects of LLM functionality. The current analysis also explicitly simplified to attention-only models for theoretical derivations, though empirical results showed generalization to models with MLPs. Further work would be needed to fully integrate MLPs into the analytical framework.

Key Takeaways

  • Mechanistic Interpretability: The research offers a method for mechanistic interpretability by analytically describing features learned in transformers during early training.
  • Gradient Leading Terms: It leverages leading terms from a series approximation of parameters under gradient descent to derive closed-form expressions for learned features.
  • Three Basis Mappings: Foundational features are decomposed into three interpretable basis mappings: bigram mapping (sequential), interchangeability mapping (similar preceding context), and context mapping (broader contextual relevance).
  • Composition in Weights: These mappings compose to form the transformer's weight matrices: output head (bigram), value matrices (context + bigram), and key query matrices (interchangeability + context).
  • Empirical Validation: Findings generalize to real models like Pythia 14B, showing strong agreement between predicted and empirical token associations in model embeddings during early training, consistent across layers.
  • Early Stage Focus: The approach is particularly effective for understanding early training dynamics, offering insights into how basic linguistic associations are initially formed.

About the Speaker(s)

The talk was presented by Shawn Im, with significant contributions from his collaborators Changdae Oh, Zhen Fang, and Sharon Li. All speakers are affiliated with the organizations mentioned in the metadata, indicating their roles as researchers or academics in the field of AI/ML. Their work focuses on understanding the fundamental learning mechanisms within complex neural networks, particularly transformers, to advance the field of mechanistic interpretability.

Reviews

  • Maya Iyer (Theoretical ML Researcher) — MUST SEE ★★★★★
  • Chen Zhao (Applied ML Researcher & Empiricist) — MUST SEE ★★★★★

→ Top-rated talks at International Conference on Learning Representations 2026

All talks from International Conference on Learning Representations 2026