data/recipes: ling3-w4a8-rtn and ling3-w4a8-gptq -- Ling-3.0's routed experts at four bits

The routed experts as int4 codes with a bf16 scale per 128 of K, everything else as the checkpoint
holds it: rounded to nearest, or chosen by GPTQ against a calibration run of the first container.
One format, so the same kernels serve both.
This commit is contained in:
keptn42 authored and StillDeadcode committed 2026-11-03 19:07:34 +01:00
1 parent a78352dad1
commit ccb5071228
2 files changed
+32

No files matched your search

+18
View File
@@ -0,0 +1,18 @@
# ling3-w4a8-gptq.recipe -- Ling-3.0-flash or a fine-tune of it (Ling-3.0-flash-Sante) from the bf16
# checkpoint: the routed experts at four bits, an int4 code and a bf16 scale per 128 of K, chosen by
# GPTQ against the Hessians of a calibration run (docs/MOE-W4.md "Calibration"); everything else as
# 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)
# 3. CALIB=<calib dir> rad-convert <checkpoint> --recipe data/recipes/ling3-w4a8-gptq.recipe \
# --reuse ling3-w4a8-rtn.rad -o ling3-w4a8-gptq.rad
#
# A routed expert's down projection takes its own Hessian where the calibration routed it enough rows,
# the layer's pooled one otherwise (libquant says which on stderr).
#
# Measured on Ling-3.0-flash-Sante as ling3-w4a8-rtn.recipe is: mean KL 0.036, top-1 agreement
# 92.96%, from 1.26M calibration tokens of medical text, documents, code, tool calls and chat.
blk.*.ffn_*_exps.*.weight gptq codes=i4 group=128 scale=bf16 calib=$CALIB
+14
View File
@@ -0,0 +1,14 @@
# ling3-w4a8-rtn.recipe -- Ling-3.0-flash or a fine-tune of it (Ling-3.0-flash-Sante) from the bf16
# checkpoint: the routed experts at four bits, an int4 code and a bf16 scale per 128 of K, rounded to
# nearest; everything else as the checkpoint holds it (the KDA and MLA projections, the dense layers,
# the shared expert, the router, the embedding and lm_head in bf16).
#
# rad-convert <Ling-3.0-flash-Sante> --recipe data/recipes/ling3-w4a8-rtn.recipe -o ling3-w4a8-rtn.rad
#
# It is the container to calibrate in: served with RADIANCE_CALIB_DIR set, its experts' Grams feed
# the GPTQ recipe.
#
# Measured on Ling-3.0-flash-Sante with the engine's KL mode against the bf16 model (wikitext-2,
# 100 chunks of 512 tokens, the second half of each scored): mean KL 0.038, top-1 agreement 92.54%.
blk.*.ffn_*_exps.*.weight rtn codes=i4 group=128 scale=bf16