drowzeys GitHub avatar

Keys-Concurrency-Patch-for-DSpark-DeepSeek-V4-Flash

drowzeys

A patch that enables correct in-server continuous-batch concurrency for DSpark speculative decoding on NVIDIA DGX Spark, overcoming the default max-num-seqs=1 limitation.

Stars

11

7-day growth

No data

Forks

0

Open issues

0

License

Apache-2.0

Last updated

2026-06-29

AI repository intelligence
FR-AI / ANALYSIS

Why it is worth attention

It removes a hard concurrency bottleneck in DSpark serving, delivering up to 290 tok/s with 16 concurrent requests and zero errors, while preserving single-stream byte-identical output.

Who it is for

  • Developers deploying DSpark-based speculative decoding on DGX Spark hardware
  • Users of DeepSeek-V4-Flash/Pro in production or research environments
  • Engineers optimizing throughput for LLM serving with speculative decoding
  • Researchers evaluating continuous batching for speculative decoding systems

Use cases

  • Serving multiple concurrent user requests with high throughput and low latency
  • Scaling out DSpark serving across multiple DGX Spark stacks for larger workloads
  • Maintaining deterministic output correctness under request churn and continuous batching
  • Benchmarking concurrency vs. throughput trade-offs in speculative decoding

Strengths

  • Proven performance: 290 tok/s at concurrency 16 on a single 2-Spark stack, 375 tok/s on two stacks with near-linear scaling
  • Byte-identical output under concurrent load, validated with a correctness test
  • Zero errors observed across all tested concurrency levels (1-16 per stack)
  • Minimal code changes (+278 lines) targeting only two root causes

Considerations

  • Only validated on DeepSeek-V4-Flash-DSpark; DeepSeek-V4-Pro-DSpark is untested
  • Ragged path requires VLLM_DSPARK_GPU_REJECTED_CONTEXT_MASK=1; legacy uniform path remains unmodified
  • A multi-hour soak is recommended before production deployment, and the patch requires a specific overlay build

README quick start

Keys-Concurrency Patch for DSpark + DeepSeek-V4-Flash/Pro

Correct in-server continuous-batch concurrency for DSpark speculative decoding on NVIDIA DGX Spark (GB10 / SM121).

Stock DSpark serving forces --max-num-seqs 1 — the upstream recipe states the DSpark draft path "stalls under max_num_seqs>1 in this build, so requests serialize. The win is depth (context), not width (concurrency)."

This patch removes that limitation. With it, DSpark serves multiple concurrent streams correctly under independent (staggered) request arrivals, while keeping single-stream output byte-identical to the unpatched engine.

Validated on DeepSeek-V4-Flash-DSpark, vLLM DSpark overlay (Rafael Caricio integration / TonyD2Wild packaging), TP=2 on 2× DGX Spark (GB10), 2026-06-29. The patch is in the model-agnostic DSpark proposer/model code, so it is expected to apply to DeepSeek-V4-Pro-DSpark as well — but Pro is untested; please report results.


Results

Headline below; full single + dual-stack tables in RESULTS.md. One stack = 2× DGX Spark (GB10), TP=2, kv-cache-dtype fp8, DSpark γ=5, gpu-memory-utilization 0.80, max-num-seqs 16.

Concurrency unlocked (this patch) — one 2-Spark stack

total concurrencystatic (best-case)staggered (real arrivals)acceptanceerrors
149 tok/s~50 tok/s~0.60
4122 tok/s104 tok/s~0.590
8183 tok/s139 tok/s~0.560
16290 tok/s191 tok/s~0.550
  • Single-stream unchanged: ~50–54 tok/s, provably byte-identical output.
  • Zero errors at every level; draft acceptance stays healthy (~0.55) — DSpark keeps accelerating under load.

Scaling out — 2 stacks (4 Sparks) measured

total concurrency1 stack2 stacksscaling
32375 tok/s (16+16, 32/32 ok)~1.96×

Replicas scale ~linearly (independent stacks behind a least-connections router).

Correctness

A deterministic request (temperature 0, ignore_eos) produces byte-identical output whether run alone or while other requests start/finish around it (forcing continuous-batch condense). Run benchmarks/correctness_test.py.


What the patch does

Two root causes blocked max_num_seqs>1:

Patch 1 — request-stable KV slot. DSpark's only persistent pe

Description

Concurrency Patch to enable on DSpark - DeepSeek V4 Flash/Pro C=16 can be modified for more

Related repositories

Similar projects matched by category, topics, and programming language.

lopopolo
Featured
lopopolo GitHub avatar

harness-engineering

Harness Engineering is a methodology for improving coding agent outputs by carefully crafting the environment around them—providing curated context, tools, and executable constraints that encode an organization’s nonfunctional requirements and cumulative lessons.

AI & Machine LearningAI Agents
2,390
slvDev
Featured
slvDev GitHub avatar

esp32-ai

A 28.9 million parameter language model runs on an $8 ESP32-S3 microcontroller entirely on-device, generating simple stories at about 9.5 tokens per second.

AI & Machine LearningLarge Language Models
1,960
littledivy
Featured
littledivy GitHub avatar

mimic

mimic captures traffic from any iOS or web app and automatically generates a Python client library that lets you call the app's API like a regular library.

AI & Machine Learning
1,482