localairecipes launch configs for local inference

DeepSeek-V4.1-Flash-1017 Fidelity-First 4x CMP 170HX alanoo81

00 upvotes — sign in to vote sign in to vote

community Community submission — verify on your own hardware.

recipe by alanoo81 (recipe, graft, measurements)↗, GNmac-lab (base recipe 1.2.0 @ 2ad5741ab1, MIT)↗, LibertAIDAI (EXL3 2.9bpw @ 0be63c33 / 3.5bpw @ 04a492fc)↗, Curtis White (hybrid layout + quantization_config.json)↗, vcruz305/vllm-exl3 (AGPL-3.0-only, inside the built image)↗ · listed by localai-recipes

Initial version · updated 21 h ago · license MIT (recipe); engine image contains AGPL-3.0-only vllm-exl3

chat code vision fp8-kv long-context exl3 sm80 tp4 prefix-caching community-recipe hybrid-checkpoint engram-ram fidelity-first

DeepSeek-V4.1-Flash-1017 (748B MoE) on 4x CMP 170HX (sm_80, 64 GB each, PCIe Gen2 x16), TP4, as a fidelity-first variant of the GNmac-lab recipe 1.2.0 @ 2ad5741ab1 with four changes: routed experts of layers 18-22 grafted 2-bit to 3-bit (LibertAIDAI EXL3 3.5bpw shards 00020-00024-of-00044 into the 2.9bpw pack, all 40 layers 3-bit); no DSpark drafter (SPEC_TOKENS=0, frees ~2.8 GiB/card for KV); Engram tables genuinely loaded (ENGRAM_STORAGE=ssd from a 200 GiB RAM tmpfs); gpu_memory_utilization 0.98, KV pool 2,717,420 tokens at 262,144 context. Author-measured: 300/300 exact identifier copies, byte-identical repeats; perplexity -1.80% overall / -4.45% French vs the 2.9bpw pack (95% CIs exclude zero); ~105 tok/s decode c1, 449-560 tok/s aggregate c8; cold prefill 2,514 tok/s median. Documents a silent failure: leaving DSV41_ENGRAM_STORAGE unset (host mode) leaves the Engram tables unfilled - layers 1 and 14 act as identity functions, 15/20 copies, temp-0 output drift, no error.

Launch command

'docker run -d --name ds41-flash --device nvidia.com/gpu=all --ipc=host --cap-add SYS_NICE' '--ulimit memlock=-1 --ulimit stack=67108864' '-v <MODELS_DIR>:/models:ro -v /opt/engram-ram/DeepSeek-V4.1-Flash-1017-engram:/engram:ro' '-v <CACHE_DIR>/root-cache:/root/.cache -v <CACHE_DIR>/triton:/root/.triton -v <CACHE_DIR>/tilelang:/root/.tilelang' '-p 127.0.0.1:8011:8011' '-e VLLM_PLUGINS=vllm_exl3 -e VLLM_ENGINE_READY_TIMEOUT_S=3600 -e VLLM_EXL3_MODEL_DIR=/models/DeepSeek-V4.1-Flash-1017-hybrid' '-e VLLM_USE_V2_MODEL_RUNNER=0 -e DSV41_DSPARK_V1=1 -e VLLM_EXL3_COOP=1' '-e VLLM_EXL3_TC_MOE_V2=1 -e VLLM_EXL3_TC_MOE_PREFILL=1 -e VLLM_EXL3_TC_PREFILL_ROWS=2048' '-e VLLM_EXL3_TC_MOE_SO=/opt/dsv41-tc-moe/_dsv41_tc_moe_C.abi3.so -e VLLM_EXL3_TC_HOOK=/opt/dsv41-tc-moe/exl3_tc_hook.py' '-e VLLM_EXL3_MOE_TP_ALIGN=128 -e VLLM_EXL3_MOE_TP_ROTATE=1' '-e NCCL_CUMEM_ENABLE=0 -e NCCL_CUMEM_HOST_ENABLE=0 -e NCCL_P2P_LEVEL=SYS -e VLLM_ALLREDUCE_USE_FLASHINFER_PCIE_IPC=1' '-e DSV41_ENGRAM_DIR=/engram -e DSV41_ENGRAM_STORAGE=ssd' '-e DSV41_EXPERTS_ONLY_FILES_RE=^model-[0-9]+-of-000(43|44|39)\.safetensors$' '-e TORCH_CUDA_ARCH_LIST=8.0 -e TORCHINDUCTOR_CACHE_DIR=/root/.cache/inductor' '-e VLLM_DSV41_DECODE_SPLITK=1 -e DSV41_SHARED_HEAVY_BLOCKS=1 -e DSV41_DRAFT_HEAD_FP8=1' '-e DSV41_PREFILL_CHUNK_REQS=1 -e DSV41_INDEXER_BUF_MULT=4 -e VLLM_EXL3_FAT_THRESHOLD=2048' '--entrypoint vllm ds41-cmp170hx:1.2.0-fidelity serve /models/DeepSeek-V4.1-Flash-1017-hybrid' '--quantization exl3 --load-format safetensors --safetensors-load-strategy lazy' '--tensor-parallel-size 4 --pipeline-parallel-size 1' '--served-model-name deepseek-v4.1-flash --host 0.0.0.0 --port 8011' '--max-model-len 262144 --max-num-seqs 8 --max-num-batched-tokens 2048 --gpu-memory-utilization 0.98' '--kv-cache-dtype fp8_ds_mla --enable-prefix-caching' '--compilation-config {"cudagraph_mode": "FULL_AND_PIECEWISE", "cudagraph_capture_sizes": [1,2,3,4,5,6,8,12,16,18,20,24,28,30,32,36,42,48]}' --async-scheduling '--tokenizer-mode deepseek_v41 --enable-auto-tool-choice --tool-call-parser deepseek_v41 --reasoning-parser deepseek_v41' --enable-prompt-tokens-details

