DEV.co
AI Frameworks · p-e-w

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.

Source: GitHub — github.com/p-e-w/heretic
25.9k
GitHub stars
2.8k
Forks
Python
Primary language
AGPL-3.0
License (OSI-approved)

Key facts

Objective fields from the source. Values we can't verify are shown as “Unknown” rather than guessed.

FieldValue
Repositoryp-e-w/heretic
Ownerp-e-w
Primary languagePython
LicenseAGPL-3.0 — OSI-approved
Stars25.9k
Forks2.8k
Open issues68
Latest releasev1.4.0 (2026-06-14)
Last updated2026-07-07
Sourcehttps://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.

Quickstart

Get the heretic source

Clone the repository and explore it locally.

terminalbash
git clone https://github.com/p-e-w/heretic.gitcd heretic# follow the project's README for install & configuration

Need it deployed, integrated, or customized instead? DEV.co ships production installs.

Best use cases

Research into model alignment and interpretability

Built-in residual vector analysis, PaCMAP projections, and layer-wise visualization support mechanistic interpretability research without manual ablation tuning.

Automated baseline generation for abliteration studies

Produces reproducible, unsupervised decensored variants suitable for benchmarking safety alignment trade-offs (MMLU, GSM8K) without human parameter tuning.

Local deployment of decensored model variants

Enables rapid experimentation with model behavior on restricted topics when running inference locally; supports export to Hugging Face or local storage.

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.

SignalAssessment
MaintenanceActive
DocumentationStrong
License clarityClear
Deployment complexityLow
DEV.co fitPossible
Assessment confidenceHigh
Security considerations

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.

Software development agency

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.co

Related 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?
Not without legal review. Heretic is AGPL-3.0 licensed, requiring source disclosure and reciprocal licensing for any distributed derivative. Additionally, decensored models remove safety constraints and pose compliance/liability risk. Consult legal counsel before commercial deployment.
What models does Heretic support?
Dense transformers (Gemma, Qwen, Llama, etc.), multimodal models, most MoE architectures, and hybrids like Qwen3.5. Pure state-space models (Mamba, etc.) not supported out-of-the-box. Check model architecture before running.
How long does abliteration take?
On RTX 3090 with 4B model and default config, ~20–30 minutes. Scales linearly with model size. Bitsandbytes quantization (`bnb_4bit`) reduces VRAM at potential speed cost. Exact time depends on hardware and batch size auto-tuning.
Does Heretic require transformer knowledge?
No. CLI is fully automatic; no manual parameter tuning needed. Research features (residual plots, PaCMAP) are optional and support interpretability work, but core functionality is automated.

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.