B2CQuantizer

Batch quantization of Mistral models from a browser, on a rented GPU.

Role
Design and engineering
Areas
AI, Tools, Pipelines

Quantizing a 24-billion-parameter model on a 48 GB card is tight to impossible, and shell scripts that chain quantizations one after another are hard-coded per run, abort everything on one failure and show no progress. B2CQuantizer turns the job into a disposable, self-service GPU pod driven from a browser: one source model, many formats, failures isolated per format, and live progress.

Six-step flow of a B2CQuantizer job: download the source model once, pick one calibration source for both lanes, run the GPU safetensors lane and the CPU GGUF lane in parallel, upload each result to its repo, write a Quantizations table into the source README, and wipe the token from memory.
A job downloads the model once, splits into two lanes and ends by updating the source model's README.

What it produces

A single job can emit any selection of 30 formats: GGUF K-quants and I-quants, Q8_0, F16 and BF16 repacks, a multimodal vision projector for Mistral3 models, and safetensors builds in GPTQ, AWQ, NVFP4 and two FP8 variants. Each safetensors format gets its own Hugging Face repo, and all GGUF files share one. When it finishes, the app writes a Quantizations table into the source model's README, replacing it on later runs.

Bar chart of B2CQuantizer's 30 output formats by group: 9 GGUF K-quants, 12 GGUF I-quants that need an importance matrix, 3 GGUF repacks (Q8_0, F16, BF16), 1 GGUF vision projector, and 5 safetensors formats built with llm-compressor.
Twenty-five of the formats are GGUF files that share one repo, and each of the five safetensors formats gets a repo of its own.

How it works

  • Lane A (GPU) loads the source onto the GPU once and runs each llm-compressor recipe against the resident model, uploading and deleting each result before the next.
  • Lane B (CPU) converts to a BF16 GGUF once, computes an importance matrix once if any I-quant is selected, then runs llama-quantize per format. For multimodal models it patches two upstream converter bugs and asserts that a required tensor made it into the output.
  • One calibration source feeds both lanes, so both see the same distribution. Calibration text is rendered through the same tokenizer path the model is served with, and a sample that fails to render stops the job instead of falling back quietly.
  • Both lanes stream logs to the browser over Server-Sent Events, behind a FastAPI, HTMX and Alpine.js front end.

The Hugging Face token lives only in process memory, is never written or logged, and is wiped when the job ends.

Two-column comparison. Lane A, on the GPU, loads the BF16 source once, runs each llm-compressor recipe (GPTQ, AWQ, NVFP4, FP8) and uploads then deletes each result. Lane B, on the CPU, converts to a BF16 GGUF once, computes an importance matrix once if needed, runs llama-quantize per format and exports the Mistral3 vision projector. In both lanes a failed format is marked and the lane moves on.
Each lane does its expensive setup once and then works through its formats one at a time.