Deterministic-mode checks for LLM inference: measure run/batch variance, generate repro packs, and explain why outputs differ.
Project description
Deterministic and verifiable LLM inference
About
detLLM verifies reproducibility for LLM inference and produces a minimal repro pack when outputs diverge. It measures run-to-run variance and batch-size variance, and reports results with explicit, capability-gated guarantees (only claimed when the backend can actually enforce them).
Demo
Quickstart
pip install detllm
detllm check --backend hf --model <model_id> \
--prompt "Choose one: A or B. Answer with a single letter." \
--tier 1 --runs 5 --batch-size 1
Note: some shells (like zsh) require quotes when installing extras, e.g. pip install 'detllm[test,hf]'.
Verification
See docs/verification.md for the full local verification procedure and expected outputs.
Tiers
- Tier 0: artifacts + deterministic diff/report (no equality guarantees)
- Tier 1: repeatability across runs for a fixed batch size
- Tier 2: Tier 1 + score/logprob equality (capability-gated)
Tier 1 guarantees repeatability only for a fixed batch size; batch invariance is measured separately.
Tier 2 scores are captured when the backend supports stable score/logprob output. See docs/verification.md for how to verify scores appear in traces.
Artifacts (minimal repro pack)
Each run writes an artifacts/<run_id>/ folder:
env.jsonrun_config.jsondeterminism_applied.jsontrace.jsonlreport.json+report.txtdiffs/first_divergence.json
Python API
from detllm import check, run
run(
backend="hf",
model="distilgpt2",
prompts=["Hello"],
tier=1,
out_dir="artifacts/run1",
)
report = check(
backend="hf",
model="distilgpt2",
prompts=["Hello"],
runs=3,
batch_size=1,
out_dir="artifacts/check1",
)
print(report.status, report.category)
CLI
detllm envdetllm rundetllm checkdetllm diffdetllm report
Known limitations
- GPU determinism is conditional; results can change across drivers/kernels.
- Batch invariance is not guaranteed; it is measured separately.
- Strict guarantees depend on backend capabilities.
- Distributed/multiprocess inference is out of scope for now.
Docs
- docs/verification.md
- docs/determinism_boundary.md
- docs/troubleshooting.md
- docs/vllm.md
- docs/python_api.md
- docs/versioning.md
Versioning
See docs/versioning.md for compatibility guarantees.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file detllm-0.1.1.tar.gz.
File metadata
- Download URL: detllm-0.1.1.tar.gz
- Upload date:
- Size: 23.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
931dc26bf674aa2ada03c161e8cfd7a0badd83fef77879344ef98e62a0dace38
|
|
| MD5 |
d0a7f6b5c80af8054c5daf1124b8b3df
|
|
| BLAKE2b-256 |
026d46fbcdf7a9a8e0acd7c8588e4d3fed23489526aa2748897714244a9e58f7
|
File details
Details for the file detllm-0.1.1-py3-none-any.whl.
File metadata
- Download URL: detllm-0.1.1-py3-none-any.whl
- Upload date:
- Size: 27.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9cf2602a3993c0eed7b28504a43338705e4efc11a03142c5f0b0558ea588e2b5
|
|
| MD5 |
065060a16ca32270f6c4330e3cc391e2
|
|
| BLAKE2b-256 |
7ca030faeb62058c969910d2849a0db933195354906e9fc2603d2508895ed781
|