How to serve 134 GB of model weights with 24 GB VRAM / 64 GB RAM

How oom-inference serves roughly 134 GB of text-model weights across a 24 GB 4090, 64 GB of host RAM and NVMe.

Inference Demo

No further weight quantisation: the NVFP4 release on one 24 GB card

Recorded on the RTX 4090
RequestInput tokensFirst tokenDecode
Read an incident report21,8786.95 s45.4 tok/s
Rewrite a source file23,7237.33 s46.3 tok/s
Read the post ↓

1. Why does capacity matter

The text model's weights come to 134 GB. A 4090 and 64 GB of RAM hold 88 GB between them. The usual fix is to quantise further until the model fits, which costs quality. I wanted to run the published NVFP4 release as it is and make up the difference with NVMe.

The tiers are far from equal. VRAM is where the GPU computes at full bandwidth, host RAM sits behind PCIe, and NVMe is slower again. So the job is keeping the weights each token needs in the fastest tier, and keeping disk reads rare on the hot path.

134 GB of weights against 88 GB of memory
Decoder experts 67.95 GB 48 layers × 512 experts, one 2.7 MB record each. Hot records sit in VRAM, warm ones in pinned RAM, all of them on NVMe.
PLE tables 51.2 GB FP8 n-gram tables. They stay on NVMe; buffered reads gather the rows a prompt needs.
Dense 10.08 GB Everything that is not an expert or a PLE table. Loaded into VRAM at start-up.
MTP experts 5.03 GB The draft head's 512 BF16 experts. Their own small tier: one VRAM chunk, records in pinned RAM from start-up.

2. How I got NERDsniped

I started reading about the work that FlashML were doing with FreeToken to enable running larger models on consumer hardware by tiering experts between GPU & CPU. This got me thinking about extending that rationale to experts on disk.

oom-inference is my attempt at making that work for Qwen 3.8 Flash Next.

3. How does the tiering work?

For every layer in the MoE our router picks 10/512 experts to use for a token. That means that most experts are idle & depending on the workload you may only trigger a subset of experts for a session.

One layer: 10 of 512 routed experts run for a token
token ROUTER pick 10 1 512 ROUTED EXPERTS IN THIS LAYER 2 COMBINE outputs shared expert: runs for every token 3 heavy = routed faint = idle for this token
KeyPart
1The router scores the token and picks 10 of the layer's 512 routed experts.
2The expert pool. Heavy squares are the experts selected for this token; faint ones sit idle. Their positions are illustrative.
3The shared expert runs for every token whatever the route, and its output joins the routed experts'. Attention and the other dense layers also run for every token.

So the expert is the unit of caching: the weights are split into one ~2.7 MB record per expert, exactly what a routing decision asks for.

Bandwidth constraints for expert tiers
VRAM · 24 GBdense weights · state · hot expertsPINNED RAMwarm expertsCPU · 8 corescomputes host hitsNVMeevery expertcopy 2.7 MBAbout 110 µsdirect read~0.45 ms, illustrative10 KB rowAbout 70 µs
In VRAM 0
Host hit, run on CPU 70 µs
Host hit, copied 110 µs
NVMe miss (illustrative) 560 µs
Running a host hit on the CPU applies to one-token decode. The NVMe row is arithmetic for a 2.7 MB read plus the copy, not an engine measurement.

Expert records are read with O_DIRECT through io_uring, bypassing the page cache, so the engine alone decides what stays in VRAM and pinned RAM. Experts that keep recurring move up to VRAM; one-off routes can stay on the host.

The PLE tables are different. Their rows depend only on the token IDs, so each step reads exactly the rows it needs through the normal page cache, with no tiering.

More context == Slower Experts

The KV cache competes for the same VRAM. It starts small and grows with the sequence, taking space back from the expert cache as it goes. A short prompt leaves more experts in VRAM; a long one costs decode speed, not capacity.

The full window works: a 255k-token prompt ran on the 4090 at 1,171 tok/s prefill and 22.8 tok/s decode, and found a needle placed at 10%, 50% and 90% depth.

KV cache and experts share the same VRAM
2,048 tokens 0.04 GB KV · 15 records out
32,768 tokens 0.68 GB KV · 246 records out
131,072 tokens 2.73 GB KV · 985 records out
262,144 tokens 5.45 GB KV · 1,969 records out

4. Prefilling layer by layer

A GPU that holds the whole model reads a long prompt in one pass. Here each layer's experts have to be copied in first, so a single pass leaves the GPU idle while the copy engine works.

