Scaling Granite Code Models to 128K Context

Matt Stallone,Vaibhav Saxena,Leonid Karlinsky,Bridget McGinn,Tim Bula,Mayank Mishra,Adriana Meza Soria,Gaoyuan Zhang,Aditya Prasad,Yikang Shen,Saptha Surendran,Shanmukha Guttula,Hima Patel,Parameswaran Selvam,Xuan-Hong Dang,Yan Koyfman,Atin Sood,Rogerio Feris,Nirmit Desai,David D. Cox,Ruchir Puri,Rameswar Panda
2024-07-19
Abstract:This paper introduces long-context Granite code models that support effective context windows of up to 128K tokens. Our solution for scaling context length of Granite 3B/8B code models from 2K/4K to 128K consists of a light-weight continual pretraining by gradually increasing its RoPE base frequency with repository-level file packing and length-upsampled long-context data. Additionally, we also release instruction-tuned models with long-context support which are derived by further finetuning the long context base models on a mix of permissively licensed short and long-context instruction-response pairs. While comparing to the original short-context Granite code models, our long-context models achieve significant improvements on long-context tasks without any noticeable performance degradation on regular code completion benchmarks (e.g., HumanEval). We release all our long-context Granite code models under an Apache 2.0 license for both research and commercial use.
Artificial Intelligence,Computation and Language,Software Engineering
What problem does this paper attempt to address?
The paper primarily addresses the problem of understanding and generating long-context code, specifically in open-source code language models. Specifically, the paper introduces IBM's long-context Granite code model, including 3B and 8B versions, which support effective context lengths of up to 128K tokens. The researchers extended the model's ability to handle long sequences through continual pretraining and instruction tuning, without significantly affecting its performance on standard code completion benchmarks. The key contributions of the paper are as follows: 1. **Continual Pretraining**: The researchers adopted a lightweight continual pretraining method that gradually increases the RoPE base frequency and uses repository-level file packing and length upsampling of long-context data to extend the context length of the Granite 3B/8B code model from 2K/4K to 128K. 2. **Instruction Tuning**: To further enhance the model's support for long-context, the researchers performed instruction tuning on a dataset that includes a mix of short-context and long-context instruction-response pairs. This involved generating multi-turn instruction data using the original Granite-8B-Code-Instruct model to avoid reliance on existing long-context models. 3. **Performance Evaluation**: The paper evaluates the performance of the long-context Granite code model on various benchmark tests, including HumanEvalPack, Long Code Completion, RepoBench-P, RepoQA, and Key Retrieval. Experimental results demonstrate significant improvements of the long-context model on long-context tasks, while showing no significant degradation on short-context tasks. 4. **Open Source Release**: All long-context Granite code models have been open-sourced under the Apache 2.0 license for research and commercial purposes. In summary, this paper demonstrates effective ways to extend the context length of code language models for better understanding and generation of long-code sequences, which is of significant importance in real-world software development.