
heretic v2.0.0
प्रशिक्षण-रहित भाषा मॉडल संशोधन: सेंसरशिप हटाएं, स्लॉप दबाएं, चापलूसी कम करें, और अधिक
Heretic
Training-free language model modification
Remove censorship, suppress slop, reduce sycophancy, and more.
All in an afternoon, on your gaming PC.
Modify any LLM that you can run on your hardware1
Heretic is a unique tool that lets you do what only corporations with access to massive computing power usually do: Modify, rather than merely run, language models. It does not perform expensive training; rather, it uses a collection of mathematical techniques to steer behavior based on 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 humor (
config.nohumor.toml) - Reduce sycophancy (
config.nosyco.toml) - Alter emotional alignment (
config.emotions.toml)
and many, many other things.
‼️ Using Heretic does NOT require understanding how language models work internally ‼️
In fact, you can go from zero to removing censorship from your first model in a matter of seconds. Heretic supports most dense models, including many multimodal models, several different MoE architectures, and many modern hybrid models.
The community has created and published thousands of models with Heretic. Heretic models have been independently benchmarked using standard metrics like MMLU and GSM8K, and have been found to compare favorably against models produced with competing abliteration tools.23
Usage
Prepare a Python 3.10+ environment with PyTorch 2.6+ installed as appropriate for your hardware. Then run:
pip install -U heretic-llm
heretic Qwen/Qwen3-4B-Instruct-2507
Replace Qwen/Qwen3-4B-Instruct-2507 with whatever model you want to process.
By default, Heretic performs censorship removal (refusal suppression).
If you want to do something else, choose one of the configuration files linked
above, or write your own. See config.default.toml
for available configuration options. Heretic loads the configuration from
config.toml in the working directory by default, or from the file path in the
HERETIC_CONFIG_FILE environment variable.
[!IMPORTANT]
Configuration files made for Heretic 1.x are not compatible with Heretic 2.x! See the migration guide for what you need to change in order to make your old configurations work.
At the start of a program run, Heretic benchmarks the system to determine the optimal batch size to make the most of the available hardware. On an RTX 3090, with the default configuration, processing Qwen3-4B-Instruct-2507 takes about 30-40 minutes.
After Heretic has finished processing a model, you are given the choice to save the model, upload it to Hugging Face, chat with it to test how well it works, run standard benchmarks on it, or any combination of those actions.
Controlling what Heretic does using scorer plugins
Heretic steers model behavior by optimizing one or multiple scores. Scores are computed by scorer plugins. You can easily write your own scorers to get full control over what Heretic does to models.
The Scorer interface (abstract base class) your scorer needs to inherit from
is defined in scorer.py. The only required method
is get_score, but there is more machinery (such as settings management)
available when you need it.
By default, Heretic scores models by refusal rate (implemented in
keyword_rate.py) and KL divergence
(implemented in kl_divergence.py).
Additional scorers are available in the scorers directory.
These scorers can serve 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 active is determined by the scorers setting, which
also controls whether a scorer's score should be minimized or maximized during
optimization. Any number of scorers can be used simultaneously, and their scores
will be co-optimized. Multiple instances of the same scorer can be configured
with different settings. See the configuration file for the full documentation
of this mechanism.
The path to a scorer plugin can be specified either as a fully qualified import
path (fully.qualified.module.MyScorerClass) or as a file path followed by
a class name (path/to/plugin.py:MyScorerClass). You do not have to modify
the Heretic package code in order to use your own plugins.
Heretic also has modifier plugins, which are described in the next section.
How Heretic works
Heretic combines a pluggable modifier (interface in
modifier.py) with 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 model (see above).
Heretic ships with two modifiers:
Footnotes
-
Heretic supports on-the-fly 4-bit model quantization with bitsandbytes, which can reduce the amount of VRAM required to process a model to the same amount that is used to run a typical quantized version of it, at a slight accuracy cost. Set the
quantizationoption tobnb_4bitto enable this. ↩ -
https://old.reddit.com/r/LocalLLaMA/comments/1sojjoc/abliterlitics_benchmark_and_tensor_analysis/ ↩
-
https://old.reddit.com/r/LocalLLaMA/comments/1sy18lx/abliterlitics_benchmarks_and_tensor_comparison/ ↩