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
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.
| Size | Ollama tag | Download | Memory at 4K | Memory at 16K | Fits | HumanEval base / Instruct / Python |
|---|---|---|---|---|---|---|
| 7B | codellama:7b | 3.8 GB | ~7.0 GB | ~13.4 GB | 8 GB card at 4K; 16 GB card for 16K | 33.5% / 34.8% / 38.4% |
| 13B | codellama:13b | 7.4 GB | ~11.8 GB | ~21.8 GB | 12 GB card at 4K; 24 GB card for 16K | 36.0% / 42.7% / 43.3% |
| 34B | codellama:34b | 19 GB | ~20.9 GB | ~23.3 GB | 24 GB card, 4K or 16K | 48.8% / 41.5% / 53.7% |
| 70B | codellama:70b | 39 GB | ~41.2 GB | n/a (Instruct is 4K) | 48 GB of VRAM (2 x 24 GB) or a 64 GB Mac | 53.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.
| Variant | Ollama tags | Use it for | Infilling |
|---|---|---|---|
| Code Llama - Instruct | codellama:7b, :13b, :34b, :70b (the short names pull Instruct) | Asking for code or explanations in plain language | Yes, except 34B |
| Code Llama (base) | codellama:7b-code, :13b-code, :34b-code, :70b-code | Continuing code from a prompt; editor autocomplete and fill-in-the-middle | Yes, except 34B |
| Code Llama - Python | codellama:7b-python, :13b-python, :34b-python, :70b-python | Python completion; not tuned to follow instructions | No |
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
📚 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:
- Attention Is All You Need - Foundational transformer architecture (Vaswani et al., 2017)
- CodeLlama: Open Foundation Models for Code - CodeLlama research paper (Rozière et al., 2023)
- Supercharging Code Generation - Code optimization research (Tang et al., 2023)
- CodeLlama Official Repository - Meta AI implementation and technical documentation
Performance Benchmarks & Analysis
Code Generation Benchmarks
HumanEval pass@1 (Source: arXiv:2308.12950)
MBPP (Python, 3-shot)
MBPP pass@1 (Source: arXiv:2308.12950)
CodeLlama 7B variants side by side (pass@1, %)
Performance Metrics
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.
| Model | 7B | 13B | 34B | 70B |
|---|---|---|---|---|
| Code Llama, HumanEval / MBPP | 33.5 / 41.4 | 36.0 / 47.0 | 48.8 / 55.0 | 53.0 / 62.4 |
| Code Llama - Instruct | 34.8 / 44.4 | 42.7 / 49.4 | 41.5 / 57.0 | 67.8 / 62.2 |
| Code Llama - Python | 38.4 / 47.6 | 43.3 / 49.0 | 53.7 / 56.2 | 57.3 / 65.6 |
Installation & Setup Guide
System Requirements
System Requirements
Install Ollama
Download Ollama from ollama.com
Run CodeLlama 7B
Downloads the 3.8 GB 4-bit file; this short tag is the Instruct model
Try Python Variant
Use the Python-specialized variant for better Python code (38.4% HumanEval)
Base Model for Autocomplete
The base model, for completion and fill-in-the-middle in an editor
Larger Sizes
codellama:13b is 7.4 GB (12 GB card), codellama:34b 19 GB (24 GB card), codellama:70b 39 GB
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 tag | Download | Memory at 4K (arithmetic) |
|---|---|---|
codellama:7b-instruct-q2_K | 2.83 GB | ~6.0 GB |
codellama:7b-instruct-q3_K_M | 3.30 GB | ~6.5 GB |
codellama:7b (q4_0) | 3.83 GB | ~7.0 GB |
codellama:7b-instruct-q4_K_M | 4.08 GB | ~7.2 GB |
codellama:7b-instruct-q5_K_M | 4.78 GB | ~7.9 GB |
codellama:7b-instruct-q6_K | 5.53 GB | ~8.7 GB |
codellama:7b-instruct-q8_0 | 7.16 GB | ~10.3 GB |
codellama:7b-instruct-fp16 | 13.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@1 | Ollama download | Source |
|---|---|---|---|
| CodeLlama 7B | 33.5% | 3.8 GB (codellama:7b-code) | Meta, arXiv:2308.12950 |
| Qwen 2.5 Coder 7B | 61.6% | 4.7 GB (qwen2.5-coder:7b) | Qwen, arXiv:2409.12186 |
| DeepSeek Coder 6.7B | 47.6% | 3.8 GB (deepseek-coder:6.7b) | Qwen, arXiv:2409.12186 |
| StarCoder2 7B | 35.4% | 4.0 GB (starcoder2:7b) | Qwen, arXiv:2409.12186 |
| CodeLlama 34B | 48.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).
| Model | HumanEval | Ollama download | Context | Ollama Command |
|---|---|---|---|---|
| Qwen 2.5 Coder 7B | 61.6% | 4.7 GB | 128K | ollama run qwen2.5-coder:7b |
| DeepSeek Coder 6.7B | 47.6% | 3.8 GB | 16K | ollama run deepseek-coder:6.7b |
| StarCoder2 7B | 35.4% | 4.0 GB | 16K | ollama run starcoder2:7b |
| CodeLlama 7B (this page) | 33.5% | 3.8 GB | 16K | ollama run codellama:7b |
| CodeLlama 13B | 36.0% | 7.4 GB | 16K | ollama 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.
Primary training language
Typed JavaScript
Enterprise, Spring Boot
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
- Meta AI Official Documentation
Official Meta AI resources and documentation
- Code Llama GitHub Repository
Source code and implementation details
- CodeLlama Paper (arXiv)
Research paper on CodeLlama architecture
- Hugging Face Model Page
Model files, usage examples, and community
- Meta AI Blog Announcement
Official announcement and technical details
⚙️ Technical Implementation
- Semantic Kernel (Microsoft)
AI integration SDK for developers
- llama.cpp Python Bindings
Efficient CPU inference implementation
- Text Generation WebUI
Gradio-based web interface for local models
- vLLM Inference Engine
High-performance serving optimization
- Ollama Runtime Platform
Simple local deployment and management
🤝 Development Resources
- GitHub Copilot Documentation
AI pair programming comparison and alternatives
- VS Code AI Extensions
IDE integration and extension development
- Hugging Face Courses
Comprehensive AI and machine learning courses
- Fast.ai Practical Deep Learning
Practical programming and AI education
- PyTorch Documentation
Deep learning framework tutorials
📈 Code Quality & Best Practices
Code Quality Resources
- Refactoring.Guru
Design patterns and refactoring techniques
- Martin Fowler's Blog
Software architecture and design principles
- Clean Code Developer
Clean code principles and practices
Community & Support
- Hugging Face Forums
Community discussions and support
- Stack Overflow Llama Tag
Technical Q&A and troubleshooting
- Reddit r/LocalLLaMA
Community discussions and experiences
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.
Related Guides
Continue your local AI journey with these comprehensive guides
Go from reading about AI to building with AI
25 structured courses. Hands-on projects. Runs on your machine. Start free.

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.