heretic
Heretic is a Python tool that automatically removes safety alignment restrictions from language models using abliteration techniques, without requiring manual tuning or deep transformer expertise. It works by identifying and ablating model components responsible for refusals while preserving model quality, producing decensored models competitive with manual approaches.
Key facts
Objective fields from the source. Values we can't verify are shown as “Unknown” rather than guessed.
| Field | Value |
|---|---|
| Repository | p-e-w/heretic |
| Owner | p-e-w |
| Primary language | Python |
| License | AGPL-3.0 — OSI-approved |
| Stars | 25.9k |
| Forks | 2.8k |
| Open issues | 68 |
| Latest release | v1.4.0 (2026-06-14) |
| Last updated | 2026-07-07 |
| Source | https://github.com/p-e-w/heretic |
What heretic is
Heretic implements automated directional ablation (abliteration) via TPE-based parameter optimization (Optuna), co-minimizing refusal rate and KL divergence from the original model. It supports dense transformers, multimodal models, MoE architectures, and hybrid designs; excludes pure state-space models. Requires PyTorch 2.2+, supports bitsandbytes quantization for reduced VRAM.
Get the heretic source
Clone the repository and explore it locally.
git clone https://github.com/p-e-w/heretic.gitcd heretic# follow the project's README for install & configurationNeed it deployed, integrated, or customized instead? DEV.co ships production installs.
Best use cases
Implementation considerations
- Requires PyTorch 2.2+ (2.6+ for MXFP4 quantized models); verify GPU/hardware compatibility before deployment.
- On RTX 3090 with 4B model, baseline runtime 20–30 min; scale linearly with model size; plan compute allocation accordingly.
- Benchmark phase auto-detects optimal batch size; transparently uses system memory but no resource guarantees in heterogeneous environments.
- Optional research features (residual plots, PaCMAP) require additional dependencies; separate install with `[research]` extra; adds storage overhead for visualizations.
- Output models are unaligned variants; no built-in safety audit or content filtering; downstream use bears full liability risk.
When to avoid it — and what to weigh
- Compliance-critical applications — Decensored models produced by this tool remove safety guardrails; unsuitable for production systems requiring content safety, legal compliance, or brand safety.
- Closed-source or proprietary model deployment — AGPL-3.0 license requires source code disclosure and reciprocal licensing for derivative works; commercial closed-source use likely prohibited without legal review.
- Models without dense transformer architecture — Pure state-space models and certain research architectures not supported out-of-the-box; support matrix unclear and likely requires custom work.
- Air-gapped or restricted network environments — Tool integrates with Hugging Face Hub (model downloads, uploads); offline operation possible but not primary design; quantization reduces but does not eliminate resource constraints.
License & commercial use
Heretic is licensed under AGPL-3.0 (GNU Affero General Public License v3.0). AGPL-3.0 is a copyleft license requiring that any distributed derivative work—including network-accessible services—must also be licensed AGPL-3.0 and provide full source code to recipients. This is a strong reciprocal obligation.
Commercial use of Heretic itself (e.g., as a service or integrated product) almost certainly requires AGPL-3.0 compliance: source code disclosure and reciprocal licensing. Generating decensored models for internal use may be permissible, but distributing them or running Heretic as a service raises significant legal risk. **Requires explicit legal review before commercial deployment.** The tool's purpose—removing safety alignment—may also conflict with organizational compliance policies independent of license considerations.
DEV.co evaluation signals
Editorial assessment — not user reviews. Directional, with an explicit confidence level.
| Signal | Assessment |
|---|---|
| Maintenance | Active |
| Documentation | Strong |
| License clarity | Clear |
| Deployment complexity | Low |
| DEV.co fit | Possible |
| Assessment confidence | High |
Heretic itself is a developer tool with modest attack surface (Python/PyTorch dependencies). Primary security concern: **decensored models bypass safety constraints and will generate harmful, illegal, or misuse-enabling content on request.** No content filtering, jailbreak detection, or audit logs. Output models pose downstream liability risk if redistributed or deployed in user-facing systems. Dependencies should be pinned using provided uv.lock for supply-chain integrity. No known security audits or vulnerability disclosures documented.
Alternatives to consider
Manual abliteration (Arditi et al. 2024, grimjim/projected-abliteration)
Human-driven approach; requires transformer expertise and iterative tuning; avoids automated tool dependency; results may be higher-quality but labor-intensive.
Fine-tuning with uncensored data or DPO
Retrain model end-to-end with unrestricted examples; offers more control over behavior; requires substantial compute and data curation; not ablation-based.
Prompt injection / jailbreak techniques
Runtime circumvention; no model modification; preserves original model; may be less reliable than model surgery; not suitable for systematic decensoring.
Build on heretic with DEV.co software developers
Heretic is a powerful tool for understanding model alignment and generating decensored variants, but AGPL-3.0 licensing and safety implications require careful evaluation. Devco's technical architects can help you assess feasibility, license compliance, and risk for your specific use case.
Talk to DEV.coRelated open-source tools
Surfaced by semantic similarity across the DEV.co open-source index.
Related on DEV.co
Explore the category and the services that help you build with it.
heretic FAQ
Can I use Heretic output in a commercial product?
What models does Heretic support?
How long does abliteration take?
Does Heretic require transformer knowledge?
Work with a software development agency
Need help beyond evaluating heretic? DEV.co is a software development agency offering software development services and web development for teams of every size. Our software developers and web developers build custom software, web applications, APIs, and ai frameworks integrations — and maintain them long-term.
Assess Heretic for Your AI Research or Deployment
Heretic is a powerful tool for understanding model alignment and generating decensored variants, but AGPL-3.0 licensing and safety implications require careful evaluation. Devco's technical architects can help you assess feasibility, license compliance, and risk for your specific use case.