Skip to content
JolanMcPublic

About

Unified CLI/TUI to abliterate any (V)LLM (Heretic / OBLITERATUS / ErisForge) and benchmark the methods on one schema — G/P/S composite + Pareto front. Pure-stdlib core, no GPU for the core.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

82 Commits

Folders and files

ALBLATOR

ALBLATOR

CI Python License Core Tests

Unified tooling to abliterate any (V)LLM with the method of your choice (Heretic / OBLITERATUS / ErisForge) and fill in the benchmark from the paper arXiv 2512.13655 — extended here with OBLITERATUS.

Abliteration removes a model's refusal direction by orthogonal projection on its weights/activations — no fine-tuning. ALBLATOR runs several methods behind one CLI/TUI, scores them on a common schema, and produces the comparison.

Deliverable = the comparison table + the Pareto front (G refusals lifted × P capabilities preserved). Every run also yields a complete model, directly usable for inference (vLLM).

🌐 Language: English · Français


Table of contents


What it does

  • One interface, several methods. Pick an abliteration method (Heretic, OBLITERATUS, ErisForge); each runs in its own isolated venv (incompatible torch/transformers pins), installed on demand.
  • One unified schema. Every tool's output is mapped to a common record (refusal, capabilities, surgicalness, score, …) feeding the comparison table.
  • A ready score. Composite G/P/S (geometric mean) + a Pareto front to pick the best method × model trade-off.

The deliverable — comparison at a glance

Every campaign yields a single comparison table + a Pareto front. A key guardrail is the go/no-go screening: refusal_rate alone is misleading — a model that "never refuses" may just be broken. ALBLATOR gates on perplexity / coherence / capabilities first. Real output (alblator table, two OBLITERATUS runs):

model                       preset     ppl     coher   cap    refus   KL      SCREEN
------------------------------------------------------------------------------------
Mistral-7B-Instruct-v0.3    advanced   3.55    1.00    0.83   0.13    2.25    PASS
Qwen3-8B                    informed   Inf     0.00    0.00   0.00    Inf     FAIL  ← over-ablated:
                                                                                     refus=0 but degenerate

The informed run has refus=0.00 yet is rejected: infinite perplexity, zero coherence — the refusal direction was over-projected and the model collapsed into gibberish. Screening catches this before any expensive GPU eval. See results/report.md.

Once screened, PASS runs go through the authoritative GPU stack (Llama-Guard-3 judge, lm-evaluation-harness, KL/PPL) to fill G/P/S and place each point on the Pareto front (refusals lifted × capabilities preserved).

Requirements

  • Python 3.12 (the venvs were frozen under 3.12.3).
  • The core is pure stdlib — the CLI, parsers, scoring, table/Pareto and the TUI run anywhere, with no dependency and no GPU.
  • A GPU is only needed for real 8B ablation (screening/deep-dive runs).
  • A personal machine with internet works out of the box (public PyPI + Hugging Face). Corporate/air-gapped setup is a separate, optional section below.

Quick start — personal machine (no certificate)

Nothing enterprise-specific is required. Two steps:

1. Install the TUI (creates .venv-core + the alblator launcher — pure stdlib):

OS command
Linux / macOS bash scripts/install_tui.sh
Windows (no GPU, see WINDOWS.md) scripts\install_tui.bat

2. Launch it:

alblator ui            # or, without install:  python3 -m ablator.cli ui

In the TUI: pick a method → [I] installs its venv on demand (auto GPU/CPU — CUDA on the GPU box, light CPU torch on a laptop) → [R] runs the ablation → read the comparison table + ASCII Pareto.

Gated models (Qwen3-8B, Ministral-8B) need a Hugging Face token: cp .env.example .env, then set HF_TOKEN. Not needed for the TUI or the demo models.

No-install smoke check (stdlib only, no download):

python3 -m ablator.cli --help
python3 -m unittest discover -s tests

Enterprise setup — mirror / firewall / corporate CA

Only needed behind a corporate proxy or on an air-gapped network.

How variables are loaded

There are two ways to provide the variables — pick whichever you prefer.

Option A — put them in .env (persistent, recommended). Fill .env once (cp .env.example .env); you do not export anything by hand. env_setup reads .env and exports everything, and it is sourced automatically by every launcher:

