Under the hood · 2 of 8 Local models

Will this model run on my machine?

To run, a model has to fit in your graphics card's memory: all of its numbers, plus a cache that grows with every token of the conversation. Pick a model, its precision and how long you chat, and see what fills the card.

Three Qwen3 models, each on a common card:

What sits on your 0 GB card

Longer chats, more memory

Qwen3-8B at 4 bits. Solid: a 16-bit cache. Dashed: an 8-bit cache. Shaded: does not fit.

Longest chat that fits, by bits per number

The same card with each model, at 4 bits

The model's numbers The context cache The runtime Your card
Model
Graphics card memory: 12 GB 6 to 48 GB
Bits per number: 4 2 to 16
Context: 32,768 tokens (num_ctx) 1k to 128k
Cache stored in

Loading the engine…

The model's numbers

–

Set once, when the model loads.

The context cache

–

for every token of the chat.

Longest chat that fits

–

On this card, with these settings.

Two things fill the card

The model's numbers take a fixed amount, set by its size and how many bits each number gets. The context cache grows with the conversation.

The cache grows with every token

For each token the model keeps a key and a value in every layer, so it does not have to reread the whole chat for the next word. Twice the context, twice the cache.

Shared heads, smaller cache

The Qwen3 models here read with 32 or 64 heads but keep only 8 sets of keys and values (grouped-query attention). That cuts the cache by four to eight times.

The trap

A model that loads feels like the hard part is over. Then a long chat or a pasted document fills the cache, and the same model slows to a crawl or stops.

Open Under the hood for the two formulas, with your numbers in them.

Why knowing this helps you

Memory decides which model you can run and how long you can talk to it. A few settings move the limit a long way.

Set the context you need

Runners reserve the cache for the full context you set (num_ctx in Ollama, --ctx-size in llama.cpp). Ollama picks 4k, 32k or 256k by default from your graphics memory. Setting 128k when your chats are 8k wastes memory you could spend on a bigger model.

Store the cache in 8 bits

An 8-bit cache halves its size for a small loss. In llama.cpp it is --cache-type-k and --cache-type-v, and an 8-bit value cache needs flash attention, which recent builds turn on for you. In Ollama it is the OLLAMA_KV_CACHE_TYPE setting.

Leave room for the chat

A rough rule this page uses: pick a model whose numbers take about two thirds of the card. The rest goes to the cache and the runtime.

Watch for spilling

If words suddenly come out much slower, part of the model has moved to ordinary memory. Shorten the context or use fewer bits.

Checked on 2026-10-07 against the llama.cpp server docs and source, Ollama's FAQ, context-length docs and settings, and the Qwen3 configs. The 0.5 GB runtime overhead and the two-thirds rule are this page's own assumptions. A llama.cpp log for an 8B model shows a 0.26 GB working buffer at a 512-token context, and that buffer grows with the batch and context. Ollama reserves no extra by default (OLLAMA_GPU_OVERHEAD is 0).

Where this goes next

Next: embeddings

The cache keeps keys and values worked out from each token. They all start from one list of numbers per token, looked up in a table: its embedding.

Then: sampling settings

At the other end, the model turns its numbers back into odds for every token. Settings decide which one it picks.

Every size on this page comes from a C engine compiled to WebAssembly. The model shapes are Qwen3's published configs; the runtime overhead is a rough figure, and real runners vary.