Correlation-Aware Select and Merge Attention for Efficient Fine-Tuning and Context Length Extension
Not on the map. Why?
Abstract (arXiv)
Modeling long sequences is crucial for various large-scale models; however, extending existing architectures to handle longer sequences presents significant technical and resource challenges. In this paper, we propose an efficient and flexible attention architecture that enables the extension of context lengths in large language models with reduced computational resources and fine-tuning time compared to other excellent methods. Specifically, we introduce correlation-aware selection and merging mechanisms to facilitate efficient sparse attention. In addition, we also propose a novel data augmentation technique involving positional encodings to enhance generalization to unseen positions. The results are as follows: First, using a single A100, we achieve fine-tuning on Llama2-7B with a sequence length of 32K, which is more efficient than other methods that rely on subsets for regression. Second, we present a comprehensive method for extending context lengths across the pre-training, fine-tuning, and inference phases. During pre-training, our attention mechanism partially breaks translation invariance during token selection, so we apply positional encodings only to the selected tokens. This approach achieves relatively high performance and significant extrapolation capabilities. For fine-tuning, we introduce Cyclic, Randomly Truncated, and Dynamically Growing NTK Positional Embedding (CRD NTK). This design allows fine-tuning with a sequence length of only 16K, enabling models such as Llama2-7B and Mistral-7B to perform inference with context lengths of up to 1M or even arbitrary lengths. Our method achieves 100% accuracy on the passkey task with a context length of 4M and maintains stable perplexity at a 1M context length. This represents at least a 64-fold reduction in resource requirements compared to traditional full-attention mechanisms, while still achieving competitive performance.
Key facts. No citing papers in the map yet (data through 14 Oct 2026). Builds on 22 of its 28 references that are in the map. First posted on arXiv 5 Oct 2024.
Builds on
22 of 28 references.
References · 22
- 2017Attention Is All You Needcited by 60,361
- 2018BERT: Pre-training of Deep Bidirectional Transformers for Language Understandingcited by 40,399
- 2020Language Models are Few-Shot Learnerscited by 32,419
- 2021LoRA: Low-Rank Adaptation of Large Language Modelscited by 14,380
- 2022FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awarenesscited by 3,673
- 2020Deformable DETR: Deformable Transformers for End-to-End Object Detectioncited by 3,422
- 2020Longformer: The Long-Document Transformercited by 3,413
- 2019Transformer-XL: Attentive Language Models Beyond a Fixed-Length Contextcited by 1,850
- 2023LongBench: A Bilingual, Multitask Benchmark for Long Context Understandingcited by 1,417
- 2023Extending Context Window of Large Language Models via Positional Interpolationcited by 740
- 2019Compressive Transformers for Long-Range Sequence Modellingcited by 726
- 2023Retentive Network: A Successor to Transformer for Large Language Modelscited by 613
10 more
- 2020Efficient Content-Based Sparse Attention with Routing Transformerscited by 471
- 2023Ring Attention with Blockwise Transformers for Near-Infinite Contextcited by 457
- 2024LongRoPE: Extending LLM Context Window Beyond 2 Million Tokenscited by 313
- 2023Landmark Attention: Random-Access Infinite Context Length for Transformerscited by 213
- 2024Leave No Context Behind: Efficient Infinite Context Transformers with Infini-attentioncited by 200
- 2024InfLLM: Training-Free Long-Context Extrapolation for LLMs with an Efficient Context Memorycited by 197
- 2023BiFormer: Vision Transformer with Bi-Level Routing Attentioncited by 151
- 2022An Empirical Survey on Long Document Summarization: Datasets, Models and Metricscited by 74
- 2022Input-Tuning: Adapting Unfamiliar Inputs to Frozen Pretrained Modelscited by 34
- 2023GrowLength: Accelerating LLMs Pretraining by Progressively Growing Training Lengthcited by 11
Built on by
Not cited yet.