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

This paper introduces the "Abstractor," a novel module for Transformers designed to explicitly model relational reasoning. By disentangling relational information from object features through "relational cross-attention," Abstractors achieve significantly improved sample efficiency and generalization on tasks requiring relational understanding, outperforming standard Transformers.

What Problem Does This Paper Address?

Humans excel at abstract and relational reasoning, a capability crucial for tasks like analogy and creative thinking. While modern deep learning models, particularly Transformers, are powerful function approximators, they often struggle with explicit relational reasoning and generalization from limited data. Standard Transformer attention mechanisms entangle object-level features with relational information, leading to suboptimal sample efficiency for learning relations. This paper aims to bridge this gap by proposing an architectural inductive bias that explicitly separates and models relational information.

Methods

The core contribution is the Abstractor module, which integrates into Transformer architectures. The key innovation is relational cross-attention, a variant of standard attention. Instead of using object features as "values" in the attention mechanism, the Abstractor uses learned "symbols" that act as abstract references to objects. This creates a "relational bottleneck" that disentangles relational information from object-specific features.

Relational cross-attention is defined as: $A \leftarrow \sigma_{rel}(\Phi_q(X)\Phi_k(X))S$ where $X$ is the input sequence, $S$ is a matrix of symbols, $\Phi_q$ and $\Phi_k$ are learned query and key transformations, and $\sigma_{rel}$ is a relation activation function (e.g., softmax).

The Abstractor module itself can be composed of multiple layers, each consisting of relational cross-attention followed by a feedforward network, optionally with residual connections and layer normalization. The paper also explores different symbol assignment mechanisms: positional symbols, position-relative symbols, and symbolic attention.

Datasets

The paper evaluates the proposed Abstractor on several datasets:

  • Discriminative Relational Tasks:
    • Order relations: Synthetic dataset for learning asymmetric relations (transitivity).
  • SET: A cognitive task dataset where models classify triplets of cards based on four attributes.
  • Purely Relational Sequence-to-Sequence Tasks:
    • Object-sorting: A synthetic dataset where models sort sequences of objects based on a defined ordering relation.
  • Partially-Relational Sequence-to-Sequence Tasks:
    • Math Problem-Solving: A dataset comprising various mathematical tasks (calculus, algebra, polynomial expansion) from Saxton et al. (2019).

Key Insights and Ideas

  • Relational Bottleneck: The core idea is that explicitly disentangling relational information from object features is crucial for efficient relational learning and generalization. This "bottleneck" forces the model to focus on relationships rather than getting bogged down by specific object details.
  • Symbols as Abstract References: Using learned symbols instead of object features as values in attention allows the model to reason about relationships without needing to encode the full object representation, leading to abstraction.
  • Flexibility of Relation Activation: The paper highlights that the choice of relation activation function ($\sigma_{rel}$) can impact performance, suggesting that a configurable hyperparameter is beneficial. Softmax provides contextual normalization, while other activations might be better for absolute relations.
  • Generalization through Disentanglement: Abstractors demonstrate superior generalization capabilities, especially after pre-training, because their disentangled relational representations can be more readily mapped to new, similar tasks compared to the entangled representations of standard Transformers.

Key Results

  • Discriminative Relational Tasks: The Abstractor significantly outperforms standard CoRelNet and MLP on learning asymmetric relations and the SET task, showing superior sample efficiency.
  • Purely Relational Sequence-to-Sequence Tasks (Object-Sorting): Abstractor-based models achieve dramatically improved sample efficiency compared to standard Transformers and an ablation model that replaces relational cross-attention with standard cross-attention.
  • Generalization: Pre-training an Abstractor significantly accelerates learning on a new object-sorting task, while a standard Transformer shows no benefit, highlighting the Abstractor's better generalization.
  • Math Problem-Solving: Abstractor-based architectures consistently outperform Transformer variants (with similar parameter counts) across various mathematical tasks, demonstrating improved accuracy and sample efficiency. The symbolic attention mechanism in the Abstractor shows the greatest improvement.
  • Robustness: Abstractors are shown to be more robust to additive noise and random linear transformations compared to standard Transformers, suggesting their relational reasoning is less dependent on specific feature representations.

Limitations and Future Work

  • Understanding Architectural Variants: The authors suggest further research into the strengths and weaknesses of different Abstractor architectural variants.
  • Streamlined and Scalable Architectures: Developing more streamlined and scalable architectures based on the Abstractor framework is an avenue for future work.
  • Complex Real-World Problems: Exploring the application of the Abstractor framework to increasingly complex real-world problems is a promising direction.
  • Theoretical Guarantees: While the paper provides theoretical analysis on universal approximation properties, further theoretical understanding of the "relational bottleneck" and its implications could be beneficial.

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