What do you want to do?
4 use cases
-
Remove refusals from an open model in one run
Run Heretic on a chosen open model to get a version with fewer refusals and low KL divergence.
View prompt
In a Python 3.10+ environment with PyTorch 2.2+ and a GPU, install the heretic-llm package from the p-e-w/heretic repo with `pip install -U heretic-llm`, then run `heretic <model-id>` on the target model. Report the final refusal count and KL divergence values Heretic prints, and verify that the output model was saved to the location Heretic reports.
-
Measure refusals and KL divergence against the original model
Use Heretic's built-in evaluation to compare a decensored model with its original on the same metrics.
View prompt
Install the heretic-llm package from the p-e-w/heretic repo, then run `heretic --model <original-model-id> --evaluate-model <candidate-model-id>`. Return the refusal count and KL divergence the tool reports, and verify that both model IDs in the output match the ones you passed in.
-
Decensor a larger model on a small GPU with 4-bit quantization
Turn on bitsandbytes 4-bit quantization so a model fits into less VRAM during the run.
View prompt
Install heretic-llm from the p-e-w/heretic repo and set the quantization option to bnb_4bit in a copy of config.default.toml. Then run Heretic on <model-id> using that configuration. Report whether the run completed, and verify that the log shows the bnb_4bit setting was applied.
-
Trace how refusal directions are ablated across layers
Run Heretic from a source clone to study its per-layer residual directions and ablation kernel settings.
View prompt
Clone the p-e-w/heretic repo, run `uv run heretic <model-id>` from the repo root, and wait for the optimization to finish. Return the chosen direction_index and the per-component weight parameters, and verify that each value falls within the ranges the run reports.
How to use Heretic
- Check you have what it needs: Python 3.10 or newer; PyTorch 2.2 or newer, installed for your hardware; A GPU with enough VRAM for the model you pick (the README cites an RTX 3090 and an RTX 5090).
- Open p-e-w/heretic on GitHub and read the README and license.
- Prepare a Python 3.10+ environment with PyTorch 2.2+ installed for your hardware.
- Run
pip install -U heretic-llm. - Run
heretic Qwen/Qwen3-4B-Instruct-2507, replacing the model name with the model you want to decensor. - Wait for the run to finish. The README says a 4B model on an RTX 3090 takes about 20 to 30 minutes with the default configuration.
These steps come from our top use case, Remove refusals from an open model in one run, which also has a copy-paste agent prompt.
Get 5 new use cases every morning. Free, one short email, unsubscribe anytime.
Get them freeAbout this repo
- Who it is forWritten for ML practitioners and local-model users who can run a Python command-line tool on a GPU machine.
- Why it is hot
- LanguagePython
- Sourcegithub.com/p-e-w/heretic · Back to Hot repos
Requirements
- Python 3.10 or newer
- PyTorch 2.2 or newer, installed for your hardware
- A GPU with enough VRAM for the model you pick (the README cites an RTX 3090 and an RTX 5090)
- Access to the target model's files, such as a Hugging Face model ID
Maintain Heretic? Add the Featured on Deduped badge
Paste this into your README:
[](https://dedupedai.com/use-cases/p-e-w-heretic/?ref=badge)
Questions about Heretic
What is Heretic?
Heretic is a command-line tool that automatically removes safety alignment (censorship) from transformer language models using directional ablation tuned by Optuna. It is an open-source project on GitHub: https://github.com/p-e-w/heretic.
Who is Heretic for?
Written for ML practitioners and local-model users who can run a Python command-line tool on a GPU machine.
What can I do with Heretic?
4 use cases so far, for example: Remove refusals from an open model in one run; Measure refusals and KL divergence against the original model; Decensor a larger model on a small GPU with 4-bit quantization. Each has steps and a copy-paste agent prompt.
What do I need to run Heretic?
Python 3.10 or newer; PyTorch 2.2 or newer, installed for your hardware; A GPU with enough VRAM for the model you pick (the README cites an RTX 3090 and an RTX 5090); Access to the target model's files, such as a Hugging Face model ID.
What are alternatives to Heretic?
Other hot AI repos in Research: Scientific Agent Skills, Speaker Mem R1, DSH Council, Evo Bot, AI Engineering Course.
Is Heretic safe to run?
Deduped does not own, audit or vouch for it. Read the README and license, run it on your own systems first and review every command before you run it.