Who it is forA QA or ML engineer who needs to check whether a model change alters outputs and must rule out batch-related noise.
The problemOutputs can change with batch composition and sampling randomness, which makes before and after comparisons unreliable.
The outcomeA test setup where the same input tokens and sampling parameters return the same output on every run on NVIDIA hardware.
What you need first
- Linux with GCC 13.0 or newer and Python 3.12
- NVIDIA SM100 GPU with CUDA 13, or Huawei Ascend 950 NPU with CANN 9.2
- Access to the deepseek-ai/DeepSeek-V4.1-Flash-1017 checkpoint on Hugging Face, or a local copy
- Enough disk space and memory for the checkpoint and the build
Steps
- Run
DEEPINFER_BATCH_INVARIANT=1 DEEPINFER_ENABLE_MTP_VARLEN=0in the shell that runs your inference script. - Pass a fixed
seq_seedtoSamplingParamsin your script. - Run the same prompts twice with the same settings and save both outputs.
- Compare the two saved outputs and record any difference as a failed check.
Prompt for your agent
In the DeepInfer repo, set DEEPINFER_BATCH_INVARIANT=1 and DEEPINFER_ENABLE_MTP_VARLEN=0, pass a fixed seq_seed to SamplingParams, and run <prompt file> twice. Output a diff of the two result files. Verify that the diff is empty.
Caveat. The README says both batch-invariant inference and deterministic sampling are NVIDIA only, so this setup does not apply to Ascend.
Use this in your AI agent
Ask your agent
Using the Deduped MCP, get the setup steps for deepseek-ai/DeepInfer and "Get repeatable model outputs for regression tests"
Add Deduped to Claude Code once
claude mcp add --transport http deduped https://dedupedai.com/mcp
Every Monday: the 5 hottest repos and exactly how to use them. Free, one email a week, unsubscribe anytime.
Get them freeShare: X LinkedIn Hacker News Email Copy link
Third-party repos we don't own. AI-written use cases can be wrong. Disclaimer