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-of-the-art long-context performance among similarly sized models at a length of 128K. ProLong 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.
한 줄 요약
ProLong-8B는 128K 토큰 길이에서 최고 성능을 보이는 8B 파라미터의 장문맥 언어 모델로, Llama-3.1-8B-Instruct 대비 5%의 토큰만 사용해 개선된 성능을 달성했다.
핵심 기여도
- 코드 저장소와 책을 포함한 장문 데이터와 고질량 단문 데이터의 혼합이 장문맥 성능 향상에 필수적임을 밝힘.
- 평가 길이보다 긴 시퀀스로 훈련하면 장문맥 성능이 향상됨을 실험적으로 검증.
- 단문 지시 데이터만을 사용한 SFT가 장문맥 작업에서 강력한 성능을 보임.
- ProLong-8B는 40B 토큰으로 훈련되어 128K에서 최고 성능, 512K 토큰까지 처리 가능.
핵심 아이디어
기존 연구는 단순 퍼플렉시티나 NIAH 평가에 의존했지만, 본 연구는 장문맥 작업(예: RAG, 문서 요약, 다중 샘플 ICL)을 기반으로 평가 프로토콜을 설계했다. 이는 SFT 이후의 모델 성능을 정확히 반영하며, 훈련 전/후의 최적 설계 선택이 다를 수 있음을 보여준다. 특히, 단문 데이터만으로 SFT를 수행해도 장문맥 작업에서 우수한 성능을 얻을 수 있다는 점은 기존 관념과 상반된다. 이는 훈련 데이터의 질보다는 지시 학습의 방식이 장문맥 성능에 더 큰 영향을 미친다는 통찰을 제공한다.
기술적 접근법
- **모델**: ProLong-8B는 Llama-3-8B로 초기화, 40B 토큰으로 훈련됨.
- **데이터**: 코드 저장소, 책(장문 데이터) + 고질량 단문 데이터 혼합.
- **훈련 전략**: 평가 길이(128K)보다 긴 시퀀스(예: 512K)로 훈련.
- **SFT 데이터**: 단문 지시 데이터만 사용.
- **기타 설계**: cross-document attention masking, position extrapolation 등 실험적으로 검증됨.
주요 결과
- ProLong-8B는 128K 길이에서 Llama-3.1-8B-Instruct 대비 대부분의 장문맥 작업에서 성능 개선.
- Llama-3.1의 장문맥 훈련 대비 5%의 토큰만 사용해 동일 성능 달성.
- 최대 512K 토큰 처리 가능, 공개된 모델 중 최장 컨텍스트 윈도우.
의의 및 한계
ProLong은 장문맥 언어 모델의 훈련 전략을 재정의하며, 단문 데이터만으로도 장문맥 작업을 효과적으로 학습할 수 있음을 보여준다. 이는 데이터 비용을 절감하고, 개발자에게 실용적인 훈련 전략을 제시한다. 그러나 본 연구는 8B 파라미터 모델에만 적용되었으며, 더 큰 모델(예: 70B)에 대한 일반화 가능성은 명시되지 않음. 또한, 평가 데이터셋은 제한적이며, 실제 산업 환경에서의 성능은 추가 실험 필요.
실용적 활용
ProLong은 책 요약, 장문 문서 분석, 다중 샘플 기반 학습 등 장문 입력이 필요한 산업 및 연구 분야에 적용 가능하다. 특히, 훈련 데이터 비용을 줄이면서도 높은 성능을 유지할 수 있어, 리소스 제한이 있는 환경에서 유용하다.