What Is a KV Cache in Local LLMs and Why Does It Use So Much VRAM?
A KV cache stores the key and value tensors for every token already in the sequence, at every attention layer, so the model does not reprocess the…
TAGGED GUIDES
Explore the guides, ideas, and practical explanations in this topic.
13 published articlesA KV cache stores the key and value tensors for every token already in the sequence, at every attention layer, so the model does not reprocess the…
VRAM usage is not one number. Device-level tools such as nvidia-smi, per-process NVML queries, framework allocator stats, and breakdown tools like LLM Inspector each answer a different…
Ollama's context length controls how many tokens a model can process at once, and the KV cache is the memory that stores those tokens. Configure it with…
Prompt caching saves money when repeated requests share a long, stable prompt prefix and hit the cache often enough to outweigh any cache-write premium. It is most…
At 4-bit quantization, budget roughly 2 GB for a 3B model, 5 GB for a 7–8B model, 8 GB for a 13–14B model, and 40 GB for…
Prompt caching lets an API reuse the saved key-value state of an unchanged prompt prefix, cutting input-token costs and time-to-first-token. This guide explains what is actually cached,…
Prompt caching and prefix caching both reuse the key-value (KV) state a model already computed for an unchanged prompt prefix, so a new request can skip that…
Raising a local model's context window from 2K to 32K changed generation speed by essentially nothing in a published llama.cpp sweep, but added about 1.7 GB of…
Quantization rewrites a model's weights in lower precision while leaving its architecture, tokenizer, and parameter count intact. The memory savings are predictable; the quality cost is not,…
Choosing a local AI model is a hardware-fit problem before it is a model-quality problem. Define the job, find your real memory budget, estimate weights plus KV…
When you run a local LLM, VRAM is where inference happens on the GPU, while system RAM provides capacity for loading models, CPU inference, and offloading. Both…
Large language models are next-token predictors, and almost every practical constraint they have follows from four ideas: how text becomes tokens, how the context window limits what…