Kyojin: open-source engine that runs 100 GB-class open models (GLM-5.3, Qwen3.8, DeepSeek V4.1) on one desktop machine. AMD Strix Halo, NVIDIA RTX and Apple Mac. OpenAI API, built on ExLlamaV3.
DeepSeek-V4.1-Flash-1017 on one 128 GB Strix Halo machine
EXPERIMENTAL. This pack is a demonstration that a 763B-parameter model runs exactly (no pruning, no approximated routing) on one 128 GB machine. It is slow, and it is not meant for daily agent use. Real decode is about 5 to 11 tokens per second, and a tool turn that adds about 2K tokens takes about 20 to 35 seconds before the first token (the SSD floor is about 24 s), because most experts are read from the NVMe again. Sources are in the Speed section.
EXL3 pack of deepseek-ai/DeepSeek-V4.1-Flash-1017 (763B parameters, about 16B active per token, 40 layers, 384 routed experts per layer with 6 active, MLA-style attention with a sparse indexer) for the Kyojin engine. The server speaks the OpenAI API with thinking and tool calls, and uses the model's own DSpark draft stages for speculative decoding.
Numbers on this page were measured on one reference machine (Ryzen AI Max+ 395, 128 GB, NVMe at about 3 GB/s). Where we have no clean measurement, there is no row.
Hardware
| Part | Needed |
|---|---|
| Machine | AMD Ryzen AI Max+ 395, Radeon 8060S (gfx1151), 128 GB unified memory. Other hardware is untested. |
| Disk | NVMe with room for the pack and the Engram tables, about 365 GB together (sizes in the table below). A fast NVMe matters: the SSD expert tier reads from it |
| System | the settings in install.md: IOMMU off, GPU clock level high, cooling |
| Download | Size |
|---|---|
Pack (shards, config.json, tokenizer, MTP/DSpark stages) |
about 172 GiB |
| Engram tables (FP8, layers 1 and 14), see Engram | about 190 GB, read from the NVMe |
Install
Same as the other models: ROCm torch and one build (install.md).
git clone https://github.com/Yamz-Labs/kyojin && cd kyojin
./build.sh
source tools/strix_halo/env.sh
Download the pack
hf download yamz-labs/DeepSeek-V4.1-Flash-EXL3-Yamz --local-dir ./ds41-pack
The pack folder holds config.json, tokenizer.json, layers.*.safetensors and the index. Check it before the first
start:
python tools/ds41/validate_pack.py ./ds41-pack
Serve
source tools/strix_halo/env.sh
DS41_PACK=./ds41-pack DS41_ENGRAM_DIR=./engram_fp8 DS41_PORT=8000 DS41_CTX=131072 DS41_DRAFT=5 tools/ds41/ds41_serve.sh
Use ds41_serve.sh on a 128 GB machine. It turns on the SSD expert tier (below), which serve.py alone does not do:
without it the server tries to load all 172 GiB of experts into memory. The flags below are what ds41_serve.sh
passes to serve.py; call serve.py directly only on a machine with enough memory for the whole pack, or after
setting EXL3_EXPERT_BUDGET_GIB yourself.
python tools/ds41/serve.py --model ./ds41-pack --loader ds41_serving:load_model --port 8000 -c 131072 --num-draft 5 \
--engine-opt engram_dir=./engram_fp8 --engine-opt prefill_chunk=32768
| Flag | Meaning |
|---|---|
-c |
context window in tokens. KV is small by design (4 layers produce KV, one head of 512), see the guidance below. |
--num-draft N |
DSpark speculative decoding, N draft tokens per round, 0 turns it off, 5 is the block size. Output is identical to plain decoding when greedy. Without the flag the DSpark stages are not loaded. |
--engine-opt engram_dir=<folder> |
where the Engram tables are, when they are not inside the pack folder |
--engine-opt prefill_chunk=N |
prefill chunk size in tokens |
--default-thinking on|off, --default-reasoning-effort |
thinking mode of requests that do not choose |
Every other flag and endpoint: tools/ds41/SERVE.md. The server tunes and warms up before it
reports ready on /health. EXL3_SERVE_WARMUP=0 skips the warm-up.
Sampling: temperature 1.0, top-p 1.0 (the model card values); the pack ships no generation_config.json.
SSD expert tier
The pack (about 172 GiB) is larger than the 128 GB of unified memory, so the routed experts do not all fit in RAM. The
server keeps a pool of expert slots in memory and reads the experts that are missing from the NVMe when the router picks
them. ds41_serve.sh turns it on by default when the pack is larger than the free memory (DS41_TIER=auto).
- Pool. A slot pool of
DS41_BUDGET_GIB(default: free memory minus 30 GiB). The non-expert weights (about 16 GiB), the KV, the runtime and a staging ring sit outside the pool. Every expert is read bit for bit from the pack: nothing is pruned and no routing is approximated, so the tokens are the same as with a pack that fits in memory. - Policy. Experts used often in decode stay (decayed-use rank, scan-resistant admission, so one long prefill does not flush the hot set). The experts picked by the last rows of a prompt are promoted, because they predict the decode.
- Reads. O_DIRECT, 12 reader threads, 4 MiB chunks. During prefill the reads of the next layers are issued while the current layer computes (top-up, wrap across chunks, upfront issue of layers 0 to 2), and the attention kernel prefetches the next key chunk.
- Prefill chunk. 32768 rows with the tier: one chunk touches almost every expert, so a bigger chunk means fewer full reads per prompt token. Large per-row buffers are row-blocked to make that fit.
- Prompt cache. Host snapshots of the prefill state, plain and DSpark decode. A follow-up request with the same prefix
(an agent loop resends the previous reply) only prefills the new tokens.
--engine-opt prefix_cache=falseturns it off. - Cost. A cold long prompt reads most of the pack once. A follow-up that adds a few tokens reads a few GB. A tool result of about 2K new tokens touches most of the experts again and is the slowest case; the reads are bounded by the NVMe speed, about 3 GB/s measured on the reference machine.
Knobs (environment, defaults set by tools/ds41/ds41_env.sh): DS41_TIER, DS41_BUDGET_GIB, DS41_WARM,
EXL3_EXPERT_READERS, EXL3_EXPERT_CHUNK_KIB, EXL3_EXPERT_PROTECT, EXL3_EXPERT_TAIL_ROWS, EXL3_TIER_PF_CHUNK.
Design and cost model: ds41-tiered.md.
Engram
DeepSeek-V4.1-Flash has two Engram layers (layers 1 and 14): hashed n-gram embedding tables with about 384 million rows each. They are very large and a pass looks up a few rows per token, so they stay on the NVMe and the rows of a pass are read ahead while the earlier layers compute. We do not re-host or change them. Download them from the original repository, deepseek-ai/DeepSeek-V4.1-Flash-1017: the two shards that hold them, plus the config and the index.
hf download deepseek-ai/DeepSeek-V4.1-Flash-1017 \
model-00047-of-00048.safetensors model-00048-of-00048.safetensors config.json model.safetensors.index.json \
--local-dir ./engram_fp8
Each shard is about 101.5 GB (about 190 GB for both). Point the server at them with
--engine-opt engram_dir=./engram_fp8, or DS41_ENGRAM_DIR=./engram_fp8 with ds41_serve.sh. validate_pack.py checks the
folder against the pack.
DSpark
The model ships three draft stages (DSpark, block size 5). The server verifies up to five draft tokens per pass. With
greedy sampling the output equals plain decoding token for token. --num-draft N sets the draft length (0 = off); without
the flag the stages are not loaded. The three stages stay resident (about 3.6 GiB).
Quick start
git clone https://github.com/Yamz-Labs/kyojin && cd kyojin && ./build.sh
hf download yamz-labs/DeepSeek-V4.1-Flash-EXL3-Yamz --local-dir ./ds41-pack
hf download deepseek-ai/DeepSeek-V4.1-Flash-1017 model-00047-of-00048.safetensors model-00048-of-00048.safetensors \
config.json model.safetensors.index.json --local-dir ./engram_fp8
source tools/strix_halo/env.sh
DS41_PACK=./ds41-pack DS41_ENGRAM_DIR=./engram_fp8 DS41_PORT=8000 DS41_CTX=131072 DS41_DRAFT=5 tools/ds41/ds41_serve.sh
ds41_serve.sh validates the pack, sets the tier and calls serve.py with the right options. The first start tunes and warms
up before /health reports ready.
Context length guidance
KV cost is about 4.3 MB per 1K tokens (4.2 GiB at 1M). The attention reads a fixed 16K candidate window plus a 128-token
sliding window, so the cost of a token grows slowly with depth. Start at -c 131072; raise it with the memory table
below as the guide. No decode curve by depth was measured for this release.
Memory layout on 128 GB
Planned budget at -c 131072 (model of doc/ds41-ramfit.md). Only the rows with a release measurement have a value
in the last column.
| Item | Planned GiB | Measured |
|---|---|---|
| Attention, shared experts, head, router, hyper-connection weights | about 16 (non-expert weights) | n/a |
| Routed experts: slot pool of the SSD tier (the rest stays on the NVMe) | DS41_BUDGET_GIB |
78 GiB (fixed budget of a warm run) |
| MTP / DSpark stages | about 3.6 | n/a |
| KV at 128K | about 0.5 | n/a |
| Engram tables | not resident, read from NVMe | n/a |
| Whole process, quality run with a 68 GiB expert pool | n/a | peak 117.2 GiB system memory |
Keep at least 512 MiB free. Close other large processes before starting. Too large a pool can be killed by a memory guard at a 16K prefill: a budget of free memory minus 42 GiB worked on a quiet machine, minus 30 GiB did not.
Quality
Against the unquantized model: top-256 KL and top-1 agreement with its logits, 20,470 positions (first 10 held-out
agentic rows, chunk 4096, Kyojin with the SSD tier, official Engram tables). Gate: tools/ds41qual/run_gate.sh.
The same run on the 115 GiB SAGE quant (1.62 bit routed experts) is shown for reference.
| Measure | This pack (172 GiB) | SAGE quant (115 GiB) |
|---|---|---|
| Top-1 agreement with the unquantized model | 0.9399 | 0.7766 |
| KL divergence, mean | 0.0675 | 0.5609 |
| KL median / 95th percentile | 0.0200 / 0.2307 | 0.1086 / 2.6404 |
| NLL on the tokens (unquantized model: 1.0279) | 1.0355 | 1.3980 |
| Non-finite positions | 0 | 0 |
No task scores were run. The two packs differ in size and in what is quantized (SAGE keeps the attention in FP8).
Speed
Honest summary: slow. Decode is limited by expert reads from the NVMe and by the routing wait, not by compute. Numbers come from the session and A/B runs of 20 October 2026 on one machine that shared its GPU and NVMe with other jobs (the same arm gave 4.8 and 10.3 tok/s in two rounds), so read them as ranges.
| Case | Measured |
|---|---|
| Decode, plain, warm session on real tokens | 9 to 11 tok/s |
| Decode, 5 workloads (chat, code, tool, after tool, follow-up), plain or DSpark depth 4, mean of 2 rounds | 4.7 to 11.2 tok/s |
| Decode, DSpark session (random token rows, acceptance not representative) | 2.8 to 19 tok/s |
| Prefill 2K, 8K, 16K prompt, chunk 16384, cold/warm run | 60/104, 257/187, 270/307 tok/s |
| Follow-up turn, few new tokens, plain with prompt cache | first token in 1 to 4 s |
| Agent tool turn, about 2K new tokens | first token in 21 to 35 s (22.3 to 63.9 s over a session), 65 to 74 GB read |
| First call with a persisted 20K-token system prompt | 10.3 s (108 s cold) |
- A 2K tool result touches about 70 % of the experts. With a 78 GiB pool, at least 42 GB must be read again, about 14 s at 3 GB/s; measured turns were 64 to 106 GB. We could not push this lower by residency.
- Prefill is SSD bound: 59 % of an 8K prefill was waiting for reads, 27 % GPU kernels.
- With DSpark on, the follow-up turns of a session re-prefill the whole history (30 to 88 s) in the measured build, while
plain decoding reuses the prompt cache. For chat use
DS41_DRAFT=0. - DSpark depth 4 loses to plain decoding on code (8.1 vs 4.5 tok/s in one test) and wins on tool turns (about +10 %).
- No depth curve to 512K or 1M was measured. A cold very long prefill is long. Plan the first request.
Sources: our internal run notes of 20 October 2026 (tier and session runs, agentic-turn runs, draft-depth A/B, real-use curve, pack comparison).
Limits
- Only gfx1151 with ROCm is tested.
- Image input is supported (see
tools/ds41/SERVE.md). - The conversion tooling is not published; the engine and the weights are.