Zebra: Extending Context Window with Layerwise Grouped Local-Global Attention
Kaiqiang Song, Xiaoyang Wang, Sangwoo Cho, Xiaoman Pan, Dong Yu
TL;DR
Transformer-based models struggle with quadratic attention costs when processing long sequences. Zebra introduces layerwise grouped local-global attention and rotary positional embeddings to extend context windows efficiently, balancing local and global computations. Through Long Context Adaptation Training (LCAT) and Long Instruction Tuning (LIT) on Llama-2 and related baselines, Zebra achieves comparable short-context performance and improved long-context perplexity and efficiency, including faster training and inference. This work demonstrates a practical path to scalable, long-context LLMs applicable to long-form understanding and generation tasks.
Abstract
This paper introduces a novel approach to enhance the capabilities of Large Language Models (LLMs) in processing and understanding extensive text sequences, a critical aspect in applications requiring deep comprehension and synthesis of large volumes of information. Recognizing the inherent challenges in extending the context window for LLMs, primarily built on Transformer architecture, we propose a new model architecture, referred to as Zebra. This architecture efficiently manages the quadratic time and memory complexity issues associated with full attention in the Transformer by employing grouped local-global attention layers. Our model, akin to a zebra's alternating stripes, balances local and global attention layers, significantly reducing computational requirements and memory consumption. Comprehensive experiments, including pretraining from scratch, continuation of long context adaptation training, and long instruction tuning, are conducted to evaluate the Zebra's performance. The results show that Zebra achieves comparable or superior performance on both short and long sequence benchmarks, while also enhancing training and inference efficiency.
