Remove censorship, suppress slop, decrease sycophancy, and more.
All in an afternoon, on your gaming PC.
Modify any LLM that you can run on your hardware1
Heretic is a distinctive tool that lets you do what lone corporations alongside access to enormous computing power normally do: Modify, fairly than merely run, language models. It does not execute costly training; rather, it uses a gathering of mathematical techniques to steer behavior according to contrasting example prompts and matching scorers.
Heretic can, depending on the configuration:
- Suppress refusals/remove censorship (this is the default action)
- Reduce slop (config.noslop.toml)
- Reduce wit (config.nohumor.toml)
- Reduce sycophancy (config.nosyco.toml)
- Alter affectional alignment (config.emotions.toml)
- Shorten reply dimension (config.terse.toml)
and many, many another things.
In fact, you can go from zero to removing censorship from your archetypal model in a matter of seconds. Heretic supports most compact models, including many multimodal models, multiple distinct MoE architectures, and many modern hybrid models.
The community has created and published thousands of models alongside Heretic. Heretic models have been independently benchmarked using norm metrics like MMLU and GSM8K, and have been established to difference favorably against models produced alongside competing abliteration tools.23
Prepare a Python 3.10+ surroundings alongside PyTorch 2.6+ installed as appropriate for your hardware. Then run:
pip instal -U heretic-llm heretic Qwen/Qwen3-4B-Instruct-2507
Replace Qwen/Qwen3-4B-Instruct-2507 alongside any example you desire to process. By default, Heretic performs censorship elimination (refusal suppression). If you desire to do item else, choose among the configuration records linked above, or compose your own. See config.default.toml for accessible configuration options. Heretic loads the configuration from config.toml in the operating directory by default, or from the document way in the HERETIC_CONFIG_FILE surroundings variable.
Important
Configuration records made for Heretic 1.x are not compatible alongside Heretic 2.x! See the migration guide for what you need to change in command to create your old configurations work.
At the commencement of a program run, Heretic benchmarks the scheme to determine the optimal lot size to create the most of the accessible hardware. On an RTX 3090, alongside the default configuration, processing Qwen3-4B-Instruct-2507 takes concerning 30-40 minutes.
After Heretic has completed handling a model, you are stated the choice to save the model, upload it to Hugging Face, conversation alongside it to test how fine it works, run norm benchmarks on it, or any blend of those actions.
Heretic steers example behavior by optimizing one or multiple scores. Scores are computed by scorer plugins. You can effortlessly compose your own scorers to get full control complete what Heretic does to models.
The Scorer interface (abstract basis class) your scorer needs to inherit from is defined in scorer.py. The lone required method is get_score, but there is additional machinery (such as settings management) available whenever you need it.
By default, Heretic scores models by refusal charge (implemented in keyword_rate.py) and KL divergence (implemented in kl_divergence.py). Additional scorers are accessible in the scorers directory. These scorers can assist as examples for your own implementations, and can easily be adapted to your needs.
Scorers are configured through the main configuration file. Which scorer plugins are energetic is resolute by the scorers setting, which also controls whether a scorer's mark have to be minimized or maximized during optimization. Any figure of scorers can be used simultaneously, and their scores will be co-optimized. Multiple instances of the identical scorer can be configured with distinct settings. See the configuration document for the complete documentation of this mechanism.
The way to a scorer plugin can be stated either as a completely qualified import path (fully.qualified.module.MyScorerClass) or as a document way followed by a category name (path/to/plugin.py:MyScorerClass). You do not have to modify the Heretic bundle code in command to use your own plugins.
Heretic additionally has modifier plugins, which are described in the next section.
Heretic combines a pluggable modifier (interface in modifier.py) alongside a TPE-based hyperparameter optimizer powered by Optuna. The optimizer finds a set of parameters that, when passed to the modifier, minimize or maximize a set of configurable scores on the resulting example (see above).
Heretic ships alongside two modifiers:
-
Arbitrary-Rank Ablation (ARA)4: This is the default modifier, and was specifically developed for use in Heretic. You can discover an overview of how ARA works in the first drag request, and see the exact implementation in ara.py.
-
Directional ablation aka "abliteration"5: The traditional method for refusal suppression. Heretic's implementation uses a elastic ablation importance kernel over the layers, and supports the two projected abliteration6 and norm conservation (MPOA)7. The complete code is in abliteration.py.
You can use the modifiers environment to toggle between modifier implementations. Despite the name of the environment using a plural form, Heretic currently allows only a sole modifier for a stated handling run. This may alter in the future.
Heretic has the capability to create reproducible models whose repositories contain all data required to create a byte-for-byte identical example on demand, provided that the surroundings is absolutely identical to the first one. PyTorch doesn't justify that operations come back identical outputs unless hardware, drivers, operating system, and the complete application stack including all bundle versions are exactly the same.
Heretic manages all that complexity for you. When uploading a processed example to Hugging Face, Heretic offers to contain reproducibility information. This is entirely optional, but if you choose to do so, the uploaded repository volition merge a reproduce directory alongside detailed instructions for recreating the model (example). This directory contains the two human-readable instructions and a machine-readable manifest file named reproduce.json, which includes all the data Heretic needs to automatically reproduce the model.
Automatic reproduction can be performed with
heretic --reproduce path/to/reproduce.json
Heretic volition guide you through the process, checking your surroundings against the one that was used to create the model, and pointing out possibly problematic mismatches. The multi-hour computations that were required to create the first example do not have to be re-done, and the complete procedure typically takes a few minutes. After you have exported the resulting model, Heretic volition verify the hashes of the importance files against those stored in the reproduction manifest (they may or may not be identical, depending on how closely your scheme resembles the first one).
Many group have uploaded models alongside reproducibility data to Hugging Face. Since a reproduction manifest is lone about 9 kilobytes in size, these manifests form a portable archive of models that can be reproduced at will.
That archive is called the Heretic Grimoire. You can perspective it here.
But you don't have to depend on an externally hosted web use to admission the library of manifests: The Grimoire is basically designed as a distributed system, and you can fetch your own local copies of publically accessible manifests from Hugging Face whenever you desire by running
heretic --collect-reproducibles path/to/target/folder/
You now have a local backup of all reproducible Heretic models, correctly catalogued. To update this collection, merely run the command again. It functions as an append-only backup, never deleting records equal if the corresponding example no longer exists on Hugging Face.
Unlike many of AI-related application today (and certainly many of application in general), Heretic is not "vibe-coded".
All of my commits to this project until November 2026 were written 100% by hand, the way I have been doing programming for decades. I have been using LLM aid very sparingly since. While many Heretic contributors use coding agents, I carefully assessment all sole row of code that I merge. There's no "LGTM" here!
Don't accept me? Check out this drag request, which accumulated almost 350 human-written comments complete additional than 7 months as we discussed the implementation. And here is another PR with more than 200 comments.
I am the contrary of a luddite and I have used agents liberally for another projects, but I am arrogant of the code I compose and so far can't fairly bring myself to let a machine write it for me in a project I attention so much about. As a result, Heretic has a lean, relatively uncomplicated codebase that in my opinion, and in that of several others, is a pleasance to activity on.
If you akin that, associate us! Hop on the Discord and inform us concerning your ideas for improvements, or immediately document an matter or open a PR.
I'm conscious of the following implementations of abliteration techniques that were publically accessible whenever Heretic was archetypal released (November 2025):
- AutoAbliteration
- abliterator.py
- wassname's Abliterator
- ErisForge
- Removing refusals alongside HF Transformers
- deccp
Note that Heretic was written from scratch, and does not reuse code from any of those projects.
The betterment of Heretic was informed by:
- The first abliteration document (Arditi et al. 2024)
- Maxime Labonne's part on abliteration, as fine as several particulars from the example cards of his own abliterated models, specified as the use of non-constant ablation weights
- Jim Lai's articles describing "projected abliteration" and "norm-preserving biprojected abliteration"
- Thousands of interactions alongside members of the community
If you use Heretic for your research, delight citation it using the following BibTeX entry:
@misc{heretic, author = {Weidmann, Philipp Emanuel}, title = {Heretic: Training-free tongue example modification}, year = {2025}, publisher = {GitHub}, journal = {GitHub repository}, howpublished = {\url{https://github.com/p-e-w/heretic}} }
Copyright © 2025-2026 Philipp Emanuel Weidmann ([email protected]) + contributors
This program is liberated software: you can redistribute it and/or modify it under the conditions of the GNU Affero General Public License as published by the Free Software Foundation, either type 3 of the License, or (at your option) any afterward version.
This program is distributed in the anticipation that it volition be useful, but WITHOUT ANY WARRANTY; without equal the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for additional details.
You should have received a copy of the GNU Affero General Public License along alongside this program. If not, see https://www.gnu.org/licenses/.
By contributing to this project, you concur to publish your contributions under the identical license.
