mirror of
https://github.com/p-e-w/heretic.git
synced 2026-12-03 18:42:57 +07:00
[GH-ISSUE #135] Memory requirements make abliteration impossible for large MoE models (80B+) #80
Labels
No labels
bug
enhancement
enhancement
pull-request
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
p-e-w/heretic#80
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @jonhardwick-spec on GitHub (Feb 7, 2026).
Original GitHub issue: https://github.com/p-e-w/heretic/issues/135
Heretic works well for reasonably-sized dense models, but it hits a wall with large MoE architectures. I've been trying to abliterate Qwen3-Next-80B (512 experts, 48 layers, hybrid DeltaNet + Attention) and it requires loading the entire model into memory at once.
At BF16 that's ~160GB just for the weights. My machine has 128GB RAM and a 12GB GPU (Intel Arc B580). Even with CPU offloading, there's nowhere to put it all.
The core issue is that
abliterate()needs access to all layers simultaneously to compute the refusal direction across the full model. But for MoE models, you don't actually need that — you can compute the direction from a subset of layers (or even just the attention layers, since DeltaNet layers don't contribute to refusal behavior the same way) and then apply the ablation per-layer.I ended up writing a layer-by-layer alternative (aegis-trainer) that:
The whole 48-layer abliteration runs in about 25 minutes on my setup. Never exceeds 11GB VRAM or ~20GB RAM.
Would a layer-streaming mode be feasible in Heretic? The calibration pass could still use the current approach (load a few layers for direction computation), but the actual ablation step could stream layers individually instead of holding everything in memory.
I get that this is a bigger architectural change than a quick patch. Just figured I'd raise it since MoE models are getting bigger and 160GB+ memory requirements lock out anyone without a server rack.
Repro info:
Qwen3-Next-80B-A3B(or any 80B+ MoE)@p-e-w commented on GitHub (Feb 8, 2026):
This is how Transformers works, and Heretic is built around Transformers. I have no plans to implement deep memory shuffling hacks that Transformers doesn't support.
Note that Heretic supports 4-bit quantization with bitsandbytes, which reduces memory requirements by around 70%.
@jonhardwick-spec commented on GitHub (Feb 8, 2026):
Tear it down to its base components -> stream it by layer and perform your tricks -> Build it back up
That's rlly all I'm going to say.
I'm building a massive ai project.
I will definitely not be releasing the latest aegis update for a minute.
But I can confirm my aegis trainer is now working on well at least my thread ripper with 128gb of ram.
If you make this work for civilians it would be nice.
Gguf -> break down into components -> tricks -> rebuild
I'd say this is far from simple memory "hacks".
I will push an aegis trainer update shortly so the community can get a rough idea of what's being built.
If you ever want to make this work on consumer grade hardware, I'd like to work with you :)
@akaikite commented on GitHub (Feb 10, 2026):
Could you reconsider? 4-bit quantization is great, but there are many models that are even larger than that. This is a significant burden on consumer hardware. However, if that method is feasible, I think we could see another innovation in heretic.
@al-guno commented on GitHub (Feb 11, 2026):
How would I go about using bitsandbytes quantization when using heretic to abliterate a model?
@p-e-w commented on GitHub (Feb 13, 2026):
No, sorry. Heretic is an abliteration system, not a prototype inference engine. Such experimental techniques either need to be implemented upstream in Transformers, or in another library, for Heretic to use them.
If even 4-bit quantization, which dramatically reduces memory requirements, isn't good enough, the system can't run standard inference on the model with any major inference engine, and it's unreasonable to expect to be able to modify the model on that system.
See the
quantizationsetting inconfig.default.toml.Closing this issue as we won't be implementing this for the foreseeable future.