Skip to main content
QUICK REVIEW

[Paper Review] CodeGemma: Open Code Models Based on Gemma

CodeGemma Team, Zhao, Heri|arXiv (Cornell University)|Jun 17, 2024
Model-Driven Software Engineering TechniquesComputer Science18 citations
TL;DR

CodeGemma introduces open code models built on Gemma, featuring a fast 2B infilling model and 7B pretrained/instruction-tuned variants with strong coding and reasoning abilities.

ABSTRACT

This paper introduces CodeGemma, a collection of specialized open code models built on top of Gemma, capable of a variety of code and natural language generation tasks. We release three model variants. CodeGemma 7B pretrained (PT) and instruction-tuned (IT) variants have remarkably resilient natural language understanding, excel in mathematical reasoning, and match code capabilities of other open models. CodeGemma 2B is a state-of-the-art code completion model designed for fast code infilling and open-ended generation in latency-sensitive settings.

Motivation & Objective

  • Advance open code modeling by building on Google DeepMind’s Gemma models.
  • Train on a large code-centric corpus with targeted preprocessing and data curation.
  • Evaluate infilling, code generation, and natural language understanding across tasks.
  • Provide practical deployment guidance for latency-sensitive and hosted environments.

Proposed method

  • Extend Gemma pretrained models with a 500–1000B token corpus focused on code, English text, and mathematics.
  • Pretrain using a fill-in-the-middle (FIM) objective with 80% FIM rate for most models (90% for 2B v1.1).
  • Support both PSM (Prefix-Suffix-Middle) and SPM (Suffix-Prefix-Middle) modes with dedicated formatting tokens.
  • Perform instruction tuning using synthetic code data and mathematics datasets to improve reasoning and coding performance.
  • Implement multi-file repository context via dependency-graph and unit-test-based packing to better reflect real-world coding tasks.
  • Provide inference recommendations and prompts tailored for code completion tasks.

Experimental results

Research questions

  • RQ1How do CodeGemma models perform on code completion and generation tasks relative to open models built on Gemma and other Code LLMs?
  • RQ2What is the impact of FIM training and multi-file repository context on code understanding and generation quality?
  • RQ3How do the 2B and 7B variants compare in latency and accuracy for coding and mathematical reasoning tasks across languages?

Key findings

  • CodeGemma 2B provides fast code infilling with strong performance, suitable for latency-sensitive environments like IDEs.
  • CodeGemma 7B pretrained and 7B instruction-tuned variants show strong code generation and natural language understanding, with notable mathematical reasoning capabilities.
  • On Python coding benchmarks, CodeGemma variants outperform base Gemma models, with notable gains in GSM8K and MATH reasoning datasets.
  • BabelCode multilingual benchmarks show CodeGemma achieving competitive or superior results across multiple languages.
  • Inference speed benefits of the 2B model are achieved without significant quality loss in infilling tasks, making it attractive for deployment in constrained settings.
  • The models balance code prowess with maintained natural language capabilities, enabling broader real-world applications.

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.