Skip to main content
QUICK REVIEW

[Paper Review] Granite Code Models: A Family of Open Foundation Models for Code Intelligence

Mayank Mishra, Matt Stallone|arXiv (Cornell University)|May 7, 2024
Software Engineering ResearchComputer Science10 citations
TL;DR

The Granite Code Models are a family of open decoder-only code LLMs (3B–34B) trained on 116 programming languages, achieving strong open-model performance across code generation, fixing, explanation, and more, and released under Apache 2.0 for research and commercial use.

ABSTRACT

Large Language Models (LLMs) trained on code are revolutionizing the software development process. Increasingly, code LLMs are being integrated into software development environments to improve the productivity of human programmers, and LLM-based agents are beginning to show promise for handling complex tasks autonomously. Realizing the full potential of code LLMs requires a wide range of capabilities, including code generation, fixing bugs, explaining and documenting code, maintaining repositories, and more. In this work, we introduce the Granite series of decoder-only code models for code generative tasks, trained with code written in 116 programming languages. The Granite Code models family consists of models ranging in size from 3 to 34 billion parameters, suitable for applications ranging from complex application modernization tasks to on-device memory-constrained use cases. Evaluation on a comprehensive set of tasks demonstrates that Granite Code models consistently reaches state-of-the-art performance among available open-source code LLMs. The Granite Code model family was optimized for enterprise software development workflows and performs well across a range of coding tasks (e.g. code generation, fixing and explanation), making it a versatile all around code model. We release all our Granite Code models under an Apache 2.0 license for both research and commercial use.

Motivation & Objective

  • Motivate the need for efficient, enterprise-ready code LLMs with broad capabilities beyond code generation.
  • Present a family of open Granite Code models (Base and Instruct) spanning 3B, 8B, 20B, and 34B parameters.
  • Describe data collection, model architecture, training/instruction tuning, and evaluation across diverse coding tasks.

Proposed method

  • Two-phase pretraining on 3.5–4.5T code+text tokens with 116 languages (phase 1: code only; phase 2: code+language data).
  • Decoder-only transformer architecture with pre-normalization and model-specific choices (RoPE, GQA/MQA, swiglu, RMSNorm/LN) across sizes.
  • Caudal language modeling objective with Fill-In-the-Middle (FIM) objective and a mixed loss L = alpha*L_CLM + (1-alpha)*L_FIM, with alpha=0.5 during pretraining and alpha=1 during instruction finetuning.
  • Instruction tuning using CommitPack-filtered data, NL-instruction datasets, MathInstruct/MetaMathQA, and synthetic code datasets to improve reasoning and instruction following.
  • Extensive benchmarks (HumanEvalPack, MBPP(+), RepoBench, ReCode, and more) across languages; multilingual and reasoning-focused evaluations; comparisons against open-source code LLMs.
Figure 1: Comparison of Granite-8B-Code (Base/Instruct) with other open source (code) LLMs of similar size on HumanEvalPack (Muennighoff et al., 2023 ) , spanning 3 coding tasks and 6 programming languages. See Tables 3 , 10 , 11 for more details. Best viewed in color.
Figure 1: Comparison of Granite-8B-Code (Base/Instruct) with other open source (code) LLMs of similar size on HumanEvalPack (Muennighoff et al., 2023 ) , spanning 3 coding tasks and 6 programming languages. See Tables 3 , 10 , 11 for more details. Best viewed in color.

Experimental results

Research questions

  • RQ1Can Granite Code models achieve state-of-the-art or competitive performance across a broad set of code-related tasks (generation, fixing, explanation, editing, translation) among open-source models?
  • RQ2How do the base and instruction-tuned Granite Code models perform across multiple languages and benchmarks beyond Python code?
  • RQ3What data collection, filtering, and training strategies enable trustworthy, license-permissible enterprise usage of open-code LLMs?
  • RQ4Do two-phase training and instruction tuning yield improvements in reasoning and problem-solving capabilities for code tasks?
  • RQ5How do Granite Code models compare to larger or general-purpose open LLMs in code-related tasks?

Key findings

  • Granite-8B-Code-Base outperforms the competitive CodeGemma-8B by ~12 points on HumanEvalPack (33.2% vs 21.3%) while using fewer training tokens (4.5T vs 7.5T).
  • Granite-8B-Code-Base shows strong CodeFix/CodeExplain performance and competitive results across languages in HumanEvalPack and MultiPL-E.
  • Instruction-tuned Granite Code models outperform equivalent-size CodeLlama instruction models, with Granite-3B/8B/20B surpassing larger CodeLlama variants in several setups.
  • On HumanEvalSynthesize (6 languages), Granite-3B-Code-Base/8B/20B-Base achieve top performance among base models; even 3B-Instruct sometimes beats larger CodeLlama-Instruct models.
  • Across MultiPL-E (18 languages), Granite-8B-Code-Base bests CodeLlama-7B on 16/18 languages; Granite-34B-Code-Base often outperforms CodeLlama-34B in many languages.
  • MBPP/MBPP+ results show Granite-8B-Base performing competitively, with 20B/34B variants achieving strong scores compared to peers.
Figure 2: An overview of depth upscaling (Kim et al., 2024 ) for efficient training of Granite-34B-Code. We utilize the 20B model after 1.6T tokens to start training of 34B model with the same code pretraining data without any changes to the training and inference framework.
Figure 2: An overview of depth upscaling (Kim et al., 2024 ) for efficient training of Granite-34B-Code. We utilize the 20B model after 1.6T tokens to start training of 34B model with the same code pretraining data without any changes to the training and inference framework.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.