conference paper · Proceedings of the conference - Association for Computational Linguistics. Meeting · 2025
How to Train Long-Context Language Models (Effectively)
Tianyu Gao, Alexander Wettig, Howard Yen, Danqi Chen
Cited by 132Open access
Abstract
We study continued training and supervised fine-tuning (SFT) of a language model (LM) to make effective use of long-context information.We first establish a reliable evaluation protocol to guide model development-instead of perplexity or simple needle-in-a-haystack (NIAH) tests, we use a broad set of long-context downstream tasks, and we evaluate models after SFT as this better reveals long-context abilities.Supported by our robust evaluations, we run thorough experiments to decide the data mix for continued pre-training, the instruction tuning dataset, and many other design choices such as position extrapolation.We find that (1) code repositories and books are excellent sources of long data, but it is crucial to combine them with high-quality short-context data;(2) training with a sequence length beyond the evaluation length boosts long-context performance; (3) for SFT, using only short instruction datasets yields strong performance on long-context tasks.Our final model, ProLong-8B, which is initialized from Llama-3 and trained on 40B tokens, demonstrates state-ofthe-art long-context performance among similarly sized models at a length of 128K.Pro-Long outperforms Llama-3.1-8B-Instruct on the majority of long-context tasks despite using only 5% as many tokens during long-context training.Additionally, ProLong can effectively process up to 512K tokens, one of the longest context windows of publicly available LMs.
Cite this paper
Gao, T., Wettig, A., Yen, H., & Chen, D. (2025). How to Train Long-Context Language Models (Effectively). Proceedings of the conference - Association for Computational Linguistics. Meeting, 7376–7399. https://doi.org/10.18653/v1/2025.acl-long.366
Gao, Tianyu, et al. “How to Train Long-Context Language Models (Effectively).” Proceedings of the conference - Association for Computational Linguistics. Meeting, 2025, pp. 7376–99, https://doi.org/10.18653/v1/2025.acl-long.366.
Gao, Tianyu, Alexander Wettig, Howard Yen, and Danqi Chen. 2025. “How to Train Long-Context Language Models (Effectively).” Proceedings of the conference - Association for Computational Linguistics. Meeting: 7376–99. https://doi.org/10.18653/v1/2025.acl-long.366.
Gao, T. et al. (2025) ‘How to Train Long-Context Language Models (Effectively)’, Proceedings of the conference - Association for Computational Linguistics. Meeting, pp. 7376–7399. Available at: https://doi.org/10.18653/v1/2025.acl-long.366.
@article{gao2025train,
title = {{How to Train Long-Context Language Models (Effectively)}},
author = {Gao, Tianyu and Wettig, Alexander and Yen, Howard and Chen, Danqi},
journal = {Proceedings of the conference - Association for Computational Linguistics. Meeting},
pages = {7376--7399},
year = {2025},
doi = {10.18653/v1/2025.acl-long.366}
}Made from the index record. Check names, capitalisation and page numbers against the paper. Need another style? AI for Research has over 10,000.
Related papers
When Long Helps Short: How Context Length in Supervised Fine-tuning Affects Behavior of Large Language Models
Yingming Zheng, Hanqi Li, Kai Yu et al. · Conference on Empirical Methods in Natural Language Processing (EMNLP) · 2025
Cited by 1Open access
Bootstrap Your Own Context Length
Liang Wang, Nan Yang, Xingxing Zhang et al. · arXiv (Cornell University) · 2024
Cited by 10Open access
LongSkywork: A Training Recipe for Efficiently Extending Context Length in Large Language Models
Liang Zhao, Tianwen Wei, Zeng, Liang et al. · arXiv (Cornell University) · 2024
Cited by 27Open access
From 128K to 4M: Efficient Training of Ultra-Long Context Large Language Models
Chejian Xu, Wei Ping, Peng Xu et al. · Findings of the Association for Computational Linguistics: ACL (Findings of ACL) · 2026
Cited by 18Open access
OctoLong: Mid-Training On Cross-Repository Code Contexts Enhances Long-Context Modeling
Indraneil Paul, Falko Helm, Goran Glavaš et al. · TUbilio (Technical University of Darmstadt) · 2026
Cited by 2Open access
Trained Agentic Context Management
Bryce Sandlund · arXiv (Cornell University) · 2026
Cited by 0Open access
Training Long-Context Vision-Language Models Effectively with Generalization Beyond 128K Context
Zhaowei Wang, Lishu Luo, Haodong Duan et al. · arXiv (Cornell University) · 2026
Cited by 2Open access