google / codegemma-1.1-7b

CodeGemma Model card

Model Information

Model Summary

Authors: Google

Description

CodeGemma is a collection of lightweight open code models built on top of Gemma. CodeGemma models are text-to-text and text-to-code decoder-only models and are available as a 7 billion pretrained variant that specializes in code completion and code generation tasks, a 7 billion parameter instruction-tuned variant for code chat and instruction following and a 2 billion parameter pretrained variant for fast code completion.

Third-Party Community Consideration

This model is not owned or developed by NVIDIA. This model has been developed and built to a third-party’s requirements for this application and use case; see link to the CodeGemma Model Card.

Terms of Use

By accessing this model, you are agreeing to the NVIDIA AI Foundation Models Community License

Additional Information: Gemma Terms of Use, Google Prohibited Use Policy.

Reference:

@article{codegemma_2024,
    title={CodeGemma: Open Code Models Based on Gemma},
    url={https://www.kaggle.com/m/3301},
    author={CodeGemma Team and Hartman, Ale Jakse and Hu, Andrea and Choquette-Choo, Christopher A. and Zhao, Heri and Fine, Jane and Hui,
    Jeffrey and Shen, Jingyue and Kelley, Joe and Howland, Joshua and Bansal, Kshitij and Vilnis, Luke and Wirth, Mateo and Nguyen, Nam, and Michel, Paul and Choy, Peter and Joshi, Pratik and Kumar, Ravin and Hashmi, Sarmad and Agrawal, Shubham and Zuo, Siqi and Warkentin, Tris and Gong, Zhitao et al.},
    year={2024}
}

Resources and Technical Documentation

Model Architecture:

Architecture Type: Transformer Decoder Network

Network Architecture: Real-Gated Linear Recurrent Unit (RG-LRU)

Inputs and outputs

Input:

Input Type(s): Text

Input Format(s): String

Input Parameters: One-Dimensional (1D)

Other Properties Related to Output: For pretrained model variants: code prefix and optionally suffix
for code completion and generation scenarios or natural language text/prompt. For instruction tuned model variant: natural language text or prompt.

Output:

Input Type(s): Text

Input Format(s): String

Input Parameters: One-Dimensional (1D)

Other Properties Related to Output: For pretrained model variants: fill-in-the-middle code
completion, code and natural language. For instruction tuned model variant:
code and natural language.

Intended Usage

Application

Code Gemma models have a wide range of applications, which vary between IT and
PT models. The following list of potential uses is not comprehensive. The
purpose of this list is to provide contextual information about the possible
use-cases that the model creators considered as part of model training and
development.

  • Code Completion: PT models can be used to complete code with an IDE extension
  • Code Generation: IT model can be used to generate code with or without an IDE
    extension
  • Code Conversation: IT model can power conversation interfaces which discuss
    code
  • Code Education: IT model supports interactive code learning experiences, aids
    in syntax correction or provides coding practice

Model Usage and Limitations

Known Limitations

These models have certain limitations that users should be aware of:

  • Training data
    • The quality and diversity of the training data significantly influence
      the model's capabilities. Biases or gaps in the training data can lead
      to limitations in the model's responses.
    • The scope of the training dataset determines the subject areas the model
      can handle effectively.
  • Context and task complexity
    • LLMs are better at tasks that can be framed with clear prompts and
      instructions. Open-ended or highly complex tasks might be challenging.
    • A model's performance can be influenced by the amount of context
      provided (longer context generally leads to better outputs, up to a
      certain point).
  • Language ambiguity and nuance
    • Natural language is inherently complex. LLMs might struggle to grasp
      subtle nuances, sarcasm, or figurative language.
  • Factual accuracy
    • LLMs generate responses based on information they learned from their
      training datasets, but they are not knowledge bases. They may generate
      incorrect or outdated factual statements.
  • Common sense
    • LLMs rely on statistical patterns in language. They might lack the
      ability to apply common sense reasoning in certain situations.

Model Data

Training Dataset

Using Gemma as the base model, CodeGemma 2B and 7B pretrained variants are
further trained on an additional 500 billion tokens of primarily English
language data from open source mathematics datasets and synthetically generated
code.

Training Data Processing

The following data pre-processing techniques were applied to train CodeGemma:

  • FIM - Pretrained CodeGemma models focus on fill-in-the-middle (FIM) tasks.
    The models are trained to work with both Prefix-Suffix-Middle (PSM) and Suffix-Prefix-Middle (SPM) modes. Our FIM settings are
    80% FIM rate with 50-50 PSM/SPM.
  • Dependency Graph-based Packing and Unit Test-based Lexical Packing techniques:
    To improve model alignment with real-world applications, we structured training
    examples at the project/repository level to colocate the most relevant source
    files within each repository. Specifically, we employed two heuristic
    techniques: dependency graph-based packing and unit test-based lexical packing.
  • We developed a novel technique for splitting the documents into prefix,
    middle, and suffix to make the suffix start in a more syntactically natural
    point rather than purely random distribution.
  • Safety: Similarly to Gemma, we deployed rigorous safety filtering including
    filtering personal data, CSAM filtering and other filtering based on content
    quality and safety in line with our policies.

Implementation Information

Hardware and Frameworks used during training

Like
Gemma,
CodeGemma was trained on the latest generation of
Tensor Processing Unit (TPU)
hardware (TPUv5e),
using JAX and ML Pathways.

Evaluation Information

Benchmark Results

Evaluation Approach

Coding Benchmark Results

Benchmark2B2B (1.1)7B7B-IT7B-IT (1.1)
HumanEval31.137.844.556.160.4
MBPP43.649.256.254.255.6
HumanEval Single Line78.479.376.168.377.4
HumanEval Multi Line51.451.058.420.123.7
BC HE C++24.219.932.942.246.6
BC HE C#10.626.122.426.754.7
BC HE Go20.518.021.728.634.2
BC HE Java29.229.841.048.450.3
BC HE JavaScript21.728.039.846.048.4
BC HE Kotlin28.032.339.851.647.8
BC HE Python21.736.642.248.454.0
BC HE Rust26.724.234.136.037.3
BC MBPP C++47.138.953.856.763.5
BC MBPP C#28.745.332.541.262.0
BC MBPP Go45.638.943.346.253.2
BC MBPP Java41.849.750.357.362.9
BC MBPP JavaScript45.345.058.261.461.4
BC MBPP Kotlin46.849.754.759.962.6
BC MBPP Python38.652.959.162.060.2
BC MBPP Rust45.347.452.953.552.3

Natural Language Benchmarks (on 7B models)

Natural Language Benchmarks on 7B models

Ethics and Safety

Ethics and Safety Evaluations

Evaluations Approach

Our evaluation methods include structured evaluations and internal red-teaming
testing of relevant content policies. Red-teaming was conducted by a number of
different teams, each with different goals and human evaluation metrics.
These models were evaluated against a number of different categories relevant to
ethics and safety, including:

  • Human evaluation on prompts covering content safety and representational
    harms. See the
    Gemma model card
    for more details on evaluation approach.

  • Specific testing of cyber-offence capabilities, focusing on testing autonomous
    hacking capabilities and ensuring potential harms are limited.

Evaluation Results

The results of ethics and safety evaluations are within acceptable thresholds
for meeting
internal policies
for categories such as child safety, content safety, representational harms,
memorization, large-scale harms. See the
Gemma model card
for more details.

Ethical considerations and risks

The development of large language models (LLMs) raises several ethical concerns.
In creating an open model, we have carefully considered the following:

  • Bias and fairness
    • LLMs trained on large-scale, real-world text data can reflect
      socio-cultural biases embedded in the training material. These models
      underwent careful scrutiny, input data pre-processing described and
      posterior evaluations reported in this card.
  • Misinformation and misuse
    • LLMs can be misused to generate text that is false, misleading, or
      harmful.
    • Guidelines are provided for responsible use with the model, see the
      Responsible Generative AI
      Toolkit
      .
  • Transparency and accountability
    • This model card summarizes details on the models' architecture,
      capabilities, limitations, and evaluation processes.
    • A responsibly developed open model offers the opportunity to share
      innovation by making LLM technology accessible to developers and
      researchers across the AI ecosystem.

Risks Identified and Mitigations:

  • Perpetuation of biases: It's encouraged to perform continuous monitoring
    (using evaluation metrics, human review) and the exploration of de-biasing
    techniques during model training, fine-tuning, and other use cases.
  • Generation of harmful content: Mechanisms and guidelines for content
    safety are essential. Developers are encouraged to exercise caution and
    implement appropriate content safety safeguards based on their specific
    product policies and application use cases.
  • Misuse for malicious purposes: Technical limitations and developer and
    end-user education can help mitigate against malicious applications of LLMs.
    Educational resources and reporting mechanisms for users to flag misuse are
    provided. Prohibited uses of Gemma models are outlined in our terms of
    use
    .
  • Privacy violations: Models were trained on data filtered for removal of
    PII (Personally Identifiable Information). Developers are encouraged to
    adhere to privacy regulations with privacy-preserving techniques.

Benefits

At the time of release, this family of models provides high-performance open
code-focused large language model implementations designed from the ground up
for Responsible AI development compared to similarly sized models.

Using the coding benchmark evaluation metrics described in this document, these
models have shown to provide superior performance to other, comparably-sized
open model alternatives.