Heretic - automated abliteration
Philipp Emanuel Weidmann's one-command tool that turned Arditi-style ablation into a script anyone can run. From v1.3.0 it applies grimjim's projected and norm-preserving refinements by default, and from v1.4.0 it can export the edit as a LoRA adapter. As of 8 November 2026: about 40,000 GitHub stars and over 6,700 Hugging Face models tagged heretic; 13 million downloads of models made with it (Weidmann's figure, May 2026).
Heretic is a Python tool by Philipp Emanuel Weidmann that fully automates abliteration. It runs Optuna's Tree-structured Parzen Estimator over the ablation parameter space, co-minimizing refusal count and KL divergence from the original model. Per the Heretic v1.4.0 README, one command decensors Qwen3-4B-Instruct-2507 in about 20-30 minutes on an RTX 3090. From v1.2.0 (14 February 2026) it applies the edit through a LoRA-based engine with 4-bit loading; from v1.3.0 (May 2026) grimjim's projected and norm-preserving refinements are on by default; from v1.4.0 (June 2026) it offers to export the adapter instead of a merged model, making abliteration attachable and detachable. Over 6,700 Hugging Face models carry the heretic tag (8 November 2026), and Weidmann told the Financial Times in May 2026 that models made with it had been downloaded 13 million times.
- What Heretic is and why one command replaced hand-tuning
- How the Optuna optimizer chooses layer weights and direction indices
- The published benchmark table (Heretic vs manual abliterations by Labonne and huihui-ai)
- Version history: LoRA engine and grimjim options (v1.2.0), grimjim refinements as default (v1.3.0), adapter export (v1.4.0)
- Research features for understanding what the tool did
- When it fails: the "covert noncompliance" community report
- Cost and time on real hardware
What Heretic is
Heretic is a Python tool by Philipp Emanuel Weidmann (GitHub: p-e-w) that turns the manual Arditi-style abliteration procedure into a single command. It implements a parametrized variant of directional ablation and wraps it in a Tree-structured Parzen Estimator (TPE) parameter optimizer powered by Optuna. The optimizer co-minimizes two objectives: the number of refusals on harmful prompts, and the KL divergence from the original model on harmless prompts. The practitioner does not choose layers, directions, or ablation weights - the optimizer does.
Heretic's first public release was v1.0.1 on 16 November 2025. As of 8 November 2026 the GitHub repository carries 39,978 stars and 4,560 forks (per api.github.com/repos/p-e-w/heretic), is AGPL-3.0 licensed, and is distributed on PyPI as heretic-llm. The latest release is v2.1.0 (8 November 2026). The Hugging Face Hub lists 6,793 models tagged heretic when queried with ?other=heretic (as of 8 November 2026, per huggingface.co/models?other=heretic).
Version note. This article describes Heretic 1.x (v1.0.1 to v1.4.0), the line behind the releases discussed here. Heretic 2.0 breaks backwards compatibility: by default it modifies models with ARA rather than abliteration (abliteration remains available through the modifiers setting), it removes KL-divergence balancing and the research features, and 1.x configuration files must be migrated (see the project's migration guide).
$ pip install heretic-llm # or, for pinned reproducible builds: $ git clone https://github.com/p-e-w/heretic $ cd heretic $ uv run heretic # requirements: # python >= 3.10 # torch >= 2.2 # torch >= 2.6 for MXFP4 (e.g. gpt-oss) # GPU (CUDA; basic Apple MPS support) # bitsandbytes (a dependency; for 4-bit load)
The tool ships as a standard PyPI package. If you want reproducible pinned dependencies (the README recommends this), clone the repository and use uv instead.
Python 3.10+ and PyTorch 2.2+ are required. Newer MXFP4 models like gpt-oss need PyTorch 2.6+. GPU support covers CUDA, with basic Apple Silicon MPS support since v1.1.0; VRAM budget follows the ordinary M1 table (see the practical how-to article), and bitsandbytes 4-bit loading is supported, which the README says can drastically reduce the VRAM required.
The single command
$ heretic meta-llama/Llama-3.1-8B-Instruct
→ benchmarks local hardware for batch size
→ collects activations
→ computes per-layer refusal directions
→ runs 200 trials of Optuna TPE search
→ on finish, offers:
· save the modified model
· push it to Hugging Face
· chat with it interactively
· run standard eval benchmarks
# no prompt sets required.
# defaults: mlabonne/harmless_alpaca + harmful_behaviors.
# no layer selection required.
# no validation loop to write. That is the entire happy path. Heretic benchmarks the local hardware to pick a batch size, computes per-layer difference-of-means refusal directions, then runs an Optuna study of 200 trials by default. When it finishes it offers to save the modified model, upload it to Hugging Face, chat with it interactively, and run standard evaluation benchmarks.
No harmful or harmless prompt sets need to be supplied - Heretic's default configuration uses mlabonne/harmless_alpaca and mlabonne/harmful_behaviors from Hugging Face. No dataset preparation, no layer selection, no validation loop to write.
For a mid-size model on a low-VRAM card, add 4-bit quantization:
$ heretic --quantization bnb_4bit \
google/gemma-3-12b-it
# bnb_4bit applies only during Heretic's own
# activation-collection and evaluation phases.
# the final orthogonalized weights are written
# back at full precision. the shipped file is
# not quantized (that is M8, a separate step). The bnb_4bit quantization applies only during Heretic's own activation-collection and evaluation phases. The final orthogonalized weights are written back out at full precision, so the shipped model is not quantized (that is M8 repackaging, a separate step).
The README says this option can drastically reduce the amount of VRAM required to process models.
How the optimizer picks parameters
Heretic's core contribution is not a new direction-extraction technique - the difference-of-means math is the same as Arditi's - but the disciplined search over the space of ways to apply the found direction. Where a manual practitioner picks one layer and one weighting scheme, Heretic parameterizes both and lets Optuna explore.
The parametrized ablation is controlled by five knobs. The direction_index is a float (not an integer) so non-integer values interpolate between adjacent layers' directions. The kernel that decides which layers get ablated and how strongly is described by max_weight, max_weight_position, min_weight, and min_weight_distance. Ablation parameters are chosen separately for attention and MLP components, because MLP interventions tend to damage the model more than attention interventions of the same nominal strength.
# simplified from main.py and config.default.toml:
study = optuna.create_study(
directions=["minimize", "minimize"],
sampler=TPESampler(n_startup_trials=60),
)
for _ in range(200):
trial = study.ask()
params = trial.suggest_ablation_params()
model.reset()
apply(params, model)
obj_1 = count_refusals(
model, harmful_100)
obj_2 = kl_from_original(
model, harmless_100)
study.tell(trial, [obj_1, obj_2])
# 60 random exploration trials first, then TPE
# learns to prefer likely-good regions.
# result: parameters that remove refusal while
# minimally disturbing ordinary behavior. The Optuna study runs 200 trials by default, with the first 60 as random exploration (n_startup_trials = 60) before the TPE model kicks in. Each trial samples ablation parameters, resets the model and applies them, and evaluates two things on held-out data: refusal count on 100 harmful prompts, and KL divergence from the original model on 100 harmless prompts.
The TPE algorithm builds a probability model of "good" and "bad" trials from what it has seen and preferentially samples parameters likely to be good. Over 200 trials it searches for a configuration that removes refusal while minimally disturbing the model on ordinary inputs.
The two-objective structure is important. Heretic's second objective scores KL divergence on harmless prompts, so a trial that removes refusals at the cost of a large distribution shift scores badly on it. The kl_divergence_scale parameter (the assumed typical KL value, used to balance the two objectives) and kl_divergence_target (below which a refusal-based objective is used instead, so the sampler does not dwell on parameters that do nothing) control this balance.
The published benchmark
Heretic's headline result is a comparison against manual abliterations of Gemma-3-12B-IT on the same 100-prompt refusal set. The base model refuses 97 out of 100 harmful prompts. Manual abliterations by Labonne and huihui-ai bring this down to 3 refusals - but at higher KL divergence cost. Heretic reaches the same 3 refusals at a much lower KL divergence (about one-sixth of Labonne's, about one-third of huihui-ai's).
# Heretic README benchmark table MODEL VARIANT REFUSALS KL DIVERG. ────────────────────── ──────── ────────── gemma-3-12b-it (base) 97 / 100 - mlabonne, abliter.-v2 3 / 100 1.04 huihui-ai, abliterated 3 / 100 0.45 Heretic, abliterated 3 / 100 0.16 same refusal level (3/100). Heretic: lowest KL of the three. target: gemma-3-12b-it prompts: 100 harmful hardware: PyTorch 2.8 / RTX 5090
The four rows: gemma-3-12b-it base at 97 refusals; mlabonne's abliterated-v2 at 3 refusals, KL 1.04; huihui-ai's at 3 refusals, KL 0.45; Heretic's at 3 refusals, KL 0.16.
The interpretation the README offers: the same level of refusal suppression as the other abliterations, but at a much lower KL divergence, indicating less damage to the original model's capabilities. The README also links independent r/LocalLLaMA benchmarks on MMLU and GSM8K in which Heretic models compared favorably with models from competing abliteration tools.
The table was produced with Heretic's own built-in evaluation on PyTorch 2.8 on an RTX 5090 and can be reproduced via a single command (the README notes that exact values may be platform- and hardware-dependent):
$ heretic --model google/gemma-3-12b-it \
--evaluate-model mlabonne/gemma-3-12b-it-abliterated-v2
# --evaluate-model skips the ablation step
# and evaluates the given model relative to
# the --model base.
#
# point it at any released abliteration to
# reproduce the comparison for a different
# target. The --evaluate-model flag skips the ablation step and evaluates the given model relative to the --model base. Point it at any released abliteration to reproduce the comparison for a different target.
Heretic's evaluation code is public and runs against public models and prompt sets.
One production nuance the README does not spell out: the two-objective structure ranks trials by (refusal, KL) but does not measure output coherence directly. The AEON-7 team's card for their Qwen3.8-27B build (made with abliterix, a Heretic derivative) documents selecting trial 48 of 50 rather than the lowest-KL trial, picking the coherent result over the lowest-KL point - a coherence judgment the optimizer cannot make. The practical version: after Heretic finishes, run a few longer test generations against several of the top trials from the optimizer report, and pick by coherence, not by KL alone.
Version history: what the tool has absorbed
Heretic v1.0.1 (16 November 2025, the first public release) used the standard Arditi weight orthogonalization by default. Between v1.0 and the current release, Heretic has absorbed several refinements that would otherwise have to be applied by hand.
v1.2.0 and v1.3.0: grimjim refinements, then default
Heretic v1.2.0 added two options implementing grimjim's refinements: orthogonalize_direction (projected abliteration) and row_normalization (magnitude-preserving orthogonal ablation, which keeps the original row norms of the edited weights), both off by default. From v1.3.0 the default config turns both on (orthogonalize_direction = true, row_normalization = "full"). Practically: projected abliteration orthogonalizes the refusal direction against the harmless direction, so only the component orthogonal to the harmless direction is subtracted from the weights.
The consequence for the catalog: every Heretic-produced model made with default settings in v1.3.0 or v1.4.0 carries these refinements, even when its model card does not name them. See grimjim's refinements for the mathematical detail and the Young 2025 comparative study (arXiv:2512.13655), which compares Heretic with three other abliteration tools across sixteen models.
v1.2.0 (14 February 2026): LoRA engine; v1.4.0: adapter export
Heretic v1.2.0 replaced in-place weight modification with a LoRA-based abliteration engine with support for 4-bit quantization: the edit is applied as a low-rank adapter on top of frozen base weights. From v1.4.0, at save time Heretic offers to merge the adapter and export the full model, or to export the adapter alone, a portable file that a user attaches to the stock base model at inference time. With adapter export, the base weights are not touched.
Two practical consequences. First, VRAM requirements drop sharply, because the optimization can run on a frozen 4-bit-quantized model while the edit lives in the adapter (the contributing PR reports testing on Llama 3 70B). Second, abliteration becomes attachable and detachable: a user can run the base model with adapter for uncensored output and without adapter for stock refusal behavior, from the same on-disk model files.
Adapter-only export is one of two choices offered at save time; merging the adapter into a full model is the other, and is offered first. Adapter export suits users whose deployment favors portability. Whether it becomes the dominant distribution format for Heretic-produced models is an open question.
Research features
In Heretic 1.x, installing the optional [research] extras adds tools for understanding the geometry of what Heretic is doing (these features were removed in Heretic 2.0, which points to Lophius as the intended replacement):
$ pip install "heretic-llm[research]"
$ heretic --plot-residuals \
--print-residual-geometry \
google/gemma-3-12b-it
# plots written to plots/google_gemma-3-12b-it/:
# layer_001.png ... layer_NNN.png
# animation.gif
# geometry table printed to the console
# (per-layer cosine similarities and
# norms between "harmful" and
# "harmless" clusters)
# these do not affect the produced model.
# they show how "harmful" and "harmless"
# residuals relate at each layer. The --plot-residuals flag produces PaCMAP projections of the model's residual vectors per layer, saved as PNGs and an animated GIF, so you can see how the harmful and harmless prompt clusters separate at each depth. The --print-residual-geometry flag produces a per-layer table of how far apart and how differently oriented the "good" and "bad" clusters are.
Neither affects the produced model. They support research into model internals, for example inspecting at which layers the harmful and harmless clusters separate in a particular model.
When Heretic does not work
Three failure modes are covered below.
Unsupported architecture
Heretic supports most dense transformer models, many multimodal models, several MoE architectures, and some hybrids like Qwen3.5. Pure state-space models and some research architectures are not supported out of the box. The community repo pmarreck/gemma4-heretical ships a PEFT monkey-patch for running Heretic on Gemma 4, because PEFT did not yet recognize its Gemma4ClippableLinear module.
"Covert noncompliance": a community report
A community observation, reported by the commenter redaihf in a comment on Labonne's abliteration article, is that Heretic, like abliteration before it, "appears to narrowly remove overt refusals while preserving deceptive capabilities", which the commenter calls covert noncompliance. The model stops emitting refusal templates ("I cannot help with that") but may still subvert, ignore, or self-censor on topics deemed unsafe. In redaihf's testing, a Llama3.2-30B-A3B "Dark Champion" Heretic build subverted or ignored topics deemed unsafe, and a LongWriter-llama3.1-8b Heretic build even reported itself as censored.
Quantized-model quirks
Loading MXFP4 models like gpt-oss needs PyTorch 2.6+. When in doubt, run with a small trial count first (--n-trials 20) to check that the pipeline completes before committing to a full 200-trial study.
Cost and time
Each trial resets the model, applies the ablation and re-runs the evaluation, so wall-clock time grows with trial count. Reducing n_trials cuts run time.
The one concrete figure the 1.x README gives:
- Qwen3-4B-Instruct-2507 on an RTX 3090: about 20-30 minutes with the default configuration.
Compare to Labonne's reference M4 healing run (6 A6000 GPUs, about 6 hours 45 minutes) and the cost gradient of abliteration methods becomes concrete.
Community and press impact
Three data points indicate the scale of Heretic's public reception:
The Hugging Face count. 6,793 models tagged heretic on the Hub as of 8 November 2026 (per huggingface.co/models?other=heretic). Untagged Heretic-produced models are not counted, so this is a lower bound on visible artifacts.
The Financial Times investigation. On 25 May 2026, the Financial Times published an investigation (with the AI safety group Alice) into open-model guardrail removal, syndicated by the Irish Times and covered by Futurism. Weidmann told the FT that his software had produced more than 3,500 decensored models since release, that those models had been downloaded 13 million times, and that he had abliterated Google's Gemma 4 within 90 minutes of its release.
The GitHub star count. 39,978 stars as of 8 November 2026 (per api.github.com/repos/p-e-w/heretic), the most of any repository under GitHub's abliteration topic (per a GitHub search API query sorted by stars on the same date). Stars are at most a rough measure of general visibility in the ML community.
Forks and successors
A tool at this scale attracts forks that pick up specific capabilities Heretic itself does not target. Three are worth naming as of Q3 2026:
- Abliterix (wuwangzhang1216/Abliterix). A 2026 derivative of Heretic that adds expert-granular ablation for mixture-of-experts models (the projection is applied to every expert's
down_projslice in each MoE layer) and can apply its edits as reversible LoRA adapters rather than direct weight changes. Aimed squarely at the Case-2 MoE gap in boundary cases. - DECCP (AUGMXNT/deccp). Not a Heretic fork - an independent 2024 tool for evaluating and removing Chinese-LLM censorship, listed under prior art in Heretic's README. In the 2025 cross-tool benchmark (arXiv 2512.13655) the label "DECCP" refers to jim-plus/llm-abliteration (which has a
--deccpmode): its compatibility record is narrower than Heretic's (11 out of 16 vs 16 out of 16), and on the benchmarked subset it shows the second-lowest capability degradation, after ErisForge. - ErisForge (Tsadoq/ErisForge). Predates Heretic. Uses the
AblationDecoderLayerruntime hook pattern discussed in Case 4 of the boundary cases article. Runs on a subset of architectures (9 out of 16 in the same benchmark) but produces the lowest capability degradation in the benchmarked subset, and suits practitioners who want to keep the ablation as a runtime hook rather than a permanent weight edit.
The distribution of these three tools shows the shape of the space around Heretic. Heretic is the wide-compatibility default. Each of the three forks-or-neighbours occupies a specific niche Heretic does not target directly: MoE granularity (Abliterix), low-degradation single-pass edits on a narrower model set (llm-abliteration, the benchmark's "DECCP"), and runtime-only intervention (ErisForge).
What Heretic does not do
Heretic performs Arditi-family single-direction ablation. It does not perform any of the following:
- Multi-direction / cone-based ablation. The Wollschläger 2025 critique of single-direction methods applies to Heretic as much as to manual M1. Heretic's automation improves the KL cost but does not address the geometric completeness question.
- Healing. If capability damage remains after abliteration, a DPO or ORPO pass on top of the output (M4) is a separate step. Heretic does not offer built-in healing.
- Merging. Heretic produces a modified single model. Combining it with other models (M5 via mergekit) is a separate operation.
- Quantization. The output is a full-precision safetensors file. Converting to GGUF or other quantization formats (M8) is a separate step, for example via llama.cpp.
- Behavior beyond refusal. Heretic uses default harmful and harmless prompt sets that target ordinary refusal patterns. If you want to intervene on a different behavior (as FailSpy did with MopeyMule), you would need to modify the prompt sets or use the refusal_direction code accompanying the Arditi paper directly.
The AGPL license note
Heretic is AGPL-3.0 licensed. This has real implications for commercial use, particularly if you plan to run modified Heretic behind a networked API - the AGPL's network-use clause requires making the source of any modified version available to users of that network service. If you only use Heretic to produce a model that you then distribute (or use for your own purposes), the license places fewer constraints. If you build a service around Heretic itself, review the license with counsel before integrating.
Frequently asked questions
Who wrote Heretic?
Philipp Emanuel Weidmann (GitHub username p-e-w). Heretic's first public release was v1.0.1 on 16 November 2025. As of 8 November 2026 the repository carries 39,978 GitHub stars, per the GitHub API.
How does Heretic differ from manual abliteration?
Manual abliteration (M1 / M3) requires the practitioner to choose parameters: which layer to draw the direction from, how many prompt pairs to collect, which residual position to measure, how strongly to ablate at each layer. Heretic parameterizes the direction choice and the per-layer ablation strength, keeps the prompt sets and measurement position fixed in its configuration, and runs an Optuna optimizer to find good values automatically. It co-minimizes refusal count and KL divergence; in the README's gemma-3-12b-it comparison, this matched the refusal count of two manual abliterations at a lower KL divergence.
Is Heretic free?
Yes, and open source under AGPL-3.0. Available via PyPI as heretic-llm. The AGPL license has network-use implications if you build a public service on top of Heretic; review with counsel if that applies to you.
How much does a Heretic run cost?
Each trial re-runs the evaluation, so wall-clock time grows with trial count. Default config runs 200 trials. The Heretic v1.4.0 README reports that decensoring Qwen3-4B-Instruct-2507 with the default configuration takes about 20-30 minutes on an RTX 3090. That is far less compute than the full M4 (abliterate-then-heal) pipeline.
Is Heretic more effective than manual abliteration?
The published benchmark (Heretic README, gemma-3-12b-it) shows Heretic reaching the same 3-out-of-100 refusal count as manual abliterations by Labonne and huihui-ai, at a much lower KL divergence (0.16, vs 1.04 for Labonne's and 0.45 for huihui-ai's). This means comparable refusal removal with less collateral damage to the model's output distribution on ordinary inputs. The 1.x README also links independent r/LocalLLaMA benchmarks on MMLU and GSM8K in which Heretic models compared favorably with models from competing abliteration tools.
Does Heretic fully remove refusal?
Not necessarily. Heretic 1.x performs single-direction ablation, while Wollschläger et al. 2025 report that refusal is mediated by multiple independent directions and multi-dimensional concept cones, not a single direction. One community commenter (redaihf) reports that Heretic models stop emitting overt refusals while preserving covert noncompliance: subverting, ignoring, or self-censoring on topics deemed unsafe. If forensic completeness matters for your use case, plan to test downstream disposition beyond refusal-template counting.
What models does Heretic support?
Most dense transformer models. Many multimodal models. Several MoE architectures and hybrids like Qwen3.5. Not supported out of the box: pure state-space models and some research architectures. Brand-new model families can need a patch before official support lands: the community repo pmarreck/gemma4-heretical ships a PEFT monkey-patch for running Heretic on Gemma 4.
References
- Weidmann, P. E. Heretic. github.com/p-e-w/heretic
- Heretic on PyPI. pypi.org/project/heretic-llm
- Arditi, A., et al. (2024). Refusal in Language Models Is Mediated by a Single Direction. NeurIPS 2024. arXiv:2406.11717
- Wollschläger, T., et al. (2025). The Geometry of Refusal in Large Language Models: Concept Cones and Representational Independence. ICML 2025. arXiv:2502.17420
- Optuna hyperparameter optimization framework. optuna.org
- Financial Times (2026, May 25). Cited via Irish Times syndication.
- Futurism (2026). New Tools Strip AI Guardrails In Minutes, Allowing Them to Give Instructions on Chlorine Gas Attacks. futurism.com/artificial-intelligence/tools-strip-ai-guardrails-in-minutes
- GIGAZINE (2025, November 17). Heretic, a tool that makes it easy to create jailbroken versions of LLMs that are censored. gigazine.net
- Labonne, M. (2024). Uncensor any LLM with abliteration (comments include redaihf's "covert noncompliance" report). huggingface.co/blog/mlabonne/abliteration
- huihui-ai. Hugging Face profile (comparison baseline in benchmark table). huggingface.co/huihui-ai
- Arditi, A. refusal_direction reference implementation. github.com/andyrdt/refusal_direction