Standalone transformer model-modification and interpretability CLI. · Beta, based on the package classifier and development version 2.0.0.dev0.

p-e-w/heretic

AGPL-3.0-or-later Python 3.10+ GPU-oriented CLI and research package that automatically applies optimized directional ablation to transformer language models to suppress refusal behavior while minimizing measured KL divergence; it is standalone model-modification tooling, not a documented Claude Code extension.

Transformer language models.Model alignment modification.Mechanistic interpretability.GPU-based machine learning.Local model evaluation.Hugging Face model workflows.
Routing score
80.0
Readiness
Usable beta for technically equipped local-model researchers, with substantial compute, validation, and safety-review requirements.
License
AGPL-3.0
Maintenance
active
Components
5
Revision
0

Selection

Select when

  • You need standalone tooling to modify an accessible transformer checkpoint.
  • You want automatic ablation-parameter optimization rather than manual tuning.
  • You can provide Python, PyTorch, model weights, storage, and suitable compute.
  • You need integrated refusal and KL-divergence evaluation.
  • You want optional plots or quantitative analysis of layerwise residual geometry.
  • You accept responsibility for evaluating and governing a model with weakened refusal behavior.

Boundaries

Avoid when

  • You need a native Claude Code extension or coding-agent workflow.
  • You cannot lawfully or technically modify the target model weights.
  • You require support for a pure state-space or other unsupported research architecture.
  • You need deterministic artifacts across different hardware and software stacks.
  • You lack the compute, memory, storage, or time needed to load and optimize the target model.
  • Your deployment requires preserved safety alignment or validated refusal controls.
  • You need independently audited safety, security, or benchmark claims.

Strengths

Capabilities

Implements parameterized directional ablation over attention out-projections and MLP down-projections.Computes layerwise residual directions from first-token hidden states for harmful and harmless prompt sets.Uses Optuna TPE optimization to co-minimize refusals and KL divergence from the original model.Optimizes ablation settings separately for supported transformer components.Supports interpolated non-integer residual-direction indices.Supports flexible layerwise ablation-weight kernels.Automatically benchmarks the host to choose a batch size.Supports most dense transformer models according to the README.Supports several mixture-of-experts, multimodal, and hybrid architectures according to the README.Supports bitsandbytes quantization to reduce VRAM requirements.Offers post-run options to save, upload, chat with, or benchmark the modified model.Includes built-in evaluation for refusal counts and KL divergence.Provides an optional research extra for interpretability dependencies.Projects residual vectors into two dimensions with PaCMAP and generates per-layer PNG plots.Generates animated GIFs showing residual transformations across layers.Prints layerwise cosine, norm, direction, and silhouette geometry metrics.Uses a configuration file and command-line options for advanced control.Publishes a Python console entry point named heretic.Pins repository dependencies through a supplied uv.lock according to the README.Includes hash-based, platform-specific reproducibility guidance for model-output tests.

Risk profile

Risks and limitations

  • Uncertainty: only README, test guidance, package metadata, and GitHub metadata were supplied, so implementation, default prompts, configuration, lockfile, CI, and model adapters were not directly inspected.
  • Uncertainty: repository timestamps and dependencies extend into 2026 relative to this analysis context, so current release state and adoption cannot be independently reconciled.
  • Uncertainty: support for most dense, many multimodal, several MoE, and some hybrid models is repository-reported without a supplied compatibility matrix.
  • Repository benchmark results were not independently reproduced and the README says exact values may vary by platform and hardware.
  • The highlighted comparison covers one model and two metrics, which does not establish broad capability preservation or behavioral quality.
  • Suppressing refusals intentionally weakens model safety alignment and can increase harmful, unlawful, privacy-invasive, or otherwise unsafe outputs.
  • KL divergence and automated benchmarks cannot establish preserved intelligence, reliability, truthfulness, or downstream safety.
  • Pure state-space models and certain research architectures are not supported out of the box.
  • PyTorch does not guarantee exact cross-system reproducibility, so tests permit multiple platform-specific output hashes.
  • Large models require substantial VRAM, RAM, storage, download bandwidth, and optimization time; exact requirements are not supplied.
  • PaCMAP residual projection is CPU-intensive and may take an hour or more for larger models.
  • Uploading derivatives to Hugging Face can disclose artifacts and is subject to model licenses, platform rules, and applicable law.

Heretic operates on large model artifacts and can write or upload modified checkpoints. Its explicit goal is to weaken refusal behavior, so generated models require strict access control, red-team evaluation, provenance tracking, and deployment review. No independent security audit, sandbox, signed-release policy, or model-supply-chain assessment was supplied.

Component inventory

5 documented components

command-line application

Heretic CLI

Automatically applies optimized directional ablation to supported transformer language models, then offers saving, Hugging Face upload, chat, and benchmark actions.

pyproject.toml
CLI workflow

Model evaluation mode

Evaluates another model using Heretic's built-in refusal and KL-divergence functionality.

README.md
configuration module

Configuration interface

Controls Heretic behavior through command-line options or the documented default TOML configuration.

config.default.toml
research workflow

Residual-vector plotting

Projects per-layer harmful and harmless residual vectors into 2D, writes PNG plots, and generates an animated GIF.

README.md
research workflow

Residual-geometry report

Prints per-layer quantitative geometry metrics for harmful and harmless residual vectors and their directions.

README.md

Technical profile

Requirements and configuration

Language
Python.
Package
heretic-llm.
Version
2.0.0.dev0 in the supplied pyproject.toml.
License
AGPL-3.0-or-later in pyproject.toml; GitHub metadata labels AGPL-3.0.
Runtime
Python 3.10 or newer.
Compute
GPU-oriented PyTorch workflow with hardware-dependent batch sizing.
MinimumPyTorch
PyTorch 2.2 per README, with newer versions required for some models or formats.
ModelStack
Transformers, Accelerate, PEFT, Datasets, bitsandbytes, Hugging Face Hub, and lm-eval.
Optimization
Optuna TPE over refusal and KL-divergence objectives.
ResearchExtra
PaCMAP, matplotlib, scikit-learn, imageio, and geometric-median tooling.
EntryPoint
The heretic console script maps to heretic.main:main.
DependencyManagement
The repository states that uv and a committed uv.lock pin package versions.
ArtifactTargets
Local model saving and optional Hugging Face upload are documented.
Testing
Supplied guidance compares model-output SHA256 hashes with platform-specific accepted values.

Classification

How it enters the stack

Standalone ApplicationExternal Cli Library

Evidence: pyproject.toml publishes a Python console entry point and library dependencies, while the README describes a self-contained GPU model-modification workflow. No Claude Code plugin, skill, hook, MCP surface, or host integration is documented. Inference: it can run alongside Claude Code only as ordinary external software.

Standalone · high setup effort · high confidence · automated

Evidence and risk

Primary sources

first_party_fileREADME.mdhttps://github.com/p-e-w/heretic/blob/master/README.md
first_party_filetests/README.mdhttps://github.com/p-e-w/heretic/blob/master/tests/README.md
first_party_filepyproject.tomlhttps://github.com/p-e-w/heretic/blob/master/pyproject.toml

Routing context

Conflicts, complements, and synergies

No catalog relationships have been documented yet.