DeepSeek veröffentlicht Inference-Framework DeepInfer als Open Source
DeepSeek hat DeepInfer offen gelegt, das Framework hinter seinen grossen Produktionsdiensten. Offline-Inferenz wird zunachst fur DeepSeek-V4.1-Flash auf NVIDIA SM100 GPUs und Huawei Ascend 950 NPUs unterstutzt, ein Leitfaden erklart den Einstieg, deterministische Ausgaben und die JSON-Schema-Nutzung.

Veröffentlicht am 24. Okt. • Zuerst erschienen auf dedupedai.com
DeepSeek hat DeepInfer als Open Source veröffentlicht, das Inferenz-Framework hinter seinen groß angelegten Produktionsdiensten. Diese Veröffentlichung bietet Offline-Inferenz für DeepSeek-V4.1-Flash auf NVIDIA SM100 GPUs oder Huawei Ascend 950 NPUs.
Dieser Leitfaden behandelt die drei Dinge, die die meisten Ingenieure zuerst wissen wollen: einen Build zum Laufen bringen, Ausgaben für Regressionstests reproduzierbar machen und die Ausgabe in ein JSON-Schema zwingen. Alles Folgende stammt aus dem README des Repositories.
Es handelt sich um Offline-Inferenz mit optimierten Kernels, Attention DP und MoE Expert Parallelism, Draft-Token-Decoding, asynchronem Scheduling, batch-invarianter Inferenz, deterministischem Sampling und strukturierten Ausgaben.
Es ist kein vollständiger Serving-Stack. Das README listet auf, was man noch benötigt: ein KV-Cache-System, Prefill/Decode-Disaggregation und Lastverteilung über data-parallele Replikate. Plane entsprechend.
Voraussetzungen: Linux, GCC 13.0 oder neuer, Python 3.12 und CUDA 13 (NVIDIA) oder CANN 9.2 (Ascend).
Erstelle und aktiviere zunächst eine leere Python 3.12 Umgebung. Dann:
# Für die Ascend-Plattform stattdessen `ascend` verwenden # In der Umgebung exportiert lassen, in der DeepInfer ausgeführt wird export DEEPINFER_ACCELERATOR = nvidia./build.sh Step 2: Offline-Inferenz ausführen python examples/offline_inference.py Der Standard-Checkpoint deepseek-ai/DeepSeek-V4.1-Flash-1017 wird beim ersten Lauf in den Hugging Face Cache heruntergeladen. Um stattdessen eine lokale Kopie zu verwenden:
export DEEPINFER_HF_MODEL_DIR = /path/to/DeepSeek-V4.1-Flash-1017 Die examples/README.md des Repositories enthält die Details zu jedem Beispiel.
Vorher-Nachher-Vergleiche sind nutzlos, wenn Ausgaben je nach Batch-Zusammensetzung oder Sampling-Zufälligkeit variieren. DeepInfer bietet dafür zwei Schalter, beide nur für NVIDIA:
export DEEPINFER_BATCH_INVARIANT = 1 export DEEPINFER_ENABLE_MTP_VARLEN = 0 Anschließend übergib ein festes seq_seed an SamplingParams in deinem Skript. Gleiche Eingabe-Tokens plus gleiche Sampling-Parameter liefern nun dieselbe Ausgabe. Ein einfacher Check: führe dieselbe Prompt-Datei zweimal aus und vergleiche die beiden Ausgaben mit diff. Ein leeres Diff bedeutet Bestehen.
Beachte den Tradeoff: DEEPINFER_ENABLE_MTP_VARLEN=1 aktiviert den Geschwindigkeitsvorteil durch Draft-Token-Decoding, daher muss man bei deterministischen Läufen darauf verzichten.
Strukturierte Ausgaben beschränken die Generierung auf einen Regex, ein JSON-Schema oder eine EBNF-Grammatik. Übergib sie über SamplingParams:
so_args = { " schema_type ":..., " schema ":...} Beginne mit examples/_structured_output.py im Repository, das zeigt, wie die Einschränkung aufgebaut wird, und parse dann den zurückgegebenen Text mit json.loads und prüfe die erforderlichen Schlüssel.
Die Prefill- und Decode-Diagramme des READMEs wurden auf 4 SM100 GPUs für Prefill und 64 für Decode gemessen, jeweils innerhalb einer Scale-up-Domain. Das Sweep-Skript liegt unter examples/sweep/run_sweep.sh. In einem kleineren Setup werden deine Zahlen nicht direkt mit den Diagrammen übereinstimmen, vergleiche also Formen, nicht Absolute.
DeepInfer wird unter der Apache License 2.0 veröffentlicht.
Erhalte jede Woche montags eine E-Mail mit den angesagtesten AI-Repos der Woche und genau, wie man sie nutzt: kostenlos abonnieren auf dedupedai.com
Automatisch übersetzt. Das Original auf Englisch ist unten aufklappbar.
Original (Englisch) anzeigen
Posted on Oct 24 • Originally published at dedupedai.com
DeepSeek open-sourced DeepInfer, the inference framework behind its large-scale production services. This release does offline inference for DeepSeek-V4.1-Flash on NVIDIA SM100 GPUs or Huawei Ascend 950 NPUs.
This guide covers the three things most engineers will want first: getting a build running, making outputs repeatable for regression tests, and forcing output into a JSON schema. Everything below comes from the repo's README.
It is offline inference with optimized kernels, attention DP and MoE expert parallelism, draft-token decoding, asynchronous scheduling, batch-invariant inference, deterministic sampling and structured outputs.
It is not a complete serving stack. The README lists what you would still need: a KV cache system, prefill/decode disaggregation, and load balancing across data-parallel replicas. Plan accordingly.
Prerequisites: Linux, GCC 13.0 or newer, Python 3.12, and CUDA 13 (NVIDIA) or CANN 9.2 (Ascend).
Create and activate an empty Python 3.12 environment first. Then:
# Use `ascend` instead for the Ascend platform # Keep it exported in the environment where you run DeepInfer export DEEPINFER_ACCELERATOR = nvidia./build.sh Enter fullscreen mode Exit fullscreen mode Step 2: Run offline inference python examples/offline_inference.py Enter fullscreen mode Exit fullscreen mode The default checkpoint, deepseek-ai/DeepSeek-V4.1-Flash-1017, downloads into the Hugging Face cache on the first run. To use a local copy instead:
export DEEPINFER_HF_MODEL_DIR = /path/to/DeepSeek-V4.1-Flash-1017 Enter fullscreen mode Exit fullscreen mode The repo's examples/README.md has the details of each example.
Before and after comparisons are useless if outputs drift with batch composition or sampling randomness. DeepInfer has two switches for that, both NVIDIA only:
export DEEPINFER_BATCH_INVARIANT = 1 export DEEPINFER_ENABLE_MTP_VARLEN = 0 Enter fullscreen mode Exit fullscreen mode Then pass a fixed seq_seed to SamplingParams in your script. Same input tokens plus same sampling parameters now give the same output. A simple check: run the same prompt file twice and diff the two outputs. An empty diff is a pass.
Note the tradeoff: DEEPINFER_ENABLE_MTP_VARLEN=1 is what turns on the draft-token decoding speedup, so deterministic runs give that up.
Structured outputs constrain generation to a regex, a JSON schema or an EBNF grammar. Pass them through SamplingParams:
so_args = { " schema_type ":..., " schema ":...} Enter fullscreen mode Exit fullscreen mode Start from examples/_structured_output.py in the repo, which shows how the constraint is built, then parse the returned text with json.loads and check the required keys.
The README's prefill and decode charts were measured on 4 SM100 GPUs for prefill and 64 for decode, each within one scale-up domain. The sweep script is at examples/sweep/run_sweep.sh. On a smaller setup your numbers will not match the charts directly, so compare shapes, not absolutes.
DeepInfer is released under the Apache License 2.0.
Get one email every Monday with the week's hottest AI repos and exactly how to use them: subscribe free at dedupedai.com