Instead the prompt is split into chunks and run one layer at a time: each layer runs over every chunk, and the union of their experts is fetched once. While one layer computes, the experts the next layer's router predicts are copied in, a few records at a time so the current layer's own copies never queue behind them.

Prefetch in small batches so urgent copies don't wait
All at once · this layer waits 41 mscopy engineGPU8 at a time · this layer waits under 1 mscopy engineGPU01020304050ms
next layer's stage-ahead copies this layer needs now GPU computing GPU idle this layer needs its experts
32k prefill 10.30 → 9.40 s
95k prefill 28.10 → 27.40 s
GPU idle before 2.7 of 10.5 s
A layer's stage-ahead is about 450 records, 1.2 GB and 45 ms of copy-engine time. Timelines are schematic; prefill times are measured, warm.

5. Guessing ahead

Every decode step reads the dense weights and fetches experts anyway, so checking 8 guessed tokens costs far less than producing 8 one at a time. Guesses come from the model's own MTP head, or from prompt lookup: if the last few tokens appeared earlier, guess that whatever followed them comes next.

When does checking a 7-token draft pay?
020406080break-evenlookup, file edits · 92–95% kept1 token per step · 40 tok/s8-token draft step01234567draft tokens kept of 7tok/s
3 of 7 kept32–36 tok/s4 of 7 kept40–45 tok/s5 of 7 kept48–55 tok/s7 of 7 kept64–73 tok/s
Arithmetic on measured step costs: 110–125 ms for 8 new tokens, about 25 ms for one. Lookup, measured: file edits +22 to +40% output, tests level, prose −2 to −9%. Catching the MTP head up after lookup steps raised its kept drafts from 76% to 83%.

Lookup shines on file edits, which repeat big chunks of their input: output rose 22–40% in our experiments. On prose it costs a few percent.

When lookup supplies the guesses, the MTP head misses those steps and falls behind, so we now catch it up first. That took the demo from 43.4 to 45.6 tok/s.

6. Keeping the quality

The weights are RadixArk's NVFP4 release, byte for byte: 4-bit routed experts, BF16 dense weights and FP8 n-gram tables. The aim was an engine that loses nothing on top of that quant. I measured it two ways: against reference logits wherever a reference exists, and on benchmarks against the quant's published scores.

Logits. Hugging Face's own model code, run on CPU, is the reference. The final logits must sit at least as close to an FP32 run as the reference's own BF16 run does. The rounding floor for faster settings comes from two exact runs that differ only in prefill chunk size: they already disagree by a KL of about 0.03 (90% top-1) on a 32k-token document, because expert routing is discrete. The demos use all four of these settings:

What each precision setting buys, and what it costs in accuracy
Faster Drift from exact
k8v6 KV cache--kv-cache k8v6Default8-bit keys and 6-bit values in the KV cache. 19% decode About 3x less KV memory; decode +19% at long context About 1,400 more expert slots at 95k tokens rounding noise Inside the model's own rounding noise
FP8 dense--dense fp8Opt-inDense weights stored as FP8, one scale per 128 weights. 23% decode step Verify step 35–37 ms against 43–50 ms at 32k–95k About 1,660 more expert slots KL 0.10–0.13, 86–88% top-1 About 3x the rounding floor
BF16 expert prefill--expert-precision bf16Opt-inPrefill expert activations rounded to BF16 once, not split into three terms. 14% prefill Warm 32k prefill 16.2 s to 14.0 s KL 0.058, 92.1% top-1 About at the rounding floor
BF16 attention prefill--attention-precision bf16Opt-inPrefill attention on BF16 tensor cores; decode stays FP32. 16% prefill attention Prefill attention 1.51 s to 1.27 s per 32k prompt KL 0.051, 92.6% top-1 Inside the rounding floor
Each setting measured on its own against the exact reference; the effects do not add. The demos used all four. Faster: share of that phase's time saved (decode rate gained for k8v6).

Benchmarks. On the full GSM8K set, run with the settings RadixArk published, the 4090 scores the same as their unquantised and NVFP4 runs:

GSM8K, all 1,319 problems Score
oom-inference, defaults, 4090 97.73 (95% CI ±0.80)
RadixArk, unquantised BF16 97.12–97.50
RadixArk, NVFP4 on SGLang 97.27

--dense fp8 --expert-precision bf16 scores the same as the defaults on the same questions: 97.00 against 97.33 on 300 GSM8K problems, 77.5 against 77.0 on 200 MMLU-Pro questions and 98.1 against 98.5 on 95k-token retrieval, all inside the noise.

