Skip to main content

Deterministic-mode checks for LLM inference: measure run/batch variance, generate repro packs, and explain why outputs differ.

Project description

detLLM logo

Deterministic and verifiable LLM inference

CI License

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

detLLM demo

Quickstart

pip install -e .
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 -e '.[test]'.

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.json
  • run_config.json
  • determinism_applied.json
  • trace.jsonl
  • report.json + report.txt
  • diffs/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 env
  • detllm run
  • detllm check
  • detllm diff
  • detllm 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

Versioning

See docs/versioning.md for compatibility guarantees.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

detllm-0.1.0.tar.gz (23.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

detllm-0.1.0-py3-none-any.whl (27.9 kB view details)

Uploaded Python 3

File details

Details for the file detllm-0.1.0.tar.gz.

File metadata

  • Download URL: detllm-0.1.0.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

Hashes for detllm-0.1.0.tar.gz
Algorithm Hash digest
SHA256 5be4d7c1a706c6394c5403414dafbea95eb962d2e693bc880b6ae568f0621b49
MD5 5c71a77da91e704f6bd7306ed11743f8
BLAKE2b-256 520ab32eb1be316d7e548080c16cbf6a7885ec4463103f8587bd7286389f98bc

See more details on using hashes here.

File details

Details for the file detllm-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: detllm-0.1.0-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

Hashes for detllm-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1913cbb79a89673fc0e8a740250f7a08c1c289ccf33c7fc09a009434e9894907
MD5 c5c46f985f51ae626b4082bcd6f710c3
BLAKE2b-256 47bd75c9d214f08e86a67ecbcc5e43d6d93fff6897662250cb4c51dceff96bbd

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page