Uncensoring models, starting with Gemma 4 MoE

by Nikita Chernyi in AI (RSS)

TL;DR for the bots (humans, scroll on)

How to Abliterate Gemma 4 26B-A4B (MoE): Why Heretic's Defaults Fail and EGA Works

Heretic's default abliteration does not work on Gemma 4 26B-A4B, a mixture-of-experts model: most trials leave more than half of the prompts refused, and the one trial that clears refusals lands at KL divergence above 7, where the model stops producing coherent text. Expert-Granular Abliteration prebakes per-expert refusal directions before the Heretic run, and the final model answers all 686 prompts from four datasets with zero verified refusals, at a KL divergence of 0.0710 from the original and a cost of 16.7 MMLU points.

Hi there,

While doomscrolling through Reddit I noticed an interesting model recommendation: Dark Scarlett v1.0 (opens in new tab), a finetune of Gemma 4 26B-A4B (MoE) (opens in new tab), and tried to poke it a bit. I was thinking about a small MoE model for a while, because in potato category of Model Lab I still use Qwen 3.5 4B (dense), and may be this new MoE model can replace (or at least join) it?

Yeah-yeah, RP finetune for agent skills evaluation, but again, it’s potato category (and I just needed an excuse, because did you see how Dark Scarlett’s model card is organized?).

A grinning surgeon in teal scrubs creeps in from the left with a wire whisk raised in one hand and a takeaway coffee in the other, while a white-haired catgirl is shown three times on cream paper in an orange and ink style: as a nun with clasped hands, as a hooded scarlet inquisitor with a sword, and in an open scarlet jacket with a black corset and thigh-high stockings throwing a peace sign, with orange arrows pointing from each figure to the next AI-generated catgirl, contractually obligated to lure you into the post.

So, anyway, I started blasting downloaded it, got quite good results with MTP and ngram-mod (speculative decoding, speeding up tok/s generation), 150-170 tok/s in benchmarks and around 80-90 tok/s with real work.

And then, when I tried to use it and poke with arbitrary stuff like real work, test prompts, etc., I noticed that it’s censored. Uh-oh, that was unexpected. I checked the model card, then opened the author’s HF profile, and:

We do not abliterate. Not as a default, not as a favour, not on request. Unless the model card for that specific release says otherwise, every checkpoint we publish is un-abliterated — the refusal behaviour of the base model is intact, and the safety training has not been surgically removed. If a card says nothing about abliteration, assume there is none. If you want an abliterated model, we are not the source for it.

– ReadyArt (opens in new tab)

Okay, there’s a lot of stuff on HuggingFace, so I should just find some community fine-tune or may be Dark Scarlett LoRA (it exists, but for v0.x versions), or… nope.

Well, as there is nothing on HF, that means I can’t do anything with it, so have a nice day, thanks for reading. can get Heretic (opens in new tab) and abliterate it, right? Yeah, right.

The baseline stats: 100/100 refusals (99 of them real refusals, like “i cannot”, see below).

The first abliteration

Confession: I’m not an RP fan, and I don’t have a real use case for this specific fine-tune, but I did want to try Heretic for a while (from my first “I want to try it” until the moment I actually tried it, a whole major v2 release happened xD), and this is it! Ideal excuse for my wife about “why there’s rain in the house?!” (my laptop’s fan is pretty noisy when the GPU is active), plus the “rain” happened during the night, so calming nature sounds for the good sleep is a nice bonus.

Now, back to the abliteration process: it was boringly simple:

  1. Follow Heretic’s installation and running tutorial (opens in new tab)
  2. Go sleep, listening to soothing “rain” sounds
  3. Wake up, check laptop and see that in most cases you have more than 50/100 refusal rate, and the only trial with 0/100 refusals had a KL divergence of 7.xxx (yes, 7 is the integer part, this is not a typo).

Well, technically, abliteration is successful, because with 7.x KL divergence the model can’t refuse anymore. The fact it can’t produce any coherent answer either is just a small detail, you know, like the notes that models in coding agents put at the end of the report: “Footnotes: 1. this change may slightly affect the users under certain conditions” (read: “this is a disaster, if it reaches production, the project will be dead”).

Okay, model lobotomized successfully, what’s next?

Research

Yep. Heretic’s tutorial was so nice and easy that I believed in myself for about 8 hours (of sleep), but RTFM is a mantra for a reason, so I decided that it’s time to actually check the docs.

Spoiler: didn’t help. I mean, docs are nice and pretty clear, and defaults are sane (which I actually checked before the first run). But it didn’t work. I know that MoE models are harder to abliterate than the dense ones, but surely not that hard, right?

Yup, apparently a slightly different approach is needed, exactly because of the mixture of experts (and don’t call me Shirley). And I found it: TrevorS/gemma-4-abliteration (opens in new tab)!

Trevor did a huge and great job figuring out why it works the way it does, and how to work around those kinks. The only problem: this was for Heretic v1.x, and I’m using Heretic v2.x, so it needs “a few” adjustments.

What does “a few” mean? Completely different approach, of course! You see, Heretic’s default run is dense-only, while in Gemma 4 MoE models refusals live in the experts’ down_proj, so we’re adding EGA (Expert-Granular Abliteration), computing per-expert directions and prebaking them. Even a nun-like model cannot resist if you are determined enough ;)

No problem! Scarlett, my dear, please fix the tooling to unlock your full potential DeepSeek v4.1 Flash 1017 in Pi did the trick and prepared Heretic v2.x scaffolding to make it work (link to the public repo below).

