# deepseek-ai/deepinfer — AlpLab Radar Static Code Audit

- Ring: `trial`
- Category: `ai-models`
- Overall score: `3.1/5`
- Implementation check: `verified`
- Maturity: `early`
- Audited commit: `a679bb86ce36` (read-only; nothing from the repository was executed)
- Reviewed at: 2026-11-30T12:43:25Z
- Repository: https://github.com/deepseek-ai/deepinfer
- Radar entry: https://radar.alplab.co/#repo/deepseek-ai/deepinfer
- License: `Apache-2.0`
- Tags: `inference`, `llm`, `moe`, `cuda`, `ascend`, `speculative-decoding`

## Summary

DeepSeek's production LLM inference engine for DeepSeek-V4.1-Flash, open-sourced as offline inference only: C++ scheduler/block manager + Python engine, TileLang/custom kernels, MoE EP+EPLB, DSpark speculative decoding, YoCo SWA replay, xgrammar structured outputs; targets NVIDIA SM100 and Ascend 950

## Implementation Check

README features are implemented in code (scheduler: deepinfer/_C engine pyi + csrc/engine/scheduler.hpp; EPLB: deepinfer/model_executor/models/deepseek.py _init_eplb; SWA replay: deepinfer/model_executor/input_metadata/yoco.py; structured output: deepinfer/structure_output/matcher.py) and the README honestly discloses what is excluded (KV cache store, P/D disaggregation, load balancers, online-serving wrapper — doc/inference_deployment_qa.md)

## When to Use

You run DeepSeek-V4.1-Flash offline generation on NVIDIA SM100 (CUDA 13) or Ascend 950 (CANN 9.2) hardware and want DeepSeek's own engine. Not usable on other GPUs/architectures, and there is no HTTP/serving API — do not reach for it as a general vLLM replacement.

## Sub-scores

| Dimension | Score |
|---|---|
| quality | 4.5/5 |
| usability | 2.0/5 |
| reliability | 3.0/5 |
| security | 4.0/5 |
| integration | 2.0/5 |

## Code Evidence

Substantial coherent implementation, not scaffolding: csrc/engine/scheduler.hpp (66KB) and csrc/engine/zos.cpp implement async zero-overhead scheduling wired through deepinfer/engine/llm_engine.py; deepinfer/model_executor/layers/tilelang_ops/ implements ~30 kernels with backend dispatch (ops.py); tests/models/test_offline_inference.py runs the real entrypoint end-to-end against golden decode-PPL baselines (tests/models/offline_decode_ppl.json); HF weight loading validates shard integrity, shapes, dtypes and folded FP32 HC/sink weights (deepinfer/hugging_face/loading.py); .gitmodules vendors FlashMLA/DeepGEMM/DeepEP/DeepSelect built by scripts/build_vendor.sh

## Issues Found

deepinfer/distributed/shm_broadcast.py unpickles data over local ZMQ/shm sockets (trusted same-host IPC, vLLM heritage — fine but worth knowing); examples/_config.py create_llm defaults trust_remote_code=True, executing code from the HF model repo; no CI workflows committed though CONTRIBUTING.md defines ci/ci_npu test markers; engine hard-requires CUDA_VISIBLE_DEVICES to be set (deepinfer/engine/llm_engine.py __init__ reads os.environ['CUDA_VISIBLE_DEVICES'] unguarded) — CPU-only smoke-testing of the engine is effectively impossible

## Key Risks

Nothing was executed — all claims are from reading code; the test suite is hardware-bound (ci/ci_npu markers, golden PPL requires 4 SM100 GPUs or 16 Ascend NPUs plus the gated HF checkpoint), so reliability is a code judgement, not a run result. No CI config exists in-tree (.github absent) despite ci-marked tests. Production-scale performance numbers (155T tokens/day) and benchmark charts are DeepSeek's own, unverifiable from the repo. Internal comments are largely Chinese. Six git submodules are fetched and built from source at install time.

## Reviewed Files

- `README.md`
- `pyproject.toml`
- `setup.py`
- `.gitmodules`
- `requirements.txt`
- `requirements-nvidia.txt`
- `build.sh`
- `scripts/build_vendor.sh`
- `Makefile`
- `CONTRIBUTING.md`
- `doc/inference_deployment_qa.md`
- `examples/offline_inference.py`
- `examples/_config.py`
- `deepinfer/entrypoints/llm.py`
- `deepinfer/engine/llm_engine.py`
- `deepinfer/environ.py`
- `deepinfer/structure_output/matcher.py`
- `deepinfer/hugging_face/loading.py`
- `deepinfer/npu_ops/patch_imports.py`
- `deepinfer/model_executor/models/deepseek.py`
- `deepinfer/testing.py`
- `deep_cluster/hardware/device.py`
- `deep_cluster/hardware/ascend.py`
- `eval/common/judge.py`
- `tests/conftest.py`
- `tests/models/test_offline_inference.py`
