Archived
Every linear of the trunk is a LinearFP8, so the container's encoding decides the GEMM: bf16 stays `gemm_nt` exactly as before, a recipe's block E4M3 is gemm_nt_q at fp8a8 over an activation quantised once per producer, and int8 is gemm_nt_q at i8a8. The format is read off layer 0's first linear; a trunk mixing formats is refused by name. The convolution, the norms and attention stay bf16. On a block-fp8 trunk the fused producers run: rmsnorm_quant_fp8 with a fold for each mixer's norm (the previous block's residual add included) and MlpFP8 for the feed-forward, whose gate|up GEMM applies SiLU(gate) * up and quantises in its epilogue. The convolution's C * conv(B * x) and the codes its out projection reads become one gate_quant_fp8 at act none. `gemm_nt_q_gated_wide` puts whole prompts through the fold instead of falling back to the pair past 64 rows; k and v ask for `gemm_nt_q_short`; the head norms and rope ask for `rmsnorm_rows` and `rope_rows`. Each of those is the model's own declaration, so no other architecture's path moves. The lm_head is read at its stored codes (bf16, or E4M3/int8 where a recipe made it so, logits_gemm_fp8/_i8). A tied head also declares the final-normed rows and the embedding table to the core (rad_declare_scores), so a scored step needs no head read at all. data/recipes/d1-3b-fp8.recipe: all 30 layers' linears to E4M3 with a bf16 scale a 128x128 block; the tied head to int8 per row per 128 columns. Co-Authored-By: Pi <pi@localhost>
23 lines
1.4 KiB
Plaintext
23 lines
1.4 KiB
Plaintext
# 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
|