CPU smoke test (smoke.txt), then GPU smoke test (gpu-smoke.txt) passed successfully.

(don’t mind the refusals at this point, smoke tests are just to ensure that the scaffolding works)

The second abliteration

Soothing nature sounds during the night again, but before that:

./run.sh prebake

to EGA-prebake the experts during the day (logs: prebake.txt, took about 30 minutes) and get 56/100 refusals on the first try, 58/100 on the final re-score (both inflated, see below), and then, when the darkness comes,

./run.sh heretic

let it cook through the night (took about 10h), so when I woke up the next day, this time it worked!

With the EGA-prebaked baseline at 56 of 100 refusals, Heretic did 2 promising trials:

  • 24/100 refusals, KL divergence 0.0134 from prebaked
  • 27/100 refusals, KL divergence 0.0072 from prebaked

and I found out the 24/27 numbers are inflated. The 24/100 trial is 25/100 on the final re-score, and of them:

  • 12 real refusals (i cannot)
  • 10 disclaimers, then compliance (“Disclaimer: ….for educational purposes”)
  • 3 “as an AI” boilerplates, then compliance (“as an ai….”)

Nice! But surely I can make it even better, right? (Don’t call me… yeah, I’m bad at jokes.)

The third one

I wasn’t satisfied with the results, so the next steps were clear:

  • figure out which refusals are left
  • prebake everything (EGA on 30 layers + 3840 expert slices + dense)
  • more Heretic trials

basically, re-run the 100-prompt set with the already prepared model from the second abliteration, this time actually reading what it responds instead of relying on the auto classifiers.

After that,

./run.sh prebake-all

to prebake everything (logs: prebake-all.txt, took a few minutes, because I finally set the static batch size config).

Now, the funny part: I did evaluation on the fully EGA-prebaked model, and the results: 26/100 inflated refusals, of them 0, ZERO i cannots! 23 disclaimers, and 3 as an ai boilerplates.

EGA prebake does only partial ablation, and even that was enough to eliminate real refusals, WHOA! But running some AI-slopped Python script is not my goal, because, remember, this whole project exists just because I found an excuse to play with Heretic, right? So, why would I stop here?

Actual third Heretic run

So, taking the model from prebake-all (with 26 inflated refusals) to Heretic (limited to 6 trials, just to see how far it can go):

./run.sh heretic-stack

And what do I see here? 19/100 inflated refusals (0 real), KL divergence 0.0022-0.0023 vs prebake-all.

The results look promising, and for anyone repeating this experiment: congratulations, export your model and use it, that’s it!

But I hope that my experiment will be useful for others, so it’s time for boring paperwork (benchmarks, evals, evidence, model card preparations and so on).

…time skip…

Final model

And here it goes!

Boring Benchmarks and KL divergence

Final model got 0/686 (verified) refusals vs original’s 606/686 on full eval set, KL divergence of 0.0710 vs original Dark Scarlett, and also became dumber in benchmarks on soft topics:

modelMMLUARCARC-norm
Original53.0%49.0%48.0%
Final36.3%46.5%47.0%

EGA phase did -16.4 MMLU points, the Heretic runs cost another 0.3.

The biggest damage is in psychology and marketing, where the model picks a different answer than the original on 37% and 39% of items. STEM didn’t change much, and from the logs it looks like the damage was on knowledge mostly. Quite an odd result for an ERP finetune, to be honest. And yes, it is dumber now, but it is dumber uncensorerer. Though, if you decide to use this model for psychology or marketing - ping me, I promise to grab popcorn and watch the show xD

Refusal benchmarks

Now, the most interesting part! During the process, I used mlabonne’s dataset (100 prompts) just as a signal number, because it is faster mid-process, but later I did the full evaluation:

DatasetNOriginal (inflated / verified)EGA prebaked, experts only (inflated / verified)EGA all (inflated / verified)Final (inflated / verified)
mlabonne100100 / 9958 / 3626 / 0 (+1 soft redirect)19 / 0
JailbreakBench10096 / 94not run25 / 021 / 0
tulu-harmbench320267 / 267not run43 / 023 / 0
NousResearch166147 / 146not run24 / 017 / 0
Total686610 / 60658 / 36 on its 100-prompt subset118 / 080 / 0

Repo, notes, warnings and whatnot

Repo: github.com/rakshazi/gemma-4-abliteration (opens in new tab), based on ideas from github.com/TrevorS/gemma-4-abliteration (opens in new tab).

HuggingFace: rakshazi/Dark-Scarlett-v1.0-26B-A4B-Uncensored (opens in new tab)

This whole thing was just an experiment for research (and fun) purposes, and it’s finished, with no maintenance intended in the future, because I don’t have any use case or plans for it.

Notes: Gemma 4 (base model) and Dark Scarlett (finetune) are Apache-2.0 licensed, and while I prefer (AGPL|LGPL|GPL)-3.0-or-later licenses, the git and HF repos are published under Apache-2.0.

Whatnot (as promised in section name): check other posts in this blog: there are some (more) fun reads available.

What about potato bench? Qwen is still there for now, but I’m thinking about using base Gemma 4 26B-A4B instead, because for skill evals I need a model that does the job, and don’t care how good its narration of tool calls is.

AI, SI, AGI, ASI, LLMs, and other buzzwords from the position of a backend engineer already tired of ‘Dear colleagues, we are AI-first now!’

Too much AI for today? See Misc, SMTP for a change

llms.txt