Skip to main content
Browse Models

Meta

CodeLlama 34B

Released

2023-08-24

Family

Llama 2

Type

Foundation Model

Downloads

External Download

You are about to open a link to an external source. Verify the URL before continuing.

Download

4-bit GGUF (Q4_K_M)

GGUF · codellama-34b.Q4_K_M.gguf

5-bit GGUF (Q5_K_M)

GGUF · codellama-34b.Q5_K_M.gguf

6-bit GGUF (Q6_K)

GGUF · codellama-34b.Q6_K.gguf

8-bit GGUF (Q8_0)

GGUF · codellama-34b.Q8_0.gguf

Ollama Model (q4_K_M)

Ollama

Model Report

Overview

Code Llama 34B is a large language model (LLM) developed by Meta, optimized for code generation, understanding, and related tasks. Released on August 24, 2023, Code Llama 34B is part of the broader Code Llama family, which leverages the underlying architecture of Llama 2 to support a range of programming-focused applications. This model is designed to interpret code, follow instructions for programming tasks, and provide context-rich code completions and explanations, addressing both professional and educational programming needs as documented in the Meta blog post and Meta publication.

Code Llama debugging demonstration

Figure 1. Animated demonstration of Code Llama 34B identifying and correcting a bug in a Python code snippet, then explaining the correction in natural language. Prompt: '# Fix the bug in the code above and explain the fix.'

Model Architecture and Training

Code Llama 34B builds upon the auto-regressive transformer architecture introduced with Llama 2. It is specifically adapted for code by further training on extensive datasets of programming code and code-related natural language. This code specialization extends to longer sequence handling, enabling context windows of up to 100,000 tokens, and allows the model to engage effectively with large codebases and complex tasks. The training process utilized Meta’s Research Super Cluster and included approximately 500 billion tokens of code and code-related data as detailed in the HuggingFace model card.

The training procedure involves the same foundational data as Llama 2 but introduces differentiated weighting and fine-tuning strategies, including further pre-training on curated code corpora and reinforcement learning from human feedback to improve instruction following and safety. The Python-specialized variant received additional fine-tuning on 100 billion Python tokens for improved performance in that language, as described in the Meta blog post.

Capabilities and Variants

Code Llama 34B supports a range of programming languages, including Python, C++, Java, PHP, Typescript (JavaScript), C#, and Bash. The model generates code from natural language or code prompts, interprets code snippets, performs debugging, provides natural language explanations, and completes code based on partial inputs. It also demonstrates infilling capabilities in select variants, allowing code to be inserted seamlessly into existing code blocks, as detailed in the Meta publication.

Code Llama explains code in natural language

Figure 2. Animated sequence illustrating Code Llama 34B providing a natural language explanation for a Python function that calculates the nth Fibonacci number. Prompt: '# Explain this code in natural language.'

Code Llama natural language code summarization

Figure 3. Demonstration of Code Llama 34B generating a concise summary of a provided Python code block in response to the prompt: '# Summarize this code.'

There are three primary variants of Code Llama 34B to address diverse use cases:

  • The Base model is intended for general code synthesis, completion, and understanding.
  • Code Llama 34B - Python is fine-tuned for enhanced performance on Python-specific tasks.
  • Code Llama 34B - Instruct is aligned to follow natural language instructions and generate contextually relevant, safe, and helpful responses, as stated in the Meta blog post.

Performance is stable and accurate across long contexts, supporting both zero-shot and instruction-guided programming tasks. The model's design prioritizes developer productivity and educational accessibility.

Performance Benchmarks

On industry-standard benchmarks, Code Llama 34B's performance is assessed against established code-specific models. In controlled internal evaluations, Code Llama 34B achieved an accuracy score of 53.7% on the HumanEval benchmark, which tests functional correctness in code generation from docstrings, and obtained 56.2% on MBPP, a benchmark for code completion from English prompts, as described in the Meta blog post and Meta publication. These results are comparable to those of models such as ChatGPT.

Benchmarks table comparing Code Llama models

Figure 4. Table comparing performance of Code Llama and several other language models across HumanEval, MBPP, and Multilingual HumanEval benchmarks. Code Llama 34B's performance is presented for these tasks.

