make round-to-grid with refinement the default, add --learned for learned rounding
On Qwen2.5-0.5B, learned rounding matched round-to-grid in perplexity and KL (22.38 vs 22.37, 0.0920 vs 0.0919) at about six times the quantize time. --simple is still accepted as a no-op. Docs and man pages updated. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
164fa6b4a4
commit
1e50e4e045
16 files changed
+76
-39
No files matched your search
@@ -14,7 +14,7 @@ hf_to_nvfp4_gguf \- quantize Hugging Face models to NVFP4 GGUF for llama.cpp and
|
||||
[\fB\-\-convert\-to\-quant\fR \fIPATH\fR]
|
||||
[\fB\-\-model\-name\fR \fINAME\fR]
|
||||
[\fB\-\-device\fR \fIDEVICE\fR]
|
||||
[\fB\-\-simple\fR]
|
||||
[\fB\-\-learned\fR]
|
||||
[\fB\-\-optimizer\fR \fIOPT\fR]
|
||||
[\fB\-\-num\-iter\fR \fIN\fR]
|
||||
[\fB\-\-lr\fR \fILR\fR]
|
||||
@@ -53,8 +53,8 @@ and \fBOllama\fR.
|
||||
.PP
|
||||
The model is loaded through \fBllama.cpp\fR's architecture conversion logic so that
|
||||
all vocabulary, tensor naming conventions, tokenization metadata, and architectural
|
||||
parameters match native GGUF standards. Weight matrices are quantized using learned
|
||||
rounding (via \fBconvert_to_quant\fR) or simple nearest-grid projection onto the E2M1
|
||||
parameters match native GGUF standards. Weight matrices are quantized using nearest-grid projection
|
||||
with block-scale and code refinement (default) or learned rounding (\fB\-\-learned\fR, via \fBconvert_to_quant\fR), onto the E2M1
|
||||
floating point grid with two-level scaling (per-block E4M3/E8M0 scales and per-tensor scales).
|
||||
.PP
|
||||
Along with the output GGUF, an Ollama \fBModelfile\fR is generated automatically,
|
||||
@@ -96,8 +96,11 @@ Skip learned rounding. Writes a float GGUF, or repacks an already NVFP4 checkpoi
|
||||
Data type for non-quantized weights when learned rounding is skipped. \fBnvfp4\fR repacks a
|
||||
checkpoint that already has packed 4-bit weights. \fBauto\fR preserves the source float types (default: \fBauto\fR).
|
||||
.TP
|
||||
.B \-\-learned
|
||||
Use \fBconvert_to_quant\fR's learned rounding instead of the default round-to-grid with block-scale and code refinement. On Qwen2.5-0.5B it matched the default in perplexity and KL and took about six times as long.
|
||||
.TP
|
||||
.B \-\-simple
|
||||
Round weights directly onto the E2M1 grid without iterative learned rounding (fast, non-iterative).
|
||||
Round onto the E2M1 grid without learned rounding (default; accepted for compatibility).
|
||||
.TP
|
||||
.B \-\-quantize\-output
|
||||
Also quantize the final output projection (\fIlm_head\fR) matrix. By default, output layers are
|
||||
@@ -191,17 +194,17 @@ Enable detailed verbose logging.
|
||||
Run internal verification of NVFP4 packing against llama.cpp's reference dequantizer and exit immediately.
|
||||
.SH EXAMPLES
|
||||
.TP
|
||||
.B Full learned-rounding conversion to GGUF:
|
||||
.B Learned-rounding conversion to GGUF (slow, no measured quality gain):
|
||||
.RS
|
||||
.nf
|
||||
hf_to_nvfp4_gguf -o ./llama3-8b-NVFP4 ./meta-llama-3-8b
|
||||
hf_to_nvfp4_gguf --learned -o ./llama3-8b-NVFP4 ./meta-llama-3-8b
|
||||
.fi
|
||||
.RE
|
||||
.TP
|
||||
.B Fast quantization with simple grid rounding:
|
||||
.B Default quantization (grid rounding with scale and code refinement):
|
||||
.RS
|
||||
.nf
|
||||
hf_to_nvfp4_gguf --simple -o ./qwen-nvfp4 ./Qwen2.5-7B-Instruct
|
||||
hf_to_nvfp4_gguf -o ./qwen-nvfp4 ./Qwen2.5-7B-Instruct
|
||||
.fi
|
||||
.RE
|
||||
.TP
|
||||
|
||||
Reference in new issue
Block a user