llama.cpp
fd0016d8 - model: fold the Olala expert scale and rescale the ssm_out input

Commit
22 hours ago
model: fold the Olala expert scale and rescale the ssm_out input A quantized matmul packs its input into Q8 blocks whose scale and sum are F16. A few Olala layers go far past that: the ssm_out input reaches 3e17 in layers 1 and 7, the routed experts of layers 0, 1, 3, 5 and 19 exceed the block sum. Instead of keeping those tensors in BF16: - ssm_out projects y divided by its per-token RMS and scales the result back, which bounds its input whatever the layer - the converter folds a power-of-two scale into the routed experts of the layers that overflow: relu^2(a*x) = a^2*relu^2(x), so ffn_up_exps *= a, ffn_down_exps *= t/a^2 and ffn_latent_up *= 1/t keep the same output, bit for bit in BF16 - ffn_latent_up (18M weights) stays BF16 Everything else quantizes normally on every backend, without any precision hint. No imatrix, against BF16: Q8_0 9.95 -> 7.27 GB, Q6_K 9.67 -> 6.30 GB, Q4_K_M 4.67 GB, no NaN in single-token decode on CUDA and CPU, decode about 2% slower.
Parents
Loading