Mix Precision Auto-Search#
The Mix Precision Auto-Search workflow automatically finds the optimal mixed-precision quantization configuration for large language models running on AMD Instinct GPUs via vLLM.
Given an accuracy loss budget—for example, GSM8K must not drop by more than 2%—it uses a hardware-aware decode Roofline to walk adjacent performance candidates and selects the fastest evaluated configuration whose accuracy stays within the threshold.
Supported Quantization Modes#
Hardware |
Supported Modes |
|---|---|
MI300 |
|
MI325 |
|
MI355 |
|
Workflow Overview#
Load model on meta device — builds the layer graph for quantization config generation with no GPU memory cost.
Generate candidate configs — constrained by the target hardware and requested mode subset. With
--file2file_quantization, candidates containing calibration-dependentfp8ormxfp4_fp8(W4A8) modes are reported in a warning and removed before evaluation.Compute the Roofline — walk the meta model’s Linear shapes and score candidates with per-op GEMM, FusedMoE, and SDPA compute/memory ceilings on the target GPU, with aggregate memory as a fallback. The default workload is
ISL=8192/OSL=1024; a separate prefill Roofline is reported but does not affect ordering.Evaluate baseline — run GSM8K on the original (unquantized) vLLM model.
Search loop — start from the hardware anchor, walk adjacent Roofline candidates, re-quantize, evaluate, check the threshold, and reset.
Select best config — the highest-scoring evaluated config under the Roofline model that passes.
Export (optional) — apply best config and save as safetensors. With
--file2file_quantization, the best calibration-free config is exported one checkpoint shard at a time without loading the full model. Hugging Face model IDs are resolved to the local cache automatically; local inputs must containconfig.jsonand at least one.safetensorsshard.
MI300 and MI325 use mlp=ptpc_fp8 as the preferred anchor. MI355 uses
mlp=mxfp4. All other layer partitions start as native.
Quick Start#
Note
This workflow requires the vLLM ROCm container. See the example README for full environment setup instructions.
cd /workspace/quark/examples/torch/experimental/mix_precision
# Search all modes for MI300
python mix_precision.py \
--model_dir /models/Qwen3.5-397B-A17B \
--hardware mi300 \
-tp 8 \
--gpu-memory-utilization 0.8 \
--export_best_model \
--file2file_quantization