DeepSeek open-sourced DeepInfer in October 2026. It’s the inference engine behind DeepSeek’s own production serving, though the public release covers offline inference only. The README is short, but the build pulls in a lot: a CUDA 13 toolchain, pinned PyTorch wheels, four vendor kernels compiled from git submodules, and an environment variable you must not forget. This guide walks through an install on Linux in order and explains what each step is doing, so a failure can be traced back to the stage that caused it.
Quick fix: Most failed DeepInfer builds come from one of three things.
DEEPINFER_ACCELERATORisn’t exported in the current shell. The Python environment isn’t a fresh 3.12 environment. Or the GPU isn’t a supported architecture (NVIDIA SM100-class GPUs or Huawei Ascend 950 NPUs in this release). Check those before you read any long traceback.
Every command, version pin and message below comes from the official deepseek-ai/DeepInfer repository (README, build.sh and requirements files) as of early November 2026. Where something is unclear upstream, we say so.
What is DeepInfer and should you use it?
DeepInfer is an Apache-2.0 inference engine published at github.com/deepseek-ai/DeepInfer. According to its README it powers DeepSeek’s production serving. This first public release targets offline (batch) inference of DeepSeek-V4.1-Flash, and the default checkpoint is deepseek-ai/DeepSeek-V4.1-Flash-1017. The project says it was originally built on top of vLLM.
What the release does and doesn’t include
| Area | Status in the public release |
|---|---|
| Model support | DeepSeek-V4.1-Flash |
| Hardware | NVIDIA SM100 GPUs, Huawei Ascend 950 NPUs |
| Offline inference | Yes (examples/offline_inference.py) |
| Benchmark script | Yes (examples/benchmark.py) |
| Structured outputs | Yes (so_args in SamplingParams) |
| KV cache system, prefill/decode disaggregation, DP load balancing | Not in this release |
If you want an OpenAI-style HTTP server on consumer GPUs, DeepInfer isn’t that tool today. Look at llama.cpp, Ollama or vLLM instead (see Related guides). DeepInfer makes sense if you run multi-GPU SM100 or Ascend 950 nodes and want the engine DeepSeek tunes for its own models.
What do you need before installing?
The README lists these prerequisites:
| Requirement | NVIDIA | Ascend |
|---|---|---|
| OS | Linux | Linux |
| Compiler | GCC ≥ 13.0 | GCC ≥ 13.0 |
| Python | 3.12, in an empty environment | 3.12, in an empty environment |
| Toolkit | CUDA 13 | CANN 9.2 |
| Accelerator | SM100 GPUs | Ascend 950 NPUs |
The “empty environment” requirement matters. The NVIDIA requirements file pins exact versions, including torch==2.13.0+cu132, flash-attn-4==4.0.0b34, transformers==4.50.0, xgrammar==0.2.2, tilelang==0.1.15 and huggingface_hub==0.36.2. Installing those over an existing ML environment is the fastest way to get confusing ABI errors.
How do you install DeepInfer step by step?
Step 1: Check the toolchain
gcc --version | head -1
nvcc --version | tail -2
nvidia-smi --query-gpu=name,compute_cap,driver_version --format=csv
You should see GCC 13 or newer, a CUDA 13.x nvcc, and a compute capability of 10.x on every GPU. If compute_cap reports 9.0 (Hopper, e.g. H100/H20), you’re outside the supported list. A community pull request for SM90 exists upstream, but until it lands in a release, treat Hopper as unsupported.
Step 2: Create a clean Python 3.12 environment
git clone --recursive https://github.com/deepseek-ai/DeepInfer.git
cd DeepInfer
uv venv --python 3.12 .venv # or: python3.12 -m venv .venv
source .venv/bin/activate
python -m ensurepip --upgrade # build.sh calls pip
python -V
You should see Python 3.12.x. Cloning with --recursive is optional because the vendor script runs git submodule update --init anyway, but it surfaces network problems early.
Step 3: Export the accelerator and build
export DEEPINFER_ACCELERATOR=nvidia # or: ascend
./build.sh
The build runs in stages. The diagram shows the order:

