Views
No views yet
Qwen/Qwen3-4B with a scale-inflation re-quantization procedure designed to make the packed NVFP4 weights more compressible while keeping the model format unchanged.compressed-tensors NVFP4 format:weight_packedweight_scaleweight_global_scaleQwen/Qwen3-4B 的原始 BF16 权重,不是直接在已有 NVFP4 权重上做简单替换。llmat/Qwen3-4B-NVFP4 作为 NVFP4 模板和初始 scale 参考,再把 scale 按 alpha=2.0 放大后重新量化回标准 NVFP4。weight_packed 的字节分布更不均匀,从而更容易被后续压缩。Qwen/Qwen3-4B as the weight source.llmat/Qwen3-4B-NVFP4 only as a structural/template baseline for:
alpha = 2.0.weight_scale / weight_global_scale.alpha = 2.0.weight_packed, weight_scale, and weight_global_scale tensors back into the checkpoint.0, +-0.5, and +-1, which makes the packed byte stream less uniform and therefore easier to compress downstream.Qwen/Qwen3-4Bllmat/Qwen3-4B-NVFP4| Variant | Compression Proxy | Weighted MSE | MMLU Sample |
|---|---|---|---|
Baseline llmat/Qwen3-4B-NVFP4 | 0.96% | 4.96e-6 vs BF16 | 29 / 40 = 72.5% |
This checkpoint (alpha=2.0 from BF16) | 12.07% | 7.46e-6 vs BF16 | 30 / 40 = 75.0% |
BF16 -> NVFP4 compression ratio.model.safetensors: quantized model weightsnvfp4_scale_inflation_from_full_precision_export.json: per-layer export summary and aggregate metricshttps://github.com/DrXuQian/Model-Optimizerexperimental/nvfp4_scale_inflation/export_from_full_precision.pyexperimental/nvfp4_scale_inflation/scale_inflation.pyexperimental/nvfp4_scale_inflation/eval_mmlu_batched.py1python -m experimental.nvfp4_scale_inflation.export_from_full_precision \
2 --full-precision-model-dir Qwen3-4B \
3 --template-nvfp4-dir Qwen3-4B-NVFP4 \
4 --output-dir Qwen3-4B-NVFP4-frombf16-alpha2 \
5 --alpha 2.0 \
6 --optimize-max-layers 0 \
7 --device cpu1python -m experimental.nvfp4_scale_inflation.eval_mmlu_batched \
2 --model-path Qwen3-4B-NVFP4-frombf16-alpha2 \
3 --output-json outputs/mmlu_batched_sample8_frombf16_alpha2.json \
4 --batch-size 8 \
5 --limit-per-subject 5 \
6 --subjects abstract_algebra,college_computer_science,clinical_knowledge,miscellaneous,econometrics,sociology,philosophy,high_school_world_history1from transformers import AutoModelForCausalLM, AutoTokenizer
2
3model_id = "DrQianXu/Qwen3-4B-nvfp4-Compressible"
4
5tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
6model = AutoModelForCausalLM.from_pretrained(
7 model_id,
8 trust_remote_code=True,
9 device_map="auto",
10 dtype="auto",
11)