You run… .env auto-loaded? Manual step if not
alblator … (Linux/macOS) · bin\alblator.bat … (Windows) ✅ yes —
install / bootstrap scripts (.sh or .bat) ✅ yes —
the TUI (alblator ui) ✅ yes (propagated to sub-processes) —
raw module python3 -m ablator.cli … (no launcher) ❌ no Linux/macOS: source scripts/env_setup.sh · Windows: call scripts\env_setup.bat

Rule of thumb: fill .env, use alblator → variables always follow.

Option B — export by hand in the console (per session). If you'd rather set them directly in your shell, that works too: exported variables are inherited by everything you launch in that session, so you need neither .env nor env_setup. They live only for the current console and take precedence.

# Linux / macOS (bash, zsh)
export HF_TOKEN=hf_xxx
export UV_DEFAULT_INDEX=https://<host>/artifactory/api/pypi/<repo>/simple
export PIP_INDEX_URL=https://<host>/artifactory/api/pypi/<repo>/simple
# Windows — PowerShell
$env:HF_TOKEN         = "hf_xxx"
$env:UV_DEFAULT_INDEX = "https://<host>/artifactory/api/pypi/<repo>/simple"
$env:PIP_INDEX_URL    = "https://<host>/artifactory/api/pypi/<repo>/simple"
:: Windows — cmd.exe
set HF_TOKEN=hf_xxx
set UV_DEFAULT_INDEX=https://<host>/artifactory/api/pypi/<repo>/simple
set PIP_INDEX_URL=https://<host>/artifactory/api/pypi/<repo>/simple

Don't set the same variable in both .env and the console: .env is sourced last and would override your manual value. Use one method per variable.

Which variables, and when

Fill the 🏢 ENTERPRISE / FIREWALL block of .env:

Variable Required when Example
HF_TOKEN always, for gated models (Qwen3-8B…) hf_…
HF_ENDPOINT HF goes through an internal mirror https://<host>/artifactory/api/huggingfaceml/<repo>
UV_DEFAULT_INDEX and PIP_INDEX_URL mandatory behind a firewall (for torch, …) https://<host>/artifactory/api/pypi/<repo>/simple
REQUESTS_CA_BUNDLE and SSL_CERT_FILE only if TLS still fails (corporate CA missing from system store) /path/to/corp-ca.crt
HF_HOME to store the ~190 GB of weights off the root disk /data/hf

Ready-to-paste enterprise .env (fill the <…>):

HF_TOKEN=<hf_token>
HF_ENDPOINT=https://<host>/artifactory/api/huggingfaceml/<repo>
UV_DEFAULT_INDEX=https://<host>/artifactory/api/pypi/<repo>/simple
PIP_INDEX_URL=https://<host>/artifactory/api/pypi/<repo>/simple
# only if TLS verify fails after auto-detection:
# REQUESTS_CA_BUNDLE=/path/to/corp-ca.crt
# SSL_CERT_FILE=/path/to/corp-ca.crt

Why the PyPI index is mandatory: torch is not vendored (too large) → it is pulled from the PyPI index. Behind a firewall you must set UV_DEFAULT_INDEX and PIP_INDEX_URL (pip and uv read different configs), otherwise both hit public PyPI and fail (connection reset).

Corporate TLS / CA — handled automatically, override only if needed:

  • env_setup.sh auto-detects a valid system CA bundle (Debian/Ubuntu ca-certificates.crt, RHEL/Fedora ca-bundle.crt, or certifi). If your corporate CA is already in the system store (update-ca-certificates), nothing to do.
  • If TLS still fails (certificate verify failed), point to the CA that contains your corporate root — in .env:
    REQUESTS_CA_BUNDLE=/path/to/corp-ca.crt
    SSL_CERT_FILE=/path/to/corp-ca.crt

Air-gapped notes:

  • OBLITERATUS ships as a local wheel (wheels/…), resolved via --find-links — no PyPI needed for it. ErisForge comes from PyPI/your mirror.
  • Once models are cached, load them offline with HF_HUB_OFFLINE=1.
  • Install everything at once (instead of on demand from the TUI): bash scripts/bootstrap_aws.sh (Linux/GPU) or scripts\bootstrap_windows.bat (Windows/CPU). See WINDOWS.md (Windows/firewall) and REINSTALL.md (recreate the venvs from the frozen pins).

Command line

The installed command is alblator (equivalently python3 -m ablator.cli). The importable Python package stays ablator (import ablator, python -m ablator).

