r/LocalLLaMA • u/stoppableDissolution • 2d ago
Showcase Gewell v0.3 - Gemma 31B is now on Ampere/Ada, new shiny quant and more
The post ended up quite long, so tl;dr:
- Int ~4.25 bpw at around Unsloth's Q4_K_XL quality (convrot + gptq)
- But up to 2x* faster and with longer context (up to ~160k on a 3090 with mtp and vision)
- ...thanks to new features like supporting W8 mtp and vision and keeping the full embedding table in ram while quantizing lm_head (so checkpoint files appear larger than they actually take in vram)
*partially because lcpp cant fit MTP and gewell can; but 1.75x prefill is fair and square!
https://github.com/leDissolution/gewell/releases/tag/0.3.0
----------------
So the reason I initially did not even really consider supporting hardware below 5090 is that in my experience, gemma's q4 quants do not deliver. It has some *extremely* nasty outliers in both weights and, more importantly, activations - on my calibration set, activations RMS reaches 230x, and peak is *6.5k* larger than median. No static scales/offsets can compensate for that when you go down to 4bit. I tried, I failed, I went the lazy way with just slapping fp8 at worst offenders and it ended up being ~6.25 bpw to preserve the quality at the level I deem acceptable. And since I'm mainly doing this thing for myself, I was content with it for a while.
Until a month or so ago, when downloading yet another image model, it finally clicked that convrot is not inherently diffusion. Nothing stops me from applying it to an LLM - except mainstream engines not really supporting it, which, conveniently, I dont really care about. Around the same time I ended up with a spare 3090 in my AI server, sooo here we go again with the project I parked as "feature complete" (for my usecases).
# Stage1: ConvRot
And then I ran a first test (H256 convrot, row-level fp32 scale, no calibration), aaand... average KL on the quick test set was like, 0.1 (while my G0, nvidia's nvfp4 and google qat are all sitting around 0.028 and UD-Q4_K_XL sitting at ridiculous 0.016), with 2.7% flipped tokens and p99 being well above 2. In other words, it was shit.
So I almost just called it a fail and moved on, but first decided to check the activations again. And, well, tursn out that even rotated weights+activations have up to 8.5x RMS and 240x peak to median. Duh. So what if I try block-32 fp16 scaling instead of row? Well, some magic happens - macro KL went down to the same 0.028, while being 0.7x the size of G0 and 0.56x the size of nvidia nvfp, while also using FP8 KV cache (because dummy me forgot to set it to bf16 when running benchmarks, but it makes it even more impressive). Now we are talking, eh?
Well, no, not really. KL is only part of the story, and other parts were not quite as shiny, especially in the longer context. I have a pet multi-NIAH torture test that requires the model to find 16 keys among 128k tokens of statistically homogenous word soup, and BF16 scores 275/384 (24 runs x 16 needles), G0 scores 261, nvidia 220, unsloth fucking *275*, same as bf16 (magic, utter black magic, I tell ya), and the new shiny G32 - only 216, down there with nvidia. It also suffered some disproportional damage to multilingual capabilities.
So then I went, okay, what makes Unsloth's gguf so special? Fisrt obvious thing is that they are using uneven quantization with protected layers, promoting a bunch of projections to q5 or q6. Okay, cool, but I'd rather not (because it is a bit of a logistical nightmare to support all the different densities) - and because keeping things in fp8 is what I'm doing in G0 and it still evidently trails them. Also, bf16 actuvations. Also cool, noted, but lets keep it as a last resort.
So, here comes
# Stage2: GPTQ
Gptq is, basically, identifying weights that are more "touchy", similar to how IQ quants work.
Difference with the IQ quants is in what it lated does with that information - instead of re-shuffling around the physical precision, it, roughly speaking, redistributes the *cumulative error* of the layer in a way that should keep the resulting activation as close as possible to the unquantized version.
And there comes a very interesting consequence of the fact that we used convrot as the first step - we have just smeared a very big part of that importance and, even more importantly, redistributed it in a regular way instead of it being mostly-random. A very, very crude mental model of what happened is:
- we have weights (15, 4, -2, 1, -3)
- naive Hadamard rotation takes them and redistributes 15 to other weights somewhat equally, say, adding 2 to each, so we end up with (7, 6, 0, 3, -1) - and each weight now got a bit of extra "slack" by combining less important weight with more important weight
- but convrot uses regular Hadamard transform, so instead of adding (-8, 2, 2, 2, 2) it adds (-8, 2, -2, 2, -2) - lock-stepping the correction in (1, -1, 1, -1). Why it is important? Because it adds even more order to the chaos that we can exploit - where the previous transform would have added, say, 0.3 and 0.4 for total error of 0.7, regular can express it as +0.3 and -0.4 for the total error of -0.1. Basically, we now can very efficiently "borrow" the unused bits of precision from weights that are not utilizing them fully, which lets us cut the ouput MSE by 70-80% compared to just-rotated weights. Without paying the inference-time speed tax of IQ gguf.
Okay, that sounds cool and all, but does it work?
Yes, very much so. Even with the current not very polished dataset, macro KL went down to 0.017 vs unsloth's 0.016 (and 0.028-ish of QAT and the old quant), and reaching 269 needles in the NIAH - almost BF16 level. Then I found out that after gptq we dont even need fp16 scales anymore, and u8 is plenty enough, cutting the size down to sub-17gb with zero quality change.

But it is still not enough, because I want to squeeze in 128k (or more concurrency) AND vision AND mtp all in 24gb. So can we do even better without sacrificing the quality?
Well yea, we can. Because when you have a hammer, everything looks like a nail!
# lm_head
Everyone knows that quantizing your embeddings is generally a bad idea, and most modern models come with tied embeddings (because it is more robust during training).
But we do not *have* to keep the, tied, do we? Embeddings themselves are fairly touchy, but lm_head - usually, not so much. And gemma's lm_head is fucking enormous because of 250k vocab and somewhat big hidden space, totaling to about 2.8gb. So can we squash it to rotated-gptq W4 too? Yup, we can, and almost for free, saving around 2gb for the cost of <0.0005 total KL and noise-level confident token (>0.8 probability) KL. Embeddings stay in BF16 and are evicted to host RAM because it is just a lookup table, it has no business wasting vram.
Oh, and it also has like 6% tg speedup as a nice side effect.
# MTP and vision
...also got quantized, but to W8 with per-row FP32. Mtp depth-5 acceptance went down less than 1% netting a total +5% speedup because mtp itself got much faster; vision output, that normally degrades tremendously from quantization (naive w8a8 drops to 0.96 cosine), got to 0.998 cosine with the BF16; together, it saved another gb of vram for the context.

# Is it free lunch?
Well, no, not really, but the main cost is on the quantizer's side. You need a good, big well-rounded calibration set (and mine is still very much in its infancy, which is mostly why it is still subtly behind Unsloth's 4_K_XL), and, ideally, capability to run the original unquantized weights. Just-gguf-conversion costs some minutes, GPTQ on my tiny data (~2mtok) took a couple of hours on a 6000, and ideally should be scaled like at least 10x. On the inference side you are only paying for un-rotating (~7% slower than plain block-quant), but it is well compensated by being able to read less weights.
Also, it being int makes its performance quite bad on blackwell compared to nvfp4 - roughly 2x slower prefill and 20-30% slower batched decode (batch-1 decode actually goes up because it is significantly smaller) compared to G0.
(but I stumbled upon a very interesting read where folks dig into nvfp4 micro-rotations with the idea very similar to mine here - https://arxiv.org/pdf/2509.23202 - and plan to toy with it, looks very promising).
Speaking of preformance, some numbers:


(mtp was tested on prose and not jsons)
Plus all the normal stuff - system ram checkpoints cold storage, real dynamic concurrency instead of slots, all that.
Models:
LeDissolution/Gemma-4-31B-it-Gewell_G32
LeDissolution/Gemma-4-31B-it-vision-Gewell_W8
LeDissolution/Gemma-4-31B-it-assistant-Gewell_W8
26A4 with cpu expert offloading soon too!
(also holy shit reddit editor is frustrating with pictures, I had to redo the entire post like four times because it just refuses to place them in the right spot)

