Qwen3 VRAM & GPU Calculator (0.6B to 480B)
Estimates the GPU memory each Qwen3 model needs as weights plus KV cache plus overhead. Weights are parameters times bits per weight divided by 8; the cache is 2 × layers × KV heads × 128 × bytes for every token and sequence; overhead is 20% of the weights on the GPU. The default 40,960-token context is the window Qwen3's config files set. For mixture-of-experts models, a checkbox moves the experts to system RAM, as llama.cpp's --cpu-moe does.
Pick a Qwen3 model, the format its weights are stored in, how many tokens of context each request holds and how many requests run at once. The calculator adds up the weights, the KV cache those requests keep and an allowance for the runtime, then shows how many of ten common GPUs it takes. A second table sizes every Qwen3 model in four formats at the same settings, and for the three mixture-of-experts models a checkbox moves the experts into system RAM, as llama.cpp can. The math runs in your browser and nothing you type is sent anywhere.
How the estimate works
Inference memory has three parts: the weights, the KV cache, which keeps a key and a value for every token in every layer, and an allowance for everything else.
total = parameters × bits ÷ 8 + 2 × layers × KV heads × 128 × bytes × tokens × sequences + overhead
The Qwen3 technical report describes grouped-query attention, in which several query heads share each key-value head, and every Qwen3 config sets that head to 128 values. The dense models and Qwen3-Coder have 8 KV heads, the other two mixture-of-experts models 4. FP8 and INT4 keep the embeddings and output layer at 16-bit, as Qwen's AWQ files and dense FP8 files do, while the GGUF formats quantize everything at a flat rate. The overhead is 20% of the weights on the GPU unless you change it, after EleutherAI's April 2023 rule of thumb that inference takes about 1.2 times the model's memory, the extra being "≤ 20%" in its authors' experience.
The defaults run Qwen3 30B-A3B as GGUF Q4_K_M, 4.8944 bits a weight, with a 40,960-token context and one sequence. Its 30,532,122,624 parameters take 17.40 GiB. Each token costs 2 × 48 layers × 4 KV heads × 128 × 2 bytes, which is 96 KiB, so 40,960 tokens add 3.75 GiB. The allowance is 3.48 GiB and the total 24.63 GiB, just over a 24 GB RTX 4090: two of them at 51%, or one 32 GB RTX 5090 at 77%. An 8-bit cache cuts the total to 22.75 GiB, one RTX 4090 at 95%.
Total and active parameters
Sparsely gated mixture-of-experts layers, the kind Qwen3 uses, were introduced in a January 2017 paper by Noam Shazeer, Geoffrey Hinton, Jeff Dean and colleagues: "up to thousands of feed-forward sub-networks", with a trainable gate choosing a few of them for each example. Qwen released Qwen1.5-MoE-A2.7B in March 2024, a model with "2.7 billion activated parameters", and its announcement already mentioned "the increased memory requirements associated with MoE models". Qwen3's two mixture-of-experts models have "128 total experts with 8 activated experts per token" and, unlike Qwen2.5-MoE, no shared experts.
So the A in a name counts work, not memory. 30B-A3B's 48 layers hold 6,144 experts with 28.99 billion parameters between them. A token uses 8 per layer, 1.81 billion, plus the 1.54 billion outside the experts: 3.35 billion, the "3.3B activated" on its model card. All 30.53 billion must stay loaded, because any expert can be picked, so the model takes 56.87 GiB in BF16, close to the dense 32B's 61.02 GiB. The active count sets the work per token, which is what the LLM inference speed calculator estimates speed from. By the same count, 235B-A22B activates 22.19 billion parameters and Coder 480B 35.47 billion.
Experts in system RAM
Because each token touches only 8 of a layer's 128 or 160 experts, the experts are the part worth moving off the GPU. llama.cpp turned that into one switch in July 2025. Its --cpu-moe option, merged on 31 July, keeps "all MoE weights in the CPU", and --n-cpu-moe N, merged on 4 August, does the same for the first N layers only.
Ticking the checkbox does that arithmetic, for the chosen model and for the mixture-of-experts rows of the family table: the experts leave the GPU total and are reported as system RAM, while everything else, from attention to the cache, stays on the GPU. For the defaults, 16.52 GiB of experts move to RAM, and the GPU keeps 0.88 GiB of weights, 3.75 GiB of cache and 0.18 GiB of allowance: 4.80 GiB in all, a fifth of an RTX 4090. That allowance shrinks with the weights left on the GPU, so treat it as a floor. 235B-A22B at Q4_K_M needs 12.81 GiB of VRAM and 129.40 GiB of RAM this way. Each layer of 30B-A3B's experts weighs 0.34 GiB at Q4_K_M, which is what each step of --n-cpu-moe moves; the calculator doesn't model a partial split.
Context: 32,768, 40,960 or 262,144 tokens
Qwen's model cards for the April 2025 models from 4B up give their context as "32,768 natively and 131,072 tokens with YaRN", a RoPE scaling method, and those for 0.6B and 1.7B as 32,768. The 40,960 in every config file is a budget: it reserves "32,768 tokens for outputs and 8,192 tokens for typical prompts", which is why the calculator starts there. Going past it means switching YaRN on, and Qwen notes that open-source frameworks implement it statically, "potentially impacting performance on shorter texts". Updates such as Qwen3-30B-A3B-Instruct-2507 keep the same architecture but handle "262,144 natively", as Qwen3-Coder does. The cache grows in step: at 262,144 tokens, 30B-A3B holds 24 GiB of it, more than its 17.40 GiB of Q4_K_M weights, for 44.88 GiB in all. The mixture-of-experts 2507 cards go up to 1,010,000 tokens, and for 30B-A3B-Instruct-2507 they put a million-token context at "approximately 240 GB" of GPU memory, peak activations included. Weights, cache and allowance come to 160.71 GiB in BF16 at that length, so read results there as a floor. Each model accepts its longest documented context, from the configs' 40,960 tokens for 0.6B and 1.7B to 1,010,000 for the mixture-of-experts models, and the family table shows a dash past it.
Checked against Qwen's own files
Qwen publishes quantized copies of most of these models, and their sizes check the weight rule. INT4, 4 bits with a scale and zero point for each group of 128 weights, lands within 0.02% of Qwen's AWQ files for 4B, 8B, 14B and 32B. FP8 is within 0.03% of Qwen's FP8 files for 8B, 14B, 32B and Coder 480B. The FP8 files of 30B-A3B and 235B-A22B store the embeddings, output layer and router in FP32, so they run 4.2% and 1.1% larger than the rule. GGUF Q8_0 lands within 0.2% of Qwen's GGUF files from 4B up. Q4_K_M is a mix: the k-quants design merged into llama.cpp in June 2023 stores half of two tensor types at 6.5625 bits and the rest at 4.5, so a flat 4.8944 lands only within 1.5%. For 30B-A3B it gives 18.68 GB against Qwen's 18.56 GB file. Downloads count decimal gigabytes, while the results here are GiB of 230 bytes.
Hugging Face's totals for Qwen3 0.6B and 1.7B count their shared embedding matrix twice, 0.75 and 2.03 billion parameters. The presets count it once, as memory holds it, and Qwen's 639 MB Q8_0 file of 0.6B agrees.
The lineup and where the formula stops
Qwen announced Qwen3 in April 2025: six dense models from 0.6B to 32B and two mixture-of-experts models, trained on about 36 trillion tokens covering 119 languages and dialects and released under Apache 2.0. Qwen3-Coder-480B-A35B followed on 22 July 2025 with 160 experts, 8 of them active. In September 2025, Qwen3-Next-80B-A3B changed the attention: in each group of four layers, three use Gated DeltaNet, a form of linear attention, and only the fourth has the key-value heads this formula counts. Qwen3.5, from February 2026, and the versions since keep that layout, so the every-layer formula would overstate their cache, and they are not presets. Their attention layers can still be sized with the custom architecture in the LLM VRAM calculator: Qwen3-Next's 12 such layers, each with 2 KV heads of 256 values, cache 24 KiB a token, a quarter of 30B-A3B's 96 KiB.
| Model | Parameters (billions) | Layers | KV heads × size | KV cache per token, 16-bit | Experts per layer |
|---|---|---|---|---|---|
| Qwen3 0.6B | 0.6 | 28 | 8 × 128 | 112 KiB | None |
| Qwen3 1.7B | 1.72 | 28 | 8 × 128 | 112 KiB | None |
| Qwen3 4B | 4.02 | 36 | 8 × 128 | 144 KiB | None |
| Qwen3 8B | 8.19 | 36 | 8 × 128 | 144 KiB | None |
| Qwen3 14B | 14.77 | 40 | 8 × 128 | 160 KiB | None |
| Qwen3 32B | 32.76 | 64 | 8 × 128 | 256 KiB | None |
| Qwen3 30B-A3B | 30.53 | 48 | 4 × 128 | 96 KiB | 128, 8 active |
| Qwen3 235B-A22B | 235.09 | 94 | 4 × 128 | 188 KiB | 128, 8 active |
| Qwen3-Coder 480B-A35B | 480.15 | 62 | 8 × 128 | 248 KiB | 160, 8 active |
Several GPUs
Each count in the GPU table is a floor. vLLM splits every layer's attention heads across tensor-parallel GPUs, and its Qwen3-MoE code asserts that the head count divides evenly. So 235B-A22B in BF16, 532.82 GiB and seven H100s by memory, needs eight to split its 64 heads. Its 4 KV heads are then fewer than the GPUs, and in that case, the code says, "we replicate the KV heads across multiple tensor parallel GPUs": each head is stored twice, and the 7.34 GiB cache at 40,960 tokens takes 14.69 GiB. Coder 480B's 8 KV heads split evenly. What such a server costs by the hour is a job for the GPU cloud cost calculator.
Figures are planning estimates, not guarantees: real memory use depends on the inference engine, its settings and the driver. This site is not affiliated with Alibaba, Qwen or any hardware maker named above. See the site disclaimer.
Frequently asked questions
How much VRAM does Qwen3 30B-A3B need?
At GGUF Q4_K_M with a 40,960-token context and one sequence, 24.63 GiB: 17.40 GiB of weights, 3.75 GiB of KV cache and 3.48 GiB of overhead allowance. That is just over a 24 GB card, so two RTX 4090s at 51%, or one 32 GB RTX 5090 at 77%. An 8-bit cache brings it to 22.75 GiB, one RTX 4090 at 95%. In BF16 it needs 71.99 GiB, one H100 at 90%.
Can I run Qwen3 30B-A3B on an 8 GB GPU?
Yes, with llama.cpp's --cpu-moe, which keeps the experts' weights in system RAM and has the CPU work through them. At Q4_K_M and 40,960 tokens the GPU then holds 4.80 GiB: 0.88 GiB of weights, 3.75 GiB of KV cache and 0.18 GiB of allowance, a floor because it follows the weights, though an 8 GB card still has 2.65 GiB to spare. The other 16.52 GiB of experts sit in system RAM, so plan for that much free memory on top of the operating system.
How many GPUs does Qwen3 235B-A22B need?
At Q4_K_M with 40,960 tokens it needs 168.09 GiB: three H100s at 70%, one B200 at 93% or one MI300X at 88%. FP8 takes 271.47 GiB, four H100s at 85%. BF16 takes 532.82 GiB, seven H100s by memory but eight with vLLM tensor parallelism, which needs the 64 attention heads to split evenly. With its experts in system RAM, 12.81 GiB stays on the GPU and 129.40 GiB goes to RAM.
Why does Qwen3 32B use more memory for context than 30B-A3B?
Because the KV cache depends on layers and KV heads, not on parameters. Qwen3 32B has 64 layers with 8 KV heads of 128 values, 256 KiB a token, while 30B-A3B has 48 layers with 4 KV heads, 96 KiB. At 40,960 tokens that is 10 GiB of cache against 3.75 GiB, so 32B at Q4_K_M needs 32.40 GiB in all, against 24.63 GiB for 30B-A3B.
What context length should I size Qwen3 for?
Qwen gives the April 2025 models 32,768 tokens natively, and those from 4B up 131,072 with YaRN. Their config files set 40,960, reserving 32,768 tokens for output and 8,192 for the prompt. The 2507 updates and Qwen3-Coder handle 262,144 natively. For 30B-A3B at Q4_K_M, the cache is 3 GiB at 32,768 tokens, 12 GiB at 131,072 and 24 GiB at 262,144, which brings the total to 44.88 GiB.
Does a mixture-of-experts model need less VRAM?
Not for its weights. Each token uses 8 of the 128 experts in every layer of Qwen3 30B-A3B, about 3.35 billion of its 30.53 billion parameters, but any expert can be picked, so all of them must be loaded: 56.87 GiB in BF16, close to the 61.02 GiB of the dense Qwen3 32B. What mixture of experts saves is the work done for each token.
Sources
- Qwen3 Technical Report, arXiv, 2025
- Qwen3: Think Deeper, Act Faster, Qwen, 2025
- Qwen3-30B-A3B, Qwen on Hugging Face, 2025
- Qwen3-30B-A3B-Instruct-2507, Qwen on Hugging Face, 2025
- Qwen3-Coder: Agentic Coding in the World, Qwen, 2025
- Qwen3-Coder-480B-A35B-Instruct, Qwen on Hugging Face, 2025
- Qwen3-Next-80B-A3B-Instruct, Qwen on Hugging Face, 2025
- vLLM Now Supports Qwen3-Next: Hybrid Architecture with Extreme Efficiency, vLLM, 2025
- Qwen3.5-397B-A17B, Qwen on Hugging Face, 2026
- Outrageously Large Neural Networks: The Sparsely-Gated Mixture-of-Experts Layer, arXiv, 2017
- Qwen1.5-MoE: Matching 7B Model Performance with 1/3 Activated Parameters, Qwen, 2024
- llama : add simple option to enable CPU for MoE weights (--cpu-moe), ggml-org/llama.cpp on GitHub, 2025
- llama : add --n-cpu-moe option, ggml-org/llama.cpp on GitHub, 2025
- k-quants, ggml-org/llama.cpp on GitHub, 2023
- Transformer Math 101, EleutherAI, 2023
- Qwen3-MoE model code (qwen3_moe.py), vLLM on GitHub
- Qwen3-32B-AWQ, Qwen on Hugging Face, 2025
- Qwen3-30B-A3B-GGUF, Qwen on Hugging Face, 2025
- Qwen3-30B-A3B-FP8, Qwen on Hugging Face, 2025
- Qwen3-0.6B, Qwen on Hugging Face, 2025
- Qwen3-1.7B, Qwen on Hugging Face, 2025
- Qwen3-0.6B-GGUF, Qwen on Hugging Face, 2025
- Qwen3-4B-Instruct-2507, Qwen on Hugging Face, 2025
- Qwen3-235B-A22B-Instruct-2507, Qwen on Hugging Face, 2025
- Qwen3.8-27B, Qwen on Hugging Face, 2026