pip install -r requirements-nvidia.txtinstalls the pinned stack.- It force-reinstalls
nvidia-nccl-cu13==2.32.3. scripts/build_vendor.shinitializes the submodules and builds wheels for DeepSelect, FlashMLA, DeepEP and DeepGEMM (withDG_FORCE_BUILD=1) intobuild/<accelerator>-<arch>/vendor-wheels.scripts/build.sh buildcompiles DeepInfer itself.
You should see this line at the end:
✅ DeepInfer is successfully built
Step 4: Run offline inference
python examples/offline_inference.py # default: --ep 8
python examples/offline_inference.py --ep 2 --dp 8
python examples/offline_inference.py --ep 2 --cp 8 --long_context
--ep sets expert parallelism, --dp data parallelism and --cp context parallelism. The script also accepts --model_name and --check_structured_output. To use weights you’ve already downloaded, point DEEPINFER_HF_MODEL_DIR at the local directory so the script doesn’t fetch from Hugging Face again.
Which DeepInfer errors are most common, and how do you fix them?
“Usage: DEEPINFER_ACCELERATOR=nvidia|ascend”
build.sh exits with this message when the variable is unset. The usual cause is that you set it in a different terminal, or ran DEEPINFER_ACCELERATOR=nvidia without export and then started the build on a later line. Keep it exported for the whole session, because later scripts read it too. A recent upstream change also makes the build reject unknown values, so a typo like cuda now fails fast instead of half-building.
pip resolver conflicts or “no matching distribution” for torch
The +cu132 local version only exists on PyTorch’s CUDA wheel index, and Python must be 3.12. Make sure python -V inside the venv shows 3.12, and that no global PIP_INDEX_URL or pip.conf is overriding the index that the requirements file expects. If you’re behind a TLS-inspecting proxy, see our SSL guide below.
Vendor kernel build fails (DeepGEMM, FlashMLA, DeepEP)
These builds compile CUDA code and are the most sensitive stage:
- Check
nvccis CUDA 13 and is the firstnvcconPATH. - Check GCC is version 13 or newer. Older compilers reject newer C++ features in the kernels.
- Make sure the machine has enough RAM for parallel nvcc jobs. Out-of-memory kills often look like a cryptic “Killed” line.
- If
git submodule update --initfailed silently, a vendor directory will be empty. Re-run it by hand and read the error.
Assertion in index attention with very short prompts
An open upstream issue reports that very short prompts can trigger an assertion in the index-attention path. If your smoke test uses a one-word prompt and crashes, try a longer, realistic prompt before you debug your install.
Benchmark sees the wrong number of GPUs
examples/benchmark.py derives the expert-parallel size from WORLD_SIZE × the number of visible devices. On a single 8-GPU node:
WORLD_SIZE=1 RANK=0 CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7 \
python examples/benchmark.py
If you see an EP size that doesn’t match your hardware, check CUDA_VISIBLE_DEVICES first.
Which environment variables are worth knowing?
| Variable | What it does (per README) |
|---|---|
DEEPINFER_ACCELERATOR |
nvidia or ascend; required for the build |
DEEPINFER_HF_MODEL_DIR |
Local model directory instead of downloading |
DEEPINFER_USE_NEXTN_DECODE |
Speculative (next-n) decode depth; default 5, 0 disables it |
DEEPINFER_ENABLE_MTP_VARLEN=1 |
Enables variable-length multi-token prediction |
DEEPINFER_BATCH_INVARIANT=1 |
Batch-invariant mode for reproducible outputs |
DEEPINFER_YOCO_PREFILL_TRUNCATION_MODE=compact |
Prefill truncation mode (paired with ..._KEEP_TOKENS) |
ASCEND_LAUNCH_BLOCKING=1, ASCEND_SLOG_PRINT_TO_STDOUT=1 |
Ascend debugging aids |
Tip: When you’re debugging accuracy rather than speed, set
DEEPINFER_USE_NEXTN_DECODE=0andDEEPINFER_BATCH_INVARIANT=1first. That takes speculative decoding and batch effects out of the picture.
FAQ
Can I run DeepInfer on an RTX 4090 or H100?
Not officially. The release lists SM100 GPUs and Ascend 950 NPUs only. Consumer GPUs and Hopper aren’t supported targets in this release.
Does DeepInfer provide an HTTP API?
Not in the current README. It documents offline inference and benchmarking. For an OpenAI-compatible endpoint, use a serving stack such as vLLM or llama.cpp’s llama-server.
Is DeepInfer a vLLM fork?
The README says it was originally built on vLLM and has since diverged. Don’t expect vLLM flags or plugins to work.
Where do I report build problems?
On the GitHub issue tracker. Include your GPU model and compute capability, the nvcc and GCC versions, the full build.sh log, and the value of DEEPINFER_ACCELERATOR.


Leave a Reply