Llama 3.1 8B squeezed into a common 4-bit format weighs about 5 GB. Almost any modern gaming card can hold that. So why would the same model need well over 17 GB once a coding agent gets hold of it?
The short answer is context. An agent that reads 32,000 tokens of your repo and juggles four tasks at once has to keep all of that in memory, and the model’s weights are only a small part of the bill. Whether you run open-weight models at home or rent bigger cards from a cloud provider like Xesktop, that hidden cost decides what actually runs. Below is how GPU memory for AI models really gets spent, and how to plan for it.
Weights Are the Easy Part
Each parameter at 16-bit precision takes two bytes. Multiply that by the number of parameters, and a 7B model needs around 14 GB, a 32B model around 64 GB, and a 70B model about 140 GB. Quantize to 4-bit, and those numbers drop to roughly 3.5, 16, and 35 GB.
Real files come in a bit heavier, though. A Q4_K_M GGUF averages closer to 4.85 bits per weight, since some tensors keep higher precision. That’s why a “4-bit” 32B model, which looks perfect for a 24 GB card, can disappoint. A Q4_K_M build of Qwen3-32B sits near 20 GB before you’ve typed a word.
Then the runtime wants its share. Compute buffers, the CUDA or Metal context, and scratch space also claim memory. And the biggest variable hasn’t even shown up yet.
Meet the Cache That Keeps Growing
Transformers cheat a little to stay fast. While generating text, they store the keys and values for every token already processed, so attention doesn’t get recalculated from zero at each step. That store is the KV cache. It’s a smart trade, but every token you add costs memory, and the model’s architecture sets the price.
Take Llama 3.1 8B. It has 32 layers, 8 KV heads, and a head dimension of 128, which works out to 128 KiB per token with an FP16 cache. Doesn’t sound like much. Watch what happens as the context fills:
| What the model is doing | KV cache (FP16) |
| Quick chat, 8K tokens | 1 GiB |
| Reading a long document, 32K tokens | 4 GiB |
| Full 128K context window | 16 GiB |
| Agent running 4 tasks at 32K each | 16 GiB |
Compare the last row with those 5 GB of weights. Three times bigger, and the model hasn’t changed one bit.
Agents Spend Memory Faster Than Chatbots
A person chatting with a model adds a few hundred tokens at a time. Agents rarely work that gently. A coding agent may load entire files, test logs, and tool output before writing anything. Research agents pull in search results and full page text. Plenty of frameworks split a job across sub-agents or parallel calls, and each live sequence carries its own cache.
Picture a made-up but believable week. A developer tries a local agent on a 16 GB card, sends a short prompt, gets a fast answer, and rolls it out to the team. A few days later, three colleagues ask it to summarize a big codebase at the same moment. Out-of-memory error. Nobody touched the model.
That pattern will only get more common as work drifts toward the emerging agentic web. Long contexts and parallel calls are turning into normal traffic, so a GPU sized for a tidy demo can fall short on an ordinary Tuesday.
Why Similar Models Can Behave So Differently
Parameter count won’t tell you how hungry the cache gets. Attention design does.
Grouped-query attention lets several query heads share one set of keys and values, which keeps the cache smaller than in older multi-head designs. Sliding-window attention limits how far back some layers look, so their slice of the cache stops growing after a fixed number of tokens.
Mixture-of-experts models trip people up for a different reason. Only some experts fire for each token, which makes them feel light. Every expert still has to be stored, though, so memory needs track the total parameter count.
And sometimes the numbers that look different don’t matter at all. Qwen2.5-32B uses 40 attention heads and Qwen3-32B uses 64. Both, however, have 64 layers and 8 KV heads, which gives them identical FP16 caches: about 2 GiB at 8K tokens and 8 GiB at 32K for one sequence. Four 32K sequences push either one to 32 GiB, stacked on top of the weights.
“It Loads” Isn’t the Same as “It Works”
Imagine 12 GB of quantized weights on a 16 GB card. Four spare gigabytes feels comfortable until buffers and cache start eating into it. When memory runs short, llama.cpp and Ollama can shift layers into system RAM so the model keeps going. You’ll get answers, just slower ones, sometimes much slower, because data keeps crossing between CPU and GPU memory.
Agents feel that slowdown more than chat users do. A single task can chain many model calls, so a lag you’d barely notice in a chat window can turn a short job into a long one and trip timeouts in the tools around it.
Shared use makes things tighter still. Four users can share one copy of the weights, but each of their sequences needs its own cache. What feels snappy for one person may crawl as a team service. In production, the real test is whether speed holds up under the load you expect.
Estimate First, Then Test
A useful estimate covers weights, KV cache, compute buffers, and a runtime reserve, with some headroom on top. Working it out by hand means opening each model’s config file and hunting for layer counts, KV heads, and head dimensions. Tedious.
Xesktop’s free LLM VRAM calculator does most of that for you. Pick a preset or enter your own architecture values, choose a quantization, then set tokens per sequence and how many sequences run at once. It breaks the result into weights, cache, and overhead, checks it against a long list of NVIDIA, AMD, and Intel cards, and suggests a VRAM tier. Agent builders will like two things in particular: it can model an 8-bit or 4-bit attention cache (backend support permitting), and it sizes MoE models on total parameters with inactive experts counted.
It’s also honest about what it leaves out. The page calls its output a planning target, excludes training, and notes that multimodal encoders, speculative decoding and multi-GPU sharding can add more memory. So take its figure as your floor. After that, replay a real agent session at your longest realistic context with your expected number of parallel tasks, and watch what the GPU actually does.
Should You Buy or Rent?
Already own a card that handles your workload with room to spare? Use it. If you mostly run a 7B or 8B model, buying hardware for a 70B model you’ll test once a month rarely pays off.
Renting makes more sense for spikes and one-off experiments. Xesktop, as one example, lists a single RTX PRO 6000 Blackwell with 96 GB of VRAM for $1.99 an hour and a two-GPU node with 192 GB for $3.98 an hour, billed per second, with volume discounts available. Keep two caveats in mind. Its servers are remote Windows workstations, so make sure your inference stack runs well on Windows first. And two 96 GB cards won’t merge into one 192 GB pool on their own; your engine has to split the model across them.
Watch the extras, too. Setup time, storage and sessions someone forgot to shut down can quietly outgrow the hourly rate. Even raw capacity has become political, with data-center skeptics winning elections in several states this year.
The Question to Ask Before Buying
Forget the download size for a moment. Think about the longest context your agent will build and how many tasks it’ll run side by side, then add headroom. A model that loads cleanly on day one proves very little. What will your agent need to hold in memory on its busiest afternoon, and can your GPU keep up?
Related: ChatGPT Lost to a 1979 Atari at Chess. Did Newer AI Models Do Better?
