Skip to content
Fantástico Mundo de Jon
RSS

Qwen3.6 27B: How Much VRAM It Really Needs

A 27B model that uses half the KV cache of a Llama 3 8B. The hybrid architecture breaks the usual calculation — and decides, for less than 1 GB, which cards are left out.

In a hurry? Ask Claude for the TL;DR — it reads the page and summarises it.

en Machine translation by qwen3:32b, reviewed by the author. Read the Portuguese original

The Qwen3.6 27B was released in April 2026 as a dense model, Apache 2.0 license, 262,144 native context tokens, and multimodal input. Dense 27B usually means “forget, it won’t fit on your GPU”.

But when opening its config.json, the math doesn’t add up as expected. It consumes half the KV cache of a Llama 3 8B — a model three and a half times smaller.

The reason lies in a line of configuration that almost nobody reads.

Qwen3.6-27B · from official config.json

Parameters
27.8 B (dense)
Layers
64
Full attention
only 16 of them
KV Heads
4 (GQA 24:4)
Head dimension
256
Native context
262,144 tokens

The line that changes everything

In the config.json, among the common keys, is this:

"full_attention_interval": 4,
"layer_types": ["linear_attention", "linear_attention", "linear_attention", "full_attention", ...]

The model has 64 layers, but only one out of every four uses full attention. The other 48 use linear attention.

This distinction is the most important thing in this post, because the two behave oppositely in memory:

  • Full attention stores a key-value pair per token, in each layer. It’s the KV cache, and it grows indefinitely as the conversation progresses.
  • Linear attention maintains a fixed-size state, compressing the past into a summary of constant dimension. Double the context and this state doesn’t change size.

In other words: 48 of the 64 layers simply don’t participate in memory growth. Anyone applying the usual formula — the one from the previous post about VRAM — to all 64 layers will be off by a factor of four.

The real KV cache

The formula remains the same, only changing how many layers are included:

bytes por token = 2 × camadas_de_atenção_plena × cabeças_kv × dim_cabeça × bytes

2 × 16 × 4 × 256 × 2 = 65.536 bytes = 64 KiB por token

Sixty-four KiB. For comparison, with the same math:

Model KV Layers KiB/token 128k context (GB)
Llama 3 8B 32 of 32 128 17.18
Qwen3.6 27B (real) 16 of 64 64 8.59
Qwen3.6 27B if dense 64 of 64 256 34.36
Arithmetic based on each model's config.json, with cache in FP16 — not a measurement. The third line is a counterfactual: what the same model would cost if all layers used full attention.

A 27 billion parameter model with half the context cost of an 8 billion one. It’s counterintuitive, and it’s the reason why this model fits where it shouldn’t.

The weights

With 27.8 billion parameters:

Quantization Weights (GB)
BF16 55.6
Q8_0 29.5
Q6_K 22.9
Q5_K_M 19.8
Q4_K_M 17.0
Effective bits per weight for K-quants in llama.cpp. Ollama publishes qwen3.6:27b at 17 GB in Q4_K_M — the calculation matches at the decimal place, which is a good sign that the bits per weight used here are correct.

Will it fit on your GPU?

Here the math meets the hardware. Weights in Q4_K_M, plus the KV cache for context, plus 1 GB buffer for runtime:

Machine Memory (GB) Left for context (GB) Possible context
RTX 5070 · 12 GiB 12.9 doesn't fit
RTX 5070 Ti · 16 GiB 17.2 missing 0.8 GB
RTX 4090 · 24 GiB 25.8 7.7 115k
RTX 5090 · 32 GiB 34.4 16.3 243k
MacBook Pro M4 Max · 48 GiB 51.5 33.5 262k (cap)
Mini PC · 96 GiB 103.1 85.1 262k (cap)
Arithmetic, not measurement: weights in Q4_K_M (17.0 GB) + KV cache at 64 KiB/token + 1 GB overhead. Doesn't include linear layer state or what the system already uses on the GPU. Measured numbers come in the next post.

Look at the second row. The 5070 Ti is excluded by 0.8 GB — less than 5% of the GPU’s memory. The weights alone take 17.0 of the 17.2 GB it has; 200 MB remain for runtime and context, which isn’t enough to even load the model.

It’s the kind of margin that makes someone buy the wrong GPU. A 16 GB GPU seems comfortable for a “17 GB” model until you remember that file GB and GPU GiB aren’t the same unit, and you still need the cache and overhead.

What you can reproduce now

The arithmetic part of this post you can verify yourself, without downloading 17 GB:

# The official config, the source of everything above
curl -sL https://huggingface.co/Qwen/Qwen3.6-27B/raw/main/config.json \
  | python3 -c "
import json,sys
from collections import Counter
t = json.load(sys.stdin)['text_config']
tipos = Counter(t['layer_types'])
plenas = tipos['full_attention']
kv = 2 * plenas * t['num_key_value_heads'] * t['head_dim'] * 2
print('camadas:', t['num_hidden_layers'], dict(tipos))
print('KV por token:', kv, 'bytes =', kv // 1024, 'KiB')
"

And, to check on your own GPU after downloading:

ollama pull qwen3.6:27b

# With the context declared: the runtime default is not what you will use
OLLAMA_CONTEXT_LENGTH=131072 ollama run qwen3.6:27b "ok"

# How much it actually reserved, and whether anything spilled to the CPU
ollama ps
nvidia-smi --query-gpu=memory.used,memory.total --format=csv

What I still don’t know

Being explicit about the boundary between what this post proves and what it only suggests.

Proven here: the hybrid architecture, the 64 KiB/token KV cache, and what the arithmetic says about each machine. All derived from the official config.json, reproducible with the command above.

Still not measured: the state of linear layers, the actual GPU usage after loading, tokens per second on each machine, and what linear attention costs in quality on a 200k token context — because compressing the past into a fixed state isn’t free, and that’s exactly the test that matters.

That last one is the good question. A model that promises 262k context and fits on a 4090 is news; whether it remembers what was in token 30k when it reaches 200k is another conversation, and no one answers that with arithmetic.

In the next post I’ll measure, on all six machines. The math says what fits; only measurement says what works.


Sources: official config.json on Hugging Face · model announcement · qwen3.6:27b on Ollama