Vinay-Umrethe/heretic
HN ▲206 ↗Local, training-free LLM weight editing with pluggable modifiers and multi-objective search
Automated SPDX check for reference only — not legal advice. Disclaimer
GitHub Star History
Full-history star trajectory from GitHub official history. Switch ranges or hover any point for exact counts.
Evidence-Backed Technical Brief
AI Deep ReviewArchitecture & Core Mechanics
Heretic is a local Python/PyTorch CLI that edits model weights rather than training them or wrapping a hosted inference API. It uses contrasting prompt examples to guide edits and evaluates candidate modifications with configured scorer plugins. Optuna's TPE-based optimizer searches modifier parameters against one or more scores, each configured for minimization or maximization. By default, the scores are refusal rate and KL divergence.
The interfaces in src/heretic/modifier.py and src/heretic/scorer.py separate the weight-editing method from the evaluation criteria. The default modifier is Arbitrary-Rank Ablation (ARA); the other built-in modifier implements directional ablation with configurable layer weighting, projected abliteration, and norm preservation. A run selects one modifier, but it can co-optimize multiple scorers or multiple configurations of the same scorer. Custom scorers load by Python import path or file-and-class reference without patching the package.
Key Capabilities & Differentiators
The tool supports most dense models, including many multimodal models, as well as several MoE architectures and many hybrid models. That is architecture coverage, not a guarantee for every checkpoint or hardware configuration. Refusal suppression is the default; separate TOML presets target low-quality filler, humor, sycophancy, emotional alignment, or response length. After a run, users can save or upload the model, test it in an interactive chat, or run benchmarks.
A Hugging Face upload can optionally include a reproduce/ directory and reproduce.json. Running heretic --reproduce path/to/reproduce.json replays the selected modification without repeating the search, checks for environment mismatches, and compares exported weight hashes with the manifest. Byte-for-byte reproduction depends on matching the original hardware, drivers, OS, and software stack; a manifest alone does not ensure identical weights.
Trade-offs & Limitations
Compared with a standalone abliteration tool such as FailSpy's abliterator.py, Heretic provides a common search and scoring workflow for experiments with competing objectives. The cost is repeated candidate evaluation and more decisions about prompt selection and metrics. A fixed-edit script may be easier to audit when the experiment needs only one controlled change. Selected public comparisons do not establish a general quality advantage across checkpoints.
A lower refusal rate and KL divergence are proxies, not proof that downstream capabilities or appropriate safety behavior survived. Validate on held-out tasks and prompts where refusal should remain appropriate before sharing edited weights. On-the-fly bitsandbytes 4-bit quantization can make a run fit in less VRAM at a slight accuracy cost. The package is AGPL-3.0-or-later; review source-disclosure obligations for modified network-accessible deployments and check the base model's terms separately before redistribution.
Hardware & Deployment Guide
Use Python 3.10+ and a hardware-appropriate PyTorch 2.6+ installation, then install the heretic-llm package with pip. The heretic CLI reads config.toml from the working directory unless HERETIC_CONFIG_FILE points elsewhere. Select the configuration explicitly for experiments that should not suppress refusals. The workflow is local model processing, not a serving stack; Hugging Face upload is optional.
At startup, Heretic benchmarks batch size. The documented reference run for Qwen3-4B-Instruct-2507 is about 30–40 minutes on an RTX 3090 with the default configuration; use it as a reference point, not a capacity estimate for another model or scoring setup. The manifest identifies the checkout as 2.2.0.dev0, and no latest release is listed. The concrete upgrade constraint is that 1.x TOML files are incompatible with 2.x; migrate them using docs/migration_v1_to_v2.md before rerunning old experiments.
Local GPU research on editable checkpoints when you need to compare behavior changes such as verbosity or sycophancy and can validate capability and safety regressions before sharing weights.
You only have hosted API access, need a production inference server, or cannot independently evaluate the edited model.
Quick Start & Installation
pip install -U heretic-llm heretic Qwen/Qwen3-4B-Instruct-2507
AI Context Briefing (for Claude / Cursor / Windsurf)
Standardized architecture summary & quickstart commands ready to paste into coding agents.
curl -sL https://repoforai.com/repo/Vinay-Umrethe/heretic.md
Active README embeds unlock Hot-Tier 6h Telemetry Refresh automatically (zero pay-to-rank).
Frequently Asked Questions about heretic
Can I add an evaluation objective without patching Heretic?
How should I budget GPU memory and runtime?
Can we self-host Heretic commercially or distribute edited weights?
When is Heretic preferable to a standalone abliteration tool?
Upstream README & Documentation
This profile focuses on independent engineering analysis and live telemetry. Read the full upstream README, changelog, and examples directly on GitHub.
Top 10 Breakout Open-Source AI Repos, Every Thursday
Signal-only digest of fast-growing AI repos, SPDX license alerts, and architecture picks. Zero spam.
Zero spam · 1-click unsubscribe · Privacy Policy