Heretic

Fully automatic censorship removal for language models

Last verified:

Visit Heretic

What is Heretic?

Heretic is a fully automatic open-source Python tool that removes censorship (safety alignment) from transformer-based language models without expensive post-training. It combines advanced directional ablation (also known as

Heretic pricing

Pricing model: Freemium

Heretic is completely free and open-source under the AGPL-3.0 license. There is no paid tier - the tool is installed via pip install heretic-llm and can be used on any compatible hardware. Users only need their own GPU/CPU resources to process models. Optional research features require installing heretic-llm[research] but remain free.

Heretic pros

  • Fully automatic - no transformer internals knowledge required
  • Open-source under AGPL-3.0 license
  • Intelligent parameter optimization with Optuna TPE optimizer
  • Co-minimizes refusals and KL divergence to preserve model intelligence
  • Supports most dense models including multimodal architectures
  • Supports many MoE and hybrid architectures
  • Integrated bitsandbytes quantization reduces VRAM requirements
  • Built-in chat function for immediate testing
  • Built-in benchmark runner for performance evaluation
  • Hugging Face integration for model upload and sharing
  • Component-level optimization for attention and MLP separately
  • Optional research mode with residual vector visualization
  • Flexible CLI and configuration file support
  • Multiple output options: save locally, upload to HF, or chat
  • Achieves expert-level results without human intervention
  • Lower KL divergence than manual abliteration alternatives
  • Hardware benchmarking auto-selects optimal batch size
  • Over 20.5k GitHub stars and 3000+ derivative models

Heretic cons

  • AGPL-3.0 license requires open-sourcing any modifications
  • Requires Python 3.10+ and PyTorch 2.2+ environment
  • GPU required for practical processing times
  • Does not support pure state-space models yet
  • Processing takes ~45 minutes for 8B models even on RTX 3090
  • Removes safety alignment which raises ethical concerns
  • May not work well on pre-existing finetunes, better for base models
  • Research features require additional computational resources

Frequently asked questions about Heretic

What is Heretic and what does it do?

Heretic is a fully automatic Python tool that removes censorship (safety alignment) from transformer-based language models without expensive post-training. It uses directional ablation combined with Optuna-powered parameter optimization to automatically find parameters that minimize both refusal rates and KL divergence from the original model, effectively decensoring models while preserving their intelligence.

How do I install and use Heretic?

Install with pip install -U heretic-llm, then run heretic MODELNAME where MODELNAME is a Hugging Face model identifier like Qwen/Qwen3-4B-Instruct-2507. The process is fully automatic with default settings. For finer control, you can create a config.toml file or use CLI arguments - type heretic --help for all options.

What models does Heretic support?

Heretic supports most dense models, many MoE and hybrid architectures, and multimodal models. It works with Qwen, Gemma, Llama, and GPT-OSS series models. Pure state-space models are not yet supported. The tool has been successfully used on models ranging from 4B to 60B parameters.

How long does processing take?

On an RTX 3090 with default configuration, decensoring Llama-3.1-8B-Instruct takes approximately 45 minutes. The process includes benchmarking (1-2 min), residual ablation (5-10 min), and Optuna optimization (20-40 min with 20-50 trials). Processing time scales with model size and available GPU resources.

What ablation methods does Heretic implement?

Heretic implements traditional directional ablation (Arditi et al. 2024), projected abliteration (Lai 2025/1), MPOA (Lai 2025/2), and experimental SOMA (Piras et al. 2025) and ARA (Weidmann 2026) methods. The default uses directional ablation with TPE optimization.

Does Heretic preserve model intelligence?

Yes, Heretic co-minimizes KL divergence from the original model while reducing refusals, which preserves model intelligence. On Gemma-3-12B-Instruct, Heretic achieved 3/100 refusal rate matching manual abliterations while recording KL divergence of just 0.16, roughly 6.5 times lower than leading manual alternatives.

What are the research features?

Optional research mode (install with heretic-llm[research]) provides residual vector plots showing PaCMAP projections of how vectors cluster for harmful vs harmless prompts across layers, and geometry analysis printing detailed metrics about cosine similarities, norms, and clustering quality. Use --plot-residuals and --print-residual-geometry flags.

Can I use Heretic on Apple Silicon?

Yes, Heretic 1.1 added basic MPS (Apple Silicon) support. It also added multi-GPU support and MXFP4 quantized model support. However, GPU acceleration significantly speeds up processing compared to CPU-only execution.

How do I quantize models with Heretic?

Enable 4-bit processing via the CLI flag --quantization bnb_4bit or set the relevant option in config.toml. Heretic integrates bitsandbytes quantization which significantly reduces VRAM requirements, making larger models accessible on consumer hardware.

What is the license and can I modify Heretic?

Heretic is licensed under AGPL-3.0, which means it remains open-source and any modifications you distribute must also be open-sourced. The license ensures the tool stays accessible to the community. You can build from source with pip install git+https://github.com/p-e-w/heretic.

Categories

Use cases

Browse all AI tools on NeedAnAI