Efficient Hybrid Long Sequence Modeling with State Space Augmented Transformers

Simiao Zuo, Xiaodong Liu, Jian Jiao, Denis X Charles, Eren Manavoglu, Tuo Zhao, Jianfeng GaoCOLM 2024

TL;DR

This paper introduces SPADE, a novel Transformer architecture that efficiently models long sequences by combining the global context-capturing capabilities of State Space Models (SSMs) with the local detail processing of attention mechanisms. SPADE achieves state-of-the-art results on long-range dependency benchmarks and language modeling tasks, demonstrating improved efficiency and performance over existing methods.

What Problem Does This Paper Address?

The Transformer architecture, while highly successful in NLP, faces a significant bottleneck with long sequences due to the quadratic computational cost of its self-attention mechanism. This makes it impractical for tasks requiring extensive context. Existing solutions either approximate attention, sacrificing structural biases, or use local attention, which struggles with global information. State Space Models (SSMs) excel at long sequences but lack the flexibility to capture complex local dependencies. This paper aims to bridge this gap by creating a hybrid model that leverages the strengths of both approaches.

Methods

The core innovation is SPADE (State Space Augmented Transformer). It's a multi-layer Transformer where:

  • Global Layer (Bottom Layer): An SSM (like S4, S5, or Hyena) is integrated into the first layer. This layer is responsible for capturing coarse global information and implicitly encodes positional information, eliminating the need for explicit positional embeddings.
  • Local Layers (Top Layers): Subsequent layers employ efficient local attention mechanisms, such as sliding window or chunk attention. These layers refine the global context with detailed local dependencies.

This hierarchical structure allows SPADE to effectively model both long-range dependencies and intricate local patterns, overcoming the limitations of purely local attention or SSMs. The SSM acts as a strong structural bias, complementing the local attention's ability to capture complex relationships.

Datasets

The paper evaluates SPADE on several standard benchmarks:

  • Long Range Arena (LRA): A benchmark specifically designed to test models' ability to handle long sequences across various tasks like Listops, Text, Retrieval, Image, Pathfinder, and Path-X.
  • Wikitext-103: A widely used dataset for language modeling.
  • GLUE benchmark: A collection of natural language understanding tasks.
  • Abstractive summarization datasets: Including arXiv, CNN/DailyMail, MediaSum, and MultiNews for natural language generation tasks.

Key Insights and Ideas

  • SSMs alone struggle with local detail: The paper empirically shows that SSMs, while good at global context, perform poorly on tasks like language modeling where local information is crucial. This is attributed to their fixed dependency patterns and lack of explicit token-to-token interaction.
  • Hybrid approach is key: Combining SSMs for global context with local attention for fine-grained details proves to be a powerful strategy. The SSM provides a strong structural bias that guides the local attention.
  • Bottom layer SSM is optimal: Experiments suggest that placing the SSM in the bottom layer is most effective. This allows it to capture initial global context before local refinement, and placing it at the top leads to performance degradation.
  • No explicit positional embeddings needed: The sequential nature of the SSM in the global layer inherently encodes positional information, simplifying the architecture.

Key Results

  • Long Range Arena: SPADE variants (S4+window and S4+chunk) significantly outperform existing models, including S4, MEGA-chunk, and the vanilla Transformer, achieving state-of-the-art average accuracy. For instance, SPADE (S4+chunk) achieved 87.40% average accuracy.
  • Language Modeling: SPADE achieves better perplexity on Wikitext-103 compared to Transformer variants and SSM-only models. SPADE (S4+window) is also noted to be significantly faster than the vanilla Transformer.
  • Scalability: Pre-trained encoder-decoder SPADE models (SPADEbase and SPADEbase++) demonstrate strong performance on both NLU (GLUE) and NLG (summarization) tasks, often outperforming larger models like LongT5. For example, SPADEbase++ achieved an average accuracy of 89.4 on MNLI, outperforming T5base by 5.5 points.
  • Efficiency: SPADE shows improved efficiency in terms of GPU memory usage and training speed compared to the vanilla Transformer, especially for longer sequences. For a 6k sequence length, SPADE uses significantly less GPU memory than the Transformer.

Limitations and Future Work

  • Computational Cost of SSMs: While SPADE is more efficient than vanilla Transformers, some SSMs (like S4 in isolation) can be less efficient than Transformers for shorter sequences due to their complex layer structures.
  • Flexibility of Local Attention: The paper notes that the performance of local attention depends on the proportion of information within its perception, suggesting further exploration into optimal local attention strategies.
  • Future Work: The authors demonstrate SPADE's flexibility by accommodating various SSMs and local attention methods, implying that further exploration of different building blocks could yield even better results. The scalability shown through pre-training also suggests potential for larger, more capable models.

Summary updated

BibTeX
@inproceedings{zuo2024efficient,
  author = {Simiao Zuo and Xiaodong Liu and Jian Jiao and Denis X Charles and Eren Manavoglu and Tuo Zhao and Jianfeng Gao},
  title = {{Efficient Hybrid Long Sequence Modeling with State Space Augmented Transformers}},
  booktitle = {COLM},
  year = {2024},
  url = {https://openreview.net/forum?id=uUIFTjBREk},
}
Figure