Everyone talks about VRAM, but system RAM decides what happens when a model does not fit on your graphics card. Too little and ComfyUI crashes, Ollama crawls, or Windows freezes while it swaps to disk.
RAM is also expensive in 2026, so buying too much hurts as well. This guide gives clear numbers for local LLMs and ComfyUI, explains why MoE models changed the maths, and shows how to check what you actually use.
- 16 GB: only if your models fit fully in VRAM. Tight for ComfyUI.
- 32 GB: the real minimum for local AI. Fine for SDXL, Flux and 7B-27B LLMs that fit on the GPU.
- 64 GB: the sweet spot. Wan 2.2 video, Qwen-Image with fp8 files, and MoE models like gpt-oss-120b with offload.
- 128 GB: for 100B+ MoE models such as Qwen3.8-Flash-Next (66-94 GB quants) on a 16-32 GB GPU.
- Quick formula: RAM needed is roughly model files that do not fit in VRAM + 8 GB for Windows + 4-8 GB headroom.
- Speed: use 2 sticks in dual channel. 4 sticks of DDR5 often run slower.
Why RAM Matters When You Have a GPU
A model has to pass through system RAM on its way to the GPU. When it is too big for VRAM, part of it stays in RAM and the CPU or the GPU reads it from there.
- Loading: safetensors and GGUF files are read from disk into RAM (often memory-mapped) before they reach VRAM.
- Offloading: llama.cpp, Ollama and LM Studio put layers that do not fit on the GPU into RAM.
- Caching: ComfyUI keeps recently used models in RAM so the next run does not reload them from disk.
- Block swap: video workflows move transformer blocks between RAM and VRAM every step.
When RAM runs out, Windows falls back to the pagefile on your SSD, which is many times slower. That is the “everything freezes” moment.
Quick Answer: RAM by Use Case
| RAM | Local LLMs | ComfyUI | Verdict |
|---|---|---|---|
| 16 GB | Models that fit fully in VRAM (up to ~14B Q4 on a 12 GB card) | SD 1.5, SDXL with care | Entry only |
| 32 GB | Up to ~30B dense if mostly on GPU; small MoE like 35B-A3B (~24 GB) | SDXL, Flux fp8, Qwen-Image 2.1 int8, LTX GGUF | Minimum I recommend |
| 64 GB | 70B Q4 (~42 GB) with offload, gpt-oss-120b (~63 GB) on a tight setup | Wan 2.2 14B fp8 pair, Qwen-Image fp8, MiniMax H3 with block swap | Best value |
| 96 GB | 100B+ MoE at Q2-Q3 | Heavy video runs without paging | Good middle step |
| 128 GB | Qwen3.8-Flash-Next IQ3/IQ4 (84-94 GB) with a 16-32 GB GPU | Several big models cached at once | Power users |
| 192 GB+ | Q5/Q8 of 125B+ MoE, 200B+ models | Rarely needed | Workstations |
Note: these are planning numbers built from model file sizes, not my own benchmark results. Your exact usage depends on quant, context length, resolution and frame count.
The Simple RAM Formula
Two worked examples:
- gpt-oss-120b (~63 GB) on a 16 GB card: about 14 GB of weights on the GPU, ~49 GB in RAM, plus 8 GB system, plus headroom = 64 GB is the bare minimum, 96 GB comfortable.
- Wan 2.2 I2V on a 16 GB card: two 14.3 GB fp8 experts + ~6.7 GB umt5 fp8 text encoder ≈ 35 GB of files. ComfyUI caches them in RAM, so 64 GB avoids paging.
For the VRAM side of the same maths, see my How much VRAM do I need guide.
RAM for Local LLMs (Ollama, LM Studio, llama.cpp)
For a dense model, every token reads every weight. If 30% of the model sits in RAM, generation speed drops sharply because RAM is roughly 10x slower than VRAM.
| Model (Q4_K_M) | File size | 16 GB GPU + RAM needed | 24-32 GB GPU + RAM needed |
|---|---|---|---|
| 8B dense | ~5 GB | 16 GB (fits on GPU) | 16 GB |
| 27B dense (e.g. Qwen3.8-27B) | ~17 GB | 32 GB (small spill) | 32 GB |
| 35B-A3B MoE | ~24 GB | 32-48 GB | 32 GB |
| 70B dense | ~42 GB | 64 GB (slow) | 48-64 GB |
| gpt-oss-120b MoE | ~63 GB | 64-96 GB | 64 GB |
| Qwen3.8-Flash-Next UD-IQ4_XS | 93.7 GB | 128 GB | 96-128 GB |
Context length adds memory too. A rough rule is about 1 GB per 10B parameters for 8K tokens and about 4 GB at 32K. Long contexts on big models can need 10-20 GB more.
Tip: Ollama and LM Studio split models automatically. If speed is terrible, check how many layers landed on the GPU before buying more RAM. My Ollama vs LM Studio vs llama.cpp guide shows where to see this.
MoE Models: Why 128 GB Became Useful
Mixture-of-experts models store many experts but use only a few per token. Qwen3.8-Flash-Next has 125B parameters but about 6B active per token, so experts can sit in RAM while staying usable.
llama.cpp has a flag built for this. --n-cpu-moe N keeps the expert weights of the first N layers in RAM and everything else on the GPU:
llama serve -m Qwen3.8-Flash-Next-UD-IQ4_XS.gguf -ngl 99 --n-cpu-moe 36 -c 32768
- Raise N if you run out of VRAM; lower it until VRAM is almost full for best speed.
- Total RAM + VRAM must hold the whole file plus context, so a 94 GB quant needs 128 GB RAM with a 16-32 GB GPU.
- Bandwidth matters more than capacity once it fits; see the speed section below.
I cover a full working setup for a 2x 16 GB + 128 GB rig in my Qwen3.8-Flash-Next local guide.
RAM for ComfyUI Image and Video
ComfyUI loads every model in a workflow (diffusion model, text encoder, VAE, LoRAs) and keeps them cached in RAM. Add up the file sizes to estimate your need.
| Workflow | Main files (approx.) | Recommended RAM |
|---|---|---|
| SDXL | ~7 GB checkpoint | 16-32 GB |
| Qwen-Image 2.1 (int8) | 7.26 GB model + 9.35 GB Qwen3-VL text encoder | 32 GB |
| Qwen-Image / Edit 2511 fp8 | 20.5 GB model + 9.38 GB text encoder | 48-64 GB |
| Qwen-Image bf16 | 40.9 GB + 16.6 GB | 96 GB+ |
| Wan 2.2 14B I2V fp8 (high + low) | 2x 14.3 GB + ~6.7 GB umt5 | 64 GB |
| Wan 2.2 5B TI2V fp16 | 10 GB + text encoder | 32 GB |
| Video with block swap and upscaling | Several models cached | 64-96 GB |
One public report on a 64 GB Windows 11 PC showed a Wan workflow using about 45 GB physical and 75 GB committed memory, against an 80 GB commit limit. That is why 32 GB systems hit errors on video even with a big GPU.
Warning: do not disable the Windows pagefile on an AI PC. When committed memory hits RAM + pagefile, allocations fail with errors even if Task Manager shows free RAM.
Does RAM Speed Matter? Channels, DIMMs and Bandwidth
Once a model spills into RAM, memory bandwidth sets your token speed. Desktop dual-channel DDR5 tops out around 90-100 GB/s, while an RTX 5090 has well over 1 TB/s.
- Dual channel beats single stick: 2x 16 GB is 30-50% faster for CPU inference than 1x 32 GB.
- Faster DDR5 helps: moving from DDR5-4800 to 6000 gave about 20-23% faster CPU token generation in Corsair’s tests on 7-8B models.
- Four DIMMs often slow down: DDR5 boards usually lower the speed with four sticks. Two 48 GB or 64 GB sticks are better than four 32 GB.
- More channels win: workstation platforms (Threadripper, Xeon) with 4-8 channels give several times the bandwidth.
| Where the weights live | Typical speed for a mid-size model |
|---|---|
| Fully in VRAM | 40+ tokens/s |
| Partly in fast dual-channel RAM | 8-15 tokens/s |
| Spilling to SSD pagefile | 5-30x slower again |
Macs and Unified Memory
On Apple Silicon, RAM is VRAM. A 64 GB Mac can give most of it to the GPU, with far higher bandwidth than PC DDR5 (hundreds of GB/s on Max and Ultra chips).
- Rule: buy about 25% more unified memory than the model file, because macOS keeps a share for itself.
- Same idea on PC: AMD Ryzen AI Max+ 395 machines with 128 GB LPDDR5X-8000 can assign up to 96 GB to the GPU.
The full comparison is in my Mac vs PC for local AI guide.
How to Check How Much RAM You Use
- Windows: open Task Manager (Ctrl+Shift+Esc), Performance, Memory. Watch In use and Committed while a workflow runs.
- Linux: run
free -horhtop; check swap usage too. - macOS: Activity Monitor, Memory tab; yellow or red memory pressure means you need more.
- Ollama:
ollama psshows the CPU/GPU split, for example “48%/52% CPU/GPU”. - GPU side:
nvidia-smishows VRAM; my VRAM check guide covers every tool.
If committed memory is above your installed RAM during normal runs, you are paging and will benefit from more RAM.
How to Use Less RAM
- Pick smaller quants: fp8 or int8 instead of bf16 halves model size; GGUF Q4/Q5 halves it again.
- Use fp8 text encoders: umt5 fp8 or qwen_2.5_vl_7b fp8 instead of fp16 saves 7-10 GB.
- ComfyUI flags:
--cache-noneor--cache-lru 2stop it caching every model; see my ComfyUI launch flags guide. - Shorter context: set
-c 8192or Ollama’snum_ctxlower when you do not need long chats. - Close the browser: Chrome with many tabs can take 4-8 GB.
- Linux: uses a few GB less than Windows for the same job.
Buying Advice and 2026 Prices
RAM prices more than doubled through 2026 because memory makers shifted to AI data-centre chips. October 2026 street prices from my RAM price guide:
| Kit | Approx. price (Oct 2026) | Good for |
|---|---|---|
| DDR5-6000 32 GB (2×16) | about $454 | Image generation, LLMs that fit in VRAM |
| DDR5-6000 64 GB (2×32) | about $915 | Video, 70B and 120B-class offload |
| 96-128 GB (2×48 / 2×64) | $1,400-$2,000+ | 100B+ MoE models |
| DDR4-3200 64 GB | about $489 | Upgrading an older AM4 or Intel 12th-gen PC |
- Buy 2 sticks so you can add more later or keep full speed.
- VRAM first: if your budget is fixed, more VRAM speeds up everything; extra RAM only prevents crashes and enables offload.
- Check your board’s QVL for high-capacity DDR5 kits before buying.
Troubleshooting RAM Problems
ComfyUI closes or shows “Reconnecting” when loading a big model
The Python process ran out of memory and was killed. Increase the pagefile, switch to fp8 or GGUF files, or try --cache-none. My ComfyUI reconnecting fix guide lists the other causes.
“DefaultCPUAllocator: not enough memory” or “Unable to allocate”
This is system RAM, not VRAM. Check committed memory in Task Manager and raise the pagefile or reduce model sizes.
Ollama is very slow and ollama ps shows a big CPU share
The model spilled into RAM. Use a smaller quant, cut context with num_ctx, or switch to an MoE model that offloads well.
llama.cpp fails to load with “failed to allocate buffer”
RAM plus VRAM is too small for the file plus context. Reduce -c, raise --n-cpu-moe on MoE models, or pick a smaller quant.
New 4x 32 GB kit made everything slower
The board probably dropped the memory speed with four DDR5 sticks. Check the speed in Task Manager and consider 2x 64 GB instead.
My Take
For most people building a local AI PC in 2026, 64 GB of dual-channel DDR5 is the point where crashes stop and video workflows become pleasant. Start with 32 GB only if you mostly generate images and run models that fit in VRAM.
Go to 128 GB when you specifically want to run 100B+ MoE models like Qwen3.8-Flash-Next locally. With RAM prices this high, make sure that is a workload you will really use.
FAQ
Is 32 GB of RAM enough for local AI?
Yes for image generation and LLMs that fit fully in VRAM. It gets tight for Wan 2.2 video and for any model that needs to offload into RAM.
Is 64 GB of RAM enough for local LLMs?
For most users, yes. It runs 70B Q4 with offload and MoE models up to around gpt-oss-120b on a 16-24 GB GPU. 100B+ MoE models at good quants need 96-128 GB.
Does system RAM count as VRAM?
No. Models can spill into RAM, but it is about ten times slower than VRAM, so speed drops. Only Apple Silicon and similar unified-memory chips share one pool.
How much RAM do I need for ComfyUI?
32 GB for SDXL, Flux and Qwen-Image 2.1 int8; 64 GB for Wan 2.2 14B video and fp8 Qwen-Image; 96 GB+ for bf16 models or heavy video chains.
Is RAM speed or size more important for AI?
Size first, because running out causes crashes. Once you have enough, speed and dual-channel setup decide how fast offloaded models run.
Should I use 2 or 4 RAM sticks?
Two larger sticks. Four DDR5 sticks often force lower speeds, which slows models that offload to RAM.
How much RAM do I need for 128 GB-class models like Qwen3.8-Flash-Next?
About 128 GB of RAM with a 16-32 GB GPU for the IQ3 or IQ4 quants (84-94 GB files). Q5 and Q8 need 192 GB or more in total.




