GPT-2 Through the Lens of Vector Symbolic Architectures

Johannes Knittel, Tushaar Gangavarapu, Hendrik Strobelt, Hanspeter PfisterarXiv 2024 · DOI

Abstract

Despite the transformative success of large language models, their internal computational mechanisms remain largely opaque. This paper proposes that GPT-2 functions as a Vector Symbolic Architecture (VSA), utilizing high-dimensional, nearly orthogonal vectors to perform symbolic-like operations. By analyzing the model's weights, we demonstrate that Transformer components—Attention and MLP layers—can be interpreted as performing bundling, binding, and unbinding operations. Our results show that many MLP neurons act as discrete logic gates over feature bundles, providing a structured framework for mechanistic interpretability.

Introduction: Decoding the Black Box

Transformers process information through a "residual stream," a hidden vector space that serves as a shared workspace across layers. While the Linear Representation Hypothesis suggests that models treat semantic features as specific directions in this space, we lack a comprehensive understanding of how these directions are combined to perform complex reasoning.

This research investigates whether the principles of Vector Symbolic Architectures (VSA) can explain this "algebra" of communication. VSA is a field of AI that uses high-dimensional vectors to represent symbols and their relationships through well-defined mathematical operations. By framing GPT-2 through this lens, we can move beyond observing activations toward understanding the fundamental logic embedded in the model's weights.

Methods: Mapping Transformers to VSA

The study analyzes GPT-2 small by mapping its standard architectural components to three core VSA operations:

  • Bundling (Superposition): The addition of nearly orthogonal vectors to create a "bag of concepts." This effectively acts as a fuzzy OR gate.
  • Binding: The use of matrix multiplication to "package" a concept, such as associating a specific word with its relative position.
  • Unbinding: The inverse operation, used to "focus" on or extract a specific component from a bundled package.
Mapping Transformer components to VSA operations.

To verify these mappings, the researchers utilized the TransformerLens library to extract model weights. They performed a greedy search to determine if individual neuron weights in the MLP layers could be reconstructed as simple sums (bundles) of token embeddings. Additionally, they examined the "near orthogonality" of weight matrices by calculating $M^\top M$, testing if the model preserves the independence of vector directions across operations.

Key Insights: The Geometry of Logic

The Power of High-Dimensional Orthogonality

In the 768-dimensional residual stream of GPT-2, it is mathematically possible to fit thousands of vectors that are almost perpendicular to one another. This geometric property allows the model to pack a massive amount of information into the same vector space with minimal interference, a phenomenon central to VSA.

MLPs as Logic Gates

The authors suggest that MLP neurons function as checks for these vector bundles. By adjusting a neuron's bias, the model can create an AND gate (requiring multiple concepts to be present to fire) or an OR gate (firing if any one concept in a bundle is present). This suggests that the residual stream acts as a "blackboard" where layers write concepts by adding vectors and read them through projection or unbinding.

Experimental Results

The analysis of GPT-2's weights yielded several significant findings:

  • Orthogonality Confirmed: Weight matrices for both attention and MLPs showed strong diagonal dominance in $M^\top M$ plots, proving the architecture is optimized to preserve nearly orthogonal directions.
  • Neuron Interpretability: For the first MLP layer, the authors achieved a cosine similarity of 0.5 or higher for 80% of neurons by simply summing a few dozen token embeddings. For example, Neuron 0-12 was found to trigger on a bundle of tokens related to news and politics (e.g., CNN, Trump, NBC).
  • Circuit Discovery: The researchers identified a specific circuit where neurons in early layers identify a concept (like "relating"), and later layers use that information to "boost" the probability of the next logical token (like "to").
Neuron interpretations and circuit discovery in GPT-2.

Limitations and Future Work

While these results are promising for GPT-2 small, several questions remain. It is unclear if larger models (e.g., GPT-4) maintain this level of VSA-like structure or if their representations become more dense and less interpretable. Furthermore, the reliance on greedy heuristics for finding bundles may miss more complex, non-linear feature combinations. Future research may apply this VSA lens to Sparse Autoencoders (SAEs) to see if the features they discover align with these bundling and binding principles.

Summary updated

Abstract

Understanding the general priniciples behind transformer models remains a complex endeavor. Experiments with probing and disentangling features using sparse autoencoders (SAE) suggest that these models might manage linear features embedded as directions in the residual stream. This paper explores the resemblance between decoder-only transformer architecture and vector symbolic architectures (VSA) and presents experiments indicating that GPT-2 uses mechanisms involving nearly orthogonal vector bundling and binding operations similar to VSA for computation and communication between layers. It further shows that these principles help explain a significant portion of the actual neural weights.
BibTeX
@misc{knittel2024gpt,
  author = {Johannes Knittel and Tushaar Gangavarapu and Hendrik Strobelt and Hanspeter Pfister},
  title = {{GPT-2 Through the Lens of Vector Symbolic Architectures}},
  year = {2024},
  eprint = {2412.07947},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2412.07947},
}
Figure