Skip to content

CodeLlama 7B HF VRAM requirements

How much VRAM CodeLlama 7B HF needs
4-bit weights: 3.8 GBWith 8K context: 8.4 GBWith 16K context: 12.4 GB8-bit, 8K context: 11.3 GB
Parameters
6.7B
Longest context
16K
Released
Aug 2023
License
Llama 2 Community
Strongest at
Not rated

Its licence (Llama 2 Community) is not a standard open-source one: check the terms before commercial use.

How much VRAM CodeLlama 7B HF needs

Memory CodeLlama 7B HF needs at each precision and context length
PrecisionWeightsWith 8KWith 16K
16-bit12.6 GB17.2 GB21.2 GB
8-bit6.7 GB11.3 GB15.3 GB
6-bit5.1 GB9.8 GB13.8 GB
5-bit4.5 GB9.1 GB13.1 GB
4-bit3.8 GB8.4 GB12.4 GB
3-bit3.1 GB7.7 GB11.7 GB
2-bit2.4 GB7.0 GB11.0 GB
1.6-bit1.3 GB5.9 GB9.9 GB

One conversation, 16-bit context cache, runtime overhead included.

GPUs and Macs that run CodeLlama 7B HF

The best way CodeLlama 7B HF runs on common GPUs, Macs and AI boxes
MachineBest fitContextSpeedFirst replyReport
RTX 4060Too bigPDF: CodeLlama 7B HF on RTX 4060 report
RTX 5060Too bigPDF: CodeLlama 7B HF on RTX 5060 report
RTX 3070Too bigPDF: CodeLlama 7B HF on RTX 3070 report
RTX 3080 10 GBToo bigPDF: CodeLlama 7B HF on RTX 3080 10 GB report
RTX 3060 12 GBToo bigPDF: CodeLlama 7B HF on RTX 3060 12 GB report
Arc B580Too bigPDF: CodeLlama 7B HF on Arc B580 report
RTX 4070Too bigPDF: CodeLlama 7B HF on RTX 4070 report
RTX 4070 SuperToo bigPDF: CodeLlama 7B HF on RTX 4070 Super report
RTX 5070Too bigPDF: CodeLlama 7B HF on RTX 5070 report
RTX 4060 Ti 16 GB6-bit16K36 tok/s0.7 sPDF: CodeLlama 7B HF on RTX 4060 Ti 16 GB report
RTX 5060 Ti 16 GB6-bit16K55 tok/s0.6 sPDF: CodeLlama 7B HF on RTX 5060 Ti 16 GB report
Arc A770 16 GB6-bit16K47 tok/s0.7 sPDF: CodeLlama 7B HF on Arc A770 16 GB report
Radeon RX 9070 XT6-bit16K64 tok/s0.4 sPDF: CodeLlama 7B HF on Radeon RX 9070 XT report
RTX 4070 Ti Super6-bit16K80 tok/s0.3 sPDF: CodeLlama 7B HF on RTX 4070 Ti Super report
RTX 4080 Super6-bit16K87 tok/s0.3 sPDF: CodeLlama 7B HF on RTX 4080 Super report
RTX 5070 Ti6-bit16K104 tok/s0.3 sPDF: CodeLlama 7B HF on RTX 5070 Ti report
RTX 50806-bit16K111 tok/s0.3 sPDF: CodeLlama 7B HF on RTX 5080 report
Radeon RX 7900 XTX8-bit16K73 tok/s0.6 sPDF: CodeLlama 7B HF on Radeon RX 7900 XTX report
RTX 30908-bit16K86 tok/s0.4 sPDF: CodeLlama 7B HF on RTX 3090 report
RTX 40908-bit16K92 tok/s0.2 sPDF: CodeLlama 7B HF on RTX 4090 report
Radeon AI PRO R97008-bit16K50 tok/s0.4 sPDF: CodeLlama 7B HF on Radeon AI PRO R9700 report
RTX 50908-bit16K153 tok/s0.1 sPDF: CodeLlama 7B HF on RTX 5090 report
2× RTX 30908-bit16K86 tok/s0.2 sPDF: CodeLlama 7B HF on 2× RTX 3090 report
2× RTX 40908-bit16K92 tok/s0.1 sPDF: CodeLlama 7B HF on 2× RTX 4090 report
RTX PRO 5000 Blackwell 48 GB8-bit16K119 tok/s0.2 sPDF: CodeLlama 7B HF on RTX PRO 5000 Blackwell 48 GB report
RTX 6000 Ada8-bit16K88 tok/s0.2 sPDF: CodeLlama 7B HF on RTX 6000 Ada report
L40S8-bit16K80 tok/s0.3 sPDF: CodeLlama 7B HF on L40S report
2× RTX 50908-bit16K153 tok/s0.1 sPDF: CodeLlama 7B HF on 2× RTX 5090 report
4× RTX 30908-bit16K86 tok/s0.1 sPDF: CodeLlama 7B HF on 4× RTX 3090 report
RTX PRO 6000 Blackwell8-bit16K153 tok/s0.1 sPDF: CodeLlama 7B HF on RTX PRO 6000 Blackwell report
Mac mini M4 16 GBToo bigPDF: CodeLlama 7B HF on Mac mini M4 16 GB report
Mac mini M4 24 GB8-bit16K14 tok/s9.2 sPDF: CodeLlama 7B HF on Mac mini M4 24 GB report
Mac mini M4 32 GB8-bit16K14 tok/s9.2 sPDF: CodeLlama 7B HF on Mac mini M4 32 GB report
Mac mini M4 Pro 24 GB8-bit16K29 tok/s4.6 sPDF: CodeLlama 7B HF on Mac mini M4 Pro 24 GB report
Mac mini M4 Pro 48 GB8-bit16K29 tok/s4.6 sPDF: CodeLlama 7B HF on Mac mini M4 Pro 48 GB report
Mac mini M4 Pro 64 GB8-bit16K29 tok/s4.6 sPDF: CodeLlama 7B HF on Mac mini M4 Pro 64 GB report
M4 Max 128 GB8-bit16K51 tok/s2.3 sPDF: CodeLlama 7B HF on M4 Max 128 GB report
M5 Max 128 GB8-bit16K56 tok/s0.7 sPDF: CodeLlama 7B HF on M5 Max 128 GB report
M3 Ultra 96 GB8-bit16K64 tok/s1.3 sPDF: CodeLlama 7B HF on M3 Ultra 96 GB report
M3 Ultra 256 GB8-bit16K64 tok/s1.3 sPDF: CodeLlama 7B HF on M3 Ultra 256 GB report
M3 Ultra 512 GB8-bit16K64 tok/s1.3 sPDF: CodeLlama 7B HF on M3 Ultra 512 GB report
M5 Ultra 512 GB8-bit16K87 tok/s0.4 sPDF: CodeLlama 7B HF on M5 Ultra 512 GB report
Ryzen AI Max+ 395 64 GB8-bit16K21 tok/s1.3 sPDF: CodeLlama 7B HF on Ryzen AI Max+ 395 64 GB report
Ryzen AI Max+ 395 128 GB8-bit16K21 tok/s1.3 sPDF: CodeLlama 7B HF on Ryzen AI Max+ 395 128 GB report
RTX Spark8-bit16K29 tok/s0.5 sPDF: CodeLlama 7B HF on RTX Spark report
DGX Spark8-bit16K27 tok/s0.5 sPDF: CodeLlama 7B HF on DGX Spark report
Dual DGX Spark8-bit16K27 tok/s0.3 sPDF: CodeLlama 7B HF on Dual DGX Spark report
DGX Station GB3008-bit16K421 tok/s0.1 sPDF: CodeLlama 7B HF on DGX Station GB300 report
2× RTX PRO 6000 Blackwell8-bit16K153 tok/s0.1 sPDF: CodeLlama 7B HF on 2× RTX PRO 6000 Blackwell report
4× RTX PRO 6000 Blackwell8-bit16K153 tok/s0.1 sPDF: CodeLlama 7B HF on 4× RTX PRO 6000 Blackwell report
8× RTX PRO 6000 Blackwell8-bit16K153 tok/s0.1 sPDF: CodeLlama 7B HF on 8× RTX PRO 6000 Blackwell report
A100 80 GB SXM8-bit16K170 tok/s0.3 sPDF: CodeLlama 7B HF on A100 80 GB SXM report
H100 SXM8-bit16K253 tok/s0.1 sPDF: CodeLlama 7B HF on H100 SXM report
4× H200 NVL8-bit16K328 tok/s0.1 sPDF: CodeLlama 7B HF on 4× H200 NVL report
8× H200 NVL8-bit16K328 tok/s0.1 sPDF: CodeLlama 7B HF on 8× H200 NVL report

Best fit is the highest quality, up to 8-bit, that leaves 16K of context. First reply is the wait for a 2K prompt. Speeds are rough, plus or minus 25%.

How to run it

llama.cpp
llama-server -hf TheBloke/CodeLlama-7B-GGUF
vLLM
vllm serve codellama/CodeLlama-7b-hf
MLX (Mac)
mlx_lm.chat --model mlx-community/CodeLlama-7b-hf-4bit-mlx

Questions

How much VRAM does CodeLlama 7B HF need?

CodeLlama 7B HF needs 3.8 GB for its weights at 4-bit, 8.4 GB with an 8K context and 12.4 GB with 16K. At 8-bit, 11.3 GB.

What is the minimum VRAM for CodeLlama 7B HF?

About 7.7 GB at 3-bit with an 8K context, the lowest precision we recommend for a model this size. The smallest machine here that runs it without spilling is the RTX 4060 Ti 16 GB.

How big is CodeLlama 7B HF?

6.7B parameters: 12.6 GB of weights at 16-bit, 3.8 GB at 4-bit.

Can CodeLlama 7B HF run on an RTX 4090?

Yes. At 8-bit it holds 16K of context and writes about 92 tokens a second.

More models