1billi Transformeres

06 Jul 2023

Understanding Trade-offs in Transformer Attention Mechanisms

The Challenge of Attention Mechanisms

Traditional transformer attention operates with O(N²) complexity, allowing each token to correlate with every other token in the sequence. While computationally expensive, this approach ensures comprehensive coverage of relationships within the text.

When moving away from O(N²) attention to accommodate larger context windows, researchers must introduce heuristics to determine which tokens should be correlated. The choice of heuristics significantly impacts model performance across different tasks.

For example, using an exponential decay heuristic—where tokens further in the past receive exponentially less attention—works well for conversational tasks where recent context is most relevant. However, this approach may perform poorly when processing dense academic papers or technical documentation, where information throughout the text carries similar importance.

The Bitter Lesson and Future Directions

As noted in Sutton’s “The Bitter Lesson” [1], the field will likely evolve toward learning these heuristics rather than hardcoding them. While Recurrent Neural Networks (RNNs) implicitly learn such patterns, training them effectively on very deep sequences remains an open challenge.

Another promising direction involves using reinforcement learning to discover attention heuristics for non-recurrent language models, as demonstrated in [2].

Beyond the Bitter Lesson

The development of modern AI reflects more than just increased computational power. It represents the confluence of:

  1. Decades of theoretical breakthroughs
  2. Collective human creativity and perseverance

Pioneers like Yann LeCun and Geoffrey Hinton have worked since the 1990s, achieving crucial milestones before the recent explosion of applications and funding. While computational resources accelerated progress, they alone would not have been sufficient.

Not all AI methods depend primarily on computation and data. For instance, autoregressive models in social sciences, such as STAN’s hierarchical Bayesian inference, advanced through theoretical breakthroughs in Monte Carlo simulation methods, including improved convergence detection and non-conjugate prior sampling.

The Data Scaling Challenge

The Bitter Lesson has an important corollary: scaling computation requires scaling data. In some domains, like Go, self-play can generate virtually unlimited training data. However, in natural language processing, we’re approaching the limits of available human-written text. This constraint highlights the importance of data efficiency.

Human learners remain more data-efficient than large machine learning systems. As Geoffrey Hinton noted in his conversation with Pieter Abbeel, current deep learning methods excel at learning from large datasets with relatively modest compute requirements. In contrast, the human brain, with approximately 150 trillion synapses, faces the opposite challenge: abundant parameters but limited data. Achieving human-like learning efficiency may require substantial advances in regularization techniques.

References

[1] Sutton, R. (2019). The Bitter Lesson. http://www.incompleteideas.net/IncIdeas/BitterLesson.html

[2] AutoResearcher paper (2021). https://arxiv.org/pdf/2109.00527.pdf