Run DeepSeek v4.1 1017 Flash(2-bit) on a single 80GB VRAM GPU at 100 tok/s A published recipe runs DeepSeek-V4.1-Flash-1017, a 748B-parameter model, as a local coding agent on a single H100 80GB GPU with about 230GB of host RAM using a 392.9GB 2-bit GGUF (routed experts in Q2_K) and two llama.cpp patches on Unsloth's fork release b12823-mix-034de92. The patches lifted pooled decode from 107.0 to 114.5 tok/s (+7.0%) on a 60-task coding gate at 64k context, with 59 of 60 tasks faster and all 60 outputs identical, while the 110-task run measured median decode of 102.9 tok/s for coding and 90.3 tok/s for agent turns. The recipe keeps all routed experts in host RAM, caches the most-used experts in free GPU memory (--moe-cache-mib 55000), runs cache misses on CPU 80% of the time, and leaves the 202.8GB n-gram table on disk; setting -t to all 26 vCPUs collapsed decode to under 3 tok/s. A recipe for running DeepSeek-V4.1-Flash-1017 https://huggingface.co/deepseek-ai/DeepSeek-V4.1-Flash-1017 748B parameters as a local coding-agent model on one H100 80 GB with about 230 GB of host RAM , using a 2-bit GGUF and two small llama.cpp patches. - Model file: Tensward/DeepSeek-V4.1-Flash-1017-Coding-2bit-GGUF https://huggingface.co/Tensward/DeepSeek-V4.1-Flash-1017-Coding-2bit-GGUF 392.9 GB, routed experts in Q2 K - Draft model: dspark-DeepSeek-V4.1-Flash-1017-Q8 0.gguf from Unsloth's repository https://huggingface.co/unsloth/DeepSeek-V4.1-Flash-1017-GGUF - Engine: Unsloth's llama.cpp fork, release b12823-mix-034de92 it adds the MXFP8 type the model's n-gram table uses bash scripts/build llama h100.sh ./llama build h100 downloads the fork's source sha256-checked , applies both patches, builds for sm 90 MODEL PATH=/models/DeepSeek-V4.1-Flash-1017-Tensward-Coding-2bit-00001-of-00009.gguf \ DSPARK PATH=/models/dspark-DeepSeek-V4.1-Flash-1017-Q8 0.gguf \ bash scripts/serve coding 64k.sh Recipe 1: one user, 64k context, OpenAI-compatible API on 127.0.0.1:8080 Before the first start, once as root: echo never | sudo tee /sys/kernel/mm/transparent hugepage/defrag . Put the model on local NVMe if you have it. configs/opencode.json points OpenCode at the server. For non-thinking replies, send "chat template kwargs": {"enable thinking": false} . All routed experts stay in host RAM -ot ...ffn . exps=CPU , -lm none so they are pinned rather than memory-mapped , and the free GPU memory becomes a cache of the most-used experts --moe-cache-mib 55000 . Experts that miss the cache run on the CPU 80% of the time --moe-cache-cpu-share 0.80 instead of being copied over PCIe. The 202.8 GB n-gram table stays on disk and is read lazily. Decode threads are the physical cores -t 13 ; prefill uses more -tb 24 . Do not set -t to all vCPUs: on our box -t 26 all 26 vCPUs made decode collapse to under 3 tok/s. Both are off unless their environment variable is set; the serve scripts set them. - 01 decode fast.patch LLAMA DECODE FAST=1 . Less CPU work per token in the expert cache's CPU path: rows the GPU cache already served are skipped instead of quantised and zero-filled on one thread, the expert ids are read back through pinned memory, and one scheduler wait is skipped when the cache's own copy step has already synchronised. - 02 spec max concurrency.patch LLAMA SPEC MAX CONCURRENCY=2 . Switches the draft model off while more than N requests are generating and back on when the load drops. With several users, drafting multiplies the batch size and pushes the expert cache out of its fast path. Hardware: GCP a3-highgpu-1g , H100 80 GB host link PCIe Gen4 x16 , Xeon Platinum 8481C 13 cores, 26 vCPUs , 230 GiB RAM, 2 x 375 GB local NVMe. Answers. We ran this recipe, built with the scripts in this folder, on 110 tasks we wrote for the test none from public benchmarks: coding with hidden tests, multi-turn agent repairs with real tool execution, 30k-54k-token long context, tool calls , against the same model on two FP8 API providers. No quality loss was readable at this size details and limits on the model card https://huggingface.co/Tensward/DeepSeek-V4.1-Flash-1017-Coding-2bit-GGUF . The patched build's 997 responses were byte-identical to the unpatched build's. Single user Recipe 1 . "Patches off" is the patched binary with LLAMA DECODE FAST=0 on the gate and 7.2k rows, and an unpatched build in our 110-task run; the 7.2k row is three restarts per arm, the others one run each: | | Patches off | Patches on | |---|---|---| | 60-task coding gate at 64k context, pooled decode | 107.0 tok/s | 114.5 tok/s +7.0%; 59 of 60 tasks faster, all 60 outputs identical | | Our 110-task run, median decode: coding / agent turns | 98.7 / 90.0 tok/s | 102.9 / 90.3 tok/s | | Prefill, 53k-token prompts our run | about 680 tok/s | about 650 tok/s | | Prefill, 7.2k-token prompt -ub 4096 | 662-691 tok/s | 662-691 tok/s 1.3% lower on average | Draft acceptance on the gate: 91.4%; expert cache hit rate: 86.8%; GPU memory at the end of the run: 77.2 GiB. Prompt cache. With --cache-ram 8192 , a follow-up turn after another request had evicted the slot started in 0.30 s instead of 13.4 s at 8k tokens, and 0.39 s instead of 44.0 s at 32k one trial each, on an earlier experimental build that also carried other patches . Several users. Auto-flip against always-on drafting, same binary and box, one session each, -np 8 -c 16384 -kvu , 56,000 MiB expert cache, --cache-ram 0 : | Concurrent requests | Always-on drafting | Auto-flip | |---|---|---| | 4 | 73.7 tok/s | 119.2 tok/s | | 8 | 42.4 tok/s | 146.5 tok/s | No draft tokens were wasted during bursts, and single-request speed after a burst stayed within the burst-to-burst spread 81.0 vs 86.1 tok/s . Recipe 2 scripts/serve team multistream.sh : no draft, 63 GiB cache, -np 8 reached 165.3 tok/s decode at 8 concurrent requests and 61.3 at 1 one session . At 4 concurrent requests 2 of 3 bursts collapsed to about 54 tok/s, because idle and busy slots interleave and the server stops reusing its decode graph; CACHE RAM MIB=0 should avoid it at the cost of the RAM prompt cache not tested on this recipe . We are working on a fix. Without the recipe. The default memory-mapped load with -ub 512 prefilled a 7.2k-token prompt at 64.3 tok/s; -lm none alone made that 170.4 tok/s, and the full recipe reaches 662-691. - Model: DeepSeek, DeepSeek-V4.1-Flash-1017 https://huggingface.co/deepseek-ai/DeepSeek-V4.1-Flash-1017 , MIT License. - Source GGUF, draft model and the llama.cpp fork with the expert cache: Unsloth https://huggingface.co/unsloth/DeepSeek-V4.1-Flash-1017-GGUF , MIT License. - llama.cpp: the ggml / llama.cpp authors https://github.com/ggml-org/llama.cpp , MIT License.