deepseek-ai/DeepInfer
An accelerator-tuned offline inference engine for DeepSeek-V4.1-Flash
Automated SPDX check for reference only — not legal advice. Disclaimer
GitHub Star History
Full-history star trajectory from GitHub official history. Switch ranges or hover any point for exact counts.
Evidence-Backed Technical Brief
AI Deep ReviewArchitecture & Core Mechanics
DeepInfer exposes offline execution through examples/offline_inference.py. The Python runtime combines model execution and sampling with asynchronous scheduling that overlaps CPU batch preparation and accelerator execution. It supports attention data parallelism and balanced context parallelism, alongside MoE expert parallelism and expert load balancing. These are engine-level execution controls, not an online serving interface.
The source tree separates deepinfer/ and csrc/. The build uses setuptools with Ninja and PyTorch >= 2.7 as build requirements; pinned dependencies include TileLang 0.1.15 and Transformers 4.50.0. Acceleration components include FlashMLA, DeepGEMM, DeepEP, TileKernels, DeepSelect, and custom TileLang operators under deepinfer/model_executor/layers/tilelang_ops. Integration uses Python sampling parameters and environment variables; no public plugin protocol is established.
Key Capabilities & Differentiators
DeepSeek-V4.1-Flash is the only listed model. DSpark uses draft tokens and schedules verification based on confidence; the configured maximum draft length defaults to 5. Sliding-window attention (SWA) bounded replay cuts decoder prefill work by replaying a suffix. The V4.1 compact setting keeps 140 tokens; any retained suffix must cover the attention window plus maximum backtracking.
Batch invariance is opt-in. For deterministic sampling, enable it, disable variable-length MTP, and pass a fixed seq_seed. Structured generation accepts regex, JSON Schema, or EBNF. The benchmark sweeps use 4 SM100 GPUs for prefill and 64 for decode, versus 8 Ascend 950 NPUs for prefill and 64 for decode. Each configuration stays within one scale-up domain; these allocations describe benchmark topology, not minimum hardware or performance guarantees.
Trade-offs & Limitations
DeepInfer is a focused choice when the checkpoint and accelerator fleet match its support envelope and the team wants direct control over prefill and decode. Prefer evaluating a general-purpose engine if a broad model catalog, heterogeneous hardware, or a ready-to-run online API matters more. The open release is an offline engine: budget separately for API integration, request admission, and service observability rather than treating it as a complete serving stack.
Validate two distinct operating profiles if you need both accelerated decoding and strict reproducibility: the deterministic sampling recipe explicitly disables variable-length MTP. Benchmark on the intended topology and size accelerator memory for the checkpoint, context lengths, and concurrency rather than extrapolating from the published device counts. Apache-2.0 covers the engine; check checkpoint and dependency terms separately.
Hardware & Deployment Guide
Build from source on Linux in a clean Python 3.12 environment with GCC >= 13.0. NVIDIA builds require CUDA >= 13.2 on SM100; Ascend deployments require CANN 9.3 on Ascend 950 with an aarch64 host. For NVIDIA, export DEEPINFER_ACCELERATOR=nvidia before running ./build.sh and keep it set when running the engine. requirements-nvidia.txt and requirements-ascend.txt are present in the tree.
Run python examples/offline_inference.py for an initial check. The default deepseek-ai/DeepSeek-V4.1-Flash-1017 checkpoint downloads into the Hugging Face cache on first run; set DEEPINFER_HF_MODEL_DIR to use a local copy. For isolated environments, stage dependencies as well as weights: the base requirements include a commit-pinned TileKernels Git dependency. Package metadata identifies version 0.1.0 as beta; no GitHub release is listed. Pin a tested revision and record the toolchain for repeatable builds.
DEEPINFER_ENABLE_MTP_VARLEN=1 enables confidence-scheduled verification; DEEPINFER_USE_NEXTN_DECODE caps draft length, defaulting to 5.seq_seed for deterministic sampling.SamplingParams.so_args accepts regex, JSON Schema, or EBNF constraints.Teams with supported SM100 or Ascend 950 hardware that need to benchmark or integrate DeepSeek-V4.1-Flash offline, with explicit control over parallel execution and reproducibility.
You need broad model or accelerator support, or an online serving API without building and operating a separate service layer.
Quick Start & Installation
### Offline inference The default checkpoint, [`deepseek-ai/DeepSeek-V4.1-Flash-1017`](https://huggingface.co/deepseek-ai/DeepSeek-V4.1-Flash-1017), is downloaded into the Hugging Face cache on the first run; set `DEEPINFER_HF_MODEL_DIR=/path/to/DeepSeek-V4.1-Flash-1017` to run from a local copy instead.
Comparison vs. Top LLMs & Inference Alternatives
Full comparison →| Repository | Stars | 7d Trend | Stack | License | Core Positioning |
|---|---|---|---|---|---|
| DeepInfer ★ | 27.7k | +1.3k | Python | Apache-2.0 | An accelerator-tuned offline inference engine for DeepSeek-V4.1-Flash |
| vllm | 98.2k | +435 | Python | Apache-2.0 | Paged-KV inference engine for high-throughput, self-hosted LLM serving |
| sglang | 39.4k | +237 | Python | Apache-2.0 | Self-hosted inference runtime for serving LLMs and multimodal models across acce |
| ollama | 189k | +703 | Go | MIT | Go-based LLM serving layer for local model management and inference |
AI Context Briefing (for Claude / Cursor / Windsurf)
Standardized architecture summary & quickstart commands ready to paste into coding agents.
curl -sL https://repoforai.com/repo/deepseek-ai/DeepInfer.md
Active README embeds unlock Hot-Tier 6h Telemetry Refresh automatically (zero pay-to-rank).
Frequently Asked Questions about DeepInfer
What is the integration entry point, and does it expose a serving API?
python examples/offline_inference.py. For constrained generation, pass so_args to SamplingParams with a schema_type and schema; examples/_structured_output.py shows the integration. Treat DeepInfer as an offline execution engine, not a drop-in server API. An online deployment needs its own request interface and service controls.How many accelerators and how much device memory should we budget?
Can we self-host DeepInfer commercially or redistribute it?
When is DeepInfer a better fit than a general-purpose serving engine?
Upstream README & Documentation
This profile focuses on independent engineering analysis and live telemetry. Read the full upstream README, changelog, and examples directly on GitHub.
Top 10 Breakout Open-Source AI Repos, Every Thursday
Signal-only digest of fast-growing AI repos, SPDX license alerts, and architecture picks. Zero spam.
Zero spam · 1-click unsubscribe · Privacy Policy