VRAMfit guide

How the VRAM number is built and what to cut when it does not fit. Read it once before you trust the result.

How is the needed VRAM calculated?

Needed VRAM is weights plus KV cache plus runtime overhead.

Weights are the parameter count times bits per weight, divided by 8. Llama 3.1 8B at Q4_K_M comes out to 4.58 GiB, the same as the llama.cpp docs.

KV cache grows with context length. Double the context and the KV cache doubles.

Runtime overhead is a 1 GiB guess. That one is an assumption, not a formula result.

Which quant should you pick?

A bigger number means closer to the original and a bigger file. Q8_0 is close to FP16 at about half the weights.

Q4_K_M is the usual balance of size and quality. Weights are a little over 30% of FP16.

Q3_K_M and Q2_K are for when memory runs out. Expect a quality drop.

This tool does not measure quality. It only calculates size.

How do context length and KV cache work?

Context length is how many tokens the model holds at once. The longer it is, the more KV cache you pay for.

KV heads decide the cache size per layer. GQA models have few KV heads, so their cache is small.

llama.cpp can store the KV cache as q8_0 or q4_0. The flags are --cache-type-k and --cache-type-v.

Quantizing the V cache needs flash attention turned on.

What if it says it does not fit?

Cut the context first. 8,192 tokens is enough for most chats.

Then drop one quant level. Switching the KV cache to q8_0 also helps.

If it still does not fit, offload some layers to CPU. The -ngl value in llama.cpp sets how many layers stay on the GPU. It runs, but slower.

This tool does not calculate speed. Measure how much slower offloading is on your own machine.

Where do your picks go?

Your picks are calculated in this browser. They are not sent or stored.

Copy link puts your picks after the # in the address. Browsers do not send anything after # to the server.

The server only gets anonymous step signals. It does not get which model you picked.