Designing post-training quantization (PTQ) algorithms for strict 4-bit MXFP4 (W4A4) is difficult because errors interact across weights, activations, and consecutive stages: improving one step often shifts what later steps must correct. LLM program search can explore such multi-stage quantizers as code, yet scoring candidates only by perplexity hides why an edit helped or hurt. Unlike black-box search, however, PTQ always has the original BF16 model running layer-for-layer alongside the quantized model on the same calibration data. We introduce QuantForge, which uses this paired BF16-MXFP4 twin to guide discovery: it runs local counterfactual controls to separate competing explanations, verifies with runtime checks that the next code edit acts on each finding, and remeasures the remaining error after each stage. Seeded from GPTQ, QuantForge discovers HiRes, uniting geometric shaping, installed-weight-aware activation coding, and sequential attention-to-SwiGLU recovery. Across seven models (3B-32B) and nine baselines, HiRes achieves the lowest C4 perplexity and mean degradation on every model (-41% on Qwen3-32B vs. WUSH); on matched-budget runs, QuantForge hits the held-out target twice as often as reflection memory (6/8 vs. 3/8 seeds) and wins 15/16 paired runs across three proposers while cutting search compute 35.7%. Code is available at https://github.com/qiulin13145/QuantForge.
翻译:暂无翻译