env

P2P: 1
BIND: 127.0.0.1
PORT: 8011
IMAGE: 'ds41-cmp170hx:1.2.0-fidelity'
LAYOUT: tp4
EXTRA_ARGS: '--enable-prompt-tokens-details'
SPEC_TOKENS: 0
MAX_NUM_SEQS: 8
MAX_MODEL_LEN: 262144
ENGRAM_STORAGE: ssd
ENGRAM_HOST_DIR: /opt/engram-ram/DeepSeek-V4.1-Flash-1017-engram
GPU_MEMORY_UTILIZATION: 0.98
VLLM_EXL3_FAT_THRESHOLD: 2048

runtime

notes: "Patched serve.sh: SPEC_TOKENS=0 drops --speculative-config entirely (no DSpark drafter, no DSV41_DYNK); ENGRAM_HOST_DIR mounted read-only at /engram with DSV41_ENGRAM_STORAGE=ssd; start.sh runs engram-ram.sh first when ENGRAM_HOST_DIR is under /opt/engram-ram/ (tmpfs ENGRAM_TMPFS_SIZE=200G, copy ~94 s from NVMe). API has no auth by default - bind stays 127.0.0.1 until EXTRA_ARGS carries --api-key. Startup log must show 'Built engram token map (129280 -> 99092 ids) for layers (1, 14)' per rank and NO 'offloaded to pinned' line; 'GPU KV cache size: 2,717,420 tokens' at 0.98 (2,417,392 at 0.97, 1,817,233 at 0.95). Graft build: tools/make_hybrid_graft.py k3 = 188,241 tensors, 23,040 grafted at 3 bits, 88 links."

Use this recipe with your agent

Paste this into any agent chat — it fetches and applies the recipe:

Fetch https://localairecipes.com/api/v1/recipes/deepseek-v4-1-flash-1017-fidelity-first-4x-cmp-170hx-alanoo81.json and apply the inference recipe it describes (engine flags, model, quant, context) to my setup. Ask before overwriting any existing config.

Or fetch it directly:

curl -fsSL https://localairecipes.com/api/v1/recipes/deepseek-v4-1-flash-1017-fidelity-first-4x-cmp-170hx-alanoo81.json

Engine

Install note: Local image ds41-cmp170hx:1.2.0-fidelity built via the upstream recipe's docker/build.sh at 2ad5741ab1 (build ~20 min, image 17.8 GB; the patches do not touch the Dockerfile - the image is the upstream 1.2.0 image under another tag). Clone GNmac-lab/deepseek-v41-flash-1017-cmp170hx @ 2ad5741ab1, apply this repo's recipe/*.patch with patch -p1, copy recipe/tools/*, recipe/engram-ram.sh and recipe/env.example (as .env), run tools/download-pinned.sh (~428 GiB, pinned revisions), tools/make_hybrid_graft.py <MODELS_DIR> DeepSeek-V4.1-Flash-1017-hybrid k3, then ./start.sh (engram-ram.sh then serve.sh; first start ~10 min kernel compile). Run in Docker with GPUs passed via CDI (--device nvidia.com/gpu=all); NVIDIA open driver 610.43.02 from a cmpunlocker fork with a P2P patch; bc, curl, python3, git, patch on the host. WARNING: the built image contains AGPL-3.0-only vllm-exl3 code (upstream patches/vllm-exl3/); serving it over a network triggers AGPL-3.0 section 13 - see the repo NOTICE.md.

Model

Context

  • max context: 256K tokens

KV pool

  • 2,717,420 tokens across concurrent requests

Performance

Speed by context

ContextConc.PrefillDecodeTTFT
32,768—2514 tok/s——reported
262,1441—105.4 tok/s—reported
262,1442—174.3 tok/s—reported
262,1444—325.2 tok/s—reported
262,1448—505 tok/s—reported
272,3841—105 tok/s—reported
272,3848—482.4 tok/s—reported
282,6241—104.8 tok/s—reported
282,6248—449.2 tok/s—reported

prefill = prompt processing · decode = generation. All decode/prefill figures are shown as reported.

reported

notesclaimed_by=submitter T0 - the author's own harness (docs/results.md @ da967740; MiaAI-Lab decode protocol: temp 0, thinking off, 400-token cap; cold prefill = median of 9 runs of texts ~24k/34k/38k tokens, no cache hits). The speed table was measured at gpu_memory_utilization 0.95 (changes the KV pool size, not the kernels); production runs at 0.98. Cards 200 W, 170tune +200 MHz. Fidelity (paired NLL, 64 x 1,024-token windows per set): perplexity vs the published 2.9bpw pack -1.80% all [-2.00,-1.60], -4.45% French [-4.97,-3.93] (64/64 better), -0.70% English, -0.18% code; copy test 300/300 exact (100 lists x 40 ids x 3 passes), repeats byte-identical; A-B-A restart check bit-identical prompt logprobs on 192 long windows. Stress: 2 waves of 8 unique 100k prompts, 16/16; peak 63,580/64,911 MiB usable per card at 0.98 (~1.3 GiB left); prompt_logprobs on 1,024-token windows peaks 64,676 MiB (~0.23 GiB) - use 0.97 (2,417,392 tokens) or <=512-token windows for that workload.

Downloads

Revision notes

Initial version.

Revision history

Initial version.

Fork

Sign in to fork this recipe — a fork is your own copy; you own it and only you can update it.

Export

recipe.yaml (raw)