mlsanityData to 7 Oct 2026

Context-aware Biases for Length Extrapolation

arXiv 2503.08067 ↗First posted 11 Mar 2025cs.CLcited by 2

Not on the map. Why?

Abstract (arXiv)

Transformers often struggle to generalize to longer sequences than those seen during training, a limitation known as length extrapolation. Most existing Relative Positional Encoding (RPE) methods attempt to address this by introducing either fixed linear biases or globally learned biases, which lack the capacity to adapt to different input contexts. In this work, we propose an additive RPE, Context-Aware Biases for Length Extrapolation (CABLE), a method that learns token-specific, context-aware biases for each attention head in transformers. By dynamically adjusting positional biases based on the input sequence, CABLE overcomes the rigidity of fixed RPEs. When evaluated on sequences longer than originally trained with, GPT-2 Medium (334M parameters) with CABLE achieves lower perplexity than counterparts using other widely adopted positional encoding methods. Additionally, by applying CABLE to the BERT base model we improved performance in long-context retrieval tasks. Our method significantly enhances the extrapolation performance of existing RPE methods tested on the FineWeb-Edu-10B and WikiText-103 datasets. Our code is available at: https://github.com/AlgonetLabs/Cable.

Key facts. Cited by 2 papers in the map (data through 7 Oct 2026). Builds on 59 of its 67 references that are in the map. First posted on arXiv 11 Mar 2025.

Builds on

59 of 67 references.

References · 59

  1. 2017Attention Is All You Needcited by 59,932
  2. 2018BERT: Pre-training of Deep Bidirectional Transformers for Language Understandingcited by 40,204
  3. 2014Adam: A Method for Stochastic Optimizationcited by 36,960
  4. 2020Language Models are Few-Shot Learnerscited by 32,199
  5. 2023GPT-4 Technical Reportcited by 18,132
  6. 2019Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformercited by 14,491
  7. 2023LLaMA: Open and Efficient Foundation Language Modelscited by 13,958
  8. 2019RoBERTa: A Robustly Optimized BERT Pretraining Approachcited by 13,266
  9. 2019Sentence-BERT: Sentence Embeddings using Siamese BERT-Networkscited by 9,049
  10. 2022PaLM: Scaling Language Modeling with Pathwayscited by 5,304
  11. 2021RoFormer: Enhanced Transformer with Rotary Position Embeddingcited by 4,581
  12. 2020Longformer: The Long-Document Transformercited by 3,362
38 more
  1. 2016Pointer Sentinel Mixture Modelscited by 2,992
  2. 2018Neural Tangent Kernel: Convergence and Generalization in Neural Networkscited by 2,597
  3. 2022BLOOM: A 176B-Parameter Open-Access Multilingual Language Modelcited by 1,968
  4. 2024Gemma 2: Improving Open Language Models at a Practical Sizecited by 1,928
  5. 2019Transformer-XL: Attentive Language Models Beyond a Fixed-Length Contextcited by 1,830
  6. 2016MS MARCO: A Human Generated MAchine Reading COmprehension Datasetcited by 1,591
  7. 2018Self-Attention with Relative Position Representationscited by 1,112
  8. 2024The FineWeb Datasets: Decanting the Web for the Finest Text Data at Scalecited by 1,104
  9. 2021Train Short, Test Long: Attention with Linear Biases Enables Input Length Extrapolationcited by 1,085
  10. 2024M3-Embedding: Multi-Linguality, Multi-Functionality, Multi-Granularity Text Embeddings Through Self-Knowledge Distillationcited by 1,050
  11. 2023Extending Context Window of Large Language Models via Positional Interpolationcited by 721
  12. 2017Convolutional Sequence to Sequence Learningcited by 550
  13. 2024Smarter, Better, Faster, Longer: A Modern Bidirectional Encoder for Fast, Memory Efficient, and Long Context Finetuning and Inferencecited by 527
  14. 2023The Falcon Series of Open Language Modelscited by 526
  15. 2018Fundamentals of Recurrent Neural Network (RNN) and Long Short-Term Memory (LSTM) Networkcited by 415
  16. 2019Are Transformers universal approximators of sequence-to-sequence functions?cited by 404
  17. 2023Learning to Compress Prompts with Gist Tokenscited by 379
  18. 2023The Impact of Positional Encoding on Length Generalization in Transformerscited by 319
  19. 2021BASE Layers: Simplifying Training of Large, Sparse Modelscited by 315
  20. 2018Adaptive Input Representations for Neural Language Modelingcited by 226
  21. 2018Scaling Neural Machine Translationcited by 204
  22. 2023What Algorithms can Transformers Learn? A Study in Length Generalizationcited by 198
  23. 2022Transformer Language Models without Positional Encodings Still Learn Positional Informationcited by 148
  24. 2023Focused Transformer: Contrastive Training for Context Scalingcited by 133
  25. 2021The Devil is in the Detail: Simple Tricks Improve Systematic Generalization of Transformerscited by 117
  26. 2023Randomized Positional Encodings Boost Length Generalization of Transformerscited by 114
  27. 2024Round and Round We Go! What makes Rotary Positional Encodings useful?cited by 111
  28. 2023PoSE: Efficient Context Window Extension of LLMs via Positional Skip-wise Trainingcited by 109
  29. 2022KERPLE: Kernelized Relative Positional Embedding for Length Extrapolationcited by 84
  30. 2020Hard negative examples are hard, but usefulcited by 82
  31. 2023Positional Description Matters for Transformers Arithmeticcited by 56
  32. 2024Contextual Position Encoding: Learning to Count What's Importantcited by 53
  33. 2024Base of RoPE Bounds Context Lengthcited by 49
  34. 2021CAPE: Encoding Relative Positions with Continuous Augmented Positional Embeddingscited by 47
  35. 2024Length Generalization of Causal Transformers without Position Encodingcited by 46
  36. 2022Dissecting Transformer Length Extrapolation via the Lens of Receptive Field Analysiscited by 39
  37. 2021A Simple and Effective Positional Encoding for Transformerscited by 37
  38. 2021SHAPE: Shifted Absolute Position Embedding for Transformerscited by 37

50 most cited of 59 All 59 (JSON)

Built on by

Cited by year

Citing papers per year: 2025: 2.

2 papers.