GPQA-Diamond (graduate-level science, thinking on) is partway through: 88.1 on the first 118 of 198 questions (95% CI ±5.8), against Qwen's 91.7 for the unquantised model. That interval still covers Qwen's number, and the first 118 rows of the file may not be a fair sample, so it settles nothing yet. AIME26 hasn't run.

7. Serving agents

Agents tend to re-send the same long document, so we save the model's state partway through a prompt and pick up from there.

First token for a follow-up question on a 32k-token document
Full prefill 13.1 s No reuse: reads the whole 32k-token prompt.
Stored entry 0.95 s Restores a 1.1 GB entry from the prefix store, then reads the rest.
Live checkpoint 0.64 s Rewinds the live sequence to its checkpoint, then reads the rest.
Both reuse 32,531 of about 32,549 prompt tokens. Max-perf config; the 13.1 s is the first question, with nothing to reuse (#6859).

With continuous batching, requests running together share the dense-weight reads and expert fetches, so total throughput climbs up to about four at once.

Requests at once: total output against each request's speed
02040601248tok/s
Total, 8 streamsTotal, 1 streamEach request's decode, 8 streams
128-token requests, temperature 0, median of two rounds. Two runs at 4 requests that schedule identically differed by 15% (54.9 against 47.8 tok/s). The server defaults to 2 streams.
Requests at once Total tok/s, 8 streams Decode tok/s per request First token p50 / max Total tok/s, 1 stream First token p50 / max, 1 stream
1 43.6 53.4 0.55 / 0.55 s 43.4 0.55 / 0.55 s
2 48.0 31.3 0.64 / 1.3 s 42.6 0.64 / 3.6 s
4 54.9 16.9 2.1 / 2.8 s 41.5 6.7 / 9.9 s
8 47.3 7.1 3.7 / 5.9 s 39.9 13.4 / 23.1 s

The server speaks the OpenAI and Anthropic APIs, including streaming and tool calls.

8. What didn't work

Idea Result
Draft width growing from one to three tokens while recent drafts were kept Tied the demo (46.4 against 46.3 tok/s) and lost 3 to 7% on file edits. Fixed two- and three-token drafts ran the demo at 45.6 and 42.8 tok/s
--kv-placement host Identical output and 9% faster decode at 95k, but 4% slower at 32k and slower at every length once --dense fp8 frees the VRAM anyway
A larger host tier Cut disk reads 19% but didn't fix the prefill stall; the copy-engine queue did
Grouping adjacent prefill tokens to share key tiles A key in a 4-token group's union is seen by about 1.2 of them, so shared tiles mostly compute masked-out scores
Smaller residual rings (32 or 64 rows) Same speed as 256 on edit workloads

9. How does it compare?

Published runs on a 96 GB RTX PRO 6000, where every expert fits in VRAM, hit 60–190 tok/s. The 4090 does 45.

Published decode rates on a 96 GB RTX PRO 6000, and the 4090
vLLM, NVFP4 74.4 tok/s 8k input, 512 output, cache-free. Keeps a roughly 95 GB BF16 PLE table in host RAM.
SGLang, paired, MTP off 97.9 tok/s NVFP4 + W4 PLE, 512 output, warm, one request at a time.
SGLang, paired, tuned 144.6 tok/s Same campaign with MTP and other tuning. KV capacity, memory settings and idle conditions also changed, so not all of the gain is MTP.
SGLang, later stack 179.4–192.7 tok/s Four workloads, 8,192 output tokens: long reasoning outputs and different sampling.
llama.cpp, UD-Q4_K_XL 59.7 tok/s 22.7k-token prompt. Different weight, PLE and KV choices from the other rows.
oom-inference, 4090 45.4 tok/s The research replay: 21,878-token prompt, warm tiers, fresh prefix. MTP and prompt lookup. 24 GB VRAM, 64 GB RAM, NVMe.
Author-reported scale references: different checkpoints, precisions and workloads. Not a controlled ranking.
Published configuration Speculation Decode
vLLM, primitive-ai NVFP4, 8k input / 512 output, cache-free Off 74.4 tok/s
SGLang, NVFP4 + W4 PLE, paired report, 512 output Off 97.9 tok/s
Same SGLang report, tuned candidate MTP + other tuning 144.6 tok/s
SGLang, later tuned stack, four workloads, 8,192 output MTP 179.4–192.7 tok/s
llama.cpp, UD-Q4_K_XL, 22.7k prompt Off 59.7 tok/s
oom-inference research replay, 4090 MTP + lookup 45.4 tok/s

Should you buy a 4090 for this? Probably not, API inference is cheap. But if you already have one, a 125B model at home is now practical.

To try it, download the converted model and run oominf serve --model <dir> (quickstart).