Abstract
LAIT (Layer-Adjustable Interactions in Transformers) is a hybrid architecture that encodes text segments independently before allowing them to interact in later layers. By delaying cross-segment attention, LAIT reduces computational costs by up to 50% and enables massive speedups through caching, all while maintaining the high accuracy of standard Transformer models.
Introduction: The Efficiency-Performance Gap
Standard Transformer encoders, such as BERT or T5, achieve state-of-the-art performance by allowing every token to attend to every other token across all layers. However, this full self-attention mechanism incurs a computational cost that grows quadratically with input length. In many natural language processing (NLP) tasks, inputs are naturally segmented—for example, a "Premise" and a "Hypothesis" in natural language inference, or a "Question" and a "Passage" in information retrieval.
While joint processing of these segments is the standard approach, it is often redundant in early layers where the model focuses on basic syntax and local semantics. Conversely, Dual Encoders process segments entirely independently, offering high speed but suffering from a significant "performance gap" due to the lack of deep cross-segment reasoning.
The LAIT Architecture
The authors propose LAIT, a bridge between fully joint Transformers and independent Dual Encoders. LAIT introduces a "tunable knob" for interaction by splitting the encoding process into two stages:
- Parallel Encoding: For the first $P$ layers, segments are encoded independently. This is implemented using a block-diagonal attention mask that prevents cross-segment interaction.
- Joint Encoding: For the remaining $L - P$ layers, the mask is removed, enabling full cross-segment self-attention.
By adjusting the hyperparameter $P$, researchers can navigate the trade-off between speed and accuracy. When $P=0$, the model behaves like a standard Transformer; when $P=L$, it functions as a Dual Encoder.
Caching: The "Killer App" for Latency
One of the most significant advantages of LAIT is its support for caching. In scenarios where one segment (e.g., a query) is compared against many others (e.g., multiple documents), the independent representations from the first $P$ layers can be pre-computed and stored.
As shown in the figure above, "full caching" allows the model to bypass the first $P$ layers for both segments, drastically reducing real-world latency. In tasks like document clustering, this approach can lead to speedups of up to 50x compared to standard T5 models.
Experimental Results
LAIT was evaluated across a wide range of benchmarks, including GLUE, SuperGLUE, and fact verification tasks like FEVER.
Accuracy Preservation
The research demonstrates that cross-segment interaction can be delayed significantly without sacrificing performance. For a 12-layer model, segments can remain independent for up to 8 or 9 layers while staying within 1% of the fully self-attentive baseline on tasks like MNLI and QQP.
Efficiency Gains
LAIT configurations that maintain 95% of baseline accuracy (LAIT-95%) reduced encoder attention FLOPs by 30-50% on average. The most dramatic gains were seen in redundant processing scenarios, such as the WikiClusters task, where LAIT-12 achieved a 50x speedup.
Conclusion and Future Directions
LAIT provides a flexible framework for optimizing Transformer efficiency. By delaying interaction, it achieves a superior balance of speed and accuracy compared to existing dual-encoder or fully-attentive paradigms. Future work may involve optimizing hardware kernels for block-diagonal attention and exploring how LAIT integrates with other sparse attention techniques.
Summary updated