Model reference · open weights
CodeLlama is an open-weight language model from codellama. CodeLlama-7b-hf (BF16) weighs 13.5 GB; the smallest configuration that runs it is 2× RTX 3060 12 GB.
For self-hosting, compare this build's requirements below with the GPU you plan to rent.
Summary of the codellama/CodeLlama-7b-hf model card, 2026-10-01
What it is
| Released by | codellama |
|---|---|
| Released | 2023-08-24 |
| Parameters | 6.7B |
| VRAM | 13.5 GB for the weights |
What it runs on
| Card | Requests at once | Context max | Memory |
|---|---|---|---|
| 8K each | |||
| RTX 3060 12 GB | 11.6 GB | ||
| RTX 4060 Ti 16 GB | 2K | 15.4 GB | |
| RTX 3090 24 GB | 2 | all 16K | 23.4 GB |
| RTX 4090 24 GB | 2 | all 16K | 23.4 GB |
| RTX 5090 32 GB | 3 | all 16K | 31.0 GB |
| L40S 48 GB | 6 | all 16K | 44.0 GB |
| A100 80 GB | 14 | all 16K | 78.2 GB |
| H100 80 GB | 14 | all 16K | 78.1 GB |
| RTX PRO 6000 Blackwell 96 GB | 17 | all 16K | 93.8 GB |
| DGX Spark (GB10) 128 GB unified | 21 | all 16K | 107 GB |
| H200 141 GB | 28 | all 16K | 138 GB |
| B200 180 GB | 36 | all 16K | 176 GB |
| 2× RTX 3060 12 GB tensor parallel | 1 | 15K | 11.6 GB a card |
| 2× RTX 4060 Ti 16 GB tensor parallel | 3 | all 16K | 15.4 GB a card |
| 2× RTX 5090 32 GB tensor parallel | 11 | all 16K | 31.0 GB a card |
| 2× L40S 48 GB tensor parallel | 17 | all 16K | 44.0 GB a card |
| 4× RTX 4090 24 GB tensor parallel | 18 | all 16K | 23.4 GB a card |
| 4× RTX 3090 24 GB tensor parallel | 18 | all 16K | 23.4 GB a card |
| Requests at once | 8K tokens each |
|---|---|
| 1 | 18.4 GB |
| 5 | 35.6 GB |
| 8 | 48.5 GB |
| 16 | 82.8 GB |
| 32 | 152 GB |
| 64 | 289 GB |
One card, with vLLM's small-card settings.
From the model card
Code Llama is a collection of pretrained and fine-tuned generative text models ranging in scale from 7 billion to 34 billion parameters. This is the repository for the base 7B version in the Hugging Face Transformers format. This model is designed for general code synthesis and understanding. Links to other models can be found in the index at the bottom.
[!NOTE] This is a non-official Code Llama repo. You can find the official Meta repository in the Meta Llama organization.
To use this model, please make sure to install transformers from main until the next version is released:
pip install transformers accelerate
Model capabilities:
from transformers import AutoTokenizer
import transformers
import torch
model = "codellama/CodeLlama-7b-hf"
tokenizer = AutoTokenizer.from_pretrained(model)
pipeline = transformers.pipeline(
"text-generation",
model=model,
torch_dtype=torch.float16,
device_map="auto",
)
sequences = pipeline(
'import socket\n\ndef ping_exponential_backoff(host: str):',
do_sample=True,
top_k=10,
temperature=0.1,
top_p=0.95,
num_return_sequences=1,
eos_token_id=tokenizer.eos_token_id,
max_length=200,
)
for seq in sequences:
print(f"Result: {seq['generated_text']}")
*Note: Use of this model is governed by the Meta license. Meta developed and publicly released the Code Llama family of large language models (LLMs).
Model Developers Meta
Variations Code Llama comes in three model sizes, and three variants:
All variants are available in sizes of 7B, 13B and 34B parameters.
This repository contains the base model of 7B parameters.
Input Models input text only.
Output Models generate text only.
Model Architecture Code Llama is an auto-regressive language model that uses an optimized transformer architecture.
Model Dates Code Llama and its variants have been trained between January 2023 and July 2023.
Status This is a static model trained on an offline dataset. Future versions of Code Llama - Instruct will be released as we improve model safety with community feedback.
License A custom commercial license is available at: https://ai.meta.com/resources/models-and-libraries/llama-downloads/
Research Paper More information can be found in the paper "Code Llama: Open Foundation Models for Code" or it's arXiv page.
Intended Use Cases Code Llama and its variants is intended for commercial and research use in English and relevant programming languages. The base model Code Llama can be adapted for a variety of code synthesis and understanding tasks, Code Llama - Python is designed specifically to handle the Python programming language, and Code Llama - Instruct is intended to be safer to use for code assistant and generation applications.
Out-of-Scope Uses Use in any manner that violates applicable laws or regulations (including trade compliance laws). Use in languages other than English. Use in any other way that is prohibited by the Acceptable Use Policy and Licensing Agreement for Code Llama and its variants.
Training Factors We used custom training libraries. The training and fine-tuning of the released models have been performed Meta’s Research Super Cluster.
Carbon Footprint In aggregate, training all 9 Code Llama models required 400K GPU hours of computation on hardware of type A100-80GB (TDP of 350-400W). Estimated total emissions were 65.3 tCO2eq, 100% of which were offset by Meta’s sustainability program.
All experiments reported here and the released models have been trained and fine-tuned using the same data as Llama 2 with
Quoted from the model card on Hugging Face. The full card is behind the Hugging Face link above.