Evaluations on additional benchmarks, such as MultiPL-E, show that Code Llama 34B and its family achieved notable results compared to other publicly available open-source models on multi-language programming tasks, as detailed in the Meta publication. Each variant's benchmarks reflect its respective training focus, with the Python-specialized and Instruct models achieving peak scores on Python and instruction-following assessments.

Applications and Use Cases

Code Llama 34B is designed as an assistive tool for software development, code comprehension, and instruction. It can generate new code from text prompts, complete partially written code, explain code functionality in natural language, and assist in debugging by identifying and correcting errors. Its extended context window facilitates navigation and manipulation of large codebases, supporting refactoring and documentation tasks, according to the Meta blog post. The model's application spans productivity toolchains for experienced developers, educational support for programming learners, and program synthesis for research.

In addition to direct code generation, Code Llama 34B serves roles in code review, automated documentation, and providing insights into code logic. The model's capabilities across multiple languages and programming tasks position it as a resource for both commercial and academic environments, as outlined in the HuggingFace model card.

Limitations and Responsible Use

As with other large language models, Code Llama 34B is subject to certain limitations. Its responses can at times be inaccurate or unsuitable for sensitive environments, necessitating thorough safety review and tailored deployment protocols for production scenarios, as noted in the HuggingFace model card. Potential risks include generation of erroneous, incomplete, or unsafe code, and developers are encouraged to conduct domain-specific validation and align with Meta’s Acceptable Use Policy.

Code Llama 34B and its variants are static models—that is, they do not learn or adapt after deployment. Their training data emphasize English and popular programming languages, with less tested support for other languages. The model, notably in its base and Python versions, is not recommended for general-purpose natural language tasks outside software contexts, according to the Meta blog post.

Red teaming has been conducted to assess the risk of generating malicious code, and while Code Llama provided safer outputs compared to certain proprietary models in testing, adherence to responsible AI guidelines remains essential, as described in the Meta blog post.

Licensing and Accessibility

Code Llama 34B is distributed under the Llama 2 community license, offering commercial and research use under community-centric terms. These include requirements for attribution, responsible deployment, adherence to the Acceptable Use Policy, and restrictions on using model outputs to improve other LLMs outside the Llama family, as outlined in the HuggingFace model card. Organizations exceeding specific user thresholds must request licensing directly from Meta.

The model and derivatives are available as open foundation resources, accompanied by documentation and model cards supporting transparency and reproducibility, as stated in the Meta research paper. Reporting channels exist for responsible disclosure of issues, misuse, and security concerns via Meta’s recommended pathways.


External Resources

About Llama 2: The Llama 2 family, developed by Meta, comprises large language models ranging from 7 billion to 70 billion parameters, trained on 40% more data than their predecessors and featuring a doubled context length of 4,096 tokens.

More in the Llama 2 Family

Meta /

Llama 2 7B

7 billion parameter version of the 2nd iteration in Meta's Llama series of open source models.
codellama /

CodeLlama 7B

Fine-tuned version of Llama 7b, with training data optimized for code generation and completion tasks.
lmsys /

Vicuna 7B

Llama 7B fine-tuned on 125k GPT-4 conversations, with strong performance in chatbot and instruction following use-cases.
PygmalionAI /

Pygmalion 2 7B

Llama 7B fine-tuned for conversation, roleplaying, and storywriting.
openchat /

OpenChat 3.5 7B

Llama 2 7B fine-tuned using the C-RLFT strategy, with performance surpassing GPT 3.5 on some benchmarks.
Xwin-LM /

Xwin LM 7B

Llama 2 7B fine-tune using numerous emerging techniques including SFT, RM, and RLHF, achieving top results on AlpacaEval.
Meta /

Llama 2 13B

13 billion parameter version of the 2nd iteration in Meta's Llama series of open source models.
Meta /

CodeLlama 13B

Fine-tuned version of Llama 13b, with training data optimized for code generation and completion tasks.
NousResearch /

Nous Hermes 13b

Llama 13b fine-tuned on over 300k curated GPT-4 outputs, known long high-quality outputs.
lmsys /

Vicuna 13B

Llama 13B fine-tuned on 125k GPT-4 conversations, with strong performance in chatbot and instruction following use-cases.
Gryphe /

