★ Reading this for free? Get 25 structured AI courses + per-chapter AI tutor — the first chapter of every course free, no card.Start free in 30 secondsOr own every course: $149 once

Code Llama 7B, 13B, 34B and 70B

Updated: November 2, 2026

CodeLlama 7B is a 3.8 GB download (ollama run codellama:7b) that runs on an 8 GB graphics card. The 13B needs a 12 GB card, the 34B a 24 GB card and the 70B about 48 GB. Meta's paper reports 33.5% HumanEval for the 7B and 53.0% for the 70B; newer code models now score far higher at the same size.

🔬 Technical Specifications Overview

•Parameters: 7, 13, 34 and 70 billion
•Context Window: 16,384 tokens (4,096 for the 70B Instruct and Python models)
•Architecture: Llama 2 decoder; 7B has 32 layers and a 4,096 hidden size
•Training: 500B code tokens (1T for the 70B), August 2023 release; 70B added January 2024
•Licensing: Llama 2 Community License
•Deployment: Local inference

Code Llama sizes and hardware requirements

Code Llama comes in four sizes. The 7B needs about 7 GB of memory at Ollama's 4K default context, the 13B about 12 GB, the 34B about 21 GB and the 70B about 41 GB. Pick the largest one your graphics card holds completely; a model that spills into system RAM still runs, but much more slowly.

Downloads are the sizes on the Ollama codellama tag list (default 4-bit Instruct build). Memory is arithmetic, not a measurement: the file, plus the key-value cache at that context, plus about 1 GB for compute buffers. The 7B and 13B have no grouped-query attention, so their cache is large (2.1 GB and 3.4 GB at 4K); the 34B and 70B use 8 key-value heads, so theirs is small. HumanEval pass@1 figures are from Table 2 of arXiv:2308.12950.

SizeOllama tagDownloadMemory at 4KMemory at 16KFitsHumanEval base / Instruct / Python
7Bcodellama:7b3.8 GB~7.0 GB~13.4 GB8 GB card at 4K; 16 GB card for 16K33.5% / 34.8% / 38.4%
13Bcodellama:13b7.4 GB~11.8 GB~21.8 GB12 GB card at 4K; 24 GB card for 16K36.0% / 42.7% / 43.3%
34Bcodellama:34b19 GB~20.9 GB~23.3 GB24 GB card, 4K or 16K48.8% / 41.5% / 53.7%
70Bcodellama:70b39 GB~41.2 GBn/a (Instruct is 4K)48 GB of VRAM (2 x 24 GB) or a 64 GB Mac53.0% / 67.8% / 57.3%

CodeLlama 13B

codellama:13b is a 7.4 GB file with 40 layers and a 5,120 hidden size. Its cache costs about 819 KB per token, so it needs about 11.8 GB at 4K and 21.8 GB at the full 16K: a 12 GB card at the default context, not an 8 GB one. The paper puts it only 2.5 HumanEval points above the 7B (36.0% against 33.5%) but 5.6 points ahead on MBPP (47.0% against 41.4%). For headroom on a 12 GB card, codellama:13b-instruct-q3_K_M is 6.3 GB.

CodeLlama 34B and CodeLlama Python 34B

codellama:34b and codellama:34b-python are both 19 GB. With 8 key-value heads the 34B's cache is about 0.8 GB at 4K and 3.2 GB at 16K, so a single 24 GB card holds it at either context. The base 34B scores 48.8% on HumanEval and 55.0% on MBPP; the Python variant scores 53.7% and 56.2%, the highest of any released Code Llama below 70B. The 34B does not support fill-in-the-middle in any variant. codellama:34b-instruct-q3_K_M (16.3 GB) leaves more room on a 24 GB card.

CodeLlama 70B

