# Code Llama

> Meta's open-weight code LLM family fine-tuned from Llama 2, with Python and Instruct variants.

- Maker: Meta
- Line: Code Llama
- Canonical page: https://ai-tldr.dev/models/code-llama/
- Updated: 2026-06-18

## In short

Code Llama is Meta's family of open-weight large language models specialized for programming, released on August 24, 2023.

## Facts

| Fact | Value | Source |
| --- | --- | --- |
| Context window | Trained on 16K-token sequences; stable generations on inputs up to ~100K tokens | [1] |
| Licence | Llama 2 Community License (custom; free for research and commercial use) · open weights | [1] |
| Released | 24 August 2023 | [2] |
| Parameters | 7B, 13B and 34B (initial release); a 70B variant was added 2024-01-29 | [1] |
| Knowledge cutoff | Trained on data between January 2023 and July 2023 | [1] |

## Sources

1. [CodeLlama-7b-Instruct-hf — model card (Hugging Face)](https://huggingface.co/codellama/CodeLlama-7b-Instruct-hf)
2. [Meta — Introducing Code Llama (official blog)](https://ai.meta.com/blog/code-llama-large-language-model-coding/)

## Overview

Code Llama is Meta's family of open-weight large language models specialized for programming, released on August 24, 2023. It is fine-tuned from the Llama 2 foundation models on code-heavy data and originally shipped in three sizes — Code Llama 7B, 13B and 34B — with a larger Code Llama 70B following on January 29, 2024. The models are distributed under the same Llama 2 Community License, free for both research and commercial use.

Each size comes in three flavors: Code Llama (the foundational code model), Code Llama - Python (further trained on ~100B tokens of Python for stronger Python performance), and Code Llama - Instruct (tuned to follow natural-language instructions and produce safer, more helpful responses). The 7B and 13B base and Instruct models were also trained with fill-in-the-middle (FIM) capability, letting them insert code into an existing file for completion tasks rather than only continuing from the end.

Code Llama is text-only and supports many popular languages, including Python, C++, Java, PHP, TypeScript/JavaScript, C# and Bash. All variants were trained on 16K-token sequences and show stable generations on inputs of up to roughly 100K tokens, which made it well suited to working over large files and repositories. At launch it was among the strongest open code models available, and it seeded a large ecosystem of community fine-tunes (such as Phind-CodeLlama and WizardCoder).

## Benchmarks

- HumanEval (pass@1, Code Llama - Python 34B): 53.7% ([source](https://arxiv.org/html/2308.12950v3))
- MBPP (pass@1, Code Llama - Python 34B): 56.2% ([source](https://arxiv.org/html/2308.12950v3))
- HumanEval (pass@1, Code Llama 34B base): 48.8% ([source](https://arxiv.org/html/2308.12950v3))
- MBPP (pass@1, Code Llama 34B base): 55% ([source](https://arxiv.org/html/2308.12950v3))
- MBPP (pass@1, Code Llama - Instruct 34B): 57% ([source](https://arxiv.org/html/2308.12950v3))
- HumanEval (pass@1, Code Llama 7B base): 33.5% ([source](https://arxiv.org/html/2308.12950v3))
- HumanEval (pass@1, Code Llama 13B base): 36% ([source](https://arxiv.org/html/2308.12950v3))

## Strengths

- Open weights under a permissive Llama 2 license, free for commercial use and self-hosting
- Fill-in-the-middle (FIM) infilling on the 7B and 13B models for in-editor code completion
- Long input handling — trained on 16K tokens, stable up to ~100K — good for large files and repos
- Multiple specializations (base, Python, Instruct) and sizes (7B/13B/34B) to fit different latency and hardware budgets
- Broad language coverage (Python, C++, Java, PHP, TypeScript/JavaScript, C#, Bash, and more)
- Strong, well-documented baseline that spawned a large ecosystem of community fine-tunes

## Best for

- Local or self-hosted code completion and autocomplete in IDEs (especially the FIM-enabled 7B/13B)
- Code generation from natural-language prompts with Code Llama - Instruct
- Python-heavy generation and refactoring with the Code Llama - Python variant
- Code explanation, documentation, and debugging assistance over large files
- A base model for building custom, domain-specific coding assistants via fine-tuning
- Offline / privacy-sensitive coding workflows where a hosted API is not acceptable

## Code Llama versions

- [Code Llama 70B](https://ai-tldr.dev/models/code-llama-70b/) (29 January 2024)
- Code Llama (24 August 2023) — this page

## FAQ

### Is Code Llama free and open source?

Code Llama's weights are openly available and free to download under the Llama 2 Community License, which permits both research and commercial use. It is commonly called open-weight rather than strictly open source, because the license includes acceptable-use terms and is not a standard OSI license.

### What sizes and variants does Code Llama come in?

The initial August 2023 release shipped 7B, 13B and 34B models (a 70B was added in January 2024). Each size has three flavors: Code Llama (base), Code Llama - Python (Python-specialized), and Code Llama - Instruct (instruction-following). The 7B and 13B base and Instruct models also support fill-in-the-middle infilling.

### How does Code Llama perform on coding benchmarks?

In Meta's paper, Code Llama - Python 34B scored 53.7% pass@1 on HumanEval and 56.2% on MBPP, the strongest among open models at the time and roughly on par with ChatGPT (GPT-3.5). The base 34B scored 48.8% on HumanEval and 55.0% on MBPP. Smaller models score lower (for example, base 7B reaches 33.5% HumanEval).

### Is Code Llama still maintained or has it been replaced?

Code Llama is now a legacy line. Meta's official codellama inference-code repository was archived (made read-only) on July 1, 2025, and Meta's more recent code-capable Llama 3 and 3.1 models have effectively superseded it. The Code Llama weights remain available for download.

## Links

- [Meta — Introducing Code Llama (official blog)](https://ai.meta.com/blog/code-llama-large-language-model-coding/)
- [Code Llama: Open Foundation Models for Code (arXiv paper)](https://arxiv.org/abs/2308.12950)
- [Code Llama paper — full text with benchmark tables](https://arxiv.org/html/2308.12950v3)
- [meta-llama/codellama — official inference code (GitHub, archived)](https://github.com/meta-llama/codellama)
- [CodeLlama-7b-Instruct-hf — model card (Hugging Face)](https://huggingface.co/codellama/CodeLlama-7b-Instruct-hf)

Source: AI/TLDR LLM registry, https://ai-tldr.dev/models/code-llama/
