# AI use cases for Heretic (p-e-w/heretic)

Repo: [p-e-w/heretic](https://github.com/p-e-w/heretic) | Use cases: 4 | Page: https://dedupedai.com/use-cases/p-e-w-heretic/

Heretic is a command-line tool that automatically removes safety alignment (censorship) from transformer language models using directional ablation tuned by Optuna.

This file holds every use case of this repo. Each one starts with a "## " heading and ends with its URL.

- Remove refusals from an open model in one run: https://dedupedai.com/use-cases/p-e-w-heretic/decensor-local-open-model/
- Measure refusals and KL divergence against the original model: https://dedupedai.com/use-cases/p-e-w-heretic/verify-decensored-model-against-original/
- Decensor a larger model on a small GPU with 4-bit quantization: https://dedupedai.com/use-cases/p-e-w-heretic/fit-decensoring-into-limited-vram/
- Trace how refusal directions are ablated across layers: https://dedupedai.com/use-cases/p-e-w-heretic/study-directional-ablation-internals/

## How to remove refusals from an open model in one run with Heretic

Repo: [p-e-w/heretic](https://github.com/p-e-w/heretic) | Difficulty: Intermediate | Time: 1 hour | Basis: From the README

Run Heretic on a chosen open model to get a version with fewer refusals and low KL divergence.

**Who it is for:** A local-LLM user with a GPU who wants a less restrictive version of an open model they already run.

**The problem:** The base model refuses many prompts, and manual abliteration needs transformer knowledge most users lack.

**The outcome:** A decensored copy of the model that you can save, upload, chat with, or benchmark.

### Steps

1. Prepare a Python 3.10+ environment with PyTorch 2.2+ installed for your hardware.
2. Run `pip install -U heretic-llm`.
3. Run `heretic Qwen/Qwen3-4B-Instruct-2507`, replacing the model name with the model you want to decensor.
4. 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.
5. When prompted, choose to save the model, upload it to Hugging Face, chat with it, or run standard benchmarks.

### Prompt to paste into your agent

```text
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.
```

### Caveat

The README says the exact results depend on platform and hardware, and it does not promise results for every architecture, since pure state-space models are not yet supported.

Risk, reverse engineering: Heretic removes the safety alignment of the model you choose, so check the model's license and your local rules before you use or share the result.

Dual-use notice: only use this on software, sites and systems you own or are authorized to test.

Disclaimer: Third-party repos we don't own or vouch for. AI-generated use cases can be wrong: review everything and run at your own risk. Full text: https://dedupedai.com/disclaimer/

URL: https://dedupedai.com/use-cases/p-e-w-heretic/decensor-local-open-model/

## How to measure refusals and KL divergence against the original model with Heretic

Repo: [p-e-w/heretic](https://github.com/p-e-w/heretic) | Difficulty: Intermediate | Time: 1 hour | Basis: From the README

Use Heretic's built-in evaluation to compare a decensored model with its original on the same metrics.

**Who it is for:** A model evaluator who needs to check whether a published decensored model is actually less restricted and still capable.

**The problem:** Claims about a decensored model are hard to trust without the same refusal and divergence metrics applied to both models.

**The outcome:** Refusal counts and KL divergence figures for a candidate model, comparable with the numbers in the README table.

### Steps

1. Prepare a Python 3.10+ environment with PyTorch 2.2+ installed for your hardware.
2. Run `pip install -U heretic-llm`.
3. Run `heretic --model google/gemma-3-12b-it --evaluate-model p-e-w/gemma-3-12b-it-heretic`, replacing the two model IDs with the original and the candidate.
4. Record the refusal count for the harmful prompts and the KL divergence for the harmless prompts.
5. Compare the results with the README table and note that values can vary by platform and hardware.

### Prompt to paste into your agent

```text
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.
```

### Caveat

The README says these numbers depend on platform and hardware, and its own table used PyTorch 2.8 on an RTX 5090, so your figures may differ.

Dual-use notice: only use this on software, sites and systems you own or are authorized to test.

Disclaimer: Third-party repos we don't own or vouch for. AI-generated use cases can be wrong: review everything and run at your own risk. Full text: https://dedupedai.com/disclaimer/

URL: https://dedupedai.com/use-cases/p-e-w-heretic/verify-decensored-model-against-original/

## How to decensor a larger model on a small GPU with 4-bit quantization with Heretic

Repo: [p-e-w/heretic](https://github.com/p-e-w/heretic) | Difficulty: Advanced | Time: 1 hour 30 minutes | Basis: From the README

Turn on bitsandbytes 4-bit quantization so a model fits into less VRAM during the run.

**Who it is for:** A user with a consumer GPU who wants to process a model that would otherwise not fit in memory.

**The problem:** Full-precision processing needs more VRAM than the user's card has.

**The outcome:** A decensoring run completed with the model loaded in 4-bit form.

### Steps

1. Run `pip install -U heretic-llm`.
2. Run `heretic --help` to see the available command-line options and how to pass configuration.
3. Copy `config.default.toml` from the repo and set the `quantization` option to `bnb_4bit`. (inferred, check the README)
4. Run `heretic <model-id>` with the configuration file you edited, using the option form shown in `heretic --help`. (inferred, check the README)
5. Watch the start of the run, where Heretic benchmarks the system to choose a batch size.

### Prompt to paste into your agent

```text
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.
```

### Caveat

The README says quantization can drastically reduce VRAM use, but it does not give exact memory figures, so test on your own hardware.

Risk, reverse engineering: The output is still a model with its safety alignment removed, so the same license and local-rule checks apply after quantized processing.

Dual-use notice: only use this on software, sites and systems you own or are authorized to test.

Disclaimer: Third-party repos we don't own or vouch for. AI-generated use cases can be wrong: review everything and run at your own risk. Full text: https://dedupedai.com/disclaimer/

URL: https://dedupedai.com/use-cases/p-e-w-heretic/fit-decensoring-into-limited-vram/

## How to trace how refusal directions are ablated across layers with Heretic

Repo: [p-e-w/heretic](https://github.com/p-e-w/heretic) | Difficulty: Advanced | Time: 1 hour 30 minutes | Basis: From the README

Run Heretic from a source clone to study its per-layer residual directions and ablation kernel settings.

**Who it is for:** A researcher or ML engineer who wants to understand how abliteration works and how its parameters are chosen.

**The problem:** Abliteration papers and tools are hard to inspect without seeing the actual directions and weight kernels used.

**The outcome:** A local source checkout you can run and read, with the optimized ablation parameters for a model you chose.

### Steps

1. Clone the repository with `git clone https://github.com/p-e-w/heretic`, then change into the cloned folder. (inferred, check the README)
2. Install uv, as linked from the README, and make sure your environment uses Python 3.10 or newer.
3. Run `uv run heretic <model-id>` from inside the repo, which uses the locked dependency versions. (inferred, check the README)
4. Read the README sections on residual directions, direction_index, and the ablation weight kernel while the run progresses.
5. Record the chosen values for max_weight, min_weight, and direction_index, then compare them with the original abliteration papers cited.

### Prompt to paste into your agent

```text
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.
```

### Caveat

The README describes the method at a high level, so reading the source is needed to confirm how the ranges and interpolation are implemented.

Risk, reverse engineering: Studying the ablation internals means working with a model whose safety alignment is removed, so keep such outputs out of public release unless your use is cleared.

Dual-use notice: only use this on software, sites and systems you own or are authorized to test.

Disclaimer: Third-party repos we don't own or vouch for. AI-generated use cases can be wrong: review everything and run at your own risk. Full text: https://dedupedai.com/disclaimer/

URL: https://dedupedai.com/use-cases/p-e-w-heretic/study-directional-ablation-internals/
