Does RoBERTa Perform Better than BERT in Continual Learning: An Attention Sink Perspective

Xueying Bai, Yifan Sun, Niranjan Balasubramanian

TL;DR

This paper investigates why RoBERTa, despite its superior pre-training, doesn't always outperform BERT in continual learning (CL). They identify "attention sinks" – specific tokens like [SEP] that receive disproportionately high attention – as a cause of over-smoothing and cross-task interference. To combat this, they propose a "pre-scaling" mechanism that encourages more diverse attention, significantly improving CL performance without needing to store past data.

What Problem Does This Paper Address?

Continual learning (CL) is crucial for models that need to learn new tasks sequentially without forgetting old ones. While pre-training generally helps, it's not always clear if models with higher general performance (like RoBERTa over BERT) translate to better CL. This paper tackles this question by exploring a phenomenon called "attention sinks" in pre-trained language models. These sinks, often special tokens like [SEP], receive a lot of attention, which the authors hypothesize leads to "over-smoothing" (making token representations too similar) and interference between tasks, hindering CL performance.

Methods

The core of the paper's contribution lies in identifying and addressing the "attention sink" phenomenon.

  • Attention Sink Analysis: They empirically analyze attention maps in pre-trained models (BERT and RoBERTa) to show that certain tokens consistently receive high attention scores across layers. They quantify this using "average outer degree" and "attention deviation" metrics.
  • Connection to Over-Smoothing: They link these attention sinks to over-smoothing, a problem where token representations become too similar, making models less adaptable and prone to feature distortion.
  • Pre-Scaling Mechanism: To mitigate attention sinks and their negative effects, they propose a "pre-scaling" mechanism. This involves a two-stage training process:
  • Probing Stage: A scaling layer is trained to encourage diverse attention, specifically directing attention towards non-sink tokens.
  • Fine-tuning Stage: The entire model, including the encoder and the scaling layer, is fine-tuned. This aims to balance the benefits of attention on common tokens (for transfer) with the need to reduce interference.

Datasets

The paper uses several standard NLP datasets for evaluating their continual learning approach:

  • Yahoo Split: A split of the Yahoo dataset for news question-answer categorization.
  • DB: A split of DBPedia for Wikipedia article classification.
  • News Series: A sequence of tasks including AG_news (news classification), MRPC (paraphrase detection), RTE (text entailment), and SST (sentiment analysis).

They also mention using NLI datasets (SST and MNLI) for empirical analysis of attention sinks.

Key Insights and Ideas

  • Attention Sinks are a Bottleneck: The paper provides strong evidence that "attention sinks" (ubiquitous tokens like [SEP]) are not just a curiosity but a significant impediment to continual learning, even for powerful models like RoBERTa.
  • Over-Smoothing is Linked to Attention Sinks: They establish a clear connection between the over-smoothing phenomenon and the behavior of attention sinks, suggesting that the dominance of sink tokens contributes to the homogenization of representations.
  • Pre-trained Capacity Isn't Always Enough: The study highlights that simply having a more capable pre-trained model (RoBERTa) doesn't guarantee better CL performance if underlying architectural or attention mechanisms are problematic for sequential learning.
  • Balancing Transfer and Interference: The work emphasizes the trade-off between leveraging common tokens for knowledge transfer and avoiding interference. Their pre-scaling method aims to strike this balance.
  • Pre-scaling Offers a Data-Efficient Solution: The proposed pre-scaling method achieves strong CL performance without relying on experience replay or storing past model parameters, making it more memory-efficient.

Key Results

  • RoBERTa vs. BERT in CL: RoBERTa does not consistently outperform BERT in CL tasks, contrary to expectations based on their single-task performance. This is attributed to their attention sink behavior.
  • Pre-scaling Improves Performance: The proposed pre-scaling mechanism significantly improves CL performance for both BERT and RoBERTa across various datasets.
  • Reduced Over-Smoothing: After pre-scaling, RoBERTa models show decreased representational similarity (indicating less over-smoothing) and increased attention deviations.
  • Competitive with Replay Methods: The pre-scaling method achieves competitive or superior results compared to CL models that use experience replay, demonstrating its effectiveness without data storage. For instance, on the News Series, Prescale outperforms replay-based models.
  • Ablation Study Insights: Scaling attention only on common sink tokens (Sink strategy) did not yield improvements, suggesting the benefit comes from a more holistic approach to diverse attention allocation.

Limitations and Future Work

  • Task-Agnostic vs. Task-Aware: While the paper focuses on task-incremental settings, they mention that their model is general to task-agnostic settings. However, in task-agnostic evaluations on BERT, the PT+FT method slightly outperformed Prescale, which they hypothesize is due to BERT's next-sentence prediction pre-training. This suggests potential model-specific nuances.
  • Future Work: The paper's findings open avenues for further research into understanding and mitigating attention sink phenomena in various model architectures and CL settings. The pre-scaling mechanism itself could be further explored and adapted for different tasks and domains.

Summary updated

BibTeX
@inproceedings{bai2024does,
  author = {Xueying Bai and Yifan Sun and Niranjan Balasubramanian},
  title = {{Does RoBERTa Perform Better than BERT in Continual Learning: An Attention Sink Perspective}},
  booktitle = {COLM},
  year = {2024},
  url = {https://openreview.net/forum?id=VHhwhmtx3b},
}
Figure