codellama · text

CodeLlama-34b-instruct-hf

codellama/CodeLlama-34b-instruct-hf

CodeLlama-34b-instruct-hf at Q4_K_M is exactly 20,219,900,064 bytes (18.83 GiB / 20.22 GB) — an effective 4.794 bits per weight, not the nominal 4. Its KV cache at 32K is 6.00 GiB.

From the file· summed from 1 file(s)From the file· KV per layer
Parameters
33.7B
Architecture
llama
48 layers
Context
16,384
native (config.json)
License
llama2

Shipped quantizations

exact bytes, summed from published files
QuantSizeExact bytesEffective bpwTensorsPublisher
Q2_K13.23 GiB14,210,674,8483.369TheBloke
Q3_K_S13.60 GiB14,605,349,0243.463TheBloke
Q3_K_M15.17 GiB16,283,594,9123.861TheBloke
Q3_K_L16.55 GiB17,771,524,2564.213TheBloke
Q4_017.74 GiB19,052,048,5444.517TheBloke
Q4_K_S17.83 GiB19,146,420,3844.539TheBloke
Q4_K_M18.83 GiB20,219,900,0644.794TheBloke
Q5_021.64 GiB23,237,177,5045.509TheBloke
Q5_K_S21.64 GiB23,237,177,5045.509TheBloke
Q5_K_M22.20 GiB23,838,797,9845.652TheBloke
Q6_K25.78 GiB27,683,877,0246.563TheBloke
Q8_033.39 GiB35,856,052,3848.501TheBloke

KV cache by context

computed per layer
ContextKV cache (f16)Flat formulaOverstated byFull / windowed / recurrent
4,0960.75 GiB0.75 GiB48 / 0 / 0
8,1921.50 GiB1.50 GiB48 / 0 / 0
16,3843.00 GiB3.00 GiB48 / 0 / 0
32,7686.00 GiB6.00 GiB48 / 0 / 0
65,53612.00 GiB12.00 GiB48 / 0 / 0
131,07224.00 GiB24.00 GiB48 / 0 / 0

Compare with

same modality, comparable size

Will it run on your card?

full quant x context sweep

Why other calculators give a different number

A parameters × bits ÷ 8 estimate puts Q4_K_M at roughly 17.68 GiB. The real file is 18.83 GiB, because a quantization is a mixture and some tensors are always kept at higher precision.

Architecture

from config.json
Layers
48
Attention heads
64
KV heads
8
Head dim
128
Hidden size
8192
Vocab
32,000
Sliding window
none
SWA period
MLA
no
Experts
Experts per token
use_sliding_window

Questions people ask

How much VRAM does CodeLlama-34b-instruct-hf need?
Q4_K_M is exactly 20,219,900,064 bytes (18.83 GiB) in weights. Add the KV cache, which depends on your context length, plus roughly half a gigabyte of runtime overhead.
How large is CodeLlama-34b-instruct-hf's KV cache?
6.00 GiB at 32K context with an f16 cache, computed per layer. Quantizing the cache to q8_0 roughly halves it, which is often the difference between a context length fitting and not.
Which quantization of CodeLlama-34b-instruct-hf should I use?
Q4_K_M is the usual default. Pick the largest quantization that fits your card at the context you actually need — the table above gives exact sizes for every one published.