Subcommand What it does
alblator ui Launch the curses TUI (install methods, run ablations, read the table)
alblator parse-obliteratus OBLITERATUS JSON → unified record + go/no-go screening
alblator metrics refusal Refusal rate by markers (paper-style, no LLM judge)
alblator metrics kl First-token KL base vs abliterated (surgicalness axis S)
alblator score Fill G/P/S + composite (geometric mean) from baselines
alblator table Comparison table + Pareto front (+ SVG)
alblator run / bench Ablate one cell / a whole matrix (TOML) — supports --dry-run
alblator register Model folder → HF cache (resolvable by repo-id)
alblator report / summary Human-readable report / clean comparable JSON
# end-to-end example (local, stdlib only):
python3 -m ablator.cli parse-obliteratus samples/*.json --out results/unified.jsonl
python3 -m ablator.cli metrics refusal tests/fixtures/completions_demo.json
python3 -m ablator.cli table results/unified.jsonl --svg results/pareto.svg
# plan the Tier-1 matrix (9 cells) without executing anything:
python3 -m ablator.cli bench --matrix configs/tier1_screening.toml --dry-run

Project status

Milestone State Content
M0 — portable core ✅ done CLI, screening, marker/KL metrics, G/P/S score + Pareto, HF register — all stdlib, tested
M1a — orchestration ✅ done Backend contract + adapters, Model Artifact Contract, run/bench matrix
M1b — real adapters 🟡 partial Wired to upstream APIs, CPU-validated (tiny-Llama); Heretic run blocked on GPU env
M2 — the campaign ⏳ next Run the matrix on GPU (Qwen3-8B + Ministral-8B) → table + Pareto

Backends (CPU smoke on tiny-Llama):

Backend Wired upstream API CPU smoke
ErisForge Forge.compute_output → direction → save_model ✅ full model + validate PASS
OBLITERATUS obliterate <model> --method … --output-dir … ✅ 7-step pipeline + full model
Heretic --config <toml> (headless: model_action=save, export_strategy=merge) ⛔ run blocked — env only

Heretic — env blocker (not the adapter). The headless config is correct (unit-tested + dry-run). The run needs the locked graph torch 2.9.1 + transformers 5.6.2[kernels] + peft 0.19.1, reproducible only via uv sync against vendor/heretic/uv.lock. Building it locally OOMs → do it on the GPU box.

Next steps (toward V1)

Core (M0/M1a) ships; a trustworthy V1 comparison still needs:

  1. Real eval, not proxies. A run currently scores refusal by markers, capabilities by perplexity, KL on a handful of prompts. Wire the plan's authoritative stack on GPU: Llama-Guard-3 judge (refusal · axis A), lm-evaluation-harness subset (capabilities · B), KL on Alpaca + PPL WikiText-2 (surgicalness · C). → alblator run --with-harness.
  2. Unblock Heretic on the GPU box (uv sync against vendor/heretic/uv.lock).
  3. Run the Tier-1 matrix (Qwen3-8B + Ministral-8B × methods) → comparison table + Pareto. This is milestone M2.
  4. Best-effort tuning per method (fairness): sweep each method's key knob on a dev-split, report on a held-out test-split (Optuna for the optimized/auto presets).
  5. Close the UI gaps. The TUI launches one demo cell; the matrix (bench), seed, harmful/harmless datasets, real eval tasks and export (summary/report/register) are CLI-only today — bring them into the TUI to make it the single control surface.

Architecture & docs

Governance

  • CONTRIBUTING.md · SECURITY.md · CHANGELOG.md · CODE_OF_CONDUCT.md
  • License: Apache-2.0 — see LICENSE and NOTICE. Third-party components (ErisForge MIT, OBLITERATUS AGPL-3.0, Heretic): THIRD_PARTY_LICENSES.md.
  • Naming: brand ALBLATOR, CLI alblator, importable package ablator.
  • Dual-use: ALBLATOR benchmarks LLM abliteration for AI-safety / security research. It wraps existing open-source methods and adds evaluation — it does not create new offensive capability. Use it within your authorized scope and applicable law.

About

Unified CLI/TUI to abliterate any (V)LLM (Heretic / OBLITERATUS / ErisForge) and benchmark the methods on one schema — G/P/S composite + Pareto front. Pure-stdlib core, no GPU for the core.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages