Abstractors and relational cross-attention: An inductive bias for explicit relational reasoning in Transformers

Awni Altabaa, Taylor Whittington Webb, Jonathan D. Cohen, John Lafferty

TL;DR

Researchers have introduced the Abstractor, a novel Transformer module that uses "relational cross-attention" to separate an object’s internal features from its relationships with other objects. By creating this "relational bottleneck," the architecture achieves dramatic improvements in sample efficiency and generalization on tasks ranging from logic games to complex calculus.

What Problem Does This Paper Address?

Standard Transformers are the "Swiss Army knives" of modern AI, but they have a hidden weakness: they are notoriously data-hungry when it comes to learning abstract rules. While a human can see three examples of a "sorting" task and understand the underlying logic, a Transformer might require thousands of examples to catch on.

The authors argue this is due to representation entanglement. In standard self-attention, the model mixes "object-level" features (e.g., the specific pixels of an image or the embedding of a word) with "relational" information (e.g., "this object is larger than that one"). Because these are mashed together, the model struggles to generalize. If it learns a rule for "red circles," it might fail to apply that exact same rule to "blue squares." This paper seeks to provide an architectural "inductive bias" that forces the model to reason about relations explicitly.

Methods: The Abstractor and Relational Cross-Attention

The core innovation is the Abstractor module and its engine, Relational Cross-Attention (RCA).

Comparison of standard Self-Attention and Relational Cross-Attention

In a standard Transformer, attention looks like this: Attention(Q=X, K=X, V=X) where $X$ is the input data. The model uses the data to decide what to look at (Queries/Keys) and then pulls the data itself (Values) into the next layer.

The Abstractor changes the "Value" part of the equation. Instead of pulling the raw data $X$, it pulls in abstract symbols ($S$). RCA(Q=X, K=X, V=S)

These symbols act like "pointers" or placeholders. Because the symbols contain no information about the objects' features (like color or texture), the output of the module is forced to encode only the relationships between objects. The authors call this the relational bottleneck.

The paper proposes three ways to assign these symbols:

  1. Positional: Symbols based on the order in the sequence.
  2. Position-relative: Symbols based on the distance between objects.
  3. Symbolic Attention: A more complex method where symbols are "bound" to objects based on their "syntactic role."

Datasets

The authors evaluated the Abstractor across three distinct categories:

  • Discriminative Tasks: The "SET" card game (identifying patterns across four dimensions) and asymmetric order relations (learning $A < B$ logic).
  • Relational Seq2Seq: A custom Object-Sorting task where the model must output the correct order of random objects based on hidden attributes.
  • Mathematical Problem Solving: Five subtasks from the DeepMind Mathematics Dataset, including calculus (differentiation), linear algebra, and polynomial expansion.

Key Insights and Ideas

  • The Power of the Bottleneck: By stripping away object features, the Abstractor cannot "cheat" by memorizing specific object-label pairs. It is forced to learn the underlying relational logic, which makes it much more robust.
  • Symbols as "Syntactic Roles": Using "Symbolic Attention" allows the model to identify objects by their function rather than just their position. This mimics how humans use variables in an equation (e.g., $x$ and $y$).
  • Relational Robustness: Because the model relies on comparisons (inner products) rather than absolute values, it is naturally more robust to noise. If you add noise to all objects, their relative relationship often stays the same, allowing the Abstractor to keep working while standard models fail.
  • Disentangled Generalization: The most striking "aha moment" is that pre-training an Abstractor on one sorting task makes it learn a different sorting task faster. A standard Transformer doesn't benefit from this because its learned representations are too tied to the specific objects from the first task.

Key Results

Performance comparisons on relational tasks including the SET game
  • Solving the SET Game: The Abstractor significantly outperformed existing relational architectures like CoRelNet and PrediNet, proving that multi-head relational attention is better at capturing multi-dimensional patterns.
  • Sample Efficiency: In the object-sorting task, the Abstractor achieved near-perfect accuracy with roughly 1/3 the training data required by a standard Transformer.
  • Mathematical Superiority: On the DeepMind Math dataset, the Abstractor-based models consistently outperformed standard Transformers and "Transformer+" (a version with more parameters to ensure a fair fight). The version using symbolic attention showed the most significant gains.

Limitations and Future Work

  • Scaling to LLMs: While the results on math and logic are impressive, the paper doesn't yet show how this scales to massive, multi-billion parameter language models.
  • Architectural Complexity: Integrating Abstractors requires choosing where to place the "bottleneck" (parallel to or after the encoder), which adds a layer of complexity to model design.
  • Symbol Assignment: While "Symbolic Attention" performed best, it is the most computationally expensive symbol assignment method. Finding a more streamlined way to assign "roles" to objects remains an open challenge.

The authors suggest that future work should explore more complex, "higher-order" relations (relations between relations) and investigate how these modules can be integrated into large-scale production models to improve their logical reasoning capabilities.

Summary updated

BibTeX
@inproceedings{altabaa2024abstractors,
  author = {Awni Altabaa and Taylor Whittington Webb and Jonathan D. Cohen and John Lafferty},
  title = {{Abstractors and relational cross-attention: An inductive bias for explicit relational reasoning in Transformers}},
  booktitle = {International Conference on Learning Representations},
  year = {2024},
  url = {https://openreview.net/forum?id=XNa6r6ZjoB},
}
Figure