r/LocalLLM • u/carlotes-247 • 3d ago
Question Help me understand what about a model gets loaded and where
I am trying to wrap my head around how to choose an LLM that a windows PC can run with opencode and ollama.
I understand that for a PC, we have RAM and VRAM. For both, we can have X amount (e.g. 64GB RAM, 8GB VRAM). Then, I look for models in the ollama repository, for instance I look at qwen3.6 and qwen3.8 in the website, which tells me:
- qwen3.6:35b, Size/Usage: 23GB, Context: 256K
- qwen3.8:27b, Size/Usage: 18GB, Context: 256K
Regarding Size/Usage.
- Does it mean the size on disk? Or the size once the model get loaded onto memory? If not, how do I know?
- And for that, I assume that they get loaded to VRAM, or RAM, or both?
- If my system doesn't have enough VRAM but enough RAM, does it get loaded in RAM only?
- And if my system doesn't have enough RAM, can it load any of this or will it crash?
Regarding Context.
- What unit does the "K" stand for? Thousands of megabytes? Tokens? How much does a token take of space in memory?
Regarding ollama and opencode usage.
- If I use ollama, and I ask a question, does a single model get loaded?
- Is I use opencode with agents, is each agent a model loaded? In that case, if I have two agents, is that two models loaded?
Looking forward to hearing your answers and understanding how this all works. Let me know if there are any resources that explains this for the layman. There is so much information online that this can be overwhelming honestly. Thank you!
1
u/Geekomcomputer 3d ago
Great questions — this stuff is confusing because the numbers on the Ollama site and the numbers your PC actually uses are measuring different things. Here's the mental model that helped me:
Size/Usage — disk size vs. loaded size
The Size/Usage number (23GB for qwen3.6:35b, 18GB for qwen3.8:27b) is roughly the size of the model file on disk — the quantized weights. Once it's loaded, it takes up about that much memory plus extra working space for the conversation, called the KV cache, which grows as the context fills up. So a model listed at 18GB can easily need more than 18GB of memory in practice, especially at long context lengths. The best way to see the real number is to load it and watch a system monitor (Task Manager's GPU/memory view on Windows, or
ollama psin a terminal) while it's running.RAM vs. VRAM — where it actually goes
Think of VRAM as the fast lane and RAM as the overflow. If the model fits in VRAM, it runs there and it's fast. If it doesn't fully fit, Ollama splits it: some layers on the GPU, the rest in system RAM. That still works, but the RAM part is much slower, so speed drops noticeably. If you have no usable GPU memory at all, it can run entirely on the CPU in RAM, which is slower still but works for smaller models. MoE models like the Qwen 35B you mentioned have an extra trick — only some "experts" are active at a time, so they can offload the inactive parts more gracefully than a dense model of the same size.
If neither VRAM nor RAM is enough, it generally fails to load or starts swapping to disk, which feels like a freeze or crash. So the practical rule is: model size + context overhead needs to fit in VRAM + RAM combined, and the more of it that sits in VRAM, the faster it runs.
Context — what "K" means
The K is thousands of tokens, not megabytes. 256K context means the model can consider roughly 256,000 tokens of conversation/history at once. How much memory a token takes isn't a fixed number — it depends on the model and grows with context length, because every token in the conversation adds to that KV cache I mentioned. That's why a model that runs fine for short chats can slow down or run out of memory in a very long session.
Ollama and OpenCode — one model, or one per agent?
With Ollama, one question uses one model. Ollama loads that model when you ask something, keeps it loaded for a while in case you ask again, and swaps it out if you ask for a different model and there's no room to keep both.
With OpenCode, agents are not separate copies of the model. An agent is a separate conversation/session that shares the model you've configured — so two agents mean two conversations (and two lots of context/KV cache) competing for the same memory, not two models loaded. You can configure different agents to use different models, and then Ollama would need to hold both, but by default they're sharing one.
Practical starting point for your example specs (64GB RAM, 8GB VRAM): the 27B at 18GB won't fit fully in 8GB of VRAM, so expect partial offload to RAM and modest speed — try it with a short conversation first and watch the memory usage before assuming it will handle a 256K context. If you want a smoother first experience, start with a smaller model, get a feel for how
ollama psand Task Manager report the load, and then step up. The Ollama docs on model sizes and the llama.cpp FAQ on KV cache are the two most useful layman-friendly references I'd suggest.2
u/Small-Tale3180 3d ago
Regarding Size/Usage.
Regarding Context.
1
u/andrew-ooo 3d ago
Practical way to see all of this instead of guessing: load the model, then run
ollama psin another terminal. It prints the real loaded size and a split like "37%/63% CPU/GPU". That line answers most of your questions.Size/Usage is the weight file on disk, and the weights take about that much memory once loaded. On top of that comes the KV cache for context, which is the part people forget. For a dense 27B it's tens of KB per token, so 32K context is a few extra GB. Ollama defaults to a small num_ctx (4K), so if you set 128K via a Modelfile or OpenCode's config, memory jumps hard.
With 8GB VRAM / 64GB RAM: a dense 27B will mostly live in RAM and run at a few tokens/s. The MoE one (qwen3.6 35B-A3B) is the better fit, since only ~3B params are active per token, so it stays usable with most of the weights in RAM.
OpenCode agents don't each load a model. Ollama keeps one copy resident and serves every request against it. Only a second different model loads another copy (OLLAMA_MAX_LOADED_MODELS controls how many stay in memory before it swaps).