MythoMax L2

An improved variant of MythoMix (MythoLogic-L2 and Huginn merge) using an experimental tensor-type merge technique. Originally a merge of multiple popular Llama 2 fine-tunes, including Hermes, Chronos, and Airoboros. Very popular for rich descriptions, storywriting, and roleplay.
WizardLM /

WizardLM 13B

Llama 2 13B model fine-tuned to follow complex instructions using the WizardLM training methodology.
PygmalionAI /

Pygmalion 2 13B

Llama 13B fine-tuned for conversation, roleplaying, and storywriting.
PygmalionAI /

Mythalion 13B

Merge of two popular fine-tunes: Pygmalion and Mythomax L2, resulting in a model that is good at roleplaying and instruction-following.
Xwin-LM /

Xwin LM 13B

Llama 2 13B fine-tune using numerous emerging techniques including SFT, RM, and RLHF, achieving top results on AlpacaEval.
Meta /

Llama 2 70B

70 billion parameter version of the 2nd iteration in Meta's Llama series of open source models.
Meta /

CodeLlama 70B

Fine-tuned version of Llama 70b, with training data optimized for code generation and completion tasks.
Xwin-LM /

Xwin 70B

Llama 2 70B fine-tune using numerous emerging techniques including SFT, RM, and RLHF, achieving top results on AlpacaEval.
WizardLM /

WizardLM 70B

Llama 2 70B model fine-tuned to follow complex instructions using the WizardLM training methodology.
NousResearch /

Nous Hermes Llama 2 70B

Llama 2 70B fine-tuned on over 300k curated GPT-4 outputs.

More from Meta

Meta /

LLaMA 7B

A 7-billion parameter transformer language model trained on one trillion tokens from publicly available datasets for natural language processing research.
Meta /

LLaMA 13B

A 13-billion parameter transformer-based language model trained on 1.4 trillion tokens from publicly available datasets, demonstrating competitive performance on various benchmarks.
Meta /

LLaMA 33B

A 32.5 billion parameter transformer-based language model trained on 1.4 trillion tokens of publicly available data with competitive benchmark performance.
Meta /

LLaMA 65B

A 65.2-billion parameter transformer language model trained on 1.4 trillion tokens from publicly available datasets for research applications.
Meta /

Llama 4 Scout (17Bx16E)

A natively multimodal transformer with mixture-of-experts architecture supporting 10 million token context and multilingual text-image understanding capabilities.
Meta /

Llama 4 Maverick (17Bx128E)

Multimodal instruction-tuned model with 17 billion active parameters from 400 billion total, trained on 22 trillion tokens across 200 languages.
Meta /

Llama 3 8B

Large language model with 8 billion parameters featuring transformer architecture, trained on 15 trillion tokens for text generation and coding tasks.
Meta /

Llama 3 70B

State-of-the-art 70B foundation model from Meta, trained on over 15 trillion tokens.
Meta /

Llama 3.1 8B

Llama 3.1 is a new state-of-the-art large language model from Meta.
Meta /

Llama 3.1 70B

The Llama 3.1 series of open models rivals top closed models in performance. It was trained on over 15 trillion tokens using over 16K H100 GPUs. These models display state-of-the-art capabilities in general knowledge, steerability, math, tool use, and translation.
Meta /

Llama 3.2 3B

The next iteration in the Llama series of open models. This lightweight model was designed to run on edge devices, even mobile.
Meta /

Llama 3.3 70B

Llama 3.3 is a text-only 70B instruction-tuned model that provides enhanced performance relative to Llama 3.1 70B and to Llama 3.2 90B when used for text-only applications. For some applications, Llama 3.3 70B approaches the performance of Llama 3.1 405B.
Meta /

MusicGen

MusicGen is a text-to-music autoregressive transformer model capable of generating music samples conditioned on text descriptions or audio prompts.
Meta /

Magnet

Magnet is a single-stage, non-autoregressive transformer model for text-to-music and text-to-audio generation, with faster generation that MusicGen.
Meta /

Seamless

Seamless is a MMMMT (Massively Multilingual and Multimodal Machine Translation) model that can translate and generate audio in over 100 languages.