From Artificial Needles to Real Haystacks: Improving Retrieval Capabilities in LLMs by Finetuning on Synthetic Data
Zheyang Xiong, Vasilis Papageorgiou, Kangwook Lee, Dimitris Papailiopoulos
Abstract
Recent studies have shown that Large Language Models (LLMs) struggle to accurately retrieve information and maintain reasoning capabilities when processing long-context inputs. To address these limitations, we propose a finetuning approach utilizing a carefully designed synthetic dataset comprising numerical key-value retrieval tasks. Our experiments on models like GPT-3.5 Turbo and Mistral 7B demonstrate that finetuning LLMs on this dataset significantly improves LLMs' information retrieval and reasoning capabilities in longer-context settings. We present an analysis of the finetuned models, illustrating the transfer of skills from synthetic to real task evaluations (e.g., 10.5% improvement on 20 documents MDQA at position 10 for GPT-3.5 Turbo). We also find that finetuned LLMs' performance on general benchmarks remains almost constant while LLMs finetuned on other baseline long-context augmentation data can encourage hallucination (e.g., on TriviaQA, Mistral 7B finetuned on our synthetic data cause no performance drop while other baseline data can cause a drop that ranges from 2.33% to 6.19%). Our study highlights the potential of finetuning on synthetic data for improving the performance of LLMs on longer-context tasks.
Ask Lune
Know this paper in minutes, not an afternoon.
Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.
8 top-tier papers have cited it since. Know what they found before your reviewers do.
Lune can draw on
the full paper · the top-tier papers that cite it · related work
Free to start. No credit card required.
Lineage
- Make Your LLM Fully Utilize the Context cites Data Engineering for Scaling Language Models to 128K Context
- Make Your LLM Fully Utilize the Context cites Measuring Massive Multitask Language Understanding
- Make Your LLM Fully Utilize the Context cites Random-Access Infinite Context Length for Transformers
- Data Engineering for Scaling Language Models to 128K Context cites Measuring Massive Multitask Language Understanding
- PERK: Long-Context Reasoning as Parameter-Efficient Test-Time Learning cites Make Your LLM Fully Utilize the Context
- PERK: Long-Context Reasoning as Parameter-Efficient Test-Time Learning cites Data Engineering for Scaling Language Models to 128K Context
- PERK: Long-Context Reasoning as Parameter-Efficient Test-Time Learning cites Random-Access Infinite Context Length for Transformers
- Untie the Knots: An Efficient Data Augmentation Strategy for Long-Context Pre-Training in Language Models cites Data Engineering for Scaling Language Models to 128K Context
- When Long Helps Short: How Context Length in Supervised Fine-tuning Affects Behavior of Large Language Models cites Data Engineering for Scaling Language Models to 128K Context
- When Long Helps Short: How Context Length in Supervised Fine-tuning Affects Behavior of Large Language Models cites Measuring Massive Multitask Language Understanding
Cited by top-tier papers8
- Untie the Knots: An Efficient Data Augmentation Strategy for Long-Context Pre-Training in Language ModelsJunfeng Tian, Da Zheng, Yang Chen, Rui Wang et al.ACL 2025 · 8 citations
- Learning from Synthetic Data Improves Multi-hop ReasoningAnmol Kabra, Yilun Yin, Albert Gong, Kamilė Stankevičiūtė et al.ICLR 2026 · 6 citations
- PERK: Long-Context Reasoning as Parameter-Efficient Test-Time LearningZeming Chen, Angelika Romanou, Gail Weiss, Antoine BosselutICLR 2026 · 4 citations
- RefactorBench: Evaluating Stateful Reasoning in Language Agents Through CodeDhruv Gautam, Spandan Garg, Jinu Jang, Neel Sundaresan et al.ICLR 2025
- When Long Helps Short: How Context Length in Supervised Fine-tuning Affects Behavior of Large Language ModelsYingming Zheng, Hanqi Li, Kai Yu, Lu ChenEMNLP 2025
Builds on12
- Chain-of-Thought Prompting Elicits Reasoning in Large Language ModelsJason Wei, Xuezhi Wang, Dale Schuurmans, Maarten Bosma et al.NeurIPS 2022 · 22,562 citations
- Measuring Massive Multitask Language UnderstandingDan Hendrycks, Collin Burns, Steven Basart, Andy Zou et al.ICLR 2021 · 7,905 citations
- Make Your LLM Fully Utilize the ContextShengnan An, Zexiong Ma, Zeqi Lin, Nanning Zheng et al.NeurIPS 2024 · 212 citations
- Random-Access Infinite Context Length for TransformersAmirkeivan Mohtashami, Martin JaggiNeurIPS 2023 · 207 citations
- Data Engineering for Scaling Language Models to 128K ContextYao Fu, Rameswar Panda, Xinyao Niu, Xiang Yue et al.ICML 2024 · 204 citations
Related papers
- Training with "Paraphrasing the Original Text" Teaches LLM to Better Retrieve in Long-Context TasksYijiong Yu, Yongfeng Huang, Zhixiao Qi, Zhe ZhouAAAI 2025 · 5 citations
- Understanding Synthetic Context Extension via Retrieval HeadsXinyu Zhao, Fangcong Yin, Greg DurrettICML 2025
- Retrieval meets Long Context Large Language ModelsPeng Xu, Wei Ping, Xianchao Wu, Lawrence McAfee et al.ICLR 2024 · 131 citations
- MAmmoTH2: Scaling Instructions from the WebXiang Yue, Tianyu Zheng, Ge Zhang, Wenhu ChenNeurIPS 2024 · 176 citations
- Differential Fine-Tuning Large Language Models Towards Better Diverse Reasoning AbilitiesXiaosong Yuan, Chen Shen, Shaotian Yan, kaiyuan liu et al.ICLR 2026 · 6 citations
