What GPU do I need to run codellama/CodeLlama-7b-hf?

6.7B parameters, published in BF16. View on Hugging Face

6.7B
Parameters
BF16
Native precision
LlamaForCausalLM
Architecture
text-generation
Pipeline

CodeLlama-7b-hf is published by codellama on Hugging Face, with 505,595 downloads and 379 likes to date. It's a LlamaForCausalLM model built for text-generation, published natively in BF16.

VRAM required & cheapest live GPU fit

Required VRAM = weight size at each precision times a flat 1.2 overhead for activations and fragmentation. The KV-cache grows with context and is not in that factor; it is listed per model below where the architecture is published. Full formula and assumptions: methodology.

PrecisionWeight sizeRequired VRAMCheapest live fitGPUs neededEst. $/hr (full fit)
BF1612.6 GB15.1 GBRTX A40001$0.167/hr
FP8 (quantized)6.3 GB7.5 GBRTX 5060 Ti1$0.180/hr
INT4 (quantized)3.1 GB3.8 GBRTX 30701$0.088/hr

A GPU is only matched to a row if its hardware supports that precision, and the primary recommendation is always a single-GPU fit when one exists.

INT4 requires a quantized checkpoint actually published for this model, check its Hugging Face page before relying on this row.

Cheapest way to run CodeLlama-7b-hf at its published (BF16) precision: 1× RTX A4000, at $0.167/hr per GPU ($0.167/hr total). Quantizing to FP8 or INT4 (rows above) can cost less, but requires a compatible quantized checkpoint to exist for this model.

CodeLlama-7b-hf: KV cache by context length

The KV cache is the memory the attention layers hold for every token of context, on top of the weights. It is not part of the flat 1.2x overhead in the table above, grows with context length and with every concurrent request, and is why a long-context deployment needs more VRAM than the table shows.

Multi-head attention: every layer caches keys and values for every head. Cached per token: 524,288 bytes at 16-bit.

ContextKV cache, one sequence
4K2.0 GB
16K (model maximum)8.0 GB

Computed from the layer, head and window counts in the model's own configuration (codellama/CodeLlama-7b-hf), at 16 bits per cached value. Each concurrent sequence needs its own cache, on top of the weights.

CodeLlama-7b-hf: common questions

Does CodeLlama-7b-hf fit on a 16 GB GPU?

Yes. At BF16 it needs 15.1 GB of VRAM, so a 16 GB card holds it with 0.9 GB to spare. A 12 GB card is not enough for it at BF16.

What is the least VRAM CodeLlama-7b-hf can run in?

3.8 GB, at INT4 (quantized), which fits a 6 GB card, against 15.1 GB at BF16. That row assumes an INT4 checkpoint has actually been published for this model, so check its Hugging Face page before planning around it.

Does quantizing CodeLlama-7b-hf lower the GPU bill?

Yes. At BF16 the cheapest live fit is one RTX A4000 at $0.167/hr. At INT4 (quantized) it drops to one RTX 3070 at $0.088/hr, provided a quantized checkpoint exists for it.

Weight-to-VRAM math, the fit rules, and how live prices are normalized: full methodology.

More Code Llama models

All 3 Code Llama models: VRAM and GPU requirements

Alternatives at this size

Other models for text-generation within about a third of CodeLlama-7b-hf's 6.7B parameters, from other model lines.

More on CodeLlama-7b-hf

Related reading: RTX A4000 pricing and specs, How much VRAM you need for LLMs, Serving LLMs with vLLM, vLLM vs TensorRT-LLM vs SGLang, and Best GPU for LLM inference.

Your own GPU cloud accounts

One console for the GPU clouds you already rent from. Your keys stay on your machine.

$20 a month, flat

Connect your accounts

One console for the GPU clouds you already use.

Connect your accounts for $20 a month, flat. Your provider bills the GPU.

© 2026 Aquanode. All rights reserved.

All trademarks, logos and brand names are the property of their respective owners.