infer-check
Catches the correctness bugs that benchmarks miss in LLM inference engines.
Quantization silently breaks arithmetic. Serving layers silently alter output. KV caches silently corrupt under load. Benchmarks like lm-evaluation-harness test whether models are smart — infer-check tests whether engines are correct.
The problem
Every LLM inference engine has correctness bugs that benchmarks don't catch:
- KV cache NaN pollution in vLLM-Ascend permanently corrupts all subsequent requests
- FP8 KV quantization in vLLM causes repeated garbage output
- 32.5% element mismatches in SGLang's FP8 DeepGEMM kernels on Blackwell GPUs
- Batch-size-dependent output where tokens change depending on concurrent request count
These aren't model quality problems — they're engine correctness failures. infer-check is a CLI tool that runs differential tests across backends, quantization levels, and concurrency conditions to surface them automatically.
Installation
pip install infer-check
# With MLX backend support (Apple Silicon)
pip install "infer-check[mlx]"
Quick start
Compare two quantizations head-to-head:
infer-check compare \
mlx-community/Llama-3.1-8B-Instruct-4bit \
mlx-community/Llama-3.1-8B-Instruct-8bit \
--prompts adversarial-numerics
Run a full quantization sweep:
infer-check sweep \
--models "bf16=mlx-community/Meta-Llama-3.1-8B-Instruct-bf16,\
8bit=mlx-community/Meta-Llama-3.1-8B-Instruct-8bit,\
4bit=mlx-community/Meta-Llama-3.1-8B-Instruct-4bit" \
--prompts reasoning
Commands
| Command | Purpose | Docs |
|---|---|---|
sweep |
Compare pre-quantized models against a baseline | docs |
compare |
Head-to-head comparison of two models or quantizations | docs |
diff |
Compare outputs across different backends for the same model | docs |
determinism |
Test output reproducibility at temperature=0 | docs |
stress |
Test correctness under concurrent load | docs |
report |
Generate HTML/JSON reports from saved results | docs |
Example results
Results from running infer-check on Llama-3.1-8B-Instruct on Apple Silicon using mlx-lm.
Quantization sweep
Sweep Summary
┏━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━┳━━━━━━━┳━━━━━━━━━━┳━━━━━━━━┳━━━━━━━━━━━━━━━━━┓
┃ quant_level ┃ identical ┃ minor ┃ moderate ┃ severe ┃ mean_similarity ┃
┡━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━╇━━━━━━━╇━━━━━━━━━━╇━━━━━━━━╇━━━━━━━━━━━━━━━━━┩
│ bf16 (self-check) │ 50/50 │ 0/50 │ 0/50 │ 0/50 │ 1.0000 │
│ 8bit │ 20/50 │ 9/50 │ 12/50 │ 9/50 │ 0.8067 │
│ 4bit │ 1/50 │ 3/50 │ 11/50 │ 35/50 │ 0.3837 │
└─────────────────────┴───────────┴───────┴──────────┴────────┴─────────────────┘
A "severe" divergence means the quantized output is functionally wrong — not just worded differently, but giving incorrect answers to questions the bf16 baseline handles correctly.
Cross-backend diff
mlx-lm vs vllm-mlx at temperature=0: 50/50 identical (reasoning) and 30/30 identical (numerics). Zero serving-layer divergence detected.
Determinism & stress
100% determinism across 20 runs per prompt at temperature=0. 100% output consistency at concurrency levels 1/2/4/8.
Supported backends
| Backend | Type | Use case |
|---|---|---|
| mlx-lm | In-process | Local Apple Silicon inference with logprobs |
| llama-cpp | HTTP | llama-server via /completion endpoint |
| vllm-mlx | HTTP | Continuous batching on Apple Silicon |
| openai-compat | HTTP | Any OpenAI-compatible server (vLLM, SGLang, Ollama) |
See the backends documentation for setup and configuration details.
Prompt suites
Six curated suites ship with the package — no need to clone the repo:
| Suite | Count | Purpose |
|---|---|---|
reasoning |
50 | Multi-step math and logic |
code |
49 | Python, JSON, SQL generation |
adversarial-numerics |
30 | IEEE 754 edge cases, overflow, precision |
long-context |
10 | Tables and transcripts with recall questions |
quant-sensitive |
20 | Multi-digit arithmetic, long CoT, precise syntax |
determinism |
50 | High-entropy continuations for determinism testing |
Custom suites are JSONL files with one object per line:
{"id": "custom-001", "text": "Your prompt here", "category": "math", "max_tokens": 512}
Roadmap
- GGUF backend (direct llama.cpp integration without HTTP)
- CUDA vLLM backend for GPU-based differential testing
- Logprobs-based divergence scoring where backends support it
- Automated regression CI mode (
infer-check ciwith pass/fail exit codes) - Expanded prompt suites for tool use and multi-turn conversations
Requirements
- Python >= 3.11
- macOS with Apple Silicon (for mlx-lm backend) or Linux
- At least one backend installed
License
Apache 2.0
Metadata
Release files for infer-check 0.2.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| infer_check-0.2.6.tar.gz | 168.9 kB | With provenance | Details for infer_check-0.2.6.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| infer_check-0.2.6-py3-none-any.whl | Python 3 | none | any | Details for infer_check-0.2.6-py3-none-any.whl |
Total release size: 321.8 kB
Release files / infer_check-0.2.6.tar.gz
| Download URL | infer_check-0.2.6.tar.gz |
|---|---|
| Size | 168.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
03688d780257041b0e13f33accb1a9d5a85bd632caad35db8deb5eba4d598ff8
|
|
BLAKE2b-256 checksum How to use checksums |
27bd373c099d6f0f89bc4ff595d3ca3f521bd8e7757ce81968214aef572926cf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 20, 2026.
Transparency logRelease files / infer_check-0.2.6-py3-none-any.whl
| Download URL | infer_check-0.2.6-py3-none-any.whl |
|---|---|
| Size | 152.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1774143ce6f1cec3b43c5688a5d3ae9431cf20815ac55ca3b153fe6493d8b8a6
|
|
BLAKE2b-256 checksum How to use checksums |
cc4297cdea378b8f574e8ed548059fa089c925c3cdf8ceecab14e77f16ed4d1d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 20, 2026.
Transparency logSecurity for infer-check 0.2.6
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for infer_check-0.2.6.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 20, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.