DeepInfer: High-performance inference framework for DeepSeek models
TL;DR Highlight
DeepSeek open-sourced DeepInfer, its production inference engine, under Apache-2.0.
Who Should Read
Infra or backend developers self-hosting DeepSeek models on their own GPUs who care about inference cost and throughput.
Core Mechanics
- Engine behind DeepSeek's large-scale service
- DeepInfer is the framework that powers DeepSeek's large-scale production services.
- This release covers offline inference and core features, under Apache-2.0.
- Narrow model and hardware support
- The only supported model is DeepSeek-V4.1-Flash.
- Hardware is NVIDIA SM100 GPUs and Huawei Ascend 950 NPUs.
- Plenty of speed features
- Draft tokens speed up decoding, and confidence estimates schedule verification (DSpark).
- Asynchronous scheduling overlaps CPU batch scheduling with device execution and is on by default.
- Parallelism includes Attention DP / balanced CP and MoE EP + EPLB.
- Reproducibility options
- DEEPINFER_BATCH_INVARIANT=1 keeps results identical across batch compositions (NVIDIA only).
- Deterministic sampling gives identical outputs for identical input tokens and sampling parameters.
- Structured outputs built in
- Generation can be constrained by a regex, JSON schema, or EBNF grammar.
- Pass so_args={"schema_type": ..., "schema": ...} to SamplingParams.
- Not a full serving stack yet
- The KV cache system is missing from this release.
- VE/Prefill/Decode disaggregation and load balancing across data-parallel replicas are also missing.
- Demanding build requirements
- You need Linux, GCC 13+, and Python 3.12.
- NVIDIA needs CUDA 13, and Ascend needs CANN 9.2.
Community Reactions
- Throughput and revenue figures cited
- One commenter quoted a Zhihu post saying single-cluster throughput is 155 trillion tokens/day.
- The same post reportedly gives revenue of $38 per card per hour at off-peak pricing.
- Doubts about comparing the $38 figure
- A commenter noted H100 rentals run about $2.75 per hour.
- They pointed out the card type was not specified.
- Missing KV cache system flagged
- Several comments noted the KV cache system is absent.
- One said the Zhihu post lists retaining KV cache for 72+ hours as a goal.
- Curiosity about gains over vLLM and SGLang
- Since the repo says it was inspired by both, a commenter wondered how big the performance gain is.
- Another hoped it might improve tool calling, which they said third-party DeepSeek providers handle worse.
- Mixed views on Ascend support
- Some argued Huawei Ascend support could challenge Nvidia's hold.
- Others countered that regulation keeps Huawei hardware out of the US and EU, so Nvidia stays.
- Hands-on experience with V4.1 Flash
- One commenter said they switched from a Claude Max subscription to the DeepSeek API and found V4.1 Flash fast with almost no refusals.
How to Apply
- Check the README requirements today
- Confirm whether your GPUs are SM100 (NVIDIA) or Ascend 950.
- Check that you meet Python 3.12, GCC 13+, and CUDA 13.
- Use deterministic options in regression tests
- If tests need identical outputs, set DEEPINFER_BATCH_INVARIANT=1 DEEPINFER_ENABLE_MTP_VARLEN=0.
- Pass a fixed seq_seed in SamplingParams (NVIDIA only).
- Use structured outputs to force JSON
- If your pipeline often fails parsing, pass schema_type and schema via so_args.
- Run the examples folder first to check the format.
- List what you must build before self-hosting
- Write down whether you need to build the KV cache system and load balancing yourself.
- Benchmark against your current vLLM or SGLang setup under the same conditions.
Try It
# Run in a shell (Linux, empty Python 3.12 env, NVIDIA SM100 + CUDA 13 required)
git clone https://github.com/deepseek-ai/DeepInfer
cd DeepInfer
# Use ascend instead for Ascend; keep this exported where you run DeepInfer
export DEEPINFER_ACCELERATOR=nvidia
./build.sh
# On first run, deepseek-ai/DeepSeek-V4.1-Flash-1017 downloads into the Hugging Face cache
# To use a local copy: export DEEPINFER_HF_MODEL_DIR=/path/to/DeepSeek-V4.1-Flash-1017
python examples/offline_inference.py
# Next: deterministic sampling
# DEEPINFER_BATCH_INVARIANT=1 DEEPINFER_ENABLE_MTP_VARLEN=0 python examples/offline_inference.py
# (pass a fixed seq_seed in SamplingParams)Terminology
Related Papers
A Beginner's Guide to Local AI with Inkling, Qwen, and Unsloth
Install Unsloth Desktop, load a quantized Qwen model, and share a private ChatGPT-like AI on your home LAN.
Muru – AI-assisted Rust server for Python apps by mod_WSGI's creator
mod_wsgi's creator is building Muru, an AI-assisted Rust ASGI/WSGI server, documenting it in public
87% of the Anthropic power will come from gas and 11% from coal in 2028
Analysis of Anthropic's contracted data centers: 87% gas, 11% coal power in 2028
Anthropic’s Nasdaq debut
Anthropic listed on Nasdaq and closed its first day below its opening price.
OpenAI still has a WebRTC Problem
WebRTC drops late audio, hurting voice AI; MoQ retransmits and buffers instead
Gemini 4 Neon
Gemini 4 Neon cuts cost per task 32% versus Carbon, at $3 input and $15 output per million tokens
AI is killing All About Berlin
After Google AI Overviews, a Berlin guide site lost 70-75% of its traffic.
Not Everything Needs an LLM
PostHog used small decision models to skip 98.7% of expensive LLM calls