Query-Guided RoPE Modulation for Lost-in-the-Middle Mitigation in Long-Context LLMs
Not on the map. Why?
Abstract (arXiv)
Long-context language models often neglect information in the middle of the input, a phenomenon known as "lost-in-the-middle". Part of this gap may stem from the long-range decay of rotary position embedding (RoPE), which weakens the positional signal between distant tokens. Existing input compression deletes low-importance tokens, and attention reweighting acts only after RoPE has weakened this signal. RoPE-level methods modify positions directly but apply the same remapping to every query. To address these limitations, we propose QGPM (Query-Guided Positional Modulation), a training-free method that reshapes RoPE positions using query relevance from the model's own attention heads. QGPM builds a broad relevance map for lower layers and a sharp one for upper layers. Low-relevance tokens advance by less than one position on fast-rotating planes, pulling relevant evidence toward the query. Slow-rotating planes keep the original layout, with every token in place. Experiments on NoLiMa and RULER with multiple context lengths show that QGPM improves over base models and strong baselines, with the largest gains on retrieval tasks, and generalizes across multiple backbones. Our code is available at https://github.com/iZHpy/QGPM.
Key facts. No citing papers in the map yet (data through 24 Nov 2026). Builds on 20 of its 25 references that are in the map. Submitted 6 Nov 2026.
Builds on
20 of 25 references.
References · 20
- 2021RoFormer: Enhanced Transformer with Rotary Position Embeddingcited by 5,132
- 2023Lost in the Middle: How Language Models Use Long Contextscited by 3,765
- 2024RULER: What's the Real Context Size of Your Long-Context Language Models?cited by 1,559
- 2025Qwen3 Embedding: Advancing Text Embedding and Reranking Through Foundation Modelscited by 1,507
- 2024SnapKV: LLM Knows What You are Looking for Before Generationcited by 1,003
- 2023Extending Context Window of Large Language Models via Positional Interpolationcited by 794
- 2023LongLLMLingua: Accelerating and Enhancing LLMs in Long Context Scenarios via Prompt Compressioncited by 500
- 2024LLMLingua-2: Data Distillation for Efficient and Faithful Task-Agnostic Prompt Compressioncited by 397
- 2024LongRoPE: Extending LLM Context Window Beyond 2 Million Tokenscited by 346
- 2024Retrieval Head Mechanistically Explains Long-Context Factualitycited by 272
- 2025NoLiMa: Long-Context Evaluation Beyond Literal Matchingcited by 142
- 2024Found in the Middle: Calibrating Positional Attention Bias Improves Long Context Utilizationcited by 116
8 more
- 2023Tell Your Model Where to Attend: Post-hoc Attention Steering for LLMscited by 102
- 2023Attention Sorting Combats Recency Bias In Long Context Language Modelscited by 100
- 2024Found in the Middle: How Language Models Use Long Contexts Better via Plug-and-Play Positional Encodingcited by 80
- 2024Discovering the Gems in Early Layers: Accelerating Long-Context LLMs with 1000x Input Token Reductioncited by 49
- 2025Query-Focused Retrieval Heads Improve Long-Context Reasoning and Re-rankingcited by 40
- 2024Model Tells Itself Where to Attend: Faithfulness Meets Automatic Attention Steeringcited by 21
- 2024Position Engineering: Boosting Large Language Models through Positional Information Manipulationcited by 10
- 2025Tagging-Augmented Generation: Assisting Language Models in Finding Intricate Knowledge In Long Contextscited by 3
Built on by
Not cited yet.