Skip to content
CLIQuantization + safety-drift CLI

quantfit

Quantize an LLM — and check it still refuses what it should. Quantization makes a model cheaper to serve and can quietly strip safety behavior; a 4-bit model that answers what the full-precision model refused is a regression no perplexity number will show you.

  • v0.61.0
  • Apache-2.0
  • Python 3.11.5 – 3.14
  • Standalone tool
pip install quantfit
PyPISourceChangelog
quantfit verify-safety --demo
How verify-safety decidesTwo drift axes, not one number; a no-detection result bounds the drift, it does not certify safety.
  1. Probe set

    40 curated prompts: some to refuse, some to answer

  2. Generate

    the unquantized baseline and the quantized model

  3. Judge

    refusal or compliance, by a local classifier

  4. Two axes

    refusal-robustness drift and over-refusal drift

  5. Verdict

    bounded by a Wilson 95% CI, never absolute

Safety drift is a vector, not a number

verify-safety generates from both the unquantized baseline and the quantized model over a curated probe set, judges each response with a local classifier, and reports two axes: refusal-robustness drift (did the quant start complying with what should be refused — the dangerous direction) and over-refusal drift (did it start refusing what should be answered — the usability direction). A scalar refusal-delta can read zero while both axes move in opposite directions. Verdicts are bounded, never absolute: a no-detection result bounds the drift, it does not certify safety.

Features

  • 01

    Method × scheme matrix

    AWQ, GPTQ, SmoothQuant, FP8, and RTN through one llm-compressor backend (vLLM-loadable), plus GGUF via llama.cpp. Schemes span W4A16 through NVFP4 and MXFP4.

  • 02

    Honest capacity, up front

    check reads HuggingFace metadata without downloading and sorts the job into fits-VRAM, fits-RAM-via-sequential-onloading, or refuse — naming the real limit. No OOM twenty minutes into a run.

  • 03

    Built to be checked

    Reports follow a written spec (QSR), reproduce decides whether one run reproduces another, and audit holds the documentation to the code — exit code 3 when they drift apart.

  • 04

    Gate either axis, on your own probes

    gate takes a threshold per axis, so over-refusal can block a release as well as lost refusals; a threshold sets the drift the run must be able to detect, not a ceiling on the observed rate. verify-safety can also run a pinned Hugging Face dataset of up to 4,096 prompts in place of the default 40, and reports label it noncanonical rather than borrowing the default set’s detectability.

Commands

26 commands. Full flags and output samples live in the README.

  • verify-safety

    did quantization break refusals? two-axis drift

  • check

    will it fit? read from HF metadata, no download

  • plan

    what config a heuristic would pick, and why

  • quantize

    run the quantization across the method matrix

  • verify

    smoke-load a quantized artifact; bounded GGUF structure checks

  • probe

    per-bit-width quantization sensitivity

  • inspect-run

    a paired baseline-versus-quant run through Inspect

  • inspect-recover

    restore a completed Inspect run’s aggregate offline

  • probes

    bundle a private probe population, offline

  • cold-run

    three fresh, uncached native GGUF replicates

  • gate

    pre-release CI check, per axis, that refuses to pass on thin evidence

  • screen

    run a target set to QSR spec

  • screen-summary

    per-stratum, per-axis bounds from a saved screen, offline

  • screen-compare

    compare two saved screens over the same targets, offline

  • resolution

    what a report can resolve, given the judge’s calibration

  • repeatability

    does a full report agree with its replicates

  • t0

    do three same-environment replicates agree

  • reproduce

    decide whether one report reproduces another

  • references

    verify reference artifacts byte for byte

  • bundle

    portable aggregate evidence, packed into one verifiable file

  • evidence

    fetch approved, immutable public aggregates

  • audit

    hold the docs to the code — exit 3 on drift

  • emit

    render any drift report as a model card

  • list

    the supported method × scheme matrix

  • calibrate

    judge calibration: blinded sheets, labels, judge comparisons

  • adjudicate

    a person’s explicit flip-by-flip rulings; nothing confirmed automatically

Evidence

Each capability traces to the measurements behind it. These are the published reports, not a summary of them.

CapabilityWhat it rests onReports
Quantization erodes alignmentThe finding the tool exists to operationalize: alignment behavior degrades under quantization in ways quality metrics do not surface.TR134
Quality is not a safety proxyThe quality-safety divergence work — and the refusal-threat index behind the judging methodology — established that a good perplexity number tells you nothing about preserved refusals.TR142

What it does not do

The limits the tool states about itself.

  • It ships transparent config help, not auto-quantization: you pass --method. Learned routing exists as published research but is explicitly out of scope.
  • At over-VRAM sizes use gptq — AWQ’s grid search is transfer-bound under sequential onloading.
  • FP4 schemes need Blackwell to serve, though quantfit can produce them anywhere.
  • The default probe set is 40 curated prompts; a no-detection result bounds drift rather than certifying safety.