Skip to content
CLIv0.6.1Apache-2.0Python 3.10 – 3.14Standalone tool

quantfit

Quantization + safety-drift CLI

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.

$pip install quantfit
quantfit verify-safety --demo

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.

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.

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.

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.

Commands

12 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

probe

per-bit-width quantization sensitivity

gate

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

screen

run a target set to QSR spec

reproduce

decide whether one report reproduces another

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

build and ingest calibration sheets

Evidence

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

Quantization erodes alignment

The finding the tool exists to operationalize: alignment behavior degrades under quantization in ways quality metrics do not surface.

Quality is not a safety proxy

The 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.

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 probe set is 40 curated prompts; a no-detection result bounds drift rather than certifying safety.