Meta added the 70B models in January 2024, trained on 1T tokens rather than 500B. codellama:70b (the Instruct build) is 38.9 GB, codellama:70b-instruct-q4_K_M 41.4 GB and the smallest, codellama:70b-instruct-q2_K, 25.5 GB. The Instruct and Python configs set a 4,096-token context, so plan on about 41 GB for the default tag: two 24 GB cards or a Mac with 64 GB of unified memory. The paper reports 53.0% HumanEval for the base 70B, 67.8% for Instruct and 57.3% for Python.

Generation speed is bounded by memory bandwidth divided by file size. An RTX 4090 has 1,008 GB/s (NVIDIA's spec), which gives the 3.8 GB 7B a ceiling of about 263 tok/s and the 19 GB 34B about 53 tok/s; real output lands below the ceiling. The VRAM calculator runs the same arithmetic for your card.

Base, Instruct or Python: which tag to pull

The short names hide one detail: codellama:7b, :13b, :34b and :70b have the same digest as the matching -instruct tag, so the default download is the Instruct model. Pull -code for the base model.

VariantOllama tagsUse it forInfilling
Code Llama - Instructcodellama:7b, :13b, :34b, :70b (the short names pull Instruct)Asking for code or explanations in plain languageYes, except 34B
Code Llama (base)codellama:7b-code, :13b-code, :34b-code, :70b-codeContinuing code from a prompt; editor autocomplete and fill-in-the-middleYes, except 34B
Code Llama - Pythoncodellama:7b-python, :13b-python, :34b-python, :70b-pythonPython completion; not tuned to follow instructionsNo

The official repository says the base and Python models “are not fine-tuned to follow instructions”, so prompt them with code to continue, not with a question. Fill-in-the-middle uses the format on Ollama's library page:

ollama run codellama:7b-code '<PRE> def compute_gcd(x, y): <SUF>return result <MID>'

Code Llama Architecture

Code Llama is Llama 2 further trained on code: 7B, 13B, 34B and 70B decoder-only transformers

👤
You
💻
Your ComputerAI Processing
👤
🌐
🏢
Cloud AI: You → Internet → Company Servers

📚 Research Background & Technical Foundation

Code Llama is described in Code Llama: Open Foundation Models for Code (Rozière, Gehring, Gloeckle et al., Meta AI, arXiv:2308.12950, submitted 24 August 2023 and revised 31 January 2024 to add the 70B models). It is Llama 2 trained further on 500B tokens of code (1T for the 70B), with a Python variant that saw another 100B tokens of mostly Python and an Instruct variant tuned to follow requests. The models were trained on 16K-token sequences and the paper reports gains on inputs up to 100K tokens. The 7B is the smallest: 32 layers, a 4,096 hidden size and 32 attention heads.

Technical Foundation

The papers and code behind Code Llama:

Performance Benchmarks & Analysis

Code Generation Benchmarks

HumanEval pass@1 (Source: arXiv:2308.12950)

CodeLlama 70B53 Score (%)
53
CodeLlama 34B48.8 Score (%)
48.8
CodeLlama 13B36 Score (%)
36
CodeLlama 7B Python38.4 Score (%)
38.4
CodeLlama 7B Instruct34.8 Score (%)
34.8
CodeLlama 7B Base33.5 Score (%)
33.5

MBPP (Python, 3-shot)

MBPP pass@1 (Source: arXiv:2308.12950)

CodeLlama 70B62.4 Score (%)
62.4
CodeLlama 34B55 Score (%)
55
CodeLlama 13B47 Score (%)
47
CodeLlama 7B Python47.6 Score (%)
47.6
CodeLlama 7B Base41.4 Score (%)
41.4
CodeLlama 7B Instruct44.4 Score (%)
44.4

CodeLlama 7B variants side by side (pass@1, %)

Performance Metrics

HumanEval
33.5
MBPP
41.4
HumanEval (Python)
38.4
MBPP (Python)
47.6
HumanEval (Instruct)
34.8
MBPP (Instruct)
44.4

Every Code Llama model in the paper

Table 2 of arXiv:2308.12950 (v3). HumanEval is zero-shot, MBPP 3-shot, pass@1 with greedy decoding. Meta's figures; this site has not re-run them.

Model7B13B34B70B
Code Llama, HumanEval / MBPP33.5 / 41.436.0 / 47.048.8 / 55.053.0 / 62.4
Code Llama - Instruct34.8 / 44.442.7 / 49.441.5 / 57.067.8 / 62.2
Code Llama - Python38.4 / 47.643.3 / 49.053.7 / 56.257.3 / 65.6

Installation & Setup Guide

System Requirements

System Requirements

▸
Operating System
Windows 10/11, macOS 12+, Ubuntu 20.04+, Linux
▸
RAM
16GB for CPU-only use of the 7B; see the table above for 13B, 34B and 70B
▸
Storage
3.8GB (7B), 7.4GB (13B), 19GB (34B), 39GB (70B) per default tag
▸
GPU
8GB card for the 7B at 4K context; 12GB for 13B; 24GB for 34B; 48GB for 70B
▸
CPU
Any modern x86-64 or Apple Silicon CPU; speed on CPU is bound by RAM bandwidth
1

Install Ollama

Download Ollama from ollama.com

$ curl -fsSL https://ollama.com/install.sh | sh
2

Run CodeLlama 7B

Downloads the 3.8 GB 4-bit file; this short tag is the Instruct model

$ ollama run codellama:7b
3

Try Python Variant

Use the Python-specialized variant for better Python code (38.4% HumanEval)

$ ollama run codellama:7b-python
4

Base Model for Autocomplete

The base model, for completion and fill-in-the-middle in an editor

$ ollama pull codellama:7b-code
5

Larger Sizes

codellama:13b is 7.4 GB (12 GB card), codellama:34b 19 GB (24 GB card), codellama:70b 39 GB

$ ollama run codellama:34b

Code Generation Capabilities

Basic Code Generation

  • • Function completion
  • • Class creation
  • • Simple algorithms
  • • API integration
  • • Database queries

Development Tools

  • • Code completion
  • • Bug detection
  • • Code refactoring
  • • Documentation
  • • Test generation

Language Support

  • • Python, JavaScript
  • • Java, C++, C#
  • • PHP, Ruby, Go
  • • SQL, Shell scripts
  • • Web markup

Practical Use Cases & Applications

Real-world Development Scenarios

Web Development

Generate React components, Node.js server code, and database schemas for full-stack web applications with modern best practices.

Data Science

Create Python scripts for data analysis, visualization charts, and machine learning model implementations for data-driven projects.

Mobile Development

Generate mobile app code for iOS and Android including UI components, business logic, and platform-specific features.

Education & Learning

Create educational content, programming tutorials, interactive examples, and learning materials for students and self-learners.

Automation Scripts

Develop shell scripts, batch files, and automation tools for system administration, DevOps tasks, and workflow optimization.

Rapid Prototyping

Quickly generate proof-of-concept code, API clients, and demonstration applications for rapid development and testing.

Performance Optimization & Configuration

Memory and Performance Optimization

The quantisation sets the file size, and the file size sets both the memory floor and the speed ceiling. These are the CodeLlama 7B Instruct download sizes on the Ollama registry, in GB; add about 2.1 GB of cache at 4K context and 1 GB of buffers to get the memory needed.

Ollama tagDownloadMemory at 4K (arithmetic)
codellama:7b-instruct-q2_K2.83 GB~6.0 GB
codellama:7b-instruct-q3_K_M3.30 GB~6.5 GB
codellama:7b (q4_0)3.83 GB~7.0 GB
codellama:7b-instruct-q4_K_M4.08 GB~7.2 GB
codellama:7b-instruct-q5_K_M4.78 GB~7.9 GB
codellama:7b-instruct-q6_K5.53 GB~8.7 GB
codellama:7b-instruct-q8_07.16 GB~10.3 GB
codellama:7b-instruct-fp1613.48 GB~16.6 GB

Optimization Strategies

  • Quantization: 4-bit, 8-bit, or 16-bit precision
  • Memory Mapping: Efficient model loading
  • Batch Processing: Improved throughput
  • Context Caching: Faster response times
  • Hardware Acceleration: GPU/CPU optimization

Deployment Options

  • Local Development: IDE integration
  • Team Sharing: Shared resources
  • API Service: Code generation API
  • Containerized: Docker deployment
  • Cloud Options: Flexible scaling

Comparison with Other Code Models

Code Generation Model Comparison

How CodeLlama 7B's base model compares with other base code models of similar size. Scores from two different evaluators are not perfectly comparable, so read the gaps, not the decimals.

Model (base)HumanEval pass@1Ollama downloadSource
CodeLlama 7B33.5%3.8 GB (codellama:7b-code)Meta, arXiv:2308.12950
Qwen 2.5 Coder 7B61.6%4.7 GB (qwen2.5-coder:7b)Qwen, arXiv:2409.12186
DeepSeek Coder 6.7B47.6%3.8 GB (deepseek-coder:6.7b)Qwen, arXiv:2409.12186
StarCoder2 7B35.4%4.0 GB (starcoder2:7b)Qwen, arXiv:2409.12186
CodeLlama 34B48.8%19 GB (codellama:34b-code)Meta, arXiv:2308.12950

CodeLlama-7B Advantages

  • • Low hardware requirements
  • • Small file: 3.8 GB at 4-bit
  • • Open-source and free
  • • Fill-in-the-middle support for editor autocomplete
  • • Easy local deployment

Considerations

  • • Limited to simple tasks
  • • Less capable than larger models
  • • 16K context window limit
  • • Reduced code quality for complex tasks
  • • May need fine-tuning for specific domains

Local Coding AI Alternatives

CodeLlama 7B (August 2023) has been surpassed by newer coding models. HumanEval figures are for base models: Code Llama from Meta's paper, the others from the Qwen2.5-Coder technical report (arXiv:2409.12186).

ModelHumanEvalOllama downloadContextOllama Command
Qwen 2.5 Coder 7B61.6%4.7 GB128Kollama run qwen2.5-coder:7b
DeepSeek Coder 6.7B47.6%3.8 GB16Kollama run deepseek-coder:6.7b
StarCoder2 7B35.4%4.0 GB16Kollama run starcoder2:7b
CodeLlama 7B (this page)33.5%3.8 GB16Kollama run codellama:7b
CodeLlama 13B36.0%7.4 GB16Kollama run codellama:13b

Recommendation: For new projects, use Qwen 2.5 Coder 7B — its base model scores 61.6% HumanEval against CodeLlama 7B's 33.5%, for a 4.7 GB download against 3.8 GB, with a 128K context against 16K. The instruct versions are further apart: 88.4% for Qwen2.5-Coder-7B-Instruct and 40.9% for CodeLlama-7B-Instruct in the same report. For a 24 GB card, Qwen 2.5 Coder 32B (19.9 GB) replaces CodeLlama 34B.

Frequently Asked Questions

What are CodeLlama 7B's actual benchmark scores?

Meta's paper (arXiv:2308.12950, Table 2) reports HumanEval pass@1 of 33.5% and MBPP pass@1 of 41.4% for the base Code Llama 7B, 38.4% and 47.6% for Code Llama - Python 7B, and 34.8% and 44.4% for Code Llama - Instruct 7B. The same table gives the base 13B 36.0%, the base 34B 48.8% and the base 70B 53.0% on HumanEval.

How much VRAM does CodeLlama 7B need?

The default codellama:7b download is a 3.8 GB 4-bit file. With Ollama's 4K default context the key-value cache adds about 2.1 GB, so it needs roughly 7 GB and fits an 8 GB graphics card. The full 16K context raises that to about 13.4 GB. The fp16 file is 13.5 GB on its own. On CPU, 16 GB of system RAM is comfortable.

What are the Code Llama hardware requirements for 13B, 34B and 70B?

By the same arithmetic (download plus key-value cache plus about 1 GB of buffers): codellama:13b is 7.4 GB and needs about 11.8 GB at 4K context, so a 12 GB card; codellama:34b is 19 GB and needs about 21 GB at 4K or 23 GB at 16K, so a 24 GB card; codellama:70b is 39 GB and needs about 41 GB at 4K, so 48 GB of VRAM (two 24 GB cards) or a Mac with 64 GB of unified memory.

What is the HumanEval score of CodeLlama Python 34B?

53.7% HumanEval pass@1 and 56.2% MBPP pass@1, from Table 2 of the Code Llama paper. It is the codellama:34b-python tag on Ollama, a 19 GB download. The 70B Python model scores 57.3% and 65.6%. The Python variants are not tuned to follow instructions and do not support infilling.

How does CodeLlama 7B compare to newer coding models?

It has been overtaken. In the Qwen2.5-Coder technical report (arXiv:2409.12186) the base Qwen2.5-Coder-7B scores 61.6% on HumanEval, DeepSeek-Coder-6.7B-Base 47.6% and StarCoder2-7B 35.4%, against 33.5% for Code Llama 7B in Meta's paper. Among instruct models the same report gives CodeLlama-7B-Instruct 40.9% and Qwen2.5-Coder-7B-Instruct 88.4%. Different evaluators use different setups, so compare within one table where you can.

What are the three CodeLlama 7B variants?

Base (codellama:7b-code) for completion and fill-in-the-middle, Python (codellama:7b-python) with an extra 100B tokens of mostly Python, and Instruct (codellama:7b-instruct, which is also what codellama:7b pulls) for chat-style requests. All three are 3.8 GB on Ollama and share the 16K context. Only the base and Instruct models support infilling.

Should I use CodeLlama 7B or a newer alternative?

For new work, Qwen2.5-Coder 7B (qwen2.5-coder:7b, 4.7 GB) is the stronger model at almost the same size and has a 128K context. Keep Code Llama if you are reproducing the paper, have a fine-tune built on it, or use a tool that expects its <PRE>/<SUF>/<MID> infill format.

💻 Comprehensive Code Generation Applications

Full-Stack Development

CodeLlama-7B can draft both frontend and backend code; treat the output as a starting point and review it.

Full-Stack Features:

  • • React, Vue, and Angular frontend applications
  • • Node.js, Python, and Java backend services
  • • RESTful API design and implementation
  • • Database integration and ORM patterns

Algorithm and Data Structures

Standard algorithms and data structures are well represented in its training code, so it can draft them; at 33.5% HumanEval, check and test what it writes.

Algorithm Capabilities:

  • • Sorting and searching algorithms implementation
  • • Dynamic programming solutions
  • • Graph algorithms and tree structures
  • • Optimization and approximation algorithms

Data Processing and Analysis

CodeLlama-7B can draft data processing pipelines, ETL scripts, and analytical tools for handling structured and unstructured data with various programming languages.

Data Processing Features:

  • • Pandas and NumPy data manipulation
  • • Data visualization with Matplotlib and Plotly
  • • ETL pipeline development
  • • Statistical analysis and reporting tools

Mobile and Web Integration

It can draft code for common mobile and web frameworks that were well represented in its 2023 training data; newer framework versions will be missing.

Mobile & Web Features:

  • • React Native and Flutter mobile apps
  • • Progressive Web App (PWA) development
  • • Cross-platform compatibility solutions
  • • API integration and third-party service connections

Advanced IDE Integration & Development Workflows

🔌 IDE Integration Capabilities

Code Llama has no editor plugin of its own. You serve it with Ollama and connect an editor extension that talks to Ollama's API, such as Continue for VS Code and JetBrains; the Continue.dev with Ollama guide walks through it. The base model (the -code tag) is the one to use for inline completion.

Visual Studio Code Integration

Through an extension such as Continue, pointed at the local Ollama server, for chat and inline completion.

JetBrains IDE Suite

Continue also has a JetBrains plugin (IntelliJ IDEA, PyCharm, WebStorm) that can use the same local Ollama model.

Vim & Neovim Support

Community Neovim plugins that call Ollama's HTTP API can use Code Llama for completion.

⚡ Development Workflow Optimization

Typical workflow uses for a local 7B code model. It does not learn from your project between sessions; anything project-specific has to be in the prompt or the context the editor sends.

Automated Code Review

Intelligent code review capabilities identifying potential bugs, security vulnerabilities, and suggesting improvements based on best practices and coding standards.

Template & Boilerplate Generation

Rapid generation of project templates, boilerplate code, and configuration files tailored to specific frameworks, architectures, and development requirements.

Test Generation & Coverage

Automated test case generation, unit test creation, and test coverage analysis to ensure code quality and reliability across different testing frameworks.

🎯 Language-Specific Optimization & Expertise

The paper's multilingual table (MultiPL-E, pass@1) shows how the 7B base model does outside Python. Beyond the four below it scores 24.2% on PHP, 25.3% on C# and 12.0% on Bash; the 13B scores 39.1% on C++, 38.0% on Java and 15.2% on Bash, and the 34B 47.8%, 45.6% and 17.1%. Shell scripting is the weakest language at every size.

33.5%
Python (HumanEval)

Primary training language

33.3%
TypeScript (MultiPL-E)

Typed JavaScript

34.2%
Java (MultiPL-E)

Enterprise, Spring Boot

28.6%
C++ (MultiPL-E)

Systems programming

👥 Collaborative Development & Team Integration

A shared Ollama server can serve one Code Llama model to a small team. It follows conventions only when they are in the prompt, so put style rules and examples in the system prompt or the editor's context.

Team Collaboration Tools

  • •Consistent code style and formatting enforcement
  • •Shared code snippet libraries and templates
  • •Collaborative code review and feedback systems
  • •Team-specific coding conventions and patterns

Knowledge Management

  • •Automated documentation generation from code
  • •Codebase knowledge capture and retrieval
  • •Onboarding assistance for new team members
  • •Best practice recommendations and learning resources

Resources & Further Reading

📚 Official Documentation

⚙️ Technical Implementation

🤝 Development Resources

📈 Code Quality & Best Practices

Code Quality Resources

Community & Support

Build Real AI on Your Machine

RAG, agents, NLP, vision, and MLOps - chapters across 25 courses that take you from reading about AI to building AI.

Reading now
Join the discussion

Related Guides

Continue your local AI journey with these comprehensive guides

🎯
AI Learning Path

Go from reading about AI to building with AI

25 structured courses. Hands-on projects. Runs on your machine. Start free.

Or own it for life — Lifetime $149 $599, pay once
Barsha Mohapatra

Written by

Barsha Mohapatra

Founder and Editor, Local AI Master · Founder, Little AI Master

Founder of Little AI Master and the editor behind every course and guide on Local AI Master. Years of tutoring students taught her where AI education actually fails.

📅 Published: 2025-10-29🔄 Last Updated: November 2, 2026✓ Manually Reviewed
More on AI Models Directory
See the full AI Models Directory guide.
📚
Free · no account required

Grab the AI Starter Kit — career roadmap, cheat sheet, setup guide

No spam. Unsubscribe with one click.

🎯
AI Learning Path

Found your model? Now build something with it.

25 hands-on courses — RAG, agents, fine-tuning — all running locally. First chapter free, no card.

Or own it for life — Lifetime $149 $599, pay once
Free Tools & Calculators