Archived
radiance 2.0.0
Radiance becomes a multi-model engine: one process serves several models behind one port, loads each when a request names it, parks it in host memory or restores it from its container, and shares the cards between them (docs/MULTIMODEL.md). The configuration is one YAML file; the command line flags are gone (`radiance --config FILE`, hot reload on SIGHUP). Formats. IQ8R (rotated int8) and IQR-V4 replace FP8 and MXFP4 as whole-model formats, with an int8 KV cache (`kv-cache-dtype: i8`) in place of the fp8 one. Containers whose weights are block FP8, MXFP4, M2XFP4, NVFP4 or ParoQuant are refused at startup by the name of the first such weight. Not served until they have int8 containers: GLM-5.3-Flash, Ornith-1.5, Sage-A1.5, Nemotron-3.5-Bolt-74B, Ling-3.0-flash, drama-3 and Anima's FP8 container; Nemotron-3.5-Bolt-E4B, the Gemma 4 31B DFlash containers and MiniCPM5-2B bf16 serve without their drafter. 1.17.0 serves all of them. Speed. Chained launches for Qwen3.8-27B, Gemma 4, Gemma 3 and the small bf16 models, a new Qwen3.8-Flash-Next container (IQR-V4 experts, int8 trunk) with its decode step and prefill reworked, and a reworked adaptive draft window. Deployment. deploy/compose has two fleet files, tp1.yaml and tp2.yaml, each with its configuration beside it, in place of the per-model files. `host-pool-mib` is a model's host pool in all, split among its ranks. The dashboard is rebuilt: an hour of history kept by the server, each accelerator's memory by model, model states over time. Merged since 1.17.0: Nemotron-3.5-Bolt-74B-A9B by keptn42 (#339); GLM-5.3-Flash on four cards by AnimusNull (#397); chained launches for Flash-Next's decode step (#396) and preempted requests keeping their prefix and place (#405) by mici81; --prefill-interleave auto by Code000 (#410); eight more libr3d kernels and the w4a4 reference by RikshaDriver (#403, #407, #408); libr3d large-BAR and E4M3 decode fixes by neuromanMD (#438, #439); int4/int5 decode tiles by Kezi (#426); attention for Nanbeige 4.3 33B by everplays (#417); expert_stats_report.py by baKon (#431). Fixed: #398, #402, #419, #437 (dschmitz's patch); added the metrics of #392, and multi-model serving as asked for in #367 and #109. Plugin ABI 39: out-of-tree plugins need to be rebuilt. Thanks to @keptn42, @AnimusNull, @mici81, @Code000, @RikshaDriver, @neuromanMD, @Kezi, @everplays, @baKon and @dschmitz.
This commit is contained in:
1 parent
b4c04b6042
commit
ddcb9c69bb
696 files changed
+120770
-56596
No files matched your search
@@ -7,7 +7,6 @@ avx_attn_paged
|
||||
avx_cast
|
||||
avx_dflash_select
|
||||
avx_embed_lookup
|
||||
avx_gated_quant_fp8
|
||||
avx_gather_rows
|
||||
avx_gdn_chunk_scan
|
||||
avx_gdn_conv_update
|
||||
@@ -17,15 +16,13 @@ avx_gdn_recurrent_update
|
||||
avx_gemm_nt
|
||||
avx_gemm_nt_bias
|
||||
avx_gemm_nt_q
|
||||
avx_gemm_nt_q_gated
|
||||
avx_grid_embed
|
||||
avx_had_quant_act_i8g
|
||||
avx_kv_store
|
||||
avx_layernorm
|
||||
avx_logits_gemm
|
||||
avx_quant_act_fp8
|
||||
avx_quant_act_i8
|
||||
avx_rmsnorm
|
||||
avx_rmsnorm_quant_fp8
|
||||
avx_rope
|
||||
avx_rope_table
|
||||
avx_row_topk
|
||||
@@ -34,6 +31,7 @@ avx_sample_dry
|
||||
avx_sample_logprobs
|
||||
avx_sample_mask
|
||||
avx_sample_minp
|
||||
avx_sample_ngram_ban
|
||||
avx_sample_penalties
|
||||
avx_sample_pick
|
||||
avx_sample_temp
|
||||
|
||||
@@ -2,14 +2,13 @@
|
||||
# A row listed here and not reached fails the replay; regenerate with
|
||||
# --coverage-write when a row is added or deliberately retired.
|
||||
add_bf16
|
||||
attn_decode_h128_gqa4_fp8kv
|
||||
attn_decode_h256_gqa6_fp8kv
|
||||
attn_prefill_h256_gqa6_fp8kv
|
||||
attn_decode_h128_gqa4_bf16kv
|
||||
attn_decode_h256_gqa6_bf16kv
|
||||
attn_prefill_h256_gqa6_bf16kv
|
||||
attn_vit_h72_bf16
|
||||
cast_bf16_bf16
|
||||
dflash_select_bf16
|
||||
embed_lookup_bf16
|
||||
gated_quant_fp8
|
||||
gather_rows_bf16
|
||||
gdn_chunk_scan_k128_v128_c64_bf16
|
||||
gdn_conv_update_w4_h128_bf16
|
||||
@@ -19,19 +18,18 @@ gdn_recurrent_update_k128_v128_bf16_fp32state
|
||||
gemm_bf16_nt_bias_tiled
|
||||
gemm_bf16_nt_m16
|
||||
gemm_bf16_nt_m64
|
||||
gemm_fp8a8_gated_nt_m16
|
||||
gemm_fp8a8_nt_m16
|
||||
gemm_fp8a8_tiled
|
||||
gemm_mxfp4a8_decode
|
||||
gemm_mxfp4a8_tiled
|
||||
gemm_iq8r_nt_m16
|
||||
gemm_iq8r_tiled
|
||||
gemm_iqr_nt_m64
|
||||
gemm_iqr_tiled
|
||||
grid_embed_bf16
|
||||
kv_store_fp8
|
||||
had_quant_act_i8g
|
||||
had_quant_act_iq8r
|
||||
kv_store_bf16
|
||||
layernorm_bf16
|
||||
logits_gemm_fp8
|
||||
quant_act_fp8
|
||||
logits_gemm_i8
|
||||
quant_act_i8
|
||||
rmsnorm_bf16
|
||||
rmsnorm_quant_fp8
|
||||
rope_bf16
|
||||
rope_table_f32
|
||||
rowtopk_bf16
|
||||
@@ -40,6 +38,7 @@ sample_dry_f32
|
||||
sample_logprobs_f32
|
||||
sample_mask_f32
|
||||
sample_minp_f32
|
||||
sample_ngram_ban_f32
|
||||
sample_penalties_f32
|
||||
sample_pick_f32
|
||||
sample_temp_f32
|
||||
|
||||
@@ -7,7 +7,6 @@ ref_attn_paged
|
||||
ref_cast
|
||||
ref_dflash_select
|
||||
ref_embed_lookup
|
||||
ref_gated_quant_fp8
|
||||
ref_gather_rows
|
||||
ref_gdn_chunk_scan
|
||||
ref_gdn_conv_update
|
||||
@@ -17,15 +16,13 @@ ref_gdn_recurrent_update
|
||||
ref_gemm_nt
|
||||
ref_gemm_nt_bias
|
||||
ref_gemm_nt_q
|
||||
ref_gemm_nt_q_gated
|
||||
ref_grid_embed
|
||||
ref_had_quant_act_i8g
|
||||
ref_kv_store
|
||||
ref_layernorm
|
||||
ref_logits_gemm
|
||||
ref_quant_act_fp8
|
||||
ref_quant_act_i8
|
||||
ref_rmsnorm
|
||||
ref_rmsnorm_quant_fp8
|
||||
ref_rope
|
||||
ref_rope_table
|
||||
ref_row_topk
|
||||
@@ -34,6 +31,7 @@ ref_sample_dry
|
||||
ref_sample_logprobs
|
||||
ref_sample_mask
|
||||
ref_sample_minp
|
||||
ref_sample_ngram_ban
|
||||
ref_sample_penalties
|
||||
ref_sample_pick
|
||||
ref_sample_temp
|
||||
|
||||
@@ -6,7 +6,6 @@ avx_attn_dense
|
||||
avx_attn_paged
|
||||
avx_cast
|
||||
avx_embed_lookup
|
||||
avx_gated_quant_fp8
|
||||
avx_gather_rows
|
||||
avx_gdn_chunk_scan
|
||||
avx_gdn_conv_update
|
||||
@@ -17,25 +16,27 @@ avx_gemm_nt
|
||||
avx_gemm_nt_bias
|
||||
avx_gemm_nt_q
|
||||
avx_grid_embed
|
||||
avx_had_quant_act_i8g
|
||||
avx_kv_store
|
||||
avx_layernorm
|
||||
avx_logits_gemm
|
||||
avx_moe_gather
|
||||
avx_moe_gemm_q
|
||||
avx_moe_scatter
|
||||
avx_quant_act_fp8
|
||||
avx_quant_act_i8
|
||||
avx_rmsnorm
|
||||
avx_rmsnorm_quant_fp8
|
||||
avx_rope
|
||||
avx_rope_table
|
||||
avx_router_gemm_topk_scatter
|
||||
avx_router_topk
|
||||
avx_router_topk_scatter
|
||||
avx_row_topk
|
||||
avx_sample_argmax
|
||||
avx_sample_dry
|
||||
avx_sample_logprobs
|
||||
avx_sample_mask
|
||||
avx_sample_minp
|
||||
avx_sample_ngram_ban
|
||||
avx_sample_penalties
|
||||
avx_sample_pick
|
||||
avx_sample_temp
|
||||
|
||||
@@ -2,12 +2,11 @@
|
||||
# A row listed here and not reached fails the replay; regenerate with
|
||||
# --coverage-write when a row is added or deliberately retired.
|
||||
add_bf16
|
||||
attn_decode_h256_gqa8_fp8kv
|
||||
attn_prefill_h256_gqa8_fp8kv
|
||||
attn_decode_h256_gqa8_bf16kv
|
||||
attn_prefill_h256_gqa8_bf16kv
|
||||
attn_vit_h72_bf16
|
||||
cast_bf16_bf16
|
||||
embed_lookup_bf16
|
||||
gated_quant_fp8
|
||||
gather_rows_bf16
|
||||
gdn_chunk_scan_k128_v128_c64_bf16
|
||||
gdn_conv_update_w4_h128_bf16
|
||||
@@ -18,28 +17,32 @@ gemm_bf16_nt_bias_tiled
|
||||
gemm_bf16_nt_m16
|
||||
gemm_bf16_nt_m64
|
||||
gemm_bf16_nt_tiled
|
||||
gemm_fp8a8_nt_m16
|
||||
gemm_fp8a8_tiled
|
||||
gemm_i8a8_nt_m16
|
||||
gemm_i8a8_tiled
|
||||
gemm_iq8r_nt_m16
|
||||
gemm_iq8r_tiled
|
||||
grid_embed_bf16
|
||||
kv_store_fp8
|
||||
had_quant_act_iq8r
|
||||
kv_store_bf16
|
||||
layernorm_bf16
|
||||
logits_gemm_fp8
|
||||
logits_gemm_i8
|
||||
moe_gather_bf16
|
||||
moe_gemm_fp8a8
|
||||
moe_gemm_i8a8
|
||||
moe_scatter_i32
|
||||
quant_act_fp8
|
||||
quant_act_i8
|
||||
rmsnorm_bf16
|
||||
rmsnorm_quant_fp8
|
||||
rope_bf16
|
||||
rope_table_f32
|
||||
router_gemm_topk_scatter_bf16
|
||||
router_topk_bf16
|
||||
router_topk_scatter_bf16
|
||||
rowtopk_bf16
|
||||
sample_argmax_f32
|
||||
sample_dry_f32
|
||||
sample_logprobs_f32
|
||||
sample_mask_f32
|
||||
sample_minp_f32
|
||||
sample_ngram_ban_f32
|
||||
sample_penalties_f32
|
||||
sample_pick_f32
|
||||
sample_temp_f32
|
||||
|
||||
@@ -6,7 +6,6 @@ ref_attn_dense
|
||||
ref_attn_paged
|
||||
ref_cast
|
||||
ref_embed_lookup
|
||||
ref_gated_quant_fp8
|
||||
ref_gather_rows
|
||||
ref_gdn_chunk_scan
|
||||
ref_gdn_conv_update
|
||||
@@ -17,25 +16,27 @@ ref_gemm_nt
|
||||
ref_gemm_nt_bias
|
||||
ref_gemm_nt_q
|
||||
ref_grid_embed
|
||||
ref_had_quant_act_i8g
|
||||
ref_kv_store
|
||||
ref_layernorm
|
||||
ref_logits_gemm
|
||||
ref_moe_gather
|
||||
ref_moe_gemm_q
|
||||
ref_moe_scatter
|
||||
ref_quant_act_fp8
|
||||
ref_quant_act_i8
|
||||
ref_rmsnorm
|
||||
ref_rmsnorm_quant_fp8
|
||||
ref_rope
|
||||
ref_rope_table
|
||||
ref_router_gemm_topk_scatter
|
||||
ref_router_topk
|
||||
ref_router_topk_scatter
|
||||
ref_row_topk
|
||||
ref_sample_argmax
|
||||
ref_sample_dry
|
||||
ref_sample_logprobs
|
||||
ref_sample_mask
|
||||
ref_sample_minp
|
||||
ref_sample_ngram_ban
|
||||
ref_sample_penalties
|
||||
ref_sample_pick
|
||||
ref_sample_temp
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -1,31 +0,0 @@
|
||||
# anima-fp8.recipe -- Anima (Base, Aesthetic or Turbo) with block-scaled fp8 linears.
|
||||
#
|
||||
# rad-convert <Anima>/split_files/diffusion_models/anima-aesthetic-v1.1.safetensors \
|
||||
# --add <Anima>/split_files/text_encoders/qwen_3_06b_base.safetensors \
|
||||
# --add <Anima>/split_files/vae/qwen_image_vae.safetensors \
|
||||
# --config <Qwen/Qwen3-0.6B-Base> --tokenizer2 <ComfyUI>/comfy/text_encoders/t5_tokenizer/tokenizer.json \
|
||||
# --arch anima --set anima.variant=aesthetic \
|
||||
# --recipe data/recipes/anima-fp8.recipe -o anima-aesthetic-fp8.rad
|
||||
#
|
||||
# Every linear of the text encoder and of the DiT's 28 blocks (self- and cross-attention, MLP)
|
||||
# becomes E4M3 codes with a bf16 scale a 128 x 128 block, read by the fp8a8 GEMMs over activations
|
||||
# quantised the same way. The LLM adapter, the embeddings, the modulation linears, the final layer
|
||||
# and the VAE stay bf16. The patch embedding (without its padding-mask columns) and the VAE's causal
|
||||
# convolutions (at their last temporal tap) are computed at convert and stored bf16.
|
||||
|
||||
te.blk.*.attn_qkv.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
te.blk.*.attn_output.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
te.blk.*.ffn_gate_up.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
te.blk.*.ffn_down.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dit.blk.*.attn_qkv.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dit.blk.*.attn_output.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dit.blk.*.cross_q.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dit.blk.*.cross_k.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dit.blk.*.cross_v.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dit.blk.*.cross_output.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dit.blk.*.mlp_layer1.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dit.blk.*.mlp_layer2.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
|
||||
dit.x_embed.weight cast dtype=bf16
|
||||
decoder.* cast dtype=bf16
|
||||
conv2.* cast dtype=bf16
|
||||
@@ -1,22 +0,0 @@
|
||||
# d1-3b-fp8.recipe -- LiquidAI d1-3B (LFM2) with block-scaled fp8 linears.
|
||||
#
|
||||
# rad-convert <LiquidAI/d1-3B> -o d1-3b-fp8.rad --set decision.type=d1 \
|
||||
# --recipe data/recipes/d1-3b-fp8.recipe
|
||||
#
|
||||
# Every linear of the 30 layers (attention q, k, v and output; the convolutions' in and out
|
||||
# projections; gate|up and down) becomes E4M3 codes with a bf16 scale a 128 x 128 block, read by the
|
||||
# fp8a8 GEMMs over activations quantised per 128 columns. The lm_head (tied to the embedding, so the
|
||||
# embedding itself stays bf16) becomes int8 with a bf16 scale per row per 128 columns, read by
|
||||
# logits_gemm_i8: as fast as an E4M3 head and closer to bf16 (84 d1 decisions against the bf16
|
||||
# model: no decision moved, mean |dP| 0.0086 against 0.0085 with a bf16 head). The short
|
||||
# convolution and the norms stay bf16.
|
||||
|
||||
blk.*.attn_q.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
blk.*.attn_k.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
blk.*.attn_v.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
blk.*.attn_output.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
blk.*.conv_in.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
blk.*.conv_out.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
blk.*.ffn_gate_up.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
blk.*.ffn_down.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
output.weight rtn codes=i8 group=128 scale=bf16
|
||||
@@ -0,0 +1,21 @@
|
||||
# d1-3b-iq8r.recipe -- LiquidAI d1-3B (LFM2) with an IQ8R trunk.
|
||||
#
|
||||
# rad-convert <LiquidAI/d1-3B> -o d1-3b-iq8r.rad --set decision.type=d1 \
|
||||
# --recipe data/recipes/d1-3b-iq8r.recipe
|
||||
#
|
||||
# Every linear of the 30 layers (attention q, k, v and output; the convolutions' in and out
|
||||
# projections; gate|up and down) becomes int8 codes in -127..127 in the 128-wide Hadamard domain,
|
||||
# with a u8 scale per [1 x 256] of K under a bf16 scale per row, read against int8 activations
|
||||
# rotated the same way. Round to nearest with a scale search; no calibration data is read. The
|
||||
# lm_head (tied to the embedding, so the embedding itself stays bf16) is int8 unrotated with a bf16
|
||||
# scale per row per 128 columns, read by logits_gemm_i8. The short convolution and the norms stay
|
||||
# bf16.
|
||||
blk.*.attn_q.weight rtn codes=i8 group=256 scale=u8 scale2=bf16 block2=1x* transform=fwht128 clamp=sym rule=search
|
||||
blk.*.attn_k.weight rtn codes=i8 group=256 scale=u8 scale2=bf16 block2=1x* transform=fwht128 clamp=sym rule=search
|
||||
blk.*.attn_v.weight rtn codes=i8 group=256 scale=u8 scale2=bf16 block2=1x* transform=fwht128 clamp=sym rule=search
|
||||
blk.*.attn_output.weight rtn codes=i8 group=256 scale=u8 scale2=bf16 block2=1x* transform=fwht128 clamp=sym rule=search
|
||||
blk.*.conv_in.weight rtn codes=i8 group=256 scale=u8 scale2=bf16 block2=1x* transform=fwht128 clamp=sym rule=search
|
||||
blk.*.conv_out.weight rtn codes=i8 group=256 scale=u8 scale2=bf16 block2=1x* transform=fwht128 clamp=sym rule=search
|
||||
blk.*.ffn_gate_up.weight rtn codes=i8 group=256 scale=u8 scale2=bf16 block2=1x* transform=fwht128 clamp=sym rule=search
|
||||
blk.*.ffn_down.weight rtn codes=i8 group=256 scale=u8 scale2=bf16 block2=1x* transform=fwht128 clamp=sym rule=search
|
||||
output.weight rtn codes=i8 group=128 scale=bf16 clamp=sym rule=search
|
||||
@@ -5,11 +5,19 @@
|
||||
# own searches (llama.cpp's iq1_s/iq2_xxs procedure, ported in Radiance); iq1_s and iq2_xxs need --imatrix. 251.07 GiB.
|
||||
#
|
||||
# data/engram_tables.py <DeepSeek-V4.1-Flash-1017 dir> engram-tables.safetensors (the release ships none)
|
||||
# data/imatrix_merge.py imatrix_unsloth.gguf_file imatrix-merged.gguf
|
||||
# rad-convert <DeepSeek-V4.1-Flash-1017 dir> --add engram-tables.safetensors \
|
||||
# --recipe data/recipes/deepseek41-ud-iq1s.recipe --imatrix <imatrix.gguf> -o deepseek41-ud-iq1s.rad
|
||||
# --recipe data/recipes/deepseek41-ud-iq1s.recipe --imatrix imatrix-merged.gguf \
|
||||
# --tokenizer <dir>/tokenizer.json --chat-template chat_template.jinja -o deepseek41-ud-iq1s.rad
|
||||
#
|
||||
# The imatrix is Unsloth's with entries for the fused weights added (data/imatrix_merge.py, docs/deepseek41-hf-direct.md). One rule per weight,
|
||||
# experts collapsed per layer; first match wins.
|
||||
# engram_tables.py rebuilds the Engram hash tables from the release's tokenizer.json and config.json (0 mismatched
|
||||
# ids of 129280 against HF tokenizers). imatrix_merge.py sums Unsloth's split ffn_gate_exps/ffn_up_exps entries
|
||||
# (and shexp's) into the fused gate_up weights; iq1_s refuses a fused weight without one. The release names no chat
|
||||
# template, so without --chat-template (or override-chat-template at serve time) /v1/chat/completions answers 501.
|
||||
# Serving needs the deepseek41 architecture plugin, which this tree does not include. Measured with it on 4x R9700,
|
||||
# greedy, thinking off: HumanEval 154/164 (the GGUF UD-IQ1_S 0.963), GSM 194/200 (0.960).
|
||||
#
|
||||
# One rule per weight, experts collapsed per layer; first match wins.
|
||||
# PATTERN QUANTISER OPTIONS
|
||||
dspark.enc.output_norm.weight cast dtype=f32
|
||||
dspark.fc.weight cast dtype=bf16
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
# flux-3-klein-bf16.recipe -- FLUX.3 [klein] (or its base) as the release holds it, bf16.
|
||||
#
|
||||
# rad-convert <flux-3-image-klein pipeline directory> --recipe data/recipes/flux-3-klein-bf16.recipe \
|
||||
# -o flux-3-klein-bf16.rad
|
||||
#
|
||||
# Every linear stays the checkpoint's bf16; the one rule casts the VAE, which the release stores
|
||||
# f32 and the decoder's kernels read bf16.
|
||||
|
||||
vae.* cast dtype=bf16
|
||||
@@ -1,24 +0,0 @@
|
||||
# flux-3-klein-fp8.recipe -- FLUX.3 [klein] (or its base) with block-scaled fp8 linears.
|
||||
#
|
||||
# rad-convert <flux-3-image-klein pipeline directory> --recipe data/recipes/flux-3-klein-fp8.recipe \
|
||||
# -o flux-3-klein-fp8.rad
|
||||
#
|
||||
# Every linear of the text encoder's language model and of the DiT's early and joint blocks
|
||||
# becomes E4M3 codes with a bf16 scale a 128 x 128 block, read by the fp8a8 GEMMs over activations
|
||||
# quantised the same way. What stays bf16 is read once a pass or less: the embedding table, the
|
||||
# embedders, the timestep MLPs, the modulations, the output layer and the VAE. The language
|
||||
# model's layers past its last tap (32 of 36) are not carried.
|
||||
|
||||
te.blk.*.attn_qkv.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
te.blk.*.attn_output.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
te.blk.*.ffn_gate_up.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
te.blk.*.ffn_down.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dit.mode.*.attn_qkv.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dit.mode.*.attn_output.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dit.mode.*.ffn_in.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dit.mode.*.ffn_out.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dit.single.*.attn_qkv.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dit.single.*.attn_output.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dit.single.*.ffn_in.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dit.single.*.ffn_out.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
vae.* cast dtype=bf16
|
||||
@@ -0,0 +1,26 @@
|
||||
# flux-3-klein-iq8r.recipe -- FLUX.3 [klein] (or its base) with IQ8R linears.
|
||||
#
|
||||
# rad-convert <flux-3-image-klein pipeline directory> --recipe data/recipes/flux-3-klein-iq8r.recipe \
|
||||
# -o flux-3-klein-iq8r.rad
|
||||
#
|
||||
# Every linear of the text encoder's language model and of the DiT's early and joint blocks
|
||||
# becomes rotated int8: codes in -127..127 in the 128-wide Hadamard domain with a u8 scale per
|
||||
# [1 x 256] of K under a bf16 scale a row, read at i8a8h against int8 activations quantised under
|
||||
# the same rotation with one scale per (token, 256). Round to nearest with a scale search; no
|
||||
# calibration data is read. What stays bf16 is read once a pass or less: the embedding table, the
|
||||
# embedders, the timestep MLPs, the modulations, the output layer and the VAE. The language
|
||||
# model's layers past its last tap (32 of 36) are not carried.
|
||||
|
||||
te.blk.*.attn_qkv.weight rtn codes=i8 group=256 scale=u8 scale2=bf16 block2=1x* transform=fwht128 clamp=sym rule=search
|
||||
te.blk.*.attn_output.weight rtn codes=i8 group=256 scale=u8 scale2=bf16 block2=1x* transform=fwht128 clamp=sym rule=search
|
||||
te.blk.*.ffn_gate_up.weight rtn codes=i8 group=256 scale=u8 scale2=bf16 block2=1x* transform=fwht128 clamp=sym rule=search
|
||||
te.blk.*.ffn_down.weight rtn codes=i8 group=256 scale=u8 scale2=bf16 block2=1x* transform=fwht128 clamp=sym rule=search
|
||||
dit.mode.*.attn_qkv.weight rtn codes=i8 group=256 scale=u8 scale2=bf16 block2=1x* transform=fwht128 clamp=sym rule=search
|
||||
dit.mode.*.attn_output.weight rtn codes=i8 group=256 scale=u8 scale2=bf16 block2=1x* transform=fwht128 clamp=sym rule=search
|
||||
dit.mode.*.ffn_in.weight rtn codes=i8 group=256 scale=u8 scale2=bf16 block2=1x* transform=fwht128 clamp=sym rule=search
|
||||
dit.mode.*.ffn_out.weight rtn codes=i8 group=256 scale=u8 scale2=bf16 block2=1x* transform=fwht128 clamp=sym rule=search
|
||||
dit.single.*.attn_qkv.weight rtn codes=i8 group=256 scale=u8 scale2=bf16 block2=1x* transform=fwht128 clamp=sym rule=search
|
||||
dit.single.*.attn_output.weight rtn codes=i8 group=256 scale=u8 scale2=bf16 block2=1x* transform=fwht128 clamp=sym rule=search
|
||||
dit.single.*.ffn_in.weight rtn codes=i8 group=256 scale=u8 scale2=bf16 block2=1x* transform=fwht128 clamp=sym rule=search
|
||||
dit.single.*.ffn_out.weight rtn codes=i8 group=256 scale=u8 scale2=bf16 block2=1x* transform=fwht128 clamp=sym rule=search
|
||||
vae.* cast dtype=bf16
|
||||
@@ -1,23 +0,0 @@
|
||||
# gemma4-26b-a4b-df-bf16x.recipe -- gemma-4-26B-A4B-it with z-lab's DFlash drafter and the routed
|
||||
# experts left bf16, as arch/gemma4 serves it.
|
||||
#
|
||||
# rad-convert <gemma-4-26B-A4B-it checkpoint> --draft-model <gemma-4-26B-A4B-it-DFlash checkpoint> \
|
||||
# --recipe data/recipes/gemma4-26b-a4b-df-bf16x.recipe -o gemma4-26b-a4b-df-bf16x.rad
|
||||
#
|
||||
# The trunk exactly as the checkpoint holds it -- the bf16 reference the fp8-expert containers are
|
||||
# measured against (radiance --kld-record) -- with only the drafter quantised.
|
||||
|
||||
# The DFlash drafter's six linears: block fp8 (the drafter only proposes; the trunk verifies).
|
||||
dflash.fc.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dflash.blk.*.attn_q.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dflash.blk.*.attn_k.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dflash.blk.*.attn_v.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dflash.blk.*.attn_output.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dflash.blk.*.ffn_gate_up.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dflash.blk.*.ffn_down.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
|
||||
# The drafter's head: the target's tied table again under a name of its own, block fp8, which the
|
||||
# draft head reads instead of the bf16 table -- half the widest read on the draft path, for half
|
||||
# the table's bytes again (176 MiB a rank at tp 4). Drafts are verified, so this changes what is
|
||||
# proposed, never what is accepted.
|
||||
dflash.draft_head.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
@@ -0,0 +1,28 @@
|
||||
# gemma4-26b-a4b-df-i8.recipe -- Gemma 4 26B-A4B with the DFlash drafter: the routed experts'
|
||||
# gate_up and the drafter at eight bits, and nothing in E4M3.
|
||||
#
|
||||
# rad-convert <gemma-4-26B-A4B-it> --draft-model <gemma-4-26B-A4B-it-DFlash> \
|
||||
# --recipe data/recipes/gemma4-26b-a4b-df-i8.recipe -o gemma4-26b-a4b-dflash-i8.rad
|
||||
#
|
||||
# - Every routed expert's gate/up projection as rotated int8: codes in -127..127 with a bf16
|
||||
# scale per (row, 128 of K), each 128 of K rotated by the unnormalised Hadamard
|
||||
# (`transform=fwht128`), round to nearest with a scale search. The grouped GEMM reads them at
|
||||
# i8a8h against int8 codes of the experts' input that the rotating norm writes
|
||||
# (rmsnorm_had_quant_i8g, moe_gemm_i8a8). They are nine tenths of the weight bytes.
|
||||
# - The experts' down projection stays bf16: its K is the
|
||||
# expert's 704 columns, which whole 128-column scale groups do not tile.
|
||||
# - The drafter's seven linears and its copy of the tied head on the int8 grid its block serves
|
||||
# (arch/common/rad_gemma4_dflash.h): int8 codes with an f16 scale per (row, 128 columns),
|
||||
# read at w8a8 against an int8 activation with a scale a row.
|
||||
#
|
||||
# The trunk's attention and dense arm, the norms, the router and the embedding stay bf16.
|
||||
|
||||
blk.*.ffn_gate_up_exps.*.weight rtn codes=i8 group=128 scale=bf16 transform=fwht128 clamp=sym rule=search
|
||||
dflash.fc.weight rtn codes=i8 group=128 scale=f16 clamp=sym
|
||||
dflash.blk.*.attn_q.weight rtn codes=i8 group=128 scale=f16 clamp=sym
|
||||
dflash.blk.*.attn_k.weight rtn codes=i8 group=128 scale=f16 clamp=sym
|
||||
dflash.blk.*.attn_v.weight rtn codes=i8 group=128 scale=f16 clamp=sym
|
||||
dflash.blk.*.attn_output.weight rtn codes=i8 group=128 scale=f16 clamp=sym
|
||||
dflash.blk.*.ffn_gate_up.weight rtn codes=i8 group=128 scale=f16 clamp=sym
|
||||
dflash.blk.*.ffn_down.weight rtn codes=i8 group=128 scale=f16 clamp=sym
|
||||
dflash.draft_head.weight rtn codes=i8 group=128 scale=f16 clamp=sym
|
||||
@@ -1,31 +0,0 @@
|
||||
# gemma4-26b-a4b-df-pad768.recipe -- gemma-4-26B-A4B-it with its experts PADDED TO 768 wide, and
|
||||
# z-lab's DFlash drafter, as arch/gemma4 serves it.
|
||||
#
|
||||
# rad-convert <padded gemma-4-26B-A4B-it checkpoint> --draft-model <gemma-4-26B-A4B-it-DFlash checkpoint> \
|
||||
# --recipe data/recipes/gemma4-26b-a4b-df-pad768.recipe -o gemma4-26b-a4b-df-pad768.rad
|
||||
#
|
||||
# The padding happens BEFORE conversion, outside the engine: each expert's gate and up gain 64
|
||||
# zero rows (704 -> 768) and its down 64 zero columns, and moe_intermediate_size becomes 768. It is
|
||||
# exact -- gelu(0) * 0 = 0 in the added intermediate columns, which meet zero columns of down -- so
|
||||
# the padded model computes the original's function. 768 is six whole 128-blocks, which the fp8
|
||||
# grouped GEMM needs for down's K, and gate and up each start on a block boundary.
|
||||
#
|
||||
# Both expert projections block fp8. Everything else as gemma4-26b-a4b-df.recipe says.
|
||||
|
||||
blk.*.ffn_gate_up_exps.*.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
blk.*.ffn_down_exps.*.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
|
||||
# The DFlash drafter's six linears: block fp8 (the drafter only proposes; the trunk verifies).
|
||||
dflash.fc.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dflash.blk.*.attn_q.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dflash.blk.*.attn_k.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dflash.blk.*.attn_v.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dflash.blk.*.attn_output.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dflash.blk.*.ffn_gate_up.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dflash.blk.*.ffn_down.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
|
||||
# The drafter's head: the target's tied table again under a name of its own, block fp8, which the
|
||||
# draft head reads instead of the bf16 table -- half the widest read on the draft path, for half
|
||||
# the table's bytes again (176 MiB a rank at tp 4). Drafts are verified, so this changes what is
|
||||
# proposed, never what is accepted.
|
||||
dflash.draft_head.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
@@ -1,33 +0,0 @@
|
||||
# gemma4-26b-a4b-df.recipe -- gemma-4-26B-A4B-it with z-lab's DFlash drafter, from the bf16
|
||||
# checkpoint as Google ships it, as arch/gemma4 serves it.
|
||||
#
|
||||
# rad-convert <gemma-4-26B-A4B-it checkpoint> --draft-model <gemma-4-26B-A4B-it-DFlash checkpoint> \
|
||||
# --recipe data/recipes/gemma4-26b-a4b-df.recipe -o gemma4-26b-a4b-df.rad
|
||||
#
|
||||
# The routed experts are ~90% of the weight bytes and a decode step reads whichever were routed.
|
||||
# Their gate_up is block fp8: 2 x 704 = 1408 rows are whole 64-row GEMM tiles and eleven 128-row
|
||||
# scale blocks, and K = 2816 is 22. A third of the expert bytes a decode step reads.
|
||||
#
|
||||
# Their down projection stays bf16: K is the expert width, 704, and the fp8 grouped GEMM reads K
|
||||
# in whole 128-column blocks. gemma4-26b-a4b-df-pad768.recipe makes it fp8 as well, from a
|
||||
# checkpoint whose experts were padded to 768 first.
|
||||
#
|
||||
# The attention, the dense arm, the router, the norms and the tied embedding stay bf16: together
|
||||
# under a tenth of the bytes, and the dense arm's 2112 is not whole 128-blocks either.
|
||||
|
||||
blk.*.ffn_gate_up_exps.*.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
|
||||
# The DFlash drafter's six linears: block fp8 (the drafter only proposes; the trunk verifies).
|
||||
dflash.fc.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dflash.blk.*.attn_q.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dflash.blk.*.attn_k.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dflash.blk.*.attn_v.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dflash.blk.*.attn_output.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dflash.blk.*.ffn_gate_up.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dflash.blk.*.ffn_down.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
|
||||
# The drafter's head: the target's tied table again under a name of its own, block fp8, which the
|
||||
# draft head reads instead of the bf16 table -- half the widest read on the draft path, for half
|
||||
# the table's bytes again (176 MiB a rank at tp 4). Drafts are verified, so this changes what is
|
||||
# proposed, never what is accepted.
|
||||
dflash.draft_head.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
@@ -5,7 +5,7 @@
|
||||
# --recipe data/recipes/gemma4-31b-dense-bf16-q8-df.recipe \
|
||||
# --set quantization_config.quant_method=compressed-tensors -o gemma4-31b-dense-q8-df.rad
|
||||
#
|
||||
# radiance serve gemma4-31b-dense-q8-df.rad --num-speculative-tokens auto ...
|
||||
# served with `model: gemma4-31b-dense-q8-df.rad` and `num-speculative-tokens: auto`
|
||||
#
|
||||
# Q8_0 is int8 codes, symmetric, one f16 scale per block, the scale amax / 127: exactly `codes=i8
|
||||
# scale=f16 clamp=sym` and the default absmax rule. What differs is the block. GGML's is 32 values
|
||||
|
||||
@@ -6,13 +6,13 @@
|
||||
# --recipe data/recipes/gemma4-31b-dense-bf16-w4a8-df.recipe \
|
||||
# --set quantization_config.quant_method=compressed-tensors -o gemma4-31b-dense-w4a8-df.rad
|
||||
#
|
||||
# radiance serve gemma4-31b-dense-w4a8-df.rad --num-speculative-tokens auto ...
|
||||
# served with `model: gemma4-31b-dense-w4a8-df.rad` and `num-speculative-tokens: auto`
|
||||
#
|
||||
# The drafter (z-lab/gemma-4-31B-it-DFlash) is five Qwen3-shaped layers of 5376 (64 heads / 8 kv
|
||||
# x 128, ffn 10752) and an fc over the trunk's residual stream at layers 1 12 23 35 46 57: 1.5 B
|
||||
# parameters, 3.1 GB at bf16. It denoises a block of 16 in one pass and proposes 15 tokens; z-lab
|
||||
# measures 4.2-8.6 accepted per step on B300 at bf16, against the assistant head's ~2. The plugin's
|
||||
# probe names that depth, so rad-convert declares at it and `--num-speculative-tokens auto` serves
|
||||
# probe names that depth, so rad-convert declares at it and `num-speculative-tokens: auto` serves
|
||||
# it; any other depth is refused by name.
|
||||
#
|
||||
# This starts from bf16, not from the QAT release. The drafter reads the trunk's hidden states at
|
||||
@@ -27,7 +27,7 @@
|
||||
# reads at int4, and 352 MB at int8. It is the trunk's verifier; drop the line to keep it bf16.
|
||||
#
|
||||
# ~20 GiB: the int4 trunk's linears (~14 GiB), the bf16 table and its int8 head (2 GiB), the
|
||||
# vision tower, the drafter at block fp8 (1.4 GiB) and its head's block-fp8 copy (0.7 GiB).
|
||||
# vision tower, the drafter at int8 (1.4 GiB) and its head's int8 copy (0.7 GiB).
|
||||
#
|
||||
# q, k and v are one linear, blk.*.attn_qkv (q | k | v; q | k on the global layers, where v is
|
||||
# k): the plugin serves one GEMM a layer where three paid the skinny GEMM's fixed cost each. The
|
||||
@@ -42,19 +42,19 @@ blk.*.ffn_gate_up.weight rtn codes=i4 group=128 scale=f16 rule=search
|
||||
|
||||
output.weight rtn codes=i8 group=128 scale=bf16 clamp=sym
|
||||
|
||||
# The DFlash drafter's seven linears: block fp8, read at fp8a8 against an E4M3 activation (the
|
||||
# drafter only proposes; the trunk verifies). All seven take one grid, because one quantised
|
||||
# The DFlash drafter's seven linears: int8 with an f16 scale per row and 128 of K, read at w8a8
|
||||
# against an int8 activation (the drafter only proposes; the trunk verifies). All seven take one grid, because one quantised
|
||||
# activation feeds several of them, and the plugin checks it.
|
||||
dflash.fc.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dflash.blk.*.attn_q.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dflash.blk.*.attn_k.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dflash.blk.*.attn_v.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dflash.blk.*.attn_output.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dflash.blk.*.ffn_gate_up.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dflash.blk.*.ffn_down.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dflash.fc.weight rtn codes=i8 group=128 scale=f16 clamp=sym
|
||||
dflash.blk.*.attn_q.weight rtn codes=i8 group=128 scale=f16 clamp=sym
|
||||
dflash.blk.*.attn_k.weight rtn codes=i8 group=128 scale=f16 clamp=sym
|
||||
dflash.blk.*.attn_v.weight rtn codes=i8 group=128 scale=f16 clamp=sym
|
||||
dflash.blk.*.attn_output.weight rtn codes=i8 group=128 scale=f16 clamp=sym
|
||||
dflash.blk.*.ffn_gate_up.weight rtn codes=i8 group=128 scale=f16 clamp=sym
|
||||
dflash.blk.*.ffn_down.weight rtn codes=i8 group=128 scale=f16 clamp=sym
|
||||
|
||||
# The drafter's head: the target's tied table again under a name of its own, block fp8, which the
|
||||
# The drafter's head: the target's tied table again under a name of its own, int8, which the
|
||||
# draft head reads instead of the bf16 table. That halves the widest read on the draft path (704 MB
|
||||
# per rank at tp 4 in bf16), for half the table's bytes again. Drafts are verified, so this changes
|
||||
# what is proposed, never what is accepted.
|
||||
dflash.draft_head.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dflash.draft_head.weight rtn codes=i8 group=128 scale=f16 clamp=sym
|
||||
@@ -6,7 +6,7 @@
|
||||
# --recipe data/recipes/gemma4-31b-dense-bf16-w4a8-df2.recipe \
|
||||
# --set quantization_config.quant_method=compressed-tensors -o gemma4-31b-dense-w4a8-df2-qkv.rad
|
||||
#
|
||||
# radiance serve gemma4-31b-dense-w4a8-df2-qkv.rad --num-speculative-tokens auto ...
|
||||
# served with `model: gemma4-31b-dense-w4a8-df2-qkv.rad` and `num-speculative-tokens: auto`
|
||||
#
|
||||
# The drafter (RedHatAI/gemma-4-31B-it-speculator.dflash2) is a speculators-format DFlash2: five
|
||||
# Qwen3-shaped layers at 5376 (32 heads / 16 kv x 256, MLP 21504), every one on a 2048-token
|
||||
@@ -18,7 +18,7 @@
|
||||
# It ships no embedding or head: it reads the trunk's table, unscaled, and the trunk's head. The
|
||||
# trunk is the -df recipe's (int4 trunk, q|k|v as one linear, int8 lm_head), so the same rules.
|
||||
#
|
||||
# ~24 GiB: the -df recipe's trunk and table (~16 GiB), the vision tower, the drafter at block fp8
|
||||
# ~24 GiB: the -df recipe's trunk and table (~16 GiB), the vision tower, the drafter at int8
|
||||
# (2.6 GiB), its selector codebooks at bf16 (2 x 128 MiB) and its head's int8 copy (1.4 GiB).
|
||||
|
||||
blk.*.attn_qkv.weight rtn codes=i4 group=128 scale=f16 rule=search
|
||||
@@ -28,16 +28,16 @@ blk.*.ffn_gate_up.weight rtn codes=i4 group=128 scale=f16 rule=search
|
||||
|
||||
output.weight rtn codes=i8 group=128 scale=bf16 clamp=sym
|
||||
|
||||
# The drafter's seven linears: block fp8, read at fp8a8 against an E4M3 activation, as the block
|
||||
# declares them (rad_fp8.h's DenseFP8). The convolution projections, the selector and the norms
|
||||
# The drafter's seven linears: rotated int8 with a bf16 scale per row and 128 of K, read at i8a8h
|
||||
# against an int8 activation rotated the same way (rad_fp8.h's DenseFP8). The convolution projections, the selector and the norms
|
||||
# stay bf16, as the block reads them.
|
||||
dflash.fc.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dflash.blk.*.attn_q.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dflash.blk.*.attn_k.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dflash.blk.*.attn_v.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dflash.blk.*.attn_output.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dflash.blk.*.ffn_gate_up.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dflash.blk.*.ffn_down.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dflash.fc.weight rtn codes=i8 group=128 scale=bf16 transform=fwht128 clamp=sym rule=search
|
||||
dflash.blk.*.attn_q.weight rtn codes=i8 group=128 scale=bf16 transform=fwht128 clamp=sym rule=search
|
||||
dflash.blk.*.attn_k.weight rtn codes=i8 group=128 scale=bf16 transform=fwht128 clamp=sym rule=search
|
||||
dflash.blk.*.attn_v.weight rtn codes=i8 group=128 scale=bf16 transform=fwht128 clamp=sym rule=search
|
||||
dflash.blk.*.attn_output.weight rtn codes=i8 group=128 scale=bf16 transform=fwht128 clamp=sym rule=search
|
||||
dflash.blk.*.ffn_gate_up.weight rtn codes=i8 group=128 scale=bf16 transform=fwht128 clamp=sym rule=search
|
||||
dflash.blk.*.ffn_down.weight rtn codes=i8 group=128 scale=bf16 transform=fwht128 clamp=sym rule=search
|
||||
|
||||
# The draft head: the trunk's tied table under the block's own name, int8 with an f16 scale per
|
||||
# (row, 128 of K), which the block reads at w8a8 (rad_block_dflash2.h, head_i8). Not the 2-bit
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
# DIR holds the trunk's Hessians, recorded from the bf16 checkpoint by arch/gemma4's calibration
|
||||
# tap (RADIANCE_CALIB_DIR; its files carry this container's weight names): every layer's q|k|v and
|
||||
# gate|up input whole, and attn_o's and ffn_down's as one block a rank (`.part`), which libquant
|
||||
# places on the diagonal. The corpus is the GPTQ one in docs/GEMMA4-31B-GPTQ.md: Gemma 4's tool
|
||||
# places on the diagonal. The corpus and the run are in docs/ARCHITECTURES.md (gemma4, "The 31B by GPTQ"): Gemma 4's tool
|
||||
# calls among chat, code, math and reasoning, rendered with the model's own template.
|
||||
#
|
||||
# Why: round to nearest moves the 31B's distribution where a reply is most constrained. After an
|
||||
@@ -26,16 +26,16 @@ blk.*.ffn_gate_up.weight gptq codes=i4 group=128 scale=f16 rule=search calib=$C
|
||||
|
||||
output.weight rtn codes=i8 group=128 scale=bf16 clamp=sym
|
||||
|
||||
# The drafter's seven linears: block fp8, read at fp8a8 against an E4M3 activation, as the block
|
||||
# declares them (rad_fp8.h's DenseFP8). The convolution projections, the selector and the norms
|
||||
# The drafter's seven linears: rotated int8 with a bf16 scale per row and 128 of K, read at i8a8h
|
||||
# against an int8 activation rotated the same way (rad_fp8.h's DenseFP8). The convolution projections, the selector and the norms
|
||||
# stay bf16, as the block reads them.
|
||||
dflash.fc.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dflash.blk.*.attn_q.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dflash.blk.*.attn_k.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dflash.blk.*.attn_v.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dflash.blk.*.attn_output.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dflash.blk.*.ffn_gate_up.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dflash.blk.*.ffn_down.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dflash.fc.weight rtn codes=i8 group=128 scale=bf16 transform=fwht128 clamp=sym rule=search
|
||||
dflash.blk.*.attn_q.weight rtn codes=i8 group=128 scale=bf16 transform=fwht128 clamp=sym rule=search
|
||||
dflash.blk.*.attn_k.weight rtn codes=i8 group=128 scale=bf16 transform=fwht128 clamp=sym rule=search
|
||||
dflash.blk.*.attn_v.weight rtn codes=i8 group=128 scale=bf16 transform=fwht128 clamp=sym rule=search
|
||||
dflash.blk.*.attn_output.weight rtn codes=i8 group=128 scale=bf16 transform=fwht128 clamp=sym rule=search
|
||||
dflash.blk.*.ffn_gate_up.weight rtn codes=i8 group=128 scale=bf16 transform=fwht128 clamp=sym rule=search
|
||||
dflash.blk.*.ffn_down.weight rtn codes=i8 group=128 scale=bf16 transform=fwht128 clamp=sym rule=search
|
||||
|
||||
# The draft head: the trunk's tied table under the block's own name, int8 with an f16 scale per
|
||||
# (row, 128 of K), which the block reads at w8a8 (rad_block_dflash2.h, head_i8). Not the 2-bit
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# gemma4-e4b-bf16-a4-df.recipe -- Gemma 4 E4B (text, vision, NVIDIA's DFlash drafter) from a bf16 checkpoint,
|
||||
# 4-bit: the feed-forward as asymmetric int4 (u4 codes, a u8 zero point and an f16 scale per [1 x 128]),
|
||||
# attention and layers 19-23 as int8 with a bf16 scale per [1 x 128] (i8a8). An int8 lm_head, the drafter on
|
||||
# block FP8, the vision tower bf16.
|
||||
# int8 (w8a8), the vision tower bf16.
|
||||
#
|
||||
# rad-convert <checkpoint> --recipe data/recipes/gemma4-e4b-bf16-a4-df.recipe --draft-model <dflash-bf16> \
|
||||
# --set quantization_config.quant_method=compressed-tensors -o gemma4-e4b-a4-df.rad
|
||||
@@ -39,11 +39,11 @@ blk.*.ffn_gate_up.weight rtn codes=u4 zero=u8 group=128 scale=f16 rule=search
|
||||
|
||||
output.weight rtn codes=i8 group=128 scale=bf16 clamp=sym
|
||||
|
||||
dflash.fc.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dflash.blk.*.attn_q.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dflash.blk.*.attn_k.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dflash.blk.*.attn_v.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dflash.blk.*.attn_output.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dflash.blk.*.ffn_gate_up.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dflash.blk.*.ffn_down.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dflash.draft_head.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dflash.fc.weight rtn codes=i8 group=128 scale=f16 clamp=sym
|
||||
dflash.blk.*.attn_q.weight rtn codes=i8 group=128 scale=f16 clamp=sym
|
||||
dflash.blk.*.attn_k.weight rtn codes=i8 group=128 scale=f16 clamp=sym
|
||||
dflash.blk.*.attn_v.weight rtn codes=i8 group=128 scale=f16 clamp=sym
|
||||
dflash.blk.*.attn_output.weight rtn codes=i8 group=128 scale=f16 clamp=sym
|
||||
dflash.blk.*.ffn_gate_up.weight rtn codes=i8 group=128 scale=f16 clamp=sym
|
||||
dflash.blk.*.ffn_down.weight rtn codes=i8 group=128 scale=f16 clamp=sym
|
||||
dflash.draft_head.weight rtn codes=i8 group=128 scale=f16 clamp=sym
|
||||
@@ -1,18 +1,18 @@
|
||||
# gemma4-e4b-bf16-df.recipe -- Gemma 4 E4B (NVIDIA-Nemotron-3.5-Bolt-E4B-BF16) as the checkpoint holds it,
|
||||
# text and vision, with NVIDIA's DFlash drafter on block FP8. Wikitext-2 KL against the HF bf16 reference
|
||||
# text and vision, with NVIDIA's DFlash drafter at int8 (w8a8). Wikitext-2 KL against the HF bf16 reference
|
||||
# 0.0015 (bf16 against fp32 0.0012).
|
||||
#
|
||||
# rad-convert <checkpoint> --recipe data/recipes/gemma4-e4b-bf16-df.recipe --draft-model <dflash-bf16> \
|
||||
# --set quantization_config.quant_method=compressed-tensors -o nemotron-3.5-bolt-e4b-bf16.rad
|
||||
#
|
||||
# The drafter ships as a GGUF only (nvidia/NVIDIA-Nemotron-3.5-Bolt-E4B-4GB-DFlash); --draft-model reads
|
||||
# it as safetensors in the z-lab layout. DFlash1 declares its linears block FP8, so bf16 codes are refused.
|
||||
# it as safetensors in the z-lab layout. The drafter's linears and head are int8 with an f16 scale per row and 128 of K.
|
||||
|
||||
dflash.fc.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dflash.blk.*.attn_q.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dflash.blk.*.attn_k.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dflash.blk.*.attn_v.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dflash.blk.*.attn_output.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dflash.blk.*.ffn_gate_up.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dflash.blk.*.ffn_down.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dflash.draft_head.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dflash.fc.weight rtn codes=i8 group=128 scale=f16 clamp=sym
|
||||
dflash.blk.*.attn_q.weight rtn codes=i8 group=128 scale=f16 clamp=sym
|
||||
dflash.blk.*.attn_k.weight rtn codes=i8 group=128 scale=f16 clamp=sym
|
||||
dflash.blk.*.attn_v.weight rtn codes=i8 group=128 scale=f16 clamp=sym
|
||||
dflash.blk.*.attn_output.weight rtn codes=i8 group=128 scale=f16 clamp=sym
|
||||
dflash.blk.*.ffn_gate_up.weight rtn codes=i8 group=128 scale=f16 clamp=sym
|
||||
dflash.blk.*.ffn_down.weight rtn codes=i8 group=128 scale=f16 clamp=sym
|
||||
dflash.draft_head.weight rtn codes=i8 group=128 scale=f16 clamp=sym
|
||||
@@ -1,6 +1,6 @@
|
||||
# gemma4-e4b-bf16-i8g-df.recipe -- Gemma 4 E4B (text, vision, NVIDIA's DFlash drafter) from a bf16 checkpoint:
|
||||
# every trunk linear int8 with a bf16 scale per 128 columns, served at i8a8 (the activation quantised with a
|
||||
# scale per row and 128 columns), an int8 lm_head, the drafter on block FP8, the vision tower bf16.
|
||||
# scale per row and 128 columns), an int8 lm_head, the drafter at int8 (w8a8), the vision tower bf16.
|
||||
# Wikitext-2 KL against the bf16 original 0.010 (w8a8 recipe, one activation scale a row: 0.076).
|
||||
#
|
||||
# rad-convert <checkpoint> --recipe data/recipes/gemma4-e4b-bf16-i8g-df.recipe --draft-model <dflash-bf16> \
|
||||
@@ -14,11 +14,11 @@ blk.*.ffn_gate_up.weight rtn codes=i8 group=128 scale=bf16
|
||||
|
||||
output.weight rtn codes=i8 group=128 scale=bf16 clamp=sym
|
||||
|
||||
dflash.fc.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dflash.blk.*.attn_q.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dflash.blk.*.attn_k.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dflash.blk.*.attn_v.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dflash.blk.*.attn_output.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dflash.blk.*.ffn_gate_up.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dflash.blk.*.ffn_down.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dflash.draft_head.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dflash.fc.weight rtn codes=i8 group=128 scale=f16 clamp=sym
|
||||
dflash.blk.*.attn_q.weight rtn codes=i8 group=128 scale=f16 clamp=sym
|
||||
dflash.blk.*.attn_k.weight rtn codes=i8 group=128 scale=f16 clamp=sym
|
||||
dflash.blk.*.attn_v.weight rtn codes=i8 group=128 scale=f16 clamp=sym
|
||||
dflash.blk.*.attn_output.weight rtn codes=i8 group=128 scale=f16 clamp=sym
|
||||
dflash.blk.*.ffn_gate_up.weight rtn codes=i8 group=128 scale=f16 clamp=sym
|
||||
dflash.blk.*.ffn_down.weight rtn codes=i8 group=128 scale=f16 clamp=sym
|
||||
dflash.draft_head.weight rtn codes=i8 group=128 scale=f16 clamp=sym
|
||||
@@ -1,7 +1,7 @@
|
||||
# gemma4-e4b-bf16-w4a8-df.recipe -- Gemma 4 E4B (text) from a bf16 checkpoint, e.g. NVIDIA's
|
||||
# Nemotron-3.5-Bolt-E4B: int4 codes with an f16 scale per 128 columns (w4a8) on the feed-forward,
|
||||
# The same trunk as gemma4-e4b-bf16-w4a8.recipe, with NVIDIA's DFlash drafter (rad-convert --draft-model <bf16 safetensors>)
|
||||
# on block FP8 like the 31B's -df recipe, and its head as a block-FP8 copy of the target table.
|
||||
# at int8 like the 31B's -df recipe, and its head as an int8 copy of the target table.
|
||||
#
|
||||
# rad-convert <checkpoint> --recipe data/recipes/gemma4-e4b-bf16-w4a8-df.recipe --draft-model <dflash-bf16> \
|
||||
# --set quantization_config.quant_method=compressed-tensors -o gemma4-e4b-w4a8-df.rad
|
||||
@@ -36,11 +36,11 @@ blk.*.ffn_gate_up.weight rtn codes=i4 group=128 scale=f16 rule=search
|
||||
|
||||
output.weight rtn codes=i8 group=128 scale=bf16 clamp=sym
|
||||
|
||||
dflash.fc.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dflash.blk.*.attn_q.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dflash.blk.*.attn_k.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dflash.blk.*.attn_v.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dflash.blk.*.attn_output.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dflash.blk.*.ffn_gate_up.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dflash.blk.*.ffn_down.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dflash.draft_head.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dflash.fc.weight rtn codes=i8 group=128 scale=f16 clamp=sym
|
||||
dflash.blk.*.attn_q.weight rtn codes=i8 group=128 scale=f16 clamp=sym
|
||||
dflash.blk.*.attn_k.weight rtn codes=i8 group=128 scale=f16 clamp=sym
|
||||
dflash.blk.*.attn_v.weight rtn codes=i8 group=128 scale=f16 clamp=sym
|
||||
dflash.blk.*.attn_output.weight rtn codes=i8 group=128 scale=f16 clamp=sym
|
||||
dflash.blk.*.ffn_gate_up.weight rtn codes=i8 group=128 scale=f16 clamp=sym
|
||||
dflash.blk.*.ffn_down.weight rtn codes=i8 group=128 scale=f16 clamp=sym
|
||||
dflash.draft_head.weight rtn codes=i8 group=128 scale=f16 clamp=sym
|
||||
@@ -1,6 +1,6 @@
|
||||
# gemma4-e4b-bf16-w8a8-df.recipe -- Gemma 4 E4B (text, vision, NVIDIA's DFlash drafter) from a bf16 checkpoint:
|
||||
# every trunk linear int8 with an f16 scale per 128 columns (w8a8), an int8 lm_head, the drafter on
|
||||
# block FP8, the vision tower bf16. Wikitext-2 KL against the bf16 original 0.076 (w4a8 recipe: 0.242).
|
||||
# int8 (w8a8), the vision tower bf16. Wikitext-2 KL against the bf16 original 0.076 (w4a8 recipe: 0.242).
|
||||
#
|
||||
# rad-convert <checkpoint> --recipe data/recipes/gemma4-e4b-bf16-w8a8-df.recipe --draft-model <dflash-bf16> \
|
||||
# --set quantization_config.quant_method=compressed-tensors -o gemma4-e4b-w8a8-df.rad
|
||||
@@ -13,11 +13,11 @@ blk.*.ffn_gate_up.weight rtn codes=i8 group=128 scale=f16
|
||||
|
||||
output.weight rtn codes=i8 group=128 scale=bf16 clamp=sym
|
||||
|
||||
dflash.fc.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dflash.blk.*.attn_q.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dflash.blk.*.attn_k.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dflash.blk.*.attn_v.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dflash.blk.*.attn_output.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dflash.blk.*.ffn_gate_up.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dflash.blk.*.ffn_down.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dflash.draft_head.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dflash.fc.weight rtn codes=i8 group=128 scale=f16 clamp=sym
|
||||
dflash.blk.*.attn_q.weight rtn codes=i8 group=128 scale=f16 clamp=sym
|
||||
dflash.blk.*.attn_k.weight rtn codes=i8 group=128 scale=f16 clamp=sym
|
||||
dflash.blk.*.attn_v.weight rtn codes=i8 group=128 scale=f16 clamp=sym
|
||||
dflash.blk.*.attn_output.weight rtn codes=i8 group=128 scale=f16 clamp=sym
|
||||
dflash.blk.*.ffn_gate_up.weight rtn codes=i8 group=128 scale=f16 clamp=sym
|
||||
dflash.blk.*.ffn_down.weight rtn codes=i8 group=128 scale=f16 clamp=sym
|
||||
dflash.draft_head.weight rtn codes=i8 group=128 scale=f16 clamp=sym
|
||||
@@ -1,19 +0,0 @@
|
||||
# HYV3 from the BF16 checkpoint, with attention, dense/shared projections and routed experts rounded
|
||||
# to block FP8. F32 scale planes are intentional: MoeFP8 format 9 consumes a 128x128 grid with
|
||||
# F32 scales. Activations are dynamically quantized to E4M3 at runtime; the BF16 output head, router,
|
||||
# norms and embeddings stay as stored.
|
||||
#
|
||||
# rad-convert <Hy-Memory-30B-A3B-BF16> \
|
||||
# --recipe data/recipes/hy-memory-30b-a3b-bf16-fp8.recipe -o hy-memory-30b-a3b-fp8.rad
|
||||
|
||||
blk.*.attn_q.weight rtn codes=fp8_e4m3 block=128x128 scale=f32
|
||||
blk.*.attn_k.weight rtn codes=fp8_e4m3 block=128x128 scale=f32
|
||||
blk.*.attn_v.weight rtn codes=fp8_e4m3 block=128x128 scale=f32
|
||||
blk.*.attn_output.weight rtn codes=fp8_e4m3 block=128x128 scale=f32
|
||||
|
||||
blk.0.ffn_gate_up.weight rtn codes=fp8_e4m3 block=128x128 scale=f32
|
||||
blk.0.ffn_down.weight rtn codes=fp8_e4m3 block=128x128 scale=f32
|
||||
blk.*.ffn_gate_up_shexp.weight rtn codes=fp8_e4m3 block=128x128 scale=f32
|
||||
blk.*.ffn_down_shexp.weight rtn codes=fp8_e4m3 block=128x128 scale=f32
|
||||
|
||||
blk.*.ffn_*_exps.*.weight rtn codes=fp8_e4m3 block=128x128 scale=f32
|
||||
@@ -1,18 +0,0 @@
|
||||
# HYV3 from BF16 with OCP MXFP4 weights: e2m1 codes and one e8m0 scale per 32 values of K. Quantize
|
||||
# attention, dense/shared projections and routed experts; router, norms, embeddings and output head
|
||||
# stay BF16. Both the regular linears and MoeFP8's expert format-8 path consume this encoding.
|
||||
#
|
||||
# rad-convert <Hy-Memory-30B-A3B-BF16> \
|
||||
# --recipe data/recipes/hy-memory-30b-a3b-bf16-mxfp4.recipe -o hy-memory-30b-a3b-mxfp4.rad
|
||||
|
||||
blk.*.attn_q.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
blk.*.attn_k.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
blk.*.attn_v.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
blk.*.attn_output.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
|
||||
blk.0.ffn_gate_up.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
blk.0.ffn_down.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
blk.*.ffn_gate_up_shexp.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
blk.*.ffn_down_shexp.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
|
||||
blk.*.ffn_*_exps.*.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
@@ -8,7 +8,7 @@
|
||||
# --recipe data/recipes/hy-memory-30b-a3b-bf16-w4.recipe -o hy-memory-30b-a3b-w4.rad
|
||||
#
|
||||
# The W4 GEMMs consume dynamic INT8 activations. Routed/shared outputs are reduced independently at
|
||||
# TP2 then combined in FP32. Use --tp 2 at serve time if one device cannot hold the .rad weights and
|
||||
# TP2 then combined in FP32. Use `tp: 2` at serve time if one device cannot hold the .rad weights and
|
||||
# KV cache.
|
||||
|
||||
blk.*.attn_q.weight rtn codes=u4 zero=u8 group=128 scale=f16
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
# hy-memory-30b-a3b-fp8.recipe -- Tencent's Hy-Memory-30B-A3B-FP8 release.
|
||||
#
|
||||
# rad-convert <Hy-Memory-30B-A3B-FP8 checkpoint directory> \
|
||||
# --recipe data/recipes/hy-memory-30b-a3b-fp8.recipe --kv-cache-dtype fp8 \
|
||||
# -o hy-memory-30b-a3b-fp8.rad
|
||||
#
|
||||
# The checkpoint stores E4M3 projection codes with one F32 weight scale per tensor. Import keeps
|
||||
# those codes and expands each scalar to the 128x128 F32 scale grid read by Radiance's FP8 GEMMs.
|
||||
# Runtime activation quantization is dynamic; source `.input_scale` calibration scalars are ignored.
|
||||
# The attention/MLP norms and router projection are widened to F32 (exact for BF16 source values),
|
||||
# as required by their RMSNorm and FP32 sigmoid-router kernels. Embeddings, lm_head, and the model's
|
||||
# BF16 activations remain BF16; expert correction biases are already F32.
|
||||
#
|
||||
# The indexed kv_cache_scales.safetensors tensors are carried into model metadata during import.
|
||||
# The plugin can use those per-layer K/V descales for an E4M3 KV cache (`--kv-cache-dtype fp8`),
|
||||
# or use a BF16 cache for higher precision.
|
||||
|
||||
blk.*.attn_q.weight import block=128x128 scale=f32
|
||||
blk.*.attn_k.weight import block=128x128 scale=f32
|
||||
blk.*.attn_v.weight import block=128x128 scale=f32
|
||||
blk.*.attn_output.weight import block=128x128 scale=f32
|
||||
blk.0.ffn_gate_up.weight import block=128x128 scale=f32
|
||||
blk.0.ffn_down.weight import block=128x128 scale=f32
|
||||
blk.*.ffn_gate_up_exps.*.weight import block=128x128 scale=f32
|
||||
blk.*.ffn_down_exps.*.weight import block=128x128 scale=f32
|
||||
blk.*.ffn_gate_up_shexp.weight import block=128x128 scale=f32
|
||||
blk.*.ffn_down_shexp.weight import block=128x128 scale=f32
|
||||
|
||||
blk.*.attn_norm.weight cast dtype=f32
|
||||
blk.*.attn_q_norm.weight cast dtype=f32
|
||||
blk.*.attn_k_norm.weight cast dtype=f32
|
||||
blk.*.ffn_norm.weight cast dtype=f32
|
||||
blk.*.glm_router.weight cast dtype=f32
|
||||
output_norm.weight cast dtype=f32
|
||||
@@ -1,45 +0,0 @@
|
||||
# krea-2-fp8-unscaled.recipe -- a Krea 2 finetune shipped as plain fp8 (every tensor E4M3 with no
|
||||
# scale, as ComfyUI's fp8 checkpoints and most civitai Krea 2 files store it), with block-scaled fp8
|
||||
# linears.
|
||||
#
|
||||
# rad-convert <pipeline directory: Krea-2-Turbo's (or -Raw's) model_index, scheduler, text encoder,
|
||||
# tokenizer and VAE, with the finetune's DiT as transformer/> \
|
||||
# --recipe data/recipes/krea-2-fp8-unscaled.recipe -o finetune-fp8.rad
|
||||
#
|
||||
# The DiT's and the text fusion's linears keep the checkpoint's codes: every value is already on the
|
||||
# E4M3 grid, so a block scale of exactly 1 (rule=fixed) holds each one as the code it was shipped
|
||||
# as, where an absmax scale would round it a second time. The text encoder is the release's bf16 and
|
||||
# is rounded as krea-2-fp8.recipe rounds it. The norms, tables and embedders the finetune stores as
|
||||
# E4M3 are widened exactly to the dtypes krea-2-fp8.recipe gives them. A Turbo finetune takes
|
||||
# Turbo's model_index.json (`is_distilled`: 8 steps, no guidance), a Raw one Raw's.
|
||||
|
||||
te.blk.*.attn_qkv.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
te.blk.*.attn_output.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
te.blk.*.ffn_gate_up.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
te.blk.*.ffn_down.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
fuse.*.attn_qkv.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16 rule=fixed scale_value=1
|
||||
fuse.*.attn_gate.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16 rule=fixed scale_value=1
|
||||
fuse.*.attn_output.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16 rule=fixed scale_value=1
|
||||
fuse.*.ffn_gate_up.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16 rule=fixed scale_value=1
|
||||
fuse.*.ffn_down.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16 rule=fixed scale_value=1
|
||||
dit.blk.*.attn_qkv.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16 rule=fixed scale_value=1
|
||||
dit.blk.*.attn_gate.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16 rule=fixed scale_value=1
|
||||
dit.blk.*.attn_output.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16 rule=fixed scale_value=1
|
||||
dit.blk.*.ffn_gate_up.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16 rule=fixed scale_value=1
|
||||
dit.blk.*.ffn_down.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16 rule=fixed scale_value=1
|
||||
|
||||
# The release stores its norms, modulation tables, embedders, projector and output layer f32.
|
||||
# diffusers keeps every norm f32 and runs the rest bf16. Here the text fusion's norms, the q/k norms
|
||||
# and txt_in's norm stay f32; the DiT's norm1, norm2 and final norm are bf16, the fused modulation
|
||||
# kernel's operand, with the rest.
|
||||
fuse.*.norm1.weight cast dtype=f32
|
||||
fuse.*.norm2.weight cast dtype=f32
|
||||
fuse.*.q_norm.weight cast dtype=f32
|
||||
fuse.*.k_norm.weight cast dtype=f32
|
||||
dit.blk.*.q_norm.weight cast dtype=f32
|
||||
dit.blk.*.k_norm.weight cast dtype=f32
|
||||
txt.norm.weight cast dtype=f32
|
||||
fuse.* cast dtype=bf16
|
||||
txt.* cast dtype=bf16
|
||||
dit.* cast dtype=bf16
|
||||
vae.* cast dtype=bf16
|
||||
@@ -1,41 +0,0 @@
|
||||
# krea-2-fp8.recipe -- Krea 2 (Raw or Turbo) with block-scaled fp8 linears.
|
||||
#
|
||||
# rad-convert <Krea-2-Raw or -Turbo pipeline directory> --recipe data/recipes/krea-2-fp8.recipe \
|
||||
# -o krea-2-fp8.rad
|
||||
#
|
||||
# Every linear of the text encoder's language model, of the text fusion's blocks and of the DiT's
|
||||
# 28 blocks becomes E4M3 codes with a bf16 scale a 128 x 128 block, read by the fp8a8 GEMMs over
|
||||
# activations quantised the same way. What stays bf16 is read once a pass or less: the embedding
|
||||
# table, txt_in, img_in, the timestep MLP and modulation, the blocks' tables, the final layer and
|
||||
# the VAE. The language model's layers past its last tap (35 of 36) are not carried.
|
||||
|
||||
te.blk.*.attn_qkv.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
te.blk.*.attn_output.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
te.blk.*.ffn_gate_up.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
te.blk.*.ffn_down.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
fuse.*.attn_qkv.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
fuse.*.attn_gate.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
fuse.*.attn_output.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
fuse.*.ffn_gate_up.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
fuse.*.ffn_down.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dit.blk.*.attn_qkv.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dit.blk.*.attn_gate.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dit.blk.*.attn_output.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dit.blk.*.ffn_gate_up.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dit.blk.*.ffn_down.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
|
||||
# The release stores its norms, modulation tables, embedders, projector and output layer f32.
|
||||
# diffusers keeps every norm f32 and runs the rest bf16. Here the text fusion's norms, the q/k norms
|
||||
# and txt_in's norm stay f32; the DiT's norm1, norm2 and final norm are bf16, the fused modulation
|
||||
# kernel's operand, with the rest.
|
||||
fuse.*.norm1.weight cast dtype=f32
|
||||
fuse.*.norm2.weight cast dtype=f32
|
||||
fuse.*.q_norm.weight cast dtype=f32
|
||||
fuse.*.k_norm.weight cast dtype=f32
|
||||
dit.blk.*.q_norm.weight cast dtype=f32
|
||||
dit.blk.*.k_norm.weight cast dtype=f32
|
||||
txt.norm.weight cast dtype=f32
|
||||
fuse.* cast dtype=bf16
|
||||
txt.* cast dtype=bf16
|
||||
dit.* cast dtype=bf16
|
||||
vae.* cast dtype=bf16
|
||||
@@ -0,0 +1,38 @@
|
||||
# krea-2-iq8r.recipe -- Krea 2 (Raw or Turbo) with IQ8R linears.
|
||||
#
|
||||
# rad-convert <Krea-2 pipeline directory> --recipe data/recipes/krea-2-iq8r.recipe -o krea-2-iq8r.rad
|
||||
#
|
||||
# Every linear of the text encoder's language model, of the text fusion and of the DiT's blocks
|
||||
# becomes rotated int8: codes in -127..127 in the 128-wide Hadamard domain with a u8 scale per
|
||||
# [1 x 256] of K under a bf16 scale a row, read at i8a8h against int8 activations quantised under
|
||||
# the same rotation with one scale per (token, 256). Round to nearest with a scale search; no
|
||||
# calibration data is read. The text fusion's down projection keeps one bf16 scale a 128 instead:
|
||||
# its 6912 columns are 3456 a rank on two cards, which whole 128s tile and whole 256s do not. The
|
||||
# casts below exist because the release stores its norms, embedders, modulations and output layer
|
||||
# f32.
|
||||
|
||||
te.blk.*.attn_qkv.weight rtn codes=i8 group=256 scale=u8 scale2=bf16 block2=1x* transform=fwht128 clamp=sym rule=search
|
||||
te.blk.*.attn_output.weight rtn codes=i8 group=256 scale=u8 scale2=bf16 block2=1x* transform=fwht128 clamp=sym rule=search
|
||||
te.blk.*.ffn_gate_up.weight rtn codes=i8 group=256 scale=u8 scale2=bf16 block2=1x* transform=fwht128 clamp=sym rule=search
|
||||
te.blk.*.ffn_down.weight rtn codes=i8 group=256 scale=u8 scale2=bf16 block2=1x* transform=fwht128 clamp=sym rule=search
|
||||
fuse.*.attn_qkv.weight rtn codes=i8 group=256 scale=u8 scale2=bf16 block2=1x* transform=fwht128 clamp=sym rule=search
|
||||
fuse.*.attn_gate.weight rtn codes=i8 group=256 scale=u8 scale2=bf16 block2=1x* transform=fwht128 clamp=sym rule=search
|
||||
fuse.*.attn_output.weight rtn codes=i8 group=256 scale=u8 scale2=bf16 block2=1x* transform=fwht128 clamp=sym rule=search
|
||||
fuse.*.ffn_gate_up.weight rtn codes=i8 group=256 scale=u8 scale2=bf16 block2=1x* transform=fwht128 clamp=sym rule=search
|
||||
fuse.*.ffn_down.weight rtn codes=i8 group=128 scale=bf16 transform=fwht128 clamp=sym rule=search
|
||||
dit.blk.*.attn_qkv.weight rtn codes=i8 group=256 scale=u8 scale2=bf16 block2=1x* transform=fwht128 clamp=sym rule=search
|
||||
dit.blk.*.attn_gate.weight rtn codes=i8 group=256 scale=u8 scale2=bf16 block2=1x* transform=fwht128 clamp=sym rule=search
|
||||
dit.blk.*.attn_output.weight rtn codes=i8 group=256 scale=u8 scale2=bf16 block2=1x* transform=fwht128 clamp=sym rule=search
|
||||
dit.blk.*.ffn_gate_up.weight rtn codes=i8 group=256 scale=u8 scale2=bf16 block2=1x* transform=fwht128 clamp=sym rule=search
|
||||
dit.blk.*.ffn_down.weight rtn codes=i8 group=256 scale=u8 scale2=bf16 block2=1x* transform=fwht128 clamp=sym rule=search
|
||||
fuse.*.norm1.weight cast dtype=f32
|
||||
fuse.*.norm2.weight cast dtype=f32
|
||||
fuse.*.q_norm.weight cast dtype=f32
|
||||
fuse.*.k_norm.weight cast dtype=f32
|
||||
dit.blk.*.q_norm.weight cast dtype=f32
|
||||
dit.blk.*.k_norm.weight cast dtype=f32
|
||||
txt.norm.weight cast dtype=f32
|
||||
fuse.* cast dtype=bf16
|
||||
txt.* cast dtype=bf16
|
||||
dit.* cast dtype=bf16
|
||||
vae.* cast dtype=bf16
|
||||
@@ -4,8 +4,9 @@
|
||||
# the checkpoint holds it. The format is ling3-w4a8-rtn.recipe's, so the same kernels serve both.
|
||||
#
|
||||
# 1. rad-convert <checkpoint> --recipe data/recipes/ling3-w4a8-rtn.recipe -o ling3-w4a8-rtn.rad
|
||||
# 2. RADIANCE_CALIB_DIR=<calib dir> radiance --model ling3-w4a8-rtn.rad ... (a calibration run:
|
||||
# whole experts per rank; push a corpus that looks like the traffic through prefill)
|
||||
# 2. RADIANCE_CALIB_DIR=<calib dir> radiance --config calib.yaml (a calibration run, the YAML's
|
||||
# model ling3-w4a8-rtn.rad: whole experts per rank; push a corpus that looks like the traffic
|
||||
# through prefill)
|
||||
# 3. CALIB=<calib dir> rad-convert <checkpoint> --recipe data/recipes/ling3-w4a8-gptq.recipe \
|
||||
# --reuse ling3-w4a8-rtn.rad -o ling3-w4a8-gptq.rad
|
||||
#
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
# ltx-2.5-fp8.recipe -- LTX-2.5 (the base or the distilled DiT) with block-scaled fp8 linears.
|
||||
#
|
||||
# rad-convert <LTX-2.5 diffusers pipeline directory> --recipe data/recipes/ltx-2.5-fp8.recipe \
|
||||
# -o ltx-2.5-fp8.rad
|
||||
#
|
||||
# Every linear of the text encoder (Gemma 4), of the two connectors and of the DiT's 48 blocks
|
||||
# becomes E4M3 codes with a bf16 scale a 128 x 128 block, read by the fp8a8 GEMMs over activations
|
||||
# quantised the same way; the biases stay bf16 and are added after. What stays bf16 is small or
|
||||
# read once a step: the attention gates' logits, the q and k norms, the patch projections, the
|
||||
# timestep MLPs and the tables, the connectors' registers, both VAEs and the latent upsampler.
|
||||
# The vocoders are cast to f32, which their convolutions and anti-aliased activations run in
|
||||
# (a pipeline saved in bf16 holds them bf16); the spectrogram bases stay bf16.
|
||||
|
||||
te.blk.*.attn_q.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
te.blk.*.attn_k.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
te.blk.*.attn_v.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
te.blk.*.attn_output.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
te.blk.*.ffn_gate_up.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
te.blk.*.ffn_down.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
conn.*.proj.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
conn.*.blk.*.qkv.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
conn.*.blk.*.out.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
conn.*.blk.*.ff_up.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
conn.*.blk.*.ff_down.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dit.blk.*.qkv.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dit.blk.*.q.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dit.blk.*.kv.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dit.blk.*.out.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dit.blk.*.ff_up.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dit.blk.*.ff_down.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dit.blk.*.audio_ff_up.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dit.blk.*.audio_ff_down.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
voc.conv_* cast dtype=f32
|
||||
voc.upsamplers.* cast dtype=f32
|
||||
voc.resnets.* cast dtype=f32
|
||||
voc.act_out.* cast dtype=f32
|
||||
bwe.* cast dtype=f32
|
||||
@@ -0,0 +1,39 @@
|
||||
# ltx-2.5-iq8r.recipe -- LTX-2.5 (the base or the distilled DiT) with IQ8R linears.
|
||||
#
|
||||
# rad-convert <LTX-2.5 diffusers pipeline directory> --recipe data/recipes/ltx-2.5-iq8r.recipe \
|
||||
# -o ltx-2.5-iq8r.rad
|
||||
#
|
||||
# Every linear of the text encoder (Gemma 4), of the two connectors and of the DiT's 48 blocks
|
||||
# becomes rotated int8: codes in -127..127 in the 128-wide Hadamard domain with a u8 scale per
|
||||
# [1 x 256] of K under a bf16 scale a row, read at i8a8h against int8 activations quantised under
|
||||
# the same rotation with one scale per (row, 256); the biases stay bf16 and are added after. Round
|
||||
# to nearest with a scale search; no calibration data is read. What stays bf16 is small or read
|
||||
# once a step: the attention gates' logits, the q and k norms, the patch projections, the timestep
|
||||
# MLPs and the tables, the connectors' registers, both VAEs and the latent upsampler. The vocoders
|
||||
# are cast to f32, which their convolutions and anti-aliased activations run in (a pipeline saved
|
||||
# in bf16 holds them bf16); the spectrogram bases stay bf16.
|
||||
|
||||
te.blk.*.attn_q.weight rtn codes=i8 group=256 scale=u8 scale2=bf16 block2=1x* transform=fwht128 clamp=sym rule=search
|
||||
te.blk.*.attn_k.weight rtn codes=i8 group=256 scale=u8 scale2=bf16 block2=1x* transform=fwht128 clamp=sym rule=search
|
||||
te.blk.*.attn_v.weight rtn codes=i8 group=256 scale=u8 scale2=bf16 block2=1x* transform=fwht128 clamp=sym rule=search
|
||||
te.blk.*.attn_output.weight rtn codes=i8 group=256 scale=u8 scale2=bf16 block2=1x* transform=fwht128 clamp=sym rule=search
|
||||
te.blk.*.ffn_gate_up.weight rtn codes=i8 group=256 scale=u8 scale2=bf16 block2=1x* transform=fwht128 clamp=sym rule=search
|
||||
te.blk.*.ffn_down.weight rtn codes=i8 group=256 scale=u8 scale2=bf16 block2=1x* transform=fwht128 clamp=sym rule=search
|
||||
conn.*.proj.weight rtn codes=i8 group=256 scale=u8 scale2=bf16 block2=1x* transform=fwht128 clamp=sym rule=search
|
||||
conn.*.blk.*.qkv.weight rtn codes=i8 group=256 scale=u8 scale2=bf16 block2=1x* transform=fwht128 clamp=sym rule=search
|
||||
conn.*.blk.*.out.weight rtn codes=i8 group=256 scale=u8 scale2=bf16 block2=1x* transform=fwht128 clamp=sym rule=search
|
||||
conn.*.blk.*.ff_up.weight rtn codes=i8 group=256 scale=u8 scale2=bf16 block2=1x* transform=fwht128 clamp=sym rule=search
|
||||
conn.*.blk.*.ff_down.weight rtn codes=i8 group=256 scale=u8 scale2=bf16 block2=1x* transform=fwht128 clamp=sym rule=search
|
||||
dit.blk.*.qkv.weight rtn codes=i8 group=256 scale=u8 scale2=bf16 block2=1x* transform=fwht128 clamp=sym rule=search
|
||||
dit.blk.*.q.weight rtn codes=i8 group=256 scale=u8 scale2=bf16 block2=1x* transform=fwht128 clamp=sym rule=search
|
||||
dit.blk.*.kv.weight rtn codes=i8 group=256 scale=u8 scale2=bf16 block2=1x* transform=fwht128 clamp=sym rule=search
|
||||
dit.blk.*.out.weight rtn codes=i8 group=256 scale=u8 scale2=bf16 block2=1x* transform=fwht128 clamp=sym rule=search
|
||||
dit.blk.*.ff_up.weight rtn codes=i8 group=256 scale=u8 scale2=bf16 block2=1x* transform=fwht128 clamp=sym rule=search
|
||||
dit.blk.*.ff_down.weight rtn codes=i8 group=256 scale=u8 scale2=bf16 block2=1x* transform=fwht128 clamp=sym rule=search
|
||||
dit.blk.*.audio_ff_up.weight rtn codes=i8 group=256 scale=u8 scale2=bf16 block2=1x* transform=fwht128 clamp=sym rule=search
|
||||
dit.blk.*.audio_ff_down.weight rtn codes=i8 group=256 scale=u8 scale2=bf16 block2=1x* transform=fwht128 clamp=sym rule=search
|
||||
voc.conv_* cast dtype=f32
|
||||
voc.upsamplers.* cast dtype=f32
|
||||
voc.resnets.* cast dtype=f32
|
||||
voc.act_out.* cast dtype=f32
|
||||
bwe.* cast dtype=f32
|
||||
@@ -1,18 +1,18 @@
|
||||
# minicpm5-2b-bf16-dspark.recipe -- MiniCPM5-2B in bf16 as the checkpoint ships it, with the DSpark
|
||||
# drafter merged in (--draft-model). Every weight of the model itself, the lm_head included, is the
|
||||
# checkpoint's own; the drafter is quantised as in minicpm5-2b-dspark.recipe, because the DSpark
|
||||
# block reads its weights in one form only: block fp8, and the vocabulary head as 2-bit codes (the
|
||||
# head only proposes; the model's own bf16 lm_head scores every token it accepts).
|
||||
# checkpoint's own; the drafter is quantised as in minicpm5-2b-iq8r.recipe: its linears rotated
|
||||
# int8 (IQ8R), and the vocabulary head as 2-bit codes (the head only proposes; the model's own bf16
|
||||
# lm_head scores every token it accepts).
|
||||
#
|
||||
# rad-convert <MiniCPM5-2B checkpoint> --draft-model <MiniCPM5-2B-DSpark checkpoint> \
|
||||
# --tokenizer <MiniCPM5-2B checkpoint>/tokenizer.json \
|
||||
# --recipe data/recipes/minicpm5-2b-bf16-dspark.recipe -o minicpm5-2b-bf16.rad
|
||||
|
||||
dspark.draft_head.weight rtn codes=u2 zero=u8 group=128 scale=f16
|
||||
dspark.fc.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dspark.blk.*.attn_q.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dspark.blk.*.attn_k.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dspark.blk.*.attn_v.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dspark.blk.*.attn_output.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dspark.blk.*.ffn_gate_up.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dspark.blk.*.ffn_down.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dspark.fc.weight rtn codes=i8 group=256 scale=u8 scale2=bf16 block2=1x* transform=fwht128 clamp=sym rule=search
|
||||
dspark.blk.*.attn_q.weight rtn codes=i8 group=256 scale=u8 scale2=bf16 block2=1x* transform=fwht128 clamp=sym rule=search
|
||||
dspark.blk.*.attn_k.weight rtn codes=i8 group=256 scale=u8 scale2=bf16 block2=1x* transform=fwht128 clamp=sym rule=search
|
||||
dspark.blk.*.attn_v.weight rtn codes=i8 group=256 scale=u8 scale2=bf16 block2=1x* transform=fwht128 clamp=sym rule=search
|
||||
dspark.blk.*.attn_output.weight rtn codes=i8 group=256 scale=u8 scale2=bf16 block2=1x* transform=fwht128 clamp=sym rule=search
|
||||
dspark.blk.*.ffn_gate_up.weight rtn codes=i8 group=256 scale=u8 scale2=bf16 block2=1x* transform=fwht128 clamp=sym rule=search
|
||||
dspark.blk.*.ffn_down.weight rtn codes=i8 group=256 scale=u8 scale2=bf16 block2=1x* transform=fwht128 clamp=sym rule=search
|
||||
@@ -1,29 +0,0 @@
|
||||
# minicpm5-2b-dspark.recipe -- MiniCPM5-2B with the DSpark drafter, as the minicpm5-2b-dspark.rad
|
||||
# container serves it (scripts/convdspark.sh).
|
||||
#
|
||||
# OpenBMB publishes MiniCPM5-2B in bf16 only, so every linear is made block fp8 here: one amax a
|
||||
# 128x128 block, scale = amax/448 rounded to bf16. The checkpoint then serves through llama_dense_fp8
|
||||
# with the graph llama_fp8 declares over an fp8 release. Also:
|
||||
#
|
||||
# - the lm_head, block fp8: the widest GEMM in the model at half the bytes
|
||||
# - the drafter's linears, block fp8 from its bf16 release
|
||||
# - the drafter's 2-bit copy of the target's head (u2 codes, an f16 scale and a u8 zero a group
|
||||
# of 128), read by its draft passes only
|
||||
#
|
||||
# Every norm, the embedding and the drafter's Markov codebooks stay bf16.
|
||||
|
||||
output.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dspark.draft_head.weight rtn codes=u2 zero=u8 group=128 scale=f16
|
||||
|
||||
blk.*.attn_qkv.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
blk.*.attn_output.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
blk.*.ffn_gate_up.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
blk.*.ffn_down.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
|
||||
dspark.fc.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dspark.blk.*.attn_q.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dspark.blk.*.attn_k.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dspark.blk.*.attn_v.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dspark.blk.*.attn_output.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dspark.blk.*.ffn_gate_up.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dspark.blk.*.ffn_down.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
@@ -0,0 +1,34 @@
|
||||
# minicpm5-2b-iq8r.recipe -- MiniCPM5-2B with the DSpark drafter at IQ8R: every linear of the trunk
|
||||
# and of the drafter as rotated int8, read against int8 activations (arch/llama_dense_fp8).
|
||||
#
|
||||
# OpenBMB publishes MiniCPM5-2B in bf16 only. IQ8R is int8 codes in the 128-wide Hadamard domain
|
||||
# with a u8 scale per [1 x 256] of K under a bf16 scale per row, so a weight costs eight bits and
|
||||
# 1/256 of a byte a parameter plus two bytes a row. Round to nearest with a scale search: no
|
||||
# calibration data is read. Also:
|
||||
#
|
||||
# - the lm_head, int8 with a bf16 scale per [1 x 128], unrotated: the widest GEMM in the model
|
||||
# at half the bytes
|
||||
# - the drafter's 2-bit copy of the target's head (u2 codes, an f16 scale and a u8 zero a group
|
||||
# of 128), read by its draft passes only
|
||||
#
|
||||
# Every norm, the embedding and the drafter's Markov codebooks stay bf16.
|
||||
#
|
||||
# rad-convert openbmb/MiniCPM5-2B --draft-model openbmb/MiniCPM5-2B-DSpark \
|
||||
# --tokenizer openbmb/MiniCPM5-2B/tokenizer.json \
|
||||
# --recipe data/recipes/minicpm5-2b-iq8r.recipe -o minicpm5-2b-iq8r.rad
|
||||
|
||||
output.weight rtn codes=i8 group=128 scale=bf16 clamp=sym rule=search
|
||||
dspark.draft_head.weight rtn codes=u2 zero=u8 group=128 scale=f16
|
||||
|
||||
blk.*.attn_qkv.weight rtn codes=i8 group=256 scale=u8 scale2=bf16 block2=1x* transform=fwht128 clamp=sym rule=search
|
||||
blk.*.attn_output.weight rtn codes=i8 group=256 scale=u8 scale2=bf16 block2=1x* transform=fwht128 clamp=sym rule=search
|
||||
blk.*.ffn_gate_up.weight rtn codes=i8 group=256 scale=u8 scale2=bf16 block2=1x* transform=fwht128 clamp=sym rule=search
|
||||
blk.*.ffn_down.weight rtn codes=i8 group=256 scale=u8 scale2=bf16 block2=1x* transform=fwht128 clamp=sym rule=search
|
||||
|
||||
dspark.fc.weight rtn codes=i8 group=256 scale=u8 scale2=bf16 block2=1x* transform=fwht128 clamp=sym rule=search
|
||||
dspark.blk.*.attn_q.weight rtn codes=i8 group=256 scale=u8 scale2=bf16 block2=1x* transform=fwht128 clamp=sym rule=search
|
||||
dspark.blk.*.attn_k.weight rtn codes=i8 group=256 scale=u8 scale2=bf16 block2=1x* transform=fwht128 clamp=sym rule=search
|
||||
dspark.blk.*.attn_v.weight rtn codes=i8 group=256 scale=u8 scale2=bf16 block2=1x* transform=fwht128 clamp=sym rule=search
|
||||
dspark.blk.*.attn_output.weight rtn codes=i8 group=256 scale=u8 scale2=bf16 block2=1x* transform=fwht128 clamp=sym rule=search
|
||||
dspark.blk.*.ffn_gate_up.weight rtn codes=i8 group=256 scale=u8 scale2=bf16 block2=1x* transform=fwht128 clamp=sym rule=search
|
||||
dspark.blk.*.ffn_down.weight rtn codes=i8 group=256 scale=u8 scale2=bf16 block2=1x* transform=fwht128 clamp=sym rule=search
|
||||
@@ -1,62 +0,0 @@
|
||||
# minimax-h3-curve-fp8.recipe -- MiniMax-H3 from a curve-form checkpoint, block-scaled fp8 linears.
|
||||
#
|
||||
# minimax-h3-fp8.recipe without its modulation rule. A curve-form checkpoint (config.json's
|
||||
# adaln_curve_grid set) ships its timestep embeddings precomputed, adaln_t_table, in place of the
|
||||
# sinusoid and its MLP, and its modulation projections take eight inputs. A 128 x 128 E4M3 block
|
||||
# does not fit an eight-column weight, so the plugin declares those projections bf16 and they are
|
||||
# stored as the checkpoint holds them; the table matches no rule and keeps its f32. Every other
|
||||
# weight converts as minimax-h3-fp8.recipe describes.
|
||||
#
|
||||
# rad-convert <pipeline directory with the curve-form transformer/> \
|
||||
# --recipe data/recipes/minimax-h3-curve-fp8.recipe -o minimax-h3-curve-fp8.rad
|
||||
#
|
||||
# A container of the base model supplies every weight outside the DiT, with the transformer's
|
||||
# tensor names (one a line, "transformer." first) listed as changed:
|
||||
#
|
||||
# rad-convert <that directory> --recipe data/recipes/minimax-h3-curve-fp8.recipe \
|
||||
# --reuse minimax-h3-fp8.rad --changed <the transformer's tensor names> \
|
||||
# -o minimax-h3-curve-fp8.rad
|
||||
#
|
||||
# A checkpoint distributed as a single ComfyUI file is laid out as that directory first: the
|
||||
# transformer's tensors under their diffusers names and dtypes in transformer/, and its
|
||||
# config.json with adaln_curve_grid.
|
||||
|
||||
te.blk.*.attn_qkv.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
te.blk.*.attn_output.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
te.blk.*.ffn_gate_up.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
te.blk.*.ffn_down.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
te.blk.*.attn_norm.weight cast dtype=f32
|
||||
te.blk.*.ffn_norm.weight cast dtype=f32
|
||||
ref.blk.*.attn_qkv.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
ref.blk.*.attn_output.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
ref.blk.*.ffn_gate_up.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
ref.blk.*.ffn_down.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dit.blk.*.attn_qkv.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dit.blk.*.attn_output.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dit.blk.*.ffn_gate_up.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dit.blk.*.ffn_down.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
vae.blk.*.attn_qkv.weight cast dtype=bf16
|
||||
vae.blk.*.attn_out.weight cast dtype=bf16
|
||||
vae.blk.*.ffn_up.weight cast dtype=bf16
|
||||
vae.blk.*.ffn_down.weight cast dtype=bf16
|
||||
vae.proj_out.* cast dtype=bf16
|
||||
aud.*.weight cast dtype=f32
|
||||
# The audio encoder's strided downsamplers and its attention and MLP block run in bf16 inside the
|
||||
# f32 chain (declare_aenc): conv1d, layernorm and gemm take one dtype for every operand, so their
|
||||
# weights are cast. The chain's own convolutions are stored f32, their weight norms folded.
|
||||
aenc.d*.w cast dtype=bf16
|
||||
aenc.d*.b cast dtype=bf16
|
||||
aenc.pb.* cast dtype=bf16
|
||||
aenc.b*.u*.c1.weight cast dtype=f32
|
||||
aenc.b*.u*.c2.weight cast dtype=f32
|
||||
aenc.cin.weight cast dtype=f32
|
||||
aenc.fin.weight cast dtype=f32
|
||||
# The video encoder's 3x3x3 convolutions are bf16, as the implicit-GEMM kernel reads them;
|
||||
# conv_in (three input channels) and the 1x1x1 shortcut and quant convolutions read their f32
|
||||
# weights as they are, and the norms and biases need no rule.
|
||||
venc.l*.b*.c1w cast dtype=bf16
|
||||
venc.l*.b*.c2w cast dtype=bf16
|
||||
venc.l*.dnw cast dtype=bf16
|
||||
venc.cout.weight cast dtype=bf16
|
||||
ups.embed.* cast dtype=f32
|
||||
ups.*.emb_layers.* cast dtype=f32
|
||||
@@ -1,62 +0,0 @@
|
||||
# minimax-h3-curve-w8a8.recipe -- MiniMax-H3 from a curve-form checkpoint, the DiT at int8 (W8A8).
|
||||
#
|
||||
# minimax-h3-w8a8.recipe without its modulation rule. A curve-form checkpoint (config.json's
|
||||
# adaln_curve_grid set) ships its timestep embeddings precomputed, adaln_t_table, in place of the
|
||||
# sinusoid and its MLP, and its modulation projections take eight inputs. A 128 x 128 E4M3 block
|
||||
# does not fit an eight-column weight, so the plugin declares those projections bf16 and they are
|
||||
# stored as the checkpoint holds them; the table matches no rule and keeps its f32. Every other
|
||||
# weight converts as minimax-h3-w8a8.recipe describes.
|
||||
#
|
||||
# rad-convert <pipeline directory with the curve-form transformer/> \
|
||||
# --recipe data/recipes/minimax-h3-curve-w8a8.recipe -o minimax-h3-curve-w8a8.rad
|
||||
#
|
||||
# A container of the base model supplies every weight outside the DiT, with the transformer's
|
||||
# tensor names (one a line, "transformer." first) listed as changed:
|
||||
#
|
||||
# rad-convert <that directory> --recipe data/recipes/minimax-h3-curve-w8a8.recipe \
|
||||
# --reuse minimax-h3-w8a8.rad --changed <the transformer's tensor names> \
|
||||
# -o minimax-h3-curve-w8a8.rad
|
||||
#
|
||||
# A checkpoint distributed as a single ComfyUI file is laid out as that directory first: the
|
||||
# transformer's tensors under their diffusers names and dtypes in transformer/, and its
|
||||
# config.json with adaln_curve_grid.
|
||||
|
||||
te.blk.*.attn_qkv.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
te.blk.*.attn_output.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
te.blk.*.ffn_gate_up.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
te.blk.*.ffn_down.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
te.blk.*.attn_norm.weight cast dtype=f32
|
||||
te.blk.*.ffn_norm.weight cast dtype=f32
|
||||
ref.blk.*.attn_qkv.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
ref.blk.*.attn_output.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
ref.blk.*.ffn_gate_up.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
ref.blk.*.ffn_down.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dit.blk.*.attn_qkv.weight rtn codes=i8 group=128 scale=bf16 clamp=sym
|
||||
dit.blk.*.attn_output.weight rtn codes=i8 group=128 scale=bf16 clamp=sym
|
||||
dit.blk.*.ffn_gate_up.weight rtn codes=i8 group=128 scale=bf16 clamp=sym
|
||||
dit.blk.*.ffn_down.weight rtn codes=i8 group=128 scale=bf16 clamp=sym
|
||||
vae.blk.*.attn_qkv.weight cast dtype=bf16
|
||||
vae.blk.*.attn_out.weight cast dtype=bf16
|
||||
vae.blk.*.ffn_up.weight cast dtype=bf16
|
||||
vae.blk.*.ffn_down.weight cast dtype=bf16
|
||||
vae.proj_out.* cast dtype=bf16
|
||||
aud.*.weight cast dtype=f32
|
||||
# The audio encoder's strided downsamplers and its attention and MLP block run in bf16 inside the
|
||||
# f32 chain (declare_aenc): conv1d, layernorm and gemm take one dtype for every operand, so their
|
||||
# weights are cast. The chain's own convolutions are stored f32, their weight norms folded.
|
||||
aenc.d*.w cast dtype=bf16
|
||||
aenc.d*.b cast dtype=bf16
|
||||
aenc.pb.* cast dtype=bf16
|
||||
aenc.b*.u*.c1.weight cast dtype=f32
|
||||
aenc.b*.u*.c2.weight cast dtype=f32
|
||||
aenc.cin.weight cast dtype=f32
|
||||
aenc.fin.weight cast dtype=f32
|
||||
# The video encoder's 3x3x3 convolutions are bf16, as the implicit-GEMM kernel reads them;
|
||||
# conv_in (three input channels) and the 1x1x1 shortcut and quant convolutions read their f32
|
||||
# weights as they are, and the norms and biases need no rule.
|
||||
venc.l*.b*.c1w cast dtype=bf16
|
||||
venc.l*.b*.c2w cast dtype=bf16
|
||||
venc.l*.dnw cast dtype=bf16
|
||||
venc.cout.weight cast dtype=bf16
|
||||
ups.embed.* cast dtype=f32
|
||||
ups.*.emb_layers.* cast dtype=f32
|
||||
@@ -1,83 +0,0 @@
|
||||
# minimax-h3-fp8.recipe -- MiniMax-H3 (text to video and audio) with block-scaled fp8 linears.
|
||||
#
|
||||
# rad-convert <MiniMax-H3 pipeline directory> --recipe data/recipes/minimax-h3-fp8.recipe \
|
||||
# -o minimax-h3-fp8.rad
|
||||
#
|
||||
# The directory needs the text-to-video-and-audio components only: text_encoder/, transformer/,
|
||||
# vae/, audio_vae/, the processor or tokenizer and both scheduler folders (transformer_ref/ and
|
||||
# the original-layout FL2VA/ and Ref2VA/ are not read).
|
||||
#
|
||||
# FastVideo's FastH3 releases (the denoiser distilled to eight steps with video sparse attention)
|
||||
# take the same recipe: their text encoder and decoders are MiniMax-H3's files, so a container of
|
||||
# the base model can supply them, with every transformer tensor listed as changed:
|
||||
#
|
||||
# rad-convert <FastH3 directory> --recipe data/recipes/minimax-h3-fp8.recipe \
|
||||
# --reuse minimax-h3-fp8.rad --changed <the transformer's tensor names, "transformer." first> \
|
||||
# -o fasth3-8step-fp8.rad
|
||||
#
|
||||
# LBH-123-AI's latent upscaler (Minimax_h3_latent_Upscaler, Apache-2.0) is a companion folder:
|
||||
# put its config.json (minimax_h3_latent_upscaler_3d_conv_v1/config.json) and its bf16 weights,
|
||||
# named diffusion_pytorch_model.safetensors, in latent_upscaler/ of the pipeline directory. It
|
||||
# converts with the rest, or is appended to a container converted without it, which keeps every
|
||||
# weight the container holds where it is:
|
||||
#
|
||||
# rad-convert <pipeline directory> --recipe data/recipes/minimax-h3-fp8.recipe \
|
||||
# --reuse minimax-h3-fp8.rad --in-place
|
||||
#
|
||||
# Every linear of the text encoder's first 50 layers, of the token refiner and of the DiT's 50
|
||||
# blocks, and the per-modality modulation projections, become E4M3 codes with a bf16 scale a
|
||||
# 128 x 128 block, read by the fp8a8 GEMMs. What keeps the checkpoint's precision is read once a
|
||||
# step or less: the embedding table, context_embedder and norm_out (bf16), the timestep MLP and the
|
||||
# four patch projections (f32), every norm and bias. The video decoder's linears are cast to bf16
|
||||
# from the checkpoint's f32, its norms, layer scales, biases and register tokens stay f32; the
|
||||
# audio decoder stays f32 (its weight norms folded at convert).
|
||||
#
|
||||
# The VAEs' encoders, which keyframes and reference media go through, are the encoder halves of
|
||||
# vae/ and audio_vae/ and convert with the rest: the audio encoder's chain convolutions f32 with
|
||||
# their weight norms folded, the video encoder's 3x3x3 convolutions bf16. A container converted
|
||||
# before the plugin declared the encoders gains them by a reuse with nothing marked changed:
|
||||
# every weight it holds is copied and only the encoders' are converted.
|
||||
#
|
||||
# rad-convert <the directory the container was converted from> \
|
||||
# --recipe data/recipes/minimax-h3-fp8.recipe --reuse <the container> -o <the new container>
|
||||
|
||||
te.blk.*.attn_qkv.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
te.blk.*.attn_output.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
te.blk.*.ffn_gate_up.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
te.blk.*.ffn_down.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
te.blk.*.attn_norm.weight cast dtype=f32
|
||||
te.blk.*.ffn_norm.weight cast dtype=f32
|
||||
ref.blk.*.attn_qkv.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
ref.blk.*.attn_output.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
ref.blk.*.ffn_gate_up.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
ref.blk.*.ffn_down.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dit.blk.*.attn_qkv.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dit.blk.*.attn_output.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dit.blk.*.ffn_gate_up.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dit.blk.*.ffn_down.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dit.blk.*.ada*.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
vae.blk.*.attn_qkv.weight cast dtype=bf16
|
||||
vae.blk.*.attn_out.weight cast dtype=bf16
|
||||
vae.blk.*.ffn_up.weight cast dtype=bf16
|
||||
vae.blk.*.ffn_down.weight cast dtype=bf16
|
||||
vae.proj_out.* cast dtype=bf16
|
||||
aud.*.weight cast dtype=f32
|
||||
# The audio encoder's strided downsamplers and its attention and MLP block run in bf16 inside the
|
||||
# f32 chain (declare_aenc): conv1d, layernorm and gemm take one dtype for every operand, so their
|
||||
# weights are cast. The chain's own convolutions are stored f32, their weight norms folded.
|
||||
aenc.d*.w cast dtype=bf16
|
||||
aenc.d*.b cast dtype=bf16
|
||||
aenc.pb.* cast dtype=bf16
|
||||
aenc.b*.u*.c1.weight cast dtype=f32
|
||||
aenc.b*.u*.c2.weight cast dtype=f32
|
||||
aenc.cin.weight cast dtype=f32
|
||||
aenc.fin.weight cast dtype=f32
|
||||
# The video encoder's 3x3x3 convolutions are bf16, as the implicit-GEMM kernel reads them;
|
||||
# conv_in (three input channels) and the 1x1x1 shortcut and quant convolutions read their f32
|
||||
# weights as they are, and the norms and biases need no rule.
|
||||
venc.l*.b*.c1w cast dtype=bf16
|
||||
venc.l*.b*.c2w cast dtype=bf16
|
||||
venc.l*.dnw cast dtype=bf16
|
||||
venc.cout.weight cast dtype=bf16
|
||||
ups.embed.* cast dtype=f32
|
||||
ups.*.emb_layers.* cast dtype=f32
|
||||
@@ -0,0 +1,80 @@
|
||||
# minimax-h3-i8.recipe -- MiniMax-H3 with no E4M3 weight: every quantised linear int8.
|
||||
#
|
||||
# The text encoder's and the token refiner's linears become IQ8R (codes in -127..127 in the
|
||||
# 128-wide Hadamard domain, a u8 scale per [1 x 256] of K under a bf16 scale a row), read at i8a8h
|
||||
# against int8 activations quantised under the same rotation; the modulation projections, whose K
|
||||
# is the 2688-wide timestep embedding and not whole 256s, the same grid with a bf16 scale per
|
||||
# (row, 128). The DiT's four per-token linears are unrotated int8 with a bf16 scale per (row, 128),
|
||||
# served w8a8, whose modulated norm quantises in its own pass. Round to nearest (the rotated grids
|
||||
# with a scale search); no calibration data is read.
|
||||
#
|
||||
# rad-convert <MiniMax-H3 pipeline directory> --recipe data/recipes/minimax-h3-i8.recipe \
|
||||
# -o minimax-h3-i8.rad
|
||||
#
|
||||
# The directory needs the text-to-video-and-audio components only: text_encoder/, transformer/,
|
||||
# vae/, audio_vae/, the processor or tokenizer and both scheduler folders (transformer_ref/ and
|
||||
# the original-layout FL2VA/ and Ref2VA/ are not read).
|
||||
#
|
||||
# FastVideo's FastH3 releases (the denoiser distilled to eight steps with video sparse attention)
|
||||
# take the same recipe: their text encoder and decoders are MiniMax-H3's files, so a container of
|
||||
# the base model can supply them, with every transformer tensor listed as changed:
|
||||
#
|
||||
# rad-convert <FastH3 directory> --recipe data/recipes/minimax-h3-i8.recipe \
|
||||
# --reuse minimax-h3-i8.rad --changed <the transformer's tensor names, "transformer." first> \
|
||||
# -o fasth3-8-step-v2-i8.rad
|
||||
#
|
||||
# LBH-123-AI's latent upscaler (Minimax_h3_latent_Upscaler, Apache-2.0) is a companion folder:
|
||||
# put its config.json (minimax_h3_latent_upscaler_3d_conv_v1/config.json) and its bf16 weights,
|
||||
# named diffusion_pytorch_model.safetensors, in latent_upscaler/ of the pipeline directory. It
|
||||
# converts with the rest, or is appended to a container converted without it, which keeps every
|
||||
# weight the container holds where it is:
|
||||
#
|
||||
# rad-convert <pipeline directory> --recipe data/recipes/minimax-h3-i8.recipe \
|
||||
# --reuse minimax-h3-i8.rad --in-place
|
||||
#
|
||||
# What keeps the checkpoint's precision is read once a step or less: the embedding table,
|
||||
# context_embedder and norm_out (bf16), the timestep MLP and the four patch projections (f32),
|
||||
# every norm and bias. The video decoder's linears are cast to bf16 from the checkpoint's f32, its
|
||||
# norms, layer scales, biases and register tokens stay f32; the audio decoder stays f32 (its weight
|
||||
# norms folded at convert). The VAEs' encoders, which keyframes and reference media go through,
|
||||
# are the encoder halves of vae/ and audio_vae/ and convert with the rest.
|
||||
te.blk.*.attn_qkv.weight rtn codes=i8 group=256 scale=u8 scale2=bf16 block2=1x* transform=fwht128 clamp=sym rule=search
|
||||
te.blk.*.attn_output.weight rtn codes=i8 group=256 scale=u8 scale2=bf16 block2=1x* transform=fwht128 clamp=sym rule=search
|
||||
te.blk.*.ffn_gate_up.weight rtn codes=i8 group=256 scale=u8 scale2=bf16 block2=1x* transform=fwht128 clamp=sym rule=search
|
||||
te.blk.*.ffn_down.weight rtn codes=i8 group=256 scale=u8 scale2=bf16 block2=1x* transform=fwht128 clamp=sym rule=search
|
||||
te.blk.*.attn_norm.weight cast dtype=f32
|
||||
te.blk.*.ffn_norm.weight cast dtype=f32
|
||||
ref.blk.*.attn_qkv.weight rtn codes=i8 group=256 scale=u8 scale2=bf16 block2=1x* transform=fwht128 clamp=sym rule=search
|
||||
ref.blk.*.attn_output.weight rtn codes=i8 group=256 scale=u8 scale2=bf16 block2=1x* transform=fwht128 clamp=sym rule=search
|
||||
ref.blk.*.ffn_gate_up.weight rtn codes=i8 group=256 scale=u8 scale2=bf16 block2=1x* transform=fwht128 clamp=sym rule=search
|
||||
ref.blk.*.ffn_down.weight rtn codes=i8 group=256 scale=u8 scale2=bf16 block2=1x* transform=fwht128 clamp=sym rule=search
|
||||
dit.blk.*.attn_qkv.weight rtn codes=i8 group=128 scale=bf16 clamp=sym
|
||||
dit.blk.*.attn_output.weight rtn codes=i8 group=128 scale=bf16 clamp=sym
|
||||
dit.blk.*.ffn_gate_up.weight rtn codes=i8 group=128 scale=bf16 clamp=sym
|
||||
dit.blk.*.ffn_down.weight rtn codes=i8 group=128 scale=bf16 clamp=sym
|
||||
dit.blk.*.ada*.weight rtn codes=i8 group=128 scale=bf16 transform=fwht128 clamp=sym rule=search
|
||||
vae.blk.*.attn_qkv.weight cast dtype=bf16
|
||||
vae.blk.*.attn_out.weight cast dtype=bf16
|
||||
vae.blk.*.ffn_up.weight cast dtype=bf16
|
||||
vae.blk.*.ffn_down.weight cast dtype=bf16
|
||||
vae.proj_out.* cast dtype=bf16
|
||||
aud.*.weight cast dtype=f32
|
||||
# The audio encoder's strided downsamplers and its attention and MLP block run in bf16 inside the
|
||||
# f32 chain (declare_aenc): conv1d, layernorm and gemm take one dtype for every operand, so their
|
||||
# weights are cast. The chain's own convolutions are stored f32, their weight norms folded.
|
||||
aenc.d*.w cast dtype=bf16
|
||||
aenc.d*.b cast dtype=bf16
|
||||
aenc.pb.* cast dtype=bf16
|
||||
aenc.b*.u*.c1.weight cast dtype=f32
|
||||
aenc.b*.u*.c2.weight cast dtype=f32
|
||||
aenc.cin.weight cast dtype=f32
|
||||
aenc.fin.weight cast dtype=f32
|
||||
# The video encoder's 3x3x3 convolutions are bf16, as the implicit-GEMM kernel reads them;
|
||||
# conv_in (three input channels) and the 1x1x1 shortcut and quant convolutions read their f32
|
||||
# weights as they are, and the norms and biases need no rule.
|
||||
venc.l*.b*.c1w cast dtype=bf16
|
||||
venc.l*.b*.c2w cast dtype=bf16
|
||||
venc.l*.dnw cast dtype=bf16
|
||||
venc.cout.weight cast dtype=bf16
|
||||
ups.embed.* cast dtype=f32
|
||||
ups.*.emb_layers.* cast dtype=f32
|
||||
@@ -1,62 +0,0 @@
|
||||
# minimax-h3-w8a8.recipe -- MiniMax-H3 with the DiT's per-token linears at int8 (W8A8).
|
||||
#
|
||||
# minimax-h3-fp8.recipe with the four per-token linears of the DiT's blocks (qkv, output, gate_up,
|
||||
# down) quantised to symmetric int8 with a bf16 scale per 128 columns of a row, and read by the
|
||||
# w8a8 GEMMs with int8 activations. At one byte a weight either way the container and the served
|
||||
# memory are the fp8 sizes; int8 spreads 255 uniform levels over each group's own range where E4M3
|
||||
# has three mantissa bits. The text encoder, the token refiner and the modulation projections stay
|
||||
# E4M3: they run once a request or once a step, not on every video token. The minimaxh3 plugin
|
||||
# serves the DiT in either encoding.
|
||||
#
|
||||
# rad-convert <MiniMax-H3 pipeline directory> --recipe data/recipes/minimax-h3-w8a8.recipe \
|
||||
# -o minimax-h3-w8a8.rad
|
||||
#
|
||||
# A container of minimax-h3-fp8.recipe supplies every other weight. A reused weight is copied only
|
||||
# at the same encoding, so the DiT's four linears are quantised again from the checkpoint:
|
||||
#
|
||||
# rad-convert <pipeline directory> --recipe data/recipes/minimax-h3-w8a8.recipe \
|
||||
# --reuse minimax-h3-fp8.rad -o minimax-h3-w8a8.rad
|
||||
#
|
||||
# The directory's contents, FastH3, the latent upscaler, the VAEs' encoders and which weights keep
|
||||
# the checkpoint's precision are as minimax-h3-fp8.recipe describes them.
|
||||
|
||||
te.blk.*.attn_qkv.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
te.blk.*.attn_output.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
te.blk.*.ffn_gate_up.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
te.blk.*.ffn_down.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
te.blk.*.attn_norm.weight cast dtype=f32
|
||||
te.blk.*.ffn_norm.weight cast dtype=f32
|
||||
ref.blk.*.attn_qkv.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
ref.blk.*.attn_output.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
ref.blk.*.ffn_gate_up.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
ref.blk.*.ffn_down.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dit.blk.*.attn_qkv.weight rtn codes=i8 group=128 scale=bf16 clamp=sym
|
||||
dit.blk.*.attn_output.weight rtn codes=i8 group=128 scale=bf16 clamp=sym
|
||||
dit.blk.*.ffn_gate_up.weight rtn codes=i8 group=128 scale=bf16 clamp=sym
|
||||
dit.blk.*.ffn_down.weight rtn codes=i8 group=128 scale=bf16 clamp=sym
|
||||
dit.blk.*.ada*.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
vae.blk.*.attn_qkv.weight cast dtype=bf16
|
||||
vae.blk.*.attn_out.weight cast dtype=bf16
|
||||
vae.blk.*.ffn_up.weight cast dtype=bf16
|
||||
vae.blk.*.ffn_down.weight cast dtype=bf16
|
||||
vae.proj_out.* cast dtype=bf16
|
||||
aud.*.weight cast dtype=f32
|
||||
# The audio encoder's strided downsamplers and its attention and MLP block run in bf16 inside the
|
||||
# f32 chain (declare_aenc): conv1d, layernorm and gemm take one dtype for every operand, so their
|
||||
# weights are cast. The chain's own convolutions are stored f32, their weight norms folded.
|
||||
aenc.d*.w cast dtype=bf16
|
||||
aenc.d*.b cast dtype=bf16
|
||||
aenc.pb.* cast dtype=bf16
|
||||
aenc.b*.u*.c1.weight cast dtype=f32
|
||||
aenc.b*.u*.c2.weight cast dtype=f32
|
||||
aenc.cin.weight cast dtype=f32
|
||||
aenc.fin.weight cast dtype=f32
|
||||
# The video encoder's 3x3x3 convolutions are bf16, as the implicit-GEMM kernel reads them;
|
||||
# conv_in (three input channels) and the 1x1x1 shortcut and quant convolutions read their f32
|
||||
# weights as they are, and the norms and biases need no rule.
|
||||
venc.l*.b*.c1w cast dtype=bf16
|
||||
venc.l*.b*.c2w cast dtype=bf16
|
||||
venc.l*.dnw cast dtype=bf16
|
||||
venc.cout.weight cast dtype=bf16
|
||||
ups.embed.* cast dtype=f32
|
||||
ups.*.emb_layers.* cast dtype=f32
|
||||
@@ -1,15 +0,0 @@
|
||||
# q36-35b-a3b-fp8.recipe -- Qwen3.6-35B-A3B-FP8 with its MTP head, as the q36-35b-a3b-fp8.rad
|
||||
# container serves it.
|
||||
#
|
||||
# rad-convert <Qwen3.6-35B-A3B-FP8 checkpoint> --recipe data/recipes/q36-35b-a3b-fp8.recipe \
|
||||
# -o q36-35b-a3b-fp8.rad
|
||||
#
|
||||
# The linears -- attention, delta net, shared and routed experts, the MTP layer's -- are
|
||||
# block-scaled fp8 in the checkpoint and kept as they are. What the recipe adds:
|
||||
#
|
||||
# - the lm_head, block fp8: the widest GEMM in the model at half the bytes
|
||||
# - the MTP head's 2-bit copy of the lm_head (u2 codes, an f16 scale and a u8 zero a group of
|
||||
# 128), which the draft rounds read in place of the full head
|
||||
|
||||
output.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
mtp.draft_head.weight rtn codes=u2 zero=u8 group=128 scale=f16
|
||||
@@ -0,0 +1,41 @@
|
||||
# q36-35b-a3b-iq8r.recipe -- Qwen3.6-35B-A3B from its bf16 release with an IQ8R trunk and int8
|
||||
# experts, served by qwen35moe_w8a8.
|
||||
#
|
||||
# rad-convert <Qwen3.6-35B-A3B bf16 checkpoint> --recipe data/recipes/q36-35b-a3b-iq8r.recipe \
|
||||
# --set quantization_config.quant_method=w8a8 --set quantization_config.fmt=fwht128 \
|
||||
# -o q36-35b-a3b-iq8r.rad
|
||||
#
|
||||
# The --set keys make the container's descriptor `w8a8_fwht128`, which selects qwen35moe_w8a8.
|
||||
#
|
||||
# - IQ8R: every trunk linear (attention q/gate, k, v and output, the delta net's qkv/z and
|
||||
# output; the MTP layer's too) as int8 codes in -127..127 with one u8 scale per (row, 256 of
|
||||
# K) under one bf16 scale a row, each 128 of K rotated by the unnormalised Hadamard before
|
||||
# rounding and the 1/128 kept in the row scale (`transform=fwht128`). Round to nearest with a
|
||||
# scale search; no calibration data is read.
|
||||
# - The 256 routed experts of every layer as int8 on the same rotated grid with one bf16 scale
|
||||
# per (row, 128 of K): an expert is 512 columns, 256 a rank on two cards and 128 on four, so
|
||||
# its scale groups are the 128 that every split leaves whole. The grouped GEMM reads them at
|
||||
# i8a8h against the int8 codes the trunk's quantisers write (moe_gemm_i8a8).
|
||||
# - The shared expert is a trunk linear pair: its gate/up projection IQ8R, reading the same
|
||||
# codes as the attention does, and its down projection at the experts' 128, its K being the
|
||||
# expert's width.
|
||||
# - The router, the shared expert's gate, the delta net's a/b projections, the norms, the
|
||||
# embedding and the vision tower stay bf16.
|
||||
# - The lm_head int8 unrotated with a bf16 scale per (row, 128) (logits_gemm_i8).
|
||||
# - The MTP head's 2-bit copy of the lm_head (u2 codes, an f16 scale and a u8 zero a group of
|
||||
# 128), which the draft rounds read in place of the full head.
|
||||
|
||||
blk.*.attn_qg.weight rtn codes=i8 group=256 scale=u8 scale2=bf16 block2=1x* transform=fwht128 clamp=sym rule=search
|
||||
blk.*.attn_k.weight rtn codes=i8 group=256 scale=u8 scale2=bf16 block2=1x* transform=fwht128 clamp=sym rule=search
|
||||
blk.*.attn_v.weight rtn codes=i8 group=256 scale=u8 scale2=bf16 block2=1x* transform=fwht128 clamp=sym rule=search
|
||||
blk.*.attn_output.weight rtn codes=i8 group=256 scale=u8 scale2=bf16 block2=1x* transform=fwht128 clamp=sym rule=search
|
||||
blk.*.ssm_inz.weight rtn codes=i8 group=256 scale=u8 scale2=bf16 block2=1x* transform=fwht128 clamp=sym rule=search
|
||||
blk.*.ssm_out.weight rtn codes=i8 group=256 scale=u8 scale2=bf16 block2=1x* transform=fwht128 clamp=sym rule=search
|
||||
|
||||
blk.*.ffn_gate_up_exps.*.weight rtn codes=i8 group=128 scale=bf16 transform=fwht128 clamp=sym rule=search
|
||||
blk.*.ffn_down_exps.*.weight rtn codes=i8 group=128 scale=bf16 transform=fwht128 clamp=sym rule=search
|
||||
blk.*.ffn_gate_up_shexp.weight rtn codes=i8 group=256 scale=u8 scale2=bf16 block2=1x* transform=fwht128 clamp=sym rule=search
|
||||
blk.*.ffn_down_shexp.weight rtn codes=i8 group=128 scale=bf16 transform=fwht128 clamp=sym rule=search
|
||||
|
||||
output.weight rtn codes=i8 group=128 scale=bf16 clamp=sym rule=search
|
||||
mtp.draft_head.weight rtn codes=u2 zero=u8 group=128 scale=f16
|
||||
@@ -4,8 +4,9 @@
|
||||
# rad-convert <Qwen3.8-27B checkpoint> --recipe data/recipes/q38-27b-bf16.recipe \
|
||||
# -o q38-27b-bf16.rad
|
||||
#
|
||||
# Every weight is served at the checkpoint's own precision except the lm_head, which is block fp8:
|
||||
# the widest GEMM in the model at half the bytes, read through the fp8 logits kernel. Without this
|
||||
# rule the same checkpoint loads directly and the head is read as bf16.
|
||||
# Every weight is served at the checkpoint's own precision except the lm_head, which is int8 with
|
||||
# a bf16 scale per row and 128 of K: the widest GEMM in the model at half the bytes, read through
|
||||
# the int8 logits kernel. Without this rule the same checkpoint loads directly and the head is read
|
||||
# as bf16.
|
||||
|
||||
output.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
output.weight rtn codes=i8 group=128 scale=bf16 clamp=sym
|
||||
@@ -1,29 +0,0 @@
|
||||
# q38-27b-fp8-df2.recipe -- Qwen3.8-27B-FP8 with the DFlash2 drafter, as the q38-27b-fp8-df2.rad
|
||||
# container serves it.
|
||||
#
|
||||
# rad-convert <Qwen3.8-27B-FP8 checkpoint> --draft-model <DFlash2 checkpoint> \
|
||||
# --recipe data/recipes/q38-27b-fp8-df2.recipe -o q38-27b-fp8-df2.rad
|
||||
#
|
||||
# The trunk's linears are block-scaled fp8 in the checkpoint and kept as they are; the norms, the
|
||||
# embedding, the delta net's a/b projection and the vision tower are bf16 and kept as they are.
|
||||
# What the recipe adds:
|
||||
#
|
||||
# - the lm_head, block fp8: the widest GEMM in the model at half the bytes
|
||||
# - the drafter's linears, OCP-MXFP4 from its bf16 release: it is read whole on every decode
|
||||
# step, and a draft is verified, so its precision can move acceptance and never an emitted token
|
||||
# - the drafter's 2-bit copy of the target's head (u2 codes, an f16 scale and a u8 zero a group
|
||||
# of 128, least-squares clip search), read by its draft rounds only; the engine rescores its
|
||||
# top 32 against the target's fp8 head
|
||||
#
|
||||
# The drafter's selector projection, codebooks and convolution weights stay bf16.
|
||||
|
||||
output.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dflash.draft_head.weight rtn codes=u2 zero=u8 group=128 scale=f16 rule=search
|
||||
|
||||
dflash.fc.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
dflash.blk.*.attn_q.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
dflash.blk.*.attn_k.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
dflash.blk.*.attn_v.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
dflash.blk.*.attn_output.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
dflash.blk.*.ffn_gate_up.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
dflash.blk.*.ffn_down.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
@@ -1,40 +0,0 @@
|
||||
# q38-27b-fp8block-df2.recipe -- a bf16 Qwen3.8-27B checkpoint (the base model's bf16 release or a
|
||||
# finetune of it) as block fp8 with the DFlash2 drafter, the same weights in the same form as
|
||||
# Qwen's own FP8 release, so it serves exactly as q38-27b-fp8-df2.rad does.
|
||||
#
|
||||
# rad-convert <bf16 Qwen3.8-27B checkpoint> --draft-model <z-lab/Qwen3.8-27B-DFlash2> \
|
||||
# --recipe data/recipes/q38-27b-fp8block-df2.recipe \
|
||||
# --set quantization_config.quant_method=fp8 --set quantization_config.fmt=e4m3 \
|
||||
# --set "quantization_config.weight_block_size=128 128" \
|
||||
# --set quantization_config.activation_scheme=dynamic -o model.rad
|
||||
#
|
||||
# The --set keys state the format the container is in, as Qwen's FP8 checkpoint's own config does:
|
||||
# they are what selects qwen35_fp8 to serve it, where a bf16 checkpoint selects qwen35.
|
||||
#
|
||||
# The trunk's linears -- attention q/gate, k, v and output, the delta net's qkv/z and output
|
||||
# projections, and the MLP's gate/up and down -- as E4M3 with one bf16 scale a 128x128 block,
|
||||
# rounded to nearest: the set and the format Qwen's FP8 checkpoint ships (its quantization_config:
|
||||
# fp8, e4m3, weight_block_size [128, 128], bf16 scales). Every fused weight's pieces end on a
|
||||
# 128-row boundary, so a block never spans two of them. The delta net's a/b projection, the
|
||||
# norms, the embedding and the vision tower stay bf16, as there. The lm_head and the drafter are
|
||||
# q38-27b-fp8-df2.recipe's.
|
||||
|
||||
blk.*.attn_qg.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
blk.*.attn_k.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
blk.*.attn_v.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
blk.*.attn_output.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
blk.*.ssm_inz.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
blk.*.ssm_out.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
blk.*.ffn_gate_up.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
blk.*.ffn_down.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
|
||||
output.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dflash.draft_head.weight rtn codes=u2 zero=u8 group=128 scale=f16 rule=search
|
||||
|
||||
dflash.fc.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
dflash.blk.*.attn_q.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
dflash.blk.*.attn_k.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
dflash.blk.*.attn_v.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
dflash.blk.*.attn_output.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
dflash.blk.*.ffn_gate_up.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
dflash.blk.*.ffn_down.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
@@ -0,0 +1,30 @@
|
||||
# q38-27b-iq8r-rtn.recipe -- q38-27b-iq8r.recipe by round to nearest: a Qwen3.8-27B checkpoint (the
|
||||
# release or a finetune of it) from bf16 in IQ8R with the DFlash2 drafter, no calibration data read.
|
||||
#
|
||||
# rad-convert <Qwen3.8-27B bf16 checkpoint> --draft-model <z-lab/Qwen3.8-27B-DFlash2> \
|
||||
# --recipe data/recipes/q38-27b-iq8r-rtn.recipe \
|
||||
# --set quantization_config.quant_method=w8a8 --set quantization_config.fmt=fwht128 \
|
||||
# -o q38-27b-iq8r.rad
|
||||
#
|
||||
# The formats are q38-27b-iq8r.recipe's, which describes them; only the fit differs. On the release,
|
||||
# two cards, the KL divergence from the bf16 model over the 464,091 generated positions of the
|
||||
# quantisation challenge's public split is 0.000491 rounded this way against 0.000393
|
||||
# fitted by GPTQ, and 0.003633 for Qwen's FP8 checkpoint.
|
||||
|
||||
blk.*.attn_qg.weight rtn codes=i8 group=256 scale=u8 scale2=bf16 block2=1x* transform=fwht128 clamp=sym rule=search
|
||||
blk.*.attn_k.weight rtn codes=i8 group=256 scale=u8 scale2=bf16 block2=1x* transform=fwht128 clamp=sym rule=search
|
||||
blk.*.attn_v.weight rtn codes=i8 group=256 scale=u8 scale2=bf16 block2=1x* transform=fwht128 clamp=sym rule=search
|
||||
blk.*.attn_output.weight rtn codes=i8 group=256 scale=u8 scale2=bf16 block2=1x* transform=fwht128 clamp=sym rule=search
|
||||
blk.*.ssm_inz.weight rtn codes=i8 group=256 scale=u8 scale2=bf16 block2=1x* transform=fwht128 clamp=sym rule=search
|
||||
blk.*.ssm_out.weight rtn codes=i8 group=256 scale=u8 scale2=bf16 block2=1x* transform=fwht128 clamp=sym rule=search
|
||||
blk.*.ffn_gate_up.weight rtn codes=i8 group=256 scale=u8 scale2=bf16 block2=1x* transform=fwht128 clamp=sym rule=search
|
||||
blk.*.ffn_down.weight rtn codes=i8 group=256 scale=u8 scale2=bf16 block2=1x* transform=fwht128 clamp=sym rule=search
|
||||
output.weight rtn codes=i8 group=128 scale=bf16 clamp=sym rule=search
|
||||
dflash.draft_head.weight rtn codes=u2 zero=u8 group=128 scale=f16 rule=search
|
||||
dflash.fc.weight rtn table=-127;-97;-75;-58;-43;-30;-18;-6;6;18;30;43;58;75;97;127 group=128 scale=bf16 transform=fwht128 rule=search
|
||||
dflash.blk.*.attn_q.weight rtn table=-127;-97;-75;-58;-43;-30;-18;-6;6;18;30;43;58;75;97;127 group=128 scale=bf16 transform=fwht128 rule=search
|
||||
dflash.blk.*.attn_k.weight rtn table=-127;-97;-75;-58;-43;-30;-18;-6;6;18;30;43;58;75;97;127 group=128 scale=bf16 transform=fwht128 rule=search
|
||||
dflash.blk.*.attn_v.weight rtn table=-127;-97;-75;-58;-43;-30;-18;-6;6;18;30;43;58;75;97;127 group=128 scale=bf16 transform=fwht128 rule=search
|
||||
dflash.blk.*.attn_output.weight rtn table=-127;-97;-75;-58;-43;-30;-18;-6;6;18;30;43;58;75;97;127 group=128 scale=bf16 transform=fwht128 rule=search
|
||||
dflash.blk.*.ffn_gate_up.weight rtn table=-127;-97;-75;-58;-43;-30;-18;-6;6;18;30;43;58;75;97;127 group=128 scale=bf16 transform=fwht128 rule=search
|
||||
dflash.blk.*.ffn_down.weight rtn table=-127;-97;-75;-58;-43;-30;-18;-6;6;18;30;43;58;75;97;127 group=128 scale=bf16 transform=fwht128 rule=search
|
||||
@@ -0,0 +1,51 @@
|
||||
# q38-27b-iq8r.recipe -- Qwen3.8-27B from its bf16 release in IQ8R, the int8 format that replaces
|
||||
# block fp8, with the DFlash2 drafter, served by qwen35_w8a8.
|
||||
#
|
||||
# CALIB=<calib Hessians, RADGRAM2> rad-convert <Qwen3.8-27B bf16 checkpoint> \
|
||||
# --draft-model <z-lab/Qwen3.8-27B-DFlash2> --recipe data/recipes/q38-27b-iq8r.recipe \
|
||||
# --set quantization_config.quant_method=w8a8 --set quantization_config.fmt=fwht128 \
|
||||
# -o q38-27b-iq8r.rad
|
||||
#
|
||||
# The --set keys make the container's descriptor `w8a8_fwht128`, which selects qwen35_w8a8.
|
||||
#
|
||||
# - IQ8R: every trunk linear (attention q/gate, k, v and output, the delta net's qkv/z and output,
|
||||
# the MLP's gate/up and down) as int8 codes in -127..127 with one u8 scale per (row, 256 of
|
||||
# K) under one bf16 scale a row, each 128 of K rotated by the unnormalised Hadamard before
|
||||
# rounding and the 1/128 kept in the row scale (`transform=fwht128`), fitted by GPTQ against
|
||||
# the calibration Hessians. gemm_nt_q
|
||||
# reads them at i8a8h, group 256, against an int8 activation with one scale per (token, 256)
|
||||
# under the same rotation.
|
||||
# - The delta net's a/b projections, the norms, the embedding and the vision tower stay bf16.
|
||||
# - The lm_head int8 unrotated with a bf16 scale per (row, 128) (logits_gemm_i8), GPTQ'd against
|
||||
# the head's input Hessian.
|
||||
# - The drafter's linears at four bits on the same rotated grid, as IQ4R stores a weight: the
|
||||
# 16-level integer codebook with a bf16 scale per (row, 128 of K) under fwht128, round to
|
||||
# nearest (it has no Hessians), read at i8a8h by gemm_iqr against int8 activations. Against an
|
||||
# MXFP4 drafter (as q38-27b-w8a8-df2.recipe makes it) on one R9700, ms a speculative step at 1, 4 and 8
|
||||
# sequences: 54.97 / 59.91 / 70.43 against 54.2..54.6 / 59.0..59.5 / 68.6, at 3.64 / 14.9 /
|
||||
# 29.6 tokens a step against 3.75 / 15.0 / 29.2. In IQ8R instead (the trunk's lines) a step
|
||||
# is 57.24 / 61.95 / 69.87 at 3.78 / 15.1 / 30.2 tokens.
|
||||
# - A 2-bit copy of the target's head (u2 with a u8 zero) whose top 32 the engine rescores
|
||||
# against the target's head.
|
||||
#
|
||||
# Without Hessians, `rtn` in place of `gptq` (and no calib=) gives the round-to-nearest container.
|
||||
|
||||
blk.*.attn_qg.weight gptq codes=i8 group=256 scale=u8 scale2=bf16 block2=1x* transform=fwht128 clamp=sym rule=search calib=$CALIB
|
||||
blk.*.attn_k.weight gptq codes=i8 group=256 scale=u8 scale2=bf16 block2=1x* transform=fwht128 clamp=sym rule=search calib=$CALIB
|
||||
blk.*.attn_v.weight gptq codes=i8 group=256 scale=u8 scale2=bf16 block2=1x* transform=fwht128 clamp=sym rule=search calib=$CALIB
|
||||
blk.*.attn_output.weight gptq codes=i8 group=256 scale=u8 scale2=bf16 block2=1x* transform=fwht128 clamp=sym rule=search calib=$CALIB
|
||||
blk.*.ssm_inz.weight gptq codes=i8 group=256 scale=u8 scale2=bf16 block2=1x* transform=fwht128 clamp=sym rule=search calib=$CALIB
|
||||
blk.*.ssm_out.weight gptq codes=i8 group=256 scale=u8 scale2=bf16 block2=1x* transform=fwht128 clamp=sym rule=search calib=$CALIB
|
||||
blk.*.ffn_gate_up.weight gptq codes=i8 group=256 scale=u8 scale2=bf16 block2=1x* transform=fwht128 clamp=sym rule=search calib=$CALIB
|
||||
blk.*.ffn_down.weight gptq codes=i8 group=256 scale=u8 scale2=bf16 block2=1x* transform=fwht128 clamp=sym rule=search calib=$CALIB
|
||||
|
||||
output.weight gptq codes=i8 group=128 scale=bf16 clamp=sym rule=search calib=$CALIB
|
||||
dflash.draft_head.weight rtn codes=u2 zero=u8 group=128 scale=f16 rule=search
|
||||
|
||||
dflash.fc.weight rtn table=-127;-97;-75;-58;-43;-30;-18;-6;6;18;30;43;58;75;97;127 group=128 scale=bf16 transform=fwht128 rule=search
|
||||
dflash.blk.*.attn_q.weight rtn table=-127;-97;-75;-58;-43;-30;-18;-6;6;18;30;43;58;75;97;127 group=128 scale=bf16 transform=fwht128 rule=search
|
||||
dflash.blk.*.attn_k.weight rtn table=-127;-97;-75;-58;-43;-30;-18;-6;6;18;30;43;58;75;97;127 group=128 scale=bf16 transform=fwht128 rule=search
|
||||
dflash.blk.*.attn_v.weight rtn table=-127;-97;-75;-58;-43;-30;-18;-6;6;18;30;43;58;75;97;127 group=128 scale=bf16 transform=fwht128 rule=search
|
||||
dflash.blk.*.attn_output.weight rtn table=-127;-97;-75;-58;-43;-30;-18;-6;6;18;30;43;58;75;97;127 group=128 scale=bf16 transform=fwht128 rule=search
|
||||
dflash.blk.*.ffn_gate_up.weight rtn table=-127;-97;-75;-58;-43;-30;-18;-6;6;18;30;43;58;75;97;127 group=128 scale=bf16 transform=fwht128 rule=search
|
||||
dflash.blk.*.ffn_down.weight rtn table=-127;-97;-75;-58;-43;-30;-18;-6;6;18;30;43;58;75;97;127 group=128 scale=bf16 transform=fwht128 rule=search
|
||||
@@ -1,42 +0,0 @@
|
||||
# q38-27b-m2xfp4-df2.recipe -- a bf16 Qwen3.8-27B (or a finetune of it) at M2XFP4 with the DFlash2
|
||||
# drafter.
|
||||
#
|
||||
# rad-convert <bf16 Qwen3.8-27B checkpoint> --draft-model <z-lab/Qwen3.8-27B-DFlash2> \
|
||||
# --recipe q38-27b-m2xfp4-df2.recipe \
|
||||
# --set quantization_config.quant_method=fp8 --set quantization_config.fmt=e4m3 \
|
||||
# -o q38-27b-m2xfp4-df2.rad
|
||||
#
|
||||
# The --set keys give the container the family's fp8 descriptor, so qwen35_fp8 serves it as it
|
||||
# serves the Quark, ParoQuant and NVFP4 releases; without them a bf16 checkpoint selects
|
||||
# qwen35_bf16, which has no 4-bit GEMM.
|
||||
#
|
||||
# q38-27b-mxfp4-df2.recipe with its 4-bit rules at M2XFP4 (`m2xfp4`, spec.md): the MXFP4
|
||||
# codes and e8m0 exponent per 32 of K plus one metadata byte a group, whose four 2-bit extra
|
||||
# mantissas refine the exponent per 8 columns, chosen by least squared error from the bf16 source,
|
||||
# once. The delta net's a/b projections, the norms, the embedding and the vision tower stay bf16;
|
||||
# the head goes block fp8 as in the other 27B recipes. The checkpoint's MTP head is not read: the
|
||||
# DFlash2 drafter displaces it.
|
||||
#
|
||||
# The drafter's linears go to M2XFP4 as well, beside the same 2-bit copy of the target's head (u2
|
||||
# with a u8 zero, least-squares clip search) whose top 32 the engine rescores against the target's
|
||||
# fp8 head.
|
||||
|
||||
blk.*.ffn_gate_up.weight m2xfp4
|
||||
blk.*.ffn_down.weight m2xfp4
|
||||
blk.*.attn_qg.weight m2xfp4
|
||||
blk.*.attn_k.weight m2xfp4
|
||||
blk.*.attn_v.weight m2xfp4
|
||||
blk.*.attn_output.weight m2xfp4
|
||||
blk.*.ssm_inz.weight m2xfp4
|
||||
blk.*.ssm_out.weight m2xfp4
|
||||
|
||||
output.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dflash.draft_head.weight rtn codes=u2 zero=u8 group=128 scale=f16 rule=search
|
||||
|
||||
dflash.fc.weight m2xfp4
|
||||
dflash.blk.*.attn_q.weight m2xfp4
|
||||
dflash.blk.*.attn_k.weight m2xfp4
|
||||
dflash.blk.*.attn_v.weight m2xfp4
|
||||
dflash.blk.*.attn_output.weight m2xfp4
|
||||
dflash.blk.*.ffn_gate_up.weight m2xfp4
|
||||
dflash.blk.*.ffn_down.weight m2xfp4
|
||||
@@ -1,39 +0,0 @@
|
||||
# q38-27b-modelopt-nvfp4.recipe -- an NVIDIA ModelOpt NVFP4 release of Qwen3.8-27B (or a finetune of
|
||||
# it, such as ukisai's Swift 1.5 NVFP4): FP8 attention and delta-net projections, NVFP4 MLPs and head.
|
||||
#
|
||||
# rad-convert <ModelOpt NVFP4 release> --recipe data/recipes/q38-27b-modelopt-nvfp4.recipe -o model.rad
|
||||
#
|
||||
# The release is ModelOpt's MIXED_PRECISION: the attention q, k, v and output and the delta net's
|
||||
# qkv, z and output projections are FP8 with one f32 scale per tensor; the MLPs and the lm_head are
|
||||
# NVFP4 (e2m1 codes, an e4m3 scale per 16 of K, times an f32 weight_scale_2 per tensor); the delta
|
||||
# net's a/b projections, the norms, the embedding, the vision tower and the MTP head are bf16. Its
|
||||
# static input scales are not read: activations are quantised from their own values.
|
||||
#
|
||||
# - The FP8 projections keep their codes. The import rule writes each tensor's scale as the
|
||||
# block plane the block-fp8 GEMM reads, rounded to bf16: one factor for the whole tensor, off
|
||||
# by at most 2^-8 (3.3e-3 on Swift 1.5's 208 tensors); qkv and z keep their own scales, each
|
||||
# a whole number of 128-row blocks.
|
||||
# - No kernel reads NVFP4, so the MLPs are made OCP-MXFP4 (`fp4_e2m1`, an e8m0 scale per 32 of
|
||||
# K, the encoding and kernel of q38-27b-quark-mxfp4-df2.recipe) from their exact values. That
|
||||
# rounds twice (e4m3 scales per 16 to a power of two per 32): 0.116 relative error against
|
||||
# the release's NVFP4 values on Swift 1.5, and unsloth's NVFP4 release made MXFP4 this way
|
||||
# scores mean KL 0.287 against the block-fp8 base, AMD's Quark MXFP4 0.206.
|
||||
# `codes=fp8_e4m3 block=128x128 scale=bf16` on the two MLP rules instead keeps them within
|
||||
# 0.027 of the release at 28.2 GiB of weights against 20.8.
|
||||
# - The head is block fp8 from its exact NVFP4 values, as in the other 27B recipes.
|
||||
# - The MTP head stays bf16 as shipped (blk.64 is its layer); it drafts through a 2-bit copy of
|
||||
# the head (u2 with a u8 zero, least-squares clip search) rescored against the fp8 head.
|
||||
|
||||
blk.*.attn_qg.weight import block=128x128 scale=bf16
|
||||
blk.*.attn_k.weight import block=128x128 scale=bf16
|
||||
blk.*.attn_v.weight import block=128x128 scale=bf16
|
||||
blk.*.attn_output.weight import block=128x128 scale=bf16
|
||||
blk.*.ssm_inz.weight import block=128x128 scale=bf16
|
||||
blk.*.ssm_out.weight import block=128x128 scale=bf16
|
||||
|
||||
blk.64.ffn_*.weight cast dtype=bf16
|
||||
blk.*.ffn_gate_up.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
blk.*.ffn_down.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
|
||||
output.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
mtp.draft_head.weight rtn codes=u2 zero=u8 group=128 scale=f16 rule=search
|
||||
@@ -1,41 +0,0 @@
|
||||
# q38-27b-mxfp4-df2.recipe -- a bf16 Qwen3.8-27B (or a finetune of it) at MXFP4 with the DFlash2
|
||||
# drafter.
|
||||
#
|
||||
# rad-convert <bf16 Qwen3.8-27B checkpoint> --draft-model <z-lab/Qwen3.8-27B-DFlash2> \
|
||||
# --recipe q38-27b-mxfp4-df2.recipe \
|
||||
# --set quantization_config.quant_method=fp8 --set quantization_config.fmt=e4m3 \
|
||||
# -o q38-27b-mxfp4-df2.rad
|
||||
#
|
||||
# The --set keys give the container the family's fp8 descriptor, so qwen35_fp8 serves it as it
|
||||
# serves the Quark, ParoQuant and NVFP4 releases; without them a bf16 checkpoint selects
|
||||
# qwen35_bf16, which has no 4-bit GEMM.
|
||||
#
|
||||
# The trunk's linears are rounded to MXFP4 (`fp4_e2m1`, an e8m0 scale per 32 of K, the OCP exponent
|
||||
# rule) from the bf16 source, once: the encoding and kernels of q38-27b-quark-mxfp4-df2.recipe,
|
||||
# without Quark's AWQ fold. The delta net's a/b projections, the norms, the embedding and the
|
||||
# vision tower stay bf16; the head goes block fp8 as in the other 27B recipes. The checkpoint's MTP
|
||||
# head is not read: the DFlash2 drafter displaces it.
|
||||
#
|
||||
# The drafter as q38-27b-quark-mxfp4-df2.recipe makes it: its linears at MXFP4, and a 2-bit copy
|
||||
# of the target's head (u2 with a u8 zero, least-squares clip search) whose top 32 the engine
|
||||
# rescores against the target's fp8 head.
|
||||
|
||||
blk.*.ffn_gate_up.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
blk.*.ffn_down.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
blk.*.attn_qg.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
blk.*.attn_k.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
blk.*.attn_v.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
blk.*.attn_output.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
blk.*.ssm_inz.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
blk.*.ssm_out.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
|
||||
output.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dflash.draft_head.weight rtn codes=u2 zero=u8 group=128 scale=f16 rule=search
|
||||
|
||||
dflash.fc.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
dflash.blk.*.attn_q.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
dflash.blk.*.attn_k.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
dflash.blk.*.attn_v.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
dflash.blk.*.attn_output.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
dflash.blk.*.ffn_gate_up.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
dflash.blk.*.ffn_down.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
@@ -1,44 +0,0 @@
|
||||
# q38-27b-nvfp4-df2.recipe -- unsloth's Qwen3.8-27B-NVFP4 with the DFlash2 drafter.
|
||||
#
|
||||
# rad-convert <unsloth/Qwen3.8-27B-NVFP4> --draft-model <z-lab/Qwen3.8-27B-DFlash2> \
|
||||
# --recipe q38-27b-nvfp4-df2.recipe -o q38-27b-nvfp4-df2.rad
|
||||
#
|
||||
# The checkpoint is compressed-tensors mixed precision: the MLPs of layers 0-55 are NVFP4 (e2m1
|
||||
# codes, an e4m3 scale per 16 of K, an f32 global scale per tensor); the attention and delta-net
|
||||
# projections, the MLPs of layers 56-63 and the lm_head are FP8 with a bf16 scale per row; the
|
||||
# delta net's a/b projections, the vision tower and the MTP head are bf16. The core decodes each
|
||||
# exactly, and every rule below quantises the decoded value, so one recipe covers all forms.
|
||||
#
|
||||
# - The trunk's linears at MXFP4 (`fp4_e2m1`, an e8m0 scale per 32 of K, the OCP exponent
|
||||
# rule): the encoding and kernel of q38-27b-quark-mxfp4-df2.recipe. No kernel serves NVFP4.
|
||||
# NVFP4 to MXFP4 rounds twice: on a synthetic Gaussian tensor the result is 0.14 relative
|
||||
# RMS from the source, against 0.12 for MXFP4 made from the source and 0.10 for NVFP4. At
|
||||
# model scale, against the block-fp8 Qwen3.8-27B on four documents: mean KL 0.287, top-1
|
||||
# 87.5% (the Quark MXFP4 container: 0.206, 89.3%).
|
||||
# - The delta net's a/b projections stay bf16, as shipped: 96 rows of 5120, read as their own
|
||||
# projection beside [q|k|v|z].
|
||||
# - The lm_head at block fp8 (from its per-row FP8), as in the other 27B recipes.
|
||||
#
|
||||
# The drafter as q38-27b-quark-mxfp4-df2.recipe makes it: its linears at MXFP4, and a 2-bit copy
|
||||
# of the target's head (u2 with a u8 zero, least-squares clip search) whose top 32 the engine
|
||||
# rescores against the target's fp8 head.
|
||||
|
||||
blk.*.ffn_gate_up.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
blk.*.ffn_down.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
blk.*.attn_qg.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
blk.*.attn_k.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
blk.*.attn_v.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
blk.*.attn_output.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
blk.*.ssm_inz.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
blk.*.ssm_out.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
|
||||
output.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dflash.draft_head.weight rtn codes=u2 zero=u8 group=128 scale=f16 rule=search
|
||||
|
||||
dflash.fc.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
dflash.blk.*.attn_q.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
dflash.blk.*.attn_k.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
dflash.blk.*.attn_v.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
dflash.blk.*.attn_output.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
dflash.blk.*.ffn_gate_up.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
dflash.blk.*.ffn_down.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
@@ -1,40 +0,0 @@
|
||||
# q38-27b-paro-m2xfp4-df2.recipe -- a ParoQuant M2XFP4 Qwen3.8-27B (quant_method paroquant_m2xfp4)
|
||||
# with the DFlash2 drafter.
|
||||
#
|
||||
# rad-convert <paroquant_m2xfp4 checkpoint> --draft-model <z-lab/Qwen3.8-27B-DFlash2> \
|
||||
# --recipe q38-27b-paro-m2xfp4-df2.recipe -o q38-27b-paro-m2xfp4-df2.rad
|
||||
#
|
||||
# The trunk's linears are imported as they ship, and need no rule: e2m1 codes, an E8M0 exponent a
|
||||
# 32 of K and the m2xfp4 scheme's metadata byte a group (four 2-bit subgroup multipliers) -- the
|
||||
# checkpoint's planes byte for byte -- stored in the ROTATED basis ParoQuant trained them in, with
|
||||
# the rotations beside them as the encoding's "givens" transform (abi/rad_encoding.h): per
|
||||
# projection the Givens pairs and angles inside groups of 128 columns, and the channel scales. A
|
||||
# fused gate|up or qkv|z keeps one set of tables a checkpoint tensor (parts). rad-convert writes
|
||||
# them as planes of the weight; the GEMM is the plain M2XFP4 one, and the activation is rotated in
|
||||
# front of it (givens_dense_quant) -- nothing is re-quantised, so the weights are the checkpoint's
|
||||
# to the bit.
|
||||
#
|
||||
# What the checkpoint does NOT ship in a form the architecture declares gets a rule. ParoQuant's
|
||||
# convert writes what it does not quantise in fp16 (the delta net's a|b and conv, the embedding,
|
||||
# the vision tower), where the plugin declares bf16: `cast` rounds f16 to bf16 once. The head goes
|
||||
# block fp8 like every other recipe here. Its MTP head is not read: the DFlash2 drafter displaces
|
||||
# it.
|
||||
#
|
||||
# THE DRAFTER is made as small as its acceptance allows, as in q38-27b-m2xfp4-df2.recipe: its
|
||||
# linears at M2XFP4, beside a 2-bit copy of the target's head.
|
||||
|
||||
blk.*.ssm_ab.weight cast dtype=bf16
|
||||
blk.*.ssm_conv1d.weight cast dtype=bf16
|
||||
token_embd.weight cast dtype=bf16
|
||||
v.* cast dtype=bf16
|
||||
|
||||
output.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dflash.draft_head.weight rtn codes=u2 zero=u8 group=128 scale=f16 rule=search
|
||||
|
||||
dflash.fc.weight m2xfp4
|
||||
dflash.blk.*.attn_q.weight m2xfp4
|
||||
dflash.blk.*.attn_k.weight m2xfp4
|
||||
dflash.blk.*.attn_v.weight m2xfp4
|
||||
dflash.blk.*.attn_output.weight m2xfp4
|
||||
dflash.blk.*.ffn_gate_up.weight m2xfp4
|
||||
dflash.blk.*.ffn_down.weight m2xfp4
|
||||
@@ -1,38 +0,0 @@
|
||||
# q38-27b-paro-mxfp4-df2.recipe -- a ParoQuant MXFP4 Qwen3.8-27B (quant_method paroquant_mxfp4) with the
|
||||
# DFlash2 drafter.
|
||||
#
|
||||
# rad-convert <MisterSnrub/Qwen3.8-27B-PARO-MXFP4-v2> --draft-model <z-lab/Qwen3.8-27B-DFlash2> \
|
||||
# --recipe q38-27b-paro-mxfp4-df2.recipe -o q38-27b-paro-mxfp4-df2.rad
|
||||
#
|
||||
# The trunk's linears are imported as they ship, and need no rule: e2m1 codes and an E8M0 exponent a
|
||||
# 32 of K -- Quark's planes byte for byte -- stored in the ROTATED basis ParoQuant trained them in,
|
||||
# with the rotations beside them as the encoding's "givens" transform (abi/rad_encoding.h): per
|
||||
# projection the Givens pairs and angles of 8 stages inside groups of 128 columns, and the channel
|
||||
# scales. A fused gate|up or qkv|z keeps one set of tables a checkpoint tensor (parts). rad-convert
|
||||
# writes them as planes of the weight; the GEMM is the plain MXFP4 one, and the activation is
|
||||
# rotated in front of it (givens_dense_quant) -- nothing is re-quantised, so the weights are the
|
||||
# release's to the bit.
|
||||
#
|
||||
# What the checkpoint does NOT ship in a form the architecture declares gets a rule. The release is
|
||||
# fp16 throughout (norms, the delta net's a|b and conv, the vision tower), where the plugin declares
|
||||
# bf16: `cast` rounds f16 to bf16 once. Its embedding and head are fp8 with one f32 scale a ROW,
|
||||
# read exactly and re-expressed: the embedding as bf16, the head as block fp8 like every other
|
||||
# recipe here. Its MTP head is not read: the DFlash2 drafter displaces it.
|
||||
#
|
||||
# THE DRAFTER is made as small as its acceptance allows, as in q38-27b-quark-mxfp4-df2.recipe.
|
||||
|
||||
blk.*.ssm_ab.weight cast dtype=bf16
|
||||
blk.*.ssm_conv1d.weight cast dtype=bf16
|
||||
token_embd.weight cast dtype=bf16
|
||||
v.* cast dtype=bf16
|
||||
|
||||
output.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dflash.draft_head.weight rtn codes=u2 zero=u8 group=128 scale=f16 rule=search
|
||||
|
||||
dflash.fc.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
dflash.blk.*.attn_q.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
dflash.blk.*.attn_k.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
dflash.blk.*.attn_v.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
dflash.blk.*.attn_output.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
dflash.blk.*.ffn_gate_up.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
dflash.blk.*.ffn_down.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
@@ -1,30 +0,0 @@
|
||||
# q38-27b-quark-mxfp4-df2.recipe -- AMD's Quark AWQ-MXFP4 Qwen3.8-27B with the DFlash2 drafter.
|
||||
#
|
||||
# rad-convert <amd/Qwen3.8-27B-Quark-AWQ-MXFP4> --draft-model <z-lab/Qwen3.8-27B-DFlash2> \
|
||||
# --recipe q38-27b-quark-mxfp4-df2.recipe -o q38-27b-quark-mxfp4-df2.rad
|
||||
#
|
||||
# Quark's MXFP4 linears are read as `fp4_e2m1*e8m0[1x32]`, byte for byte, so no rule names them:
|
||||
# the trunk is served at the 4-bit weights Quark shipped, against E4M3 activations. The checkpoint
|
||||
# is served by the family's quantised plugin (qwen35_fp8). The delta net's a/b projection is
|
||||
# declared bf16, and every MXFP4 value is exact in bf16, so `cast` keeps Quark's values that way.
|
||||
# The target's head goes block fp8, as in q38-27b-fp8-df2.recipe.
|
||||
#
|
||||
# THE DRAFTER is made as small as its acceptance allows, since it is read whole on every decode step
|
||||
# and a draft is verified, so its precision moves acceptance and never an emitted token: its linears
|
||||
# at OCP-MXFP4 like the trunk, and a 2-bit copy of the target's head (u2 with a u8 zero, least-squares
|
||||
# clip search) whose top 32 the engine rescores against the target's fp8 head. Against fp8 linears
|
||||
# and an unsearched 2-bit head without the rescore, TP1 at depth 7: 108.9 -> 121.6 tok/s one
|
||||
# stream, 0.75 GiB less weight.
|
||||
|
||||
blk.*.ssm_ab.weight cast dtype=bf16
|
||||
|
||||
output.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dflash.draft_head.weight rtn codes=u2 zero=u8 group=128 scale=f16 rule=search
|
||||
|
||||
dflash.fc.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
dflash.blk.*.attn_q.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
dflash.blk.*.attn_k.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
dflash.blk.*.attn_v.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
dflash.blk.*.attn_output.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
dflash.blk.*.ffn_gate_up.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
dflash.blk.*.ffn_down.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
@@ -16,12 +16,12 @@
|
||||
# up to 64 rows a step, w4a8i8_asym over an int8 activation with a scale per (row, 128) above.
|
||||
#
|
||||
# What the release keeps in bf16 stays bf16: the delta net's a/b projections, the norms, the
|
||||
# embedding, the vision tower and the MTP head. Its head is made block fp8 as in the other 27B
|
||||
# embedding, the vision tower and the MTP head. Its head is made int8 as in the other 27B
|
||||
# recipes (the widest GEMM, read every step, at half the bytes), and the MTP head drafts through a
|
||||
# 2-bit copy of it (u2 with a u8 zero, least-squares clip search) whose top candidates the engine
|
||||
# rescores against the fp8 head.
|
||||
# rescores against the int8 head.
|
||||
|
||||
blk.*.weight import codes=u4 zero=u4 scale=f16
|
||||
|
||||
output.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
output.weight rtn codes=i8 group=128 scale=bf16 clamp=sym
|
||||
mtp.draft_head.weight rtn codes=u2 zero=u8 group=128 scale=f16 rule=search
|
||||
@@ -20,10 +20,9 @@
|
||||
# - The lm_head int8 too, unrotated (logits_gemm_i8): weight error 6.8e-3 against block fp8's
|
||||
# 2.6e-2. Against the bf16 model over 45K mostly-Go positions it halves the container's mean KL
|
||||
# (0.00051 against 0.00090 with a block-fp8 head; Qwen's FP8 release 0.00404) and takes top-1
|
||||
# agreement from 98.83% to 99.25%. A block-fp8 head is one override away:
|
||||
# --quant 'output.weight=rtn:codes=fp8_e4m3,block=128x128,scale=bf16'
|
||||
# agreement from 98.83% to 99.25%.
|
||||
#
|
||||
# The drafter as q38-27b-fp8-df2.recipe makes it: its linears at MXFP4, and a 2-bit copy of the
|
||||
# The drafter: its linears at MXFP4, and a 2-bit copy of the
|
||||
# target's head (u2 with a u8 zero, least-squares clip search) whose top 32 the engine rescores
|
||||
# against the target's head.
|
||||
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
# qwen-image-2.1-fp8.recipe -- Qwen-Image 2.1 or 2.1-Turbo with block-scaled fp8 linears.
|
||||
#
|
||||
# rad-convert <Qwen-Image-2.1 pipeline directory> --recipe data/recipes/qwen-image-2.1-fp8.recipe \
|
||||
# -o qwen-image-2.1-fp8.rad
|
||||
#
|
||||
# Every linear of the text encoder's language model and of the DiT's 32 blocks becomes E4M3 codes
|
||||
# with a bf16 scale a 128 x 128 block, read by the fp8a8 GEMMs over activations quantised the same
|
||||
# way. What stays bf16 is read once a pass or less: the embedding table, the vision tower, txt_in,
|
||||
# img_in, the timestep MLP, the shared modulation, norm_out, proj_out and the VAE (cast from the
|
||||
# base model's f32).
|
||||
|
||||
te.blk.*.attn_qkv.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
te.blk.*.attn_output.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
te.blk.*.ffn_gate_up.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
te.blk.*.ffn_down.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dit.blk.*.attn_qkv.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dit.blk.*.attn_output.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dit.blk.*.ffn_gate_up.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dit.blk.*.ffn_down.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
vae.* cast dtype=bf16
|
||||
@@ -0,0 +1,22 @@
|
||||
# qwen-image-2.1-iq8r.recipe -- Qwen-Image 2.1 or 2.1-Turbo with IQ8R linears.
|
||||
#
|
||||
# rad-convert <Qwen-Image-2.1 pipeline directory> --recipe data/recipes/qwen-image-2.1-iq8r.recipe \
|
||||
# -o qwen-image-2.1-iq8r.rad
|
||||
#
|
||||
# Every linear of the text encoder's language model and of the DiT's 32 blocks becomes rotated
|
||||
# int8: codes in -127..127 in the 128-wide Hadamard domain with a u8 scale per [1 x 256] of K
|
||||
# under a bf16 scale a row, read at i8a8h against int8 activations quantised under the same
|
||||
# rotation with one scale per (token, 256). Round to nearest with a scale search; no calibration
|
||||
# data is read. What stays bf16 is read once a pass or less: the embedding table, the vision tower,
|
||||
# txt_in, img_in, the timestep MLP, the shared modulation, norm_out, proj_out and the VAE (cast
|
||||
# from the base model's f32).
|
||||
|
||||
te.blk.*.attn_qkv.weight rtn codes=i8 group=256 scale=u8 scale2=bf16 block2=1x* transform=fwht128 clamp=sym rule=search
|
||||
te.blk.*.attn_output.weight rtn codes=i8 group=256 scale=u8 scale2=bf16 block2=1x* transform=fwht128 clamp=sym rule=search
|
||||
te.blk.*.ffn_gate_up.weight rtn codes=i8 group=256 scale=u8 scale2=bf16 block2=1x* transform=fwht128 clamp=sym rule=search
|
||||
te.blk.*.ffn_down.weight rtn codes=i8 group=256 scale=u8 scale2=bf16 block2=1x* transform=fwht128 clamp=sym rule=search
|
||||
dit.blk.*.attn_qkv.weight rtn codes=i8 group=256 scale=u8 scale2=bf16 block2=1x* transform=fwht128 clamp=sym rule=search
|
||||
dit.blk.*.attn_output.weight rtn codes=i8 group=256 scale=u8 scale2=bf16 block2=1x* transform=fwht128 clamp=sym rule=search
|
||||
dit.blk.*.ffn_gate_up.weight rtn codes=i8 group=256 scale=u8 scale2=bf16 block2=1x* transform=fwht128 clamp=sym rule=search
|
||||
dit.blk.*.ffn_down.weight rtn codes=i8 group=256 scale=u8 scale2=bf16 block2=1x* transform=fwht128 clamp=sym rule=search
|
||||
vae.* cast dtype=bf16
|
||||
@@ -1,65 +0,0 @@
|
||||
# qwen4exp-w4-hc8m-pe.recipe -- qwen4exp-w4-hc8m.recipe with the routed experts quantised by GPTQ
|
||||
# against the bf16 model's own Hessians -- each expert's own for `down`, the layer's for `gate_up` --
|
||||
# and the ten experts that carry the most of their layer's output kept plain bf16
|
||||
# (docs/MOE-W4.md, "Protected experts").
|
||||
#
|
||||
# CALIB=DIR rad-convert <Qwen3.8-Flash-Next checkpoint> \
|
||||
# --recipe data/recipes/qwen4exp-w4-hc8m-pe.recipe --reuse q38-flashnext-w4-mtp-hc8m.rad \
|
||||
# -o q38-flashnext-w4-mtp-hc8m-pe.rad
|
||||
#
|
||||
# DIR holds those Hessians, recorded from the bf16 model (docs/MOE-W4.md, "Calibration"); --reuse
|
||||
# copies every weight whose rule is the same as in qwen4exp-w4-hc8m.recipe. Everything not named
|
||||
# here is served as the checkpoint holds it; the first rule that matches a weight decides it.
|
||||
|
||||
# The protected experts, from a 1M-token recording of the bf16 model on the calibration corpus:
|
||||
# an expert whose share of its layer's down-input energy is at least 3% and at least three times its
|
||||
# share of the routing, and on each rank's half of the layer an even count -- the four-bit GEMM takes
|
||||
# the rest as two equal tables by parity -- by adding that half's next most energetic expert
|
||||
# (407/496, 350/292, 290/392 and 445,143/399,122 below). Layer 47's expert 445 alone carries 64% of
|
||||
# its layer's down-input energy from 0.4% of the routing.
|
||||
blk.34.ffn_*_exps.407.weight cast dtype=bf16
|
||||
blk.34.ffn_*_exps.496.weight cast dtype=bf16
|
||||
blk.44.ffn_*_exps.292.weight cast dtype=bf16
|
||||
blk.44.ffn_*_exps.350.weight cast dtype=bf16
|
||||
blk.46.ffn_*_exps.290.weight cast dtype=bf16
|
||||
blk.46.ffn_*_exps.392.weight cast dtype=bf16
|
||||
blk.47.ffn_*_exps.122.weight cast dtype=bf16
|
||||
blk.47.ffn_*_exps.143.weight cast dtype=bf16
|
||||
blk.47.ffn_*_exps.399.weight cast dtype=bf16
|
||||
blk.47.ffn_*_exps.445.weight cast dtype=bf16
|
||||
|
||||
# Every other routed expert, trunk and MTP layer alike: int4, a bf16 scale a group of 128, rotated
|
||||
# by the 128-wide Hadamard, chosen by GPTQ against $CALIB. The MTP layer has no recording and is
|
||||
# rounded to nearest, which libquant says on stderr.
|
||||
blk.*.ffn_*_exps.*.weight gptq codes=i4 group=128 scale=bf16 transform=fwht128 calib=$CALIB
|
||||
|
||||
# Every connection's two mixing matrices -- the 96 trunk connections, the final mixer and the MTP
|
||||
# head's three -- as E4M3 rows with an f32 scale a group of each row. A 128x128 block cannot cover
|
||||
# them: lowrank is 320, 2.5 blocks. Down is [320, 10240] and takes a scale every 128 columns; up is
|
||||
# [10240, 320] and takes four scales a row, 80 columns each.
|
||||
*_hc_down.weight rtn codes=fp8_e4m3 group=128 scale=f32
|
||||
*_hc_up.weight rtn codes=fp8_e4m3 group=80 scale=f32
|
||||
|
||||
# The MTP head's fc_hidden and fc_embedding, the same rows. They only ever change the drafts.
|
||||
mtp.fc_hidden.weight rtn codes=fp8_e4m3 group=128 scale=f32
|
||||
mtp.fc_embedding.weight rtn codes=fp8_e4m3 group=128 scale=f32
|
||||
|
||||
# The block-scaled fp8 linears. The QSA indexer's projection is not one of them: its top-k is a
|
||||
# hard choice between blocks, and keeping it as the checkpoint holds it costs 20 MB.
|
||||
blk.*.attn_qg.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
blk.*.attn_k.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
blk.*.attn_v.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
blk.*.attn_output.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
blk.*.ssm_inz.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
blk.*.ssm_out.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
blk.*.ffn_gate_up_shexp.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
blk.*.ffn_down_shexp.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
|
||||
# The lm_head, block fp8.
|
||||
output.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
|
||||
# The n-gram table at one fixed E4M3 scale; qwen4exp-w4.recipe says where the value comes from.
|
||||
blk.*.ple_ngram.weight rtn codes=fp8_e4m3 block=*x* scale=bf16 rule=fixed scale_value=1.99317932128906e-4
|
||||
|
||||
# The MTP head's 2-bit draft head.
|
||||
mtp.draft_head.weight rtn codes=u2 zero=u8 group=128 scale=f16
|
||||
@@ -1,46 +0,0 @@
|
||||
# qwen4exp-w4-hc8m.recipe -- Qwen3.8-Flash-Next from its bf16 checkpoint, as the
|
||||
# q38-flashnext-w4-mtp-hc8m.rad container serves it: qwen4exp-w4.recipe, plus the gated-residual
|
||||
# mixing matrices and the MTP head's two entry matrices as E4M3 rows.
|
||||
#
|
||||
# rad-convert <Qwen3.8-Flash-Next checkpoint> --recipe data/recipes/qwen4exp-w4-hc8m.recipe \
|
||||
# -o q38-flashnext-w4-mtp-hc8m.rad
|
||||
#
|
||||
# The uncensored release (orcarouter/Qwen3.8-Flash-Next-Uncensored) takes the same recipe.
|
||||
# Everything not named here is served as the checkpoint holds it; the first rule that matches a
|
||||
# weight decides it. The routed experts' GPTQ form is one rule ahead of this file:
|
||||
# --quant 'blk.*.ffn_*_exps.*.weight=gptq:codes=i4,group=128,scale=bf16,transform=fwht128,calib=$CALIB'
|
||||
|
||||
# The routed experts, trunk and MTP layer alike: int4, a bf16 scale a group of 128, rotated by the
|
||||
# 128-wide Hadamard. qwen4exp-w4.recipe says why.
|
||||
blk.*.ffn_*_exps.*.weight rtn codes=i4 group=128 scale=bf16 transform=fwht128
|
||||
|
||||
# Every connection's two mixing matrices -- the 96 trunk connections, the final mixer and the MTP
|
||||
# head's three -- as E4M3 rows with an f32 scale a group of each row. A 128x128 block cannot cover
|
||||
# them: lowrank is 320, 2.5 blocks. Down is [320, 10240] and takes a scale every 128 columns; up is
|
||||
# [10240, 320] and takes four scales a row, 80 columns each.
|
||||
*_hc_down.weight rtn codes=fp8_e4m3 group=128 scale=f32
|
||||
*_hc_up.weight rtn codes=fp8_e4m3 group=80 scale=f32
|
||||
|
||||
# The MTP head's fc_hidden and fc_embedding, the same rows. They only ever change the drafts.
|
||||
mtp.fc_hidden.weight rtn codes=fp8_e4m3 group=128 scale=f32
|
||||
mtp.fc_embedding.weight rtn codes=fp8_e4m3 group=128 scale=f32
|
||||
|
||||
# The block-scaled fp8 linears. The QSA indexer's projection is not one of them: its top-k is a
|
||||
# hard choice between blocks, and keeping it as the checkpoint holds it costs 20 MB.
|
||||
blk.*.attn_qg.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
blk.*.attn_k.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
blk.*.attn_v.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
blk.*.attn_output.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
blk.*.ssm_inz.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
blk.*.ssm_out.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
blk.*.ffn_gate_up_shexp.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
blk.*.ffn_down_shexp.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
|
||||
# The lm_head, block fp8.
|
||||
output.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
|
||||
# The n-gram table at one fixed E4M3 scale; qwen4exp-w4.recipe says where the value comes from.
|
||||
blk.*.ple_ngram.weight rtn codes=fp8_e4m3 block=*x* scale=bf16 rule=fixed scale_value=1.99317932128906e-4
|
||||
|
||||
# The MTP head's 2-bit draft head.
|
||||
mtp.draft_head.weight rtn codes=u2 zero=u8 group=128 scale=f16
|
||||
@@ -1,48 +0,0 @@
|
||||
# qwen4exp-w4.recipe -- Qwen3.8-Flash-Next from its bf16 checkpoint, as the
|
||||
# q38-flashnext-w4-mtp.rad container serves it: fp8 linears, four-bit rotated experts, the n-gram
|
||||
# table at E4M3, the MTP head with its 2-bit draft head; the gated-residual mixing matrices and the
|
||||
# MTP head's fc matrices stay bf16 (qwen4exp-w4-hc8m.recipe makes those E4M3 too).
|
||||
#
|
||||
# rad-convert <Qwen3.8-Flash-Next checkpoint> --recipe data/recipes/qwen4exp-w4.recipe \
|
||||
# -o q38-flashnext-w4-mtp.rad
|
||||
#
|
||||
# The checkpoint carries no quantization_config, so everything not named here is served as the
|
||||
# checkpoint holds it: every norm gain, A_log, dt_bias, conv1d, the delta net's a/b projections
|
||||
# (48 rows, not a whole scale block), the router and shared-expert gate, the QSA indexer's
|
||||
# projection, the embedding, the PLE projections and the hyper-connection weights. Rank-1 weights a
|
||||
# pattern happens to match are declined by the quantiser and kept as they are. The first rule that
|
||||
# matches a weight decides it.
|
||||
|
||||
# The routed experts, trunk and MTP layer alike: int4 codes, a bf16 scale a group of 128 along K,
|
||||
# each row rotated by the 128-wide Hadamard first. The experts are 112.8 GiB at E4M3 and do not fit
|
||||
# two cards; at four bits they do. Round-to-nearest with absmax scales; the calibrated GPTQ form of
|
||||
# the same encoding is one rule ahead of this file:
|
||||
# --quant 'blk.*.ffn_*_exps.*.weight=gptq:codes=i4,group=128,scale=bf16,transform=fwht128,calib=$CALIB'
|
||||
blk.*.ffn_*_exps.*.weight rtn codes=i4 group=128 scale=bf16 transform=fwht128
|
||||
|
||||
# The block-scaled fp8 linears: E4M3 codes, a bf16 scale a 128x128 block. The QSA indexer's
|
||||
# projection is not one of them: its top-k is a hard choice between blocks, and keeping it as the
|
||||
# checkpoint holds it costs 20 MB.
|
||||
blk.*.attn_qg.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
blk.*.attn_k.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
blk.*.attn_v.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
blk.*.attn_output.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
blk.*.ssm_inz.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
blk.*.ssm_out.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
blk.*.ffn_gate_up_shexp.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
blk.*.ffn_down_shexp.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
|
||||
# The lm_head, block fp8: the widest GEMM in the model at half the bytes.
|
||||
output.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
|
||||
# The n-gram table, 51B parameters: E4M3 with ONE scale for all 320 million rows, fixed rather than
|
||||
# measured -- an absmax over the whole table cannot be taken a block of rows at a time, and the
|
||||
# table streams. 1.99317932128906e-4 is bf16 0x3951, the value Qwen3.8-Flash-Next-FP8 ships in its
|
||||
# own `ngram_embedding.weight_scale`; it sits on a three-octave plateau (2^-13..2^-10 give rel_l2
|
||||
# 0.02662 to five digits) with 1.7x headroom over the table's absmax.
|
||||
blk.*.ple_ngram.weight rtn codes=fp8_e4m3 block=*x* scale=bf16 rule=fixed scale_value=1.99317932128906e-4
|
||||
|
||||
# The MTP head's 2-bit copy of the lm_head -- u2 codes, an f16 scale and a u8 zero a group of 128 --
|
||||
# which the draft rounds read in place of the full head. A draft is verified by the trunk, so this
|
||||
# moves acceptance and never an emitted token.
|
||||
mtp.draft_head.weight rtn codes=u2 zero=u8 group=128 scale=f16
|
||||
@@ -73,7 +73,11 @@ blk.*.ffn_down_shexp.weight rtn codes=i8 group=128 scale=bf16 clamp=sy
|
||||
# ~0.6 points of top-1 on its own.
|
||||
output.weight rtn codes=i8 group=128 scale=bf16 clamp=sym rule=search
|
||||
|
||||
# The n-gram table at one fixed E4M3 scale; qwen4exp-w4.recipe says where the value comes from.
|
||||
# The n-gram table, 51B parameters: E4M3 with ONE scale for all 320 million rows, fixed rather than
|
||||
# measured -- an absmax over the whole table cannot be taken a block of rows at a time, and the
|
||||
# table streams. 1.99317932128906e-4 is bf16 0x3951, the value Qwen3.8-Flash-Next-FP8 ships in its
|
||||
# own `ngram_embedding.weight_scale`; it sits on a three-octave plateau (2^-13..2^-10 give rel_l2
|
||||
# 0.02662 to five digits) with 1.7x headroom over the table's absmax.
|
||||
blk.*.ple_ngram.weight rtn codes=fp8_e4m3 block=*x* scale=bf16 rule=fixed scale_value=1.99317932128906e-4
|
||||
|
||||
# The MTP head's 2-bit draft head.
|
||||
|
||||
@@ -72,7 +72,8 @@ blk.*.ffn_down_shexp.weight rtn codes=i8 group=128 scale=bf16 clamp=sy
|
||||
# ~0.6 points of top-1 on its own.
|
||||
output.weight rtn codes=i8 group=128 scale=bf16 clamp=sym rule=search
|
||||
|
||||
# The n-gram table at one fixed E4M3 scale; qwen4exp-w4.recipe says where the value comes from.
|
||||
# The n-gram table at one fixed E4M3 scale; qwen4exp-w4nl64-i8-hc8m.recipe says where the value
|
||||
# comes from.
|
||||
blk.*.ple_ngram.weight rtn codes=fp8_e4m3 block=*x* scale=bf16 rule=fixed scale_value=1.99317932128906e-4
|
||||
|
||||
# The MTP head's 2-bit draft head.
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
# time -- RADIANCE_SPARK_CALIB_LAYERS=lo:hi, once per slice, same directory:
|
||||
#
|
||||
# RADIANCE_CALIB_DIR=$CALIB RADIANCE_CALIB_TOKENS=65536 RADIANCE_SPARK_CALIB_LAYERS=0:12 \
|
||||
# radiance --model spark-x2.6-4b-radiance-bf16.rad ... # and drive prompts at max_tokens=1
|
||||
# radiance --config bf16.yaml # model: spark-x2.6-4b-radiance-bf16.rad; drive prompts at max_tokens=1
|
||||
#
|
||||
# CALIB=$CALIB rad-convert <XHToken-Spark-X2.6-4B> --recipe data/recipes/spark-x26-4b-iq8r.recipe \
|
||||
# --set quantization_config.quant_method=w8a8 --set quantization_config.fmt=fwht128 \
|
||||
|
||||
@@ -81,7 +81,8 @@ blk.*.ffn_down_shexp.weight rtn codes=i8 group=128 scale=bf16 clamp=sy
|
||||
# ~0.6 points of top-1 on its own.
|
||||
output.weight rtn codes=i8 group=128 scale=bf16 clamp=sym rule=search
|
||||
|
||||
# The n-gram table at one fixed E4M3 scale; qwen4exp-w4.recipe says where the value comes from.
|
||||
# The n-gram table at one fixed E4M3 scale; qwen4exp-w4nl64-i8-hc8m.recipe says where the value
|
||||
# comes from.
|
||||
blk.*.ple_ngram.weight rtn codes=fp8_e4m3 block=*x* scale=bf16 rule=fixed scale_value=1.99317932128906e-4
|
||||
|
||||
# The MTP head's 2-bit draft head.
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
# translategemma-27b-mxfp4-gptq-df2.recipe -- translategemma-27b-mxfp4-gptq.recipe with a DFlash2
|
||||
# drafter (rad-convert --draft-model). The drafter's linears are MXFP4 (read whole every draft pass;
|
||||
# drafts are verified, so this changes only what is proposed) and its head a 2-bit copy of the tied
|
||||
# embedding, rescored against output.weight, as q38-27b-quark-mxfp4-df2.recipe makes Qwen's.
|
||||
# `--reuse` of a container made by the recipe above copies its trunk.
|
||||
#
|
||||
# CALIB=<dir> rad-convert <translategemma-27b-it> --draft-model <drafter> \
|
||||
# --recipe data/recipes/translategemma-27b-mxfp4-gptq-df2.recipe -o translategemma-27b-mxfp4-gptq-df2.rad
|
||||
|
||||
blk.*.attn_q.weight gptq codes=fp4_e2m1 group=32 scale=e8m0 calib=$CALIB
|
||||
blk.*.attn_k.weight gptq codes=fp4_e2m1 group=32 scale=e8m0 calib=$CALIB
|
||||
blk.*.attn_v.weight gptq codes=fp4_e2m1 group=32 scale=e8m0 calib=$CALIB
|
||||
blk.*.attn_o.weight gptq codes=fp4_e2m1 group=32 scale=e8m0 calib=$CALIB
|
||||
blk.*.ffn_down.weight gptq codes=fp4_e2m1 group=32 scale=e8m0 calib=$CALIB
|
||||
blk.*.ffn_gate_up.weight gptq codes=fp4_e2m1 group=32 scale=e8m0 calib=$CALIB
|
||||
output.weight rtn codes=i8 group=128 scale=bf16 clamp=sym
|
||||
|
||||
dflash.draft_head.weight rtn codes=u2 zero=u8 group=128 scale=f16 rule=search
|
||||
dflash.fc.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
dflash.blk.*.attn_q.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
dflash.blk.*.attn_k.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
dflash.blk.*.attn_v.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
dflash.blk.*.attn_output.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
dflash.blk.*.ffn_gate_up.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
dflash.blk.*.ffn_down.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
@@ -1,16 +0,0 @@
|
||||
# translategemma-27b-mxfp4-gptq.recipe -- TranslateGemma 27B (arch/gemma3): every linear MXFP4 by
|
||||
# GPTQ against the Grams a calibration run wrote (CALIB, see docs/ARCHITECTURES.md), served at
|
||||
# mxfp4a8 over an E4M3 activation scaled per (row, 128). The tied lm_head is int8 a 128 columns:
|
||||
# block fp8 cannot be split at --tp 2, where a rank holds 131104 vocabulary rows. Norms and the
|
||||
# embedding stay bf16. KL 0.042 against the bf16 model.
|
||||
#
|
||||
# CALIB=<dir> rad-convert <translategemma-27b-it> \
|
||||
# --recipe data/recipes/translategemma-27b-mxfp4-gptq.recipe -o translategemma-27b-mxfp4-gptq.rad
|
||||
|
||||
blk.*.attn_q.weight gptq codes=fp4_e2m1 group=32 scale=e8m0 calib=$CALIB
|
||||
blk.*.attn_k.weight gptq codes=fp4_e2m1 group=32 scale=e8m0 calib=$CALIB
|
||||
blk.*.attn_v.weight gptq codes=fp4_e2m1 group=32 scale=e8m0 calib=$CALIB
|
||||
blk.*.attn_o.weight gptq codes=fp4_e2m1 group=32 scale=e8m0 calib=$CALIB
|
||||
blk.*.ffn_down.weight gptq codes=fp4_e2m1 group=32 scale=e8m0 calib=$CALIB
|
||||
blk.*.ffn_gate_up.weight gptq codes=fp4_e2m1 group=32 scale=e8m0 calib=$CALIB
|
||||
output.weight rtn codes=i8 group=128 scale=bf16 clamp=sym
|
||||
Reference in new issue
Block a user