Views
No views yet
serving/ folder, this quant enables serving
on Ampere.tools/ampere/dsv4_requant_checkpoint.py from the
AppMana vllm-consumer-nvidia-platforms fork:1python tools/ampere/dsv4_requant_checkpoint.py \
2 --src deepseek-ai/DeepSeek-V4-Flash-0731 \
3 --dst ./output \
4 --expert-format mxfp4 \
5 --dense-int8-strategy channel \
6 --device cuda:0 \
7 --overwriteserving/convert.sh.
Regenerate with serving/convert.sh; compare shard hashes against
serving/checksums/ (sha256 of the published files).deepseek-ai/DeepSeek-V4-Flash-0731
Fork: AppMana/forks-vllm-consumer-nvidia-platforms branch appmana/upstream-merge, tip 760ced86b + the two serving/patches (== commit 623739503)
Similar quants: appmana/deepseek-v4-mxfp4-int8 (pre-0731, no DSpark),
appmana/deepseek-v4-int4-int8 (0731, INT4 experts, faster but less headroom)| Profile | KV pool | Single | 4-way agg | Notes |
|---|---|---|---|---|
| TP4xPP2, async, 512K window (recommended default) | 1,008,842 tok = 1.92x @512K | 49 tok/s | 135 tok/s | 492K-token ingest validated E2E |
| TP8, async, 262K | 413,887 tok = 1.58x @262K | 58 tok/s | 139 tok/s | max single-stream |
| TP8, sync, 262K + 20 GiB CPU offload | 461,011 tok + CPU spill | 49 tok/s | 120 tok/s | clean teardown |
--max-num-batched-tokens 128 gives 100% Triton JIT cache hitserving/patches/,
and flash-mla==2.0.0+8ec3de6.https://appmana.github.io/forks-flash-mla-int/,
which redirects to
GitHub releases.
If it is unavailable, the sm86 attention path has no fallback. Consider
mirroring the wheel if you depend on this setup.1# 1. Quant (also provides serving/patches/ and serving/serve.sh)
2Q="$(hf download Jon-Nielsen/__REPO__)"
3
4# 2. Fork at the pinned commit (current public tip of the branch)
5git clone --branch appmana/upstream-merge \
6 https://github.com/AppMana/forks-vllm-consumer-nvidia-platforms.git
7cd forks-vllm-consumer-nvidia-platforms
8git checkout 760ced86b
9
10# 3. Patches: upstream engine sync, then the consumer-NVIDIA fixes
11git apply "$Q/serving/patches/0001-upstream-sync-20260906.patch"
12git apply "$Q/serving/patches/0002-consumer-nvidia-fixes-20260906.patch"
13
14# 4. Dependencies
15python -m venv .venv && source .venv/bin/activate
16pip install torch==2.13.0+cu130 \
17 --extra-index-url https://download.pytorch.org/whl/cu130
18pip install flash-mla==2.0.0+8ec3de6 \
19 --extra-index-url https://appmana.github.io/forks-flash-mla-int/
20
21# 5. Build and install (sm86 only — saves 3-5x build time)
22MAX_JOBS=12 TORCH_CUDA_ARCH_LIST="8.6" pip install -e . --no-build-isolation
23
24# 6. Serve — defaults are the recommended measured profile
25# (TP4 x PP2, async scheduling, 512K context, ~1.0M-token KV pool)
26VENV="$PWD/.venv" MODEL="$Q" bash "$Q/serving/serve.sh"CUDA_VISIBLE_DEVICES=0,1,2,7,3,4,5,6.serving/serve.sh — see serving/README.md and serving/profiles.md for
what each knob does and the alternative profiles.760ced86b (branch
appmana/upstream-merge), applied in order:VLLM_DSV4_PREFILL_CHUNK_SIZE (long-context workspace locked fix)_vllm_fa3_C optional (Ampere builds produce no FA3 .so)760ced86b + both patches equals commit 623739503 of the maintainer's line
(verified in a throwaway worktree; modulo serving documentation). The previous
recipe's three patches (expert weight loader, conversion kernel block, int8
prefill safety) are superseded — all three are contained in 0002.serving/
serve.sh — launcher; defaults = recommended profile
profiles.md — measured profile matrix + envelope rules
README.md — recipe, knob explanations, known-good facts
convert.sh — re-run the conversion (tool in the patched fork)
tests/ — bench harness behind profiles.md + card numbers
checksums/ — sha256 of published shards (base/ablit)
patches/0001-upstream-sync-20260906.patch — upstream engine sync (745 KB)
patches/0002-consumer-nvidia-fixes-20260906.patch — consumer-NVIDIA fixes (43 KB)deepseek-ai/DeepSeek-V4-Flash-0731,
included for reference only. The encoding/ and inference/ folders it
mentions are not part of this repository.| Benchmark | DeepSeek-V4-Flash-0731 | DeepSeek-V4-Flash (Preview) | DeepSeek-V4-Pro (Preview) | GLM-5.2 | Opus-4.8 |
|---|---|---|---|---|---|
| Terminal Bench 2.1 | 82.7 | 61.8 | 72.1 | 81.0 | 85.0 |
| NL2Repo | 54.2 | 39.4 | 38.5 | 48.9 | 69.7 |
| Cybergym | 76.7 | 38.7 | 52.7 | - | 83.1 |
| DeepSWE | 54.4 | 7.3 | 12.8 | 46.2 | 58.0 |
| Toolathlon-Verified | 70.3 | 49.7 | 55.9 | 59.9 | 76.2 |
| Agents' Last Exam | 25.2 | 15.8 | 16.5 | 23.8 | 25.7 |
| AutomationBench Public | 25.1 | 10.8 | 12.8 | 12.9 | 27.2 |
| DSBench-FullStack † | 68.7 | 37.0 | 41.8 | 61.8 | 71.6 |
| DSBench-Hard † | 59.6 | 25.8 | 31.1 | 54.5 | 71.7 |
max reasoning effort level with temperature = 1.0, top_p = 0.95.encoding folder with Python scripts and test cases demonstrating how to encode messages in OpenAI-compatible format into input strings for the model, and how to parse the model's text output. Please refer to the encoding folder for full documentation.reasoning_effort parameter now supports three levels — low, high, and max — which control how much deliberation the model spends before answering.1from encoding_dsv4 import encode_messages, parse_message_from_completion_text
2
3messages = [
4 {"role": "user", "content": "hello"},
5 {"role": "assistant", "content": "Hello! I am DeepSeek.", "reasoning_content": "thinking..."},
6 {"role": "user", "content": "1+1=?"}
7]
8
9# messages -> string
10prompt = encode_messages(messages, thinking_mode="thinking", reasoning_effort="max")
11
12# string -> tokens
13import transformers
14tokenizer = transformers.AutoTokenizer.from_pretrained("deepseek-ai/DeepSeek-V4-Flash-0731")
15tokens = tokenizer.encode(prompt)--speculative-config '{"method":"dspark","num_speculative_tokens":7,"draft_sample_method":"greedy"}'1vllm serve deepseek-ai/DeepSeek-V4-Flash-0731 \
2 --trust-remote-code --kv-cache-dtype fp8 --block-size 256 \
3 --data-parallel-size 4 --enable-expert-parallel \
4 --moe-backend deep_gemm_mega_moe \
5 --attention-config '{"use_fp4_indexer_cache": true}' \
6 --speculative-config '{"method":"dspark","num_speculative_tokens":7,"draft_sample_method":"greedy"}'--speculative-algorithm DSPARK and do not set a separate --speculative-draft-model-path as the target and draft weights therefore come from the same checkpoint.
See the SGLang cookbook for detailed instructions, benchmarks and other hardwares configurations.1sglang serve \
2 --trust-remote-code \
3 --model-path deepseek-ai/DeepSeek-V4-Flash-0731 \
4 --tp 4 \
5 --moe-runner-backend flashinfer_mxfp4 \
6 --speculative-algorithm DSPARK \
7 --mem-fraction-static 0.90 \
8 --chunked-prefill-size 4096 \
9 --swa-full-tokens-ratio 0.1 \temperature = 1.0, with top_p = 0.95 for agentic scenarios and top_p = 1.0 otherwise. For the high and max reasoning effort levels, we recommend a maximum output length of 384K tokens.@misc{deepseekai2026deepseekv4,
title={DeepSeek-V4: Towards Highly Efficient Million-Token Context Intelligence},
author={DeepSeek-AI},
year={2026},
}