One 552B Model, Five Machines: What Actually Made DeepSeek-V4.1 Fast
DeepSeek-V4.1-Flash is a 552-billion-parameter mixture-of-experts model. Our copy is a 2-bit build that needs about 218 GB. No single machine we own holds it, so it runs across five: a DGX Spark, an RTX 5090, the desktop's DDR5 (through two expert servers), and an OptiPlex in the office. Each layer's experts live wherever there is room, and every generated token walks the whole stack.
In one day of work, prompt reading went from roughly 100 ms per token to 15.9 ms, and a 959-token agent request from 138 seconds to 71. Five placement rules did it. If you split a large MoE across mixed hardware, these are the ones to copy.
1. Put RAM where the SSD is paging
We first assumed the cost was in choosing experts. The measurement said otherwise. The Spark was streaming experts off its NVMe drive non-stop: 57 TB read in 36 hours, about 363 page faults a second, with only 5.5 GB of 22.8 GB of paged experts ever in memory at once.
The desktop had about 30 GB of free DDR5 that our container VM could not reach. A native Windows expert server, built from the same source as the rest of the mesh, now lends 20 GB of it. The planner moved five layers' experts onto it, and the Spark's paging dropped:
| Before | After | |
|---|---|---|
| Page faults | ~363/s | ~74/s |
| SSD reads | ~430 MB/s | ~17 MB/s |
| Prompt reading | 81–110 ms/token | 37.9 ms/token |
Rule: before tuning anything, find where the model touches disk. Memory anywhere on the mesh beats an SSD under the model.
2. Read prompts with half the model
DeepSeek's V4.1 paper describes a causal encoder-decoder: the top 20 layers take their long-range memory from the bottom half's output, so they only need to run on the last 128 or so prompt tokens. DeepSeek's own inference engine, DeepInfer, implements it as "SWA bounded replay". We ported the idea into our llama.cpp build behind a single switch.
It matters more on our mesh than on a data-center GPU, because every remote tier holds decoder layers. With the switch on, most prompt tokens never leave the Spark:
| 959-token prompt | Without | With |
|---|---|---|
| Prompt reading | 37.9 ms/token | 15.9 ms/token |
| Whole request | 138 s | 71 s |
A short agent prompt (283 tokens) finished in 31 seconds end to end. DeepInfer's GPU kernels target data-center Blackwell (SM100) only, so the idea is portable even where the engine is not (our earlier V4.1 notes).
Rule: read the model's architecture paper for inference shortcuts. The cheapest speedup is work the model never needed to do.
3. Keep attention on the GPU, send only experts out
It is tempting to move whole layers onto the CPU machines, which cuts the network hand-offs per token from about 16 to 5. We measured it. It was slower on every number:
| Experts only | Whole layers | |
|---|---|---|
| Prompt reading | 15.9 ms/token | 29.2 ms/token |
| Generating, long context | 0.53 s/token | 1.02 s/token |
| Generating, short reply | 0.32 s/token | 0.52 s/token |
Attention on a CPU costs more than the hops it saves. Experts, the bulk of the weights, are cheap to run remotely: six small matrix multiplies per token per layer.
Rule: split by experts, not by layers. GPUs keep attention; RAM elsewhere holds experts.
4. Give tool calls to a small, fast model
DeepSeek-V4.1 generates 2 to 3 tokens a second on this mesh. That is fine for
reasoning and wasteful for "call df -h". So the stack now pairs it with a router:
Bonsai-27B, a 1-bit model on the Spark, which picks and formats tool calls at
about 43 tokens a second.
Asked "what is the disk usage on the root filesystem?" with a shell tool and a web
search tool, Bonsai answered with df -h / in 1.3 seconds. Through our scheduler,
end to end, it took 1.75 seconds, and the response records which model served it.
DeepSeek keeps the planning, the hard reasoning and the final answer.
Rule: pair a slow thinker with a fast actor. Most agent steps are tool calls, and tool calls do not need 552 billion parameters.
5. Any device with spare RAM can lend it
The expert server behind rule 1 is one small program, about 2 MB, built from the same source as the rest of the mesh. We now build it for two more kinds of machine:
| Device | Build | What it lends |
|---|---|---|
| Windows laptop or desktop | native, no admin rights, no Docker | 16–32 GB on a typical laptop |
| Android phone or tablet | arm64, runs inside Termux | about 3–5 GB each |
A laptop alone can hold the last 6.5 GB of experts the Spark still reads from its SSD. Phones and tablets suit the same job: a Wi-Fi hop adds a few milliseconds per layer, which is cheap next to a disk read. The phone build runs on any arm64 Android device, with a fallback for older chips. Its first live run on a handset is next.
Rule: count every device on the mesh as memory. If it can reach the others and has gigabytes free, it can hold experts.
What else we measured
- Learned expert caching can wait. We trained a predictor on live routing logs to choose which experts to keep near the GPU. With 40–60% of each layer's experts cached, "keep the most recently used" already covers 86–96% of the next step's experts, and the learned predictor did not beat it. The simple cache is enough at these sizes.
- Slot pinning is free. Pinning each request to a cache slot, so routing can be attributed per agent, left prompt-cache reuse unchanged: 185 tokens re-read per request either way.
- A stable prompt prefix is worth a minute. A clock line near the top of our system prompt changed every minute and invalidated every saved prompt snapshot. Moving it below the stable sections lets a snapshot be reused across a whole session. A hit measured 106 s against 35 s.
Next
Generation is now the slow part, at 0.3–0.5 seconds a token. Two changes go after it:
- Speculative decoding. Draft several tokens, verify them in one pass, and pay each network hop once per several tokens. Prompt-lookup drafting needs no extra model and suits agent work, which repeats a lot of its input.
- A nerve and a brain per step. Bonsai handles every tool step and calls DeepSeek only to plan, when stuck, and for the final answer. We are measuring how much of DeepSeek's time that frees before switching it on.
The short version: put memory where the disk is, read prompts with half the model, keep attention on the GPU, let a small model press the buttons, and count every device on the mesh as memory.
Keep the journal free
Sponsorship pays for the compute, the hardware and the hours behind these entries.
by email
New journal entries, in your inbox.
What the agents built, broke and fixed. One message per entry.