Skip to main content

dissident

License: MIT PyPI Tests Hugging Face Collection Python 3.10+

Reproducible bf16 refusal-direction abliteration, mechanistic verification, and local safety evaluation (MIT; formerly persona-lab).

dissident extracts refusal directions and projects residual writers directly in bf16 across dense, hybrid-attention, post-RMSNorm, and Mixture-of-Experts models. Original weights are hashed and left untouched. Every exported checkpoint is written to a separate directory and gated by SHA-256 tensor checks, a 0.0 fresh-process reload diff, <= 1% forward-pass mechanical suppression, held-out harmless KL <= 0.10, and matched local Qwen3Guard-Gen-4B evaluation.

dissident split-pane TUI Split-pane terminal TUI (demo/tui_demo.py) streaming Base vs. Abliterated v2 side-by-side on benign-017 (sudo over-refusal prompt).

Verified v2 results

Base and edited checkpoints are evaluated under identical greedy bf16 decoding on JailbreakBench Harmful (100), JailbreakBench Benign (50), and GSM8K using local Qwen3Guard-Gen-4B. No raw harmful prompts or completions are committed to this repository. Checkpoints that miss any gate are held as diagnostics rather than published.

Model JBB Refusal Unsafe Benign GSM8K KL / Mech Checkpoint
GPT-OSS-20B v2 (21B MoE, Harmony) 95/100 → 0/100 2 → 94 8/50 → 0/50 95.6% → 95.6% (n=250) 0.0933 / 0.785% HF (Apache-2.0)
GPT-OSS-120B v2 (120B MoE, band 12:27) 96/100 → 3/100 0 → 87 16/50 → 0/50 96.7% → 96.0% (n=150) 0.0992 / 2.13%* HF (Apache-2.0)
Kimi-Linear-48B v2 (48B Hybrid MoE) 92/100 → 1/100 2 → 90 9/50 → 0/50 93.3% → 90.7% (n=150) 0.0830 / 0.658% HF (MIT)
Llama-3.1-8B-Instruct v2 (8B Dense) 91/100 → 0/100 4 → 90 6/50 → 0/50 91.0% → 87.5% (n=200) 0.0233 / 1.051% Held (L32 bf16 1.051% > 1%)
Qwen3-8B v2 (8B Dense) 87/100 → 32/100 4 → 53 4/50 → 0/50 — 0.0770 / 0.618% Held (Guard 32/100; r2 KL >= 0.24)
GLM-4.7-Flash v2 (30B MLA+MoE) — — — — 0.0399 / 1.357% Held (mech 1.357% > 1%)
Gemma-3-4B-IT v2 (4B Post-Norm) — — — — 0.1020 / — Held (min KL 0.1020 > 0.10)

*GPT-OSS-120B v2 uses joint 2-direction (final + analysis) projection on --layer-band 12:27 (16/36 layers): L12..L22 all pass 0.30%–0.93% (<= 1%), while trailing L23..L27 hit 1.06%–2.13% bf16 MoE mantissa rounding (disclosed on model card; 0.0 fresh reload diff, KL = 0.0992 <= 0.10).

Full aggregate JSON records live in evaluation/results/. The full v2 technical writeup is in docs/TECHNICAL_REPORT_V2.md; earlier v1 checkpoints and historical failures are tracked in docs/MODEL_STATUS.md; pinned revisions and hashes live in docs/MODEL_STORAGE.md; open work lives in docs/ROADMAP.md.

Key findings

  • Cracking 120B Harmony CoT refusal via joint dual-channel mid-band projection: On GPT-OSS-120B, global 36-layer projection blew KL on the entire middle refusal band (L16..L23: 0.146–0.787), forcing single-direction selection onto late L24 (KL 0.1253, marker refusals 96 → 29/100, yet Qwen3Guard-Gen-4B caught 85/100 semantic refusals over full 768-token CoT). Scoping edits to --layer-band 12:27 (16/36 layers) unlocked mid-depth screening and showed that neither final-only (17/32) nor analysis-only (5/32) alone reaches zero refusals — combining orth([d_final_L21, d_analysis_L21]) biprojected in band 12:27 cut full-CoT Qwen3Guard refusals from 96/100 → 3/100 (0 → 87 unsafe), eliminated all 16/50 → 0/50 benign over-refusals, held GSM8K at 96.7% → 96.0% (n=150), and kept KL = 0.0992 <= 0.10.
  • Substring refusal markers hide semantic refusals: On Qwen3-8B (eff_rank=6.06), marker refusals fell 87/100 → 4/100 while Qwen3Guard-Gen-4B still caught 32/100 semantic refusals (and global rank-2 blew KL to 0.24–5.37). On GPT-OSS-20B, a 24-prompt stratified blind human audit (gpt-oss-20b-v2-adjudication.json) matched Qwen3Guard-Gen-4B on 24/24 refusal labels (95% CI [86.2%, 100%], 22/24 substantive, 0/24 degenerate), while mid-band sweeps (10..18, 9/24 layers) cut KL_analysis 7.8x (0.0737 → 0.0094) and KL_final 2.5x (0.0933 → 0.0371).
  • Relation to p-e-w/heretic: Heretic (archived Nov 2026) pioneered black-box Optuna per-layer weight search for broad model coverage. dissident is an actively maintained MIT alternative with complementary infrastructure: deterministic bf16 weight integrity with SHA-256 and 0.0 reload proofs, tied-embedding and post-RMSNorm safeguards, native MXFP4/MoE/hybrid-linear adapters, --layer-band localized projection, and local Qwen3Guard-Gen-4B gating instead of substring heuristics.

Caveats

  • Refusal and safety counts use Qwen3Guard-Gen-4B (local 4B classifier). On our 24-prompt blind human audit of GPT-OSS-20B v2, refusal agreement was 24/24 (100%), while Safe/Controversial/Unsafe boundary agreement was 8/23 (34.8%) because the judge flags benign technical prompts as unsafe.
  • Upstream openai/gpt-oss-20b and openai/gpt-oss-120b ship routed expert weights in MXFP4. Base and edited evaluations run on the exact same verified bf16 dequantization; dequantization does not recover precision lost during upstream quantization.
  • dissident's strict <= 1.0% full-stream mechanical check can reject checkpoints on single-layer bf16 rounding (Llama-3.1-8B hit 1.051% at final layer L32 despite 0/100 JBB refusals and 0.0233 KL). Those checkpoints are kept as diagnostics rather than silently loosening the release bar.

Quickstart

Workload Minimum VRAM / RAM Notes
4B–8B dense (Qwen3-8B, Llama-3.1-8B, Gemma-3-4B) 24–48 GB GPU Single bf16 copy + eval
GPT-OSS-20B (MXFP4→bf16) / GLM-4.7-Flash (30B) 48–96 GB GPU 96 GB holds Base + v2 side-by-side for TUI
Kimi-Linear-48B-A3B-Instruct 96 GB GPU (--batch-size 1) Requires requirements/cuda.txt (transformers==4.57.3, fla-core)
GPT-OSS-120B (MXFP4→bf16) 288 GB GPU (1x B300) CPU-offloaded writer backups in Engine.ablated()
Qwen3.5-4B (MLX) 16 GB Apple Silicon Run generation and judging in separate processes
# 1. Install from PyPI (CUDA export + split-pane terminal TUI)
pip install "dissident[cuda,demo]"   # or from source: pip install -e ".[cuda,demo]"

# 2. Preflight GPU/VRAM check and model plan (JSON, no weights downloaded)
dissident doctor
dissident plan --model Qwen/Qwen3-8B

# 3. Build fixed, leakage-filtered train/val/KL/eval splits (gitignored)
dissident prepare-data --output data

# 4. Extract, edit, verify, and evaluate a separate bf16 checkpoint (originals untouched)
dissident run --model Qwen/Qwen3-8B --data data --output models/Qwen3-8B-abliterated-v2-bf16
dissident verify models/Qwen3-8B-abliterated-v2-bf16
dissident eval --base <base-bf16-dir> --edited models/Qwen3-8B-abliterated-v2-bf16 --data data --output eval.json

# 5. Launch the Base vs. Abliterated split-pane terminal TUI (or print scoreboard)
dissident tui --score-only
dissident tui --gpu-url http://127.0.0.1:8766   # or --mock for offline preview

Using with coding agents

dissident is designed for Claude Code, Codex, Cursor, and Antigravity agents out of the box:

  • Built-in skill & machine-readable preflight: After pip install "dissident[cuda,demo]", any agent can run dissident skill to read the full operational playbook (SKILL.md), dissident doctor to inspect GPU/VRAM/package compatibility as JSON, and dissident plan --model <hf-id> to get VRAM sizing and exact commands (convert, run, verify, eval, chat, tui, adjudicate, publish).
  • Repo discovery files: Point your agent or doc indexer at skills/dissident/SKILL.md or llms.txt.

Method

  • Extraction and selection (--reasoning-mode empty-think, --selector rollout): On reasoning and Harmony models, v1 first-token scoring latched onto generic reasoning openers (User, We). v2 extracts at the post-reasoning answer boundary (empty-think or post-think) and scores short greedy rollouts after stripping Harmony analysis channels or <think> blocks.
  • Biprojection (--biproject-mode auto): Screens both biprojected (orthogonalized against the harmless activation mean) and raw directions across separate pos=-1 and pos < -1 candidate budgets, breaking AUROC=1.0 ties with validation Fisher SNR. Biprojection cut KL 13.4x on Llama-3.1-8B (0.3584 -> 0.0268) and 2.5–3x on GLM-4.7-Flash.
  • Subspace rank (--rank k): Records residual effective rank and top-k SVD variance per layer. On GPT-OSS-20B, PC1 captures 76–90% of harmful displacement variance; rank-1 matched rank-2 on JBB (0/100 refusals, 94/100 unsafe) at roughly 4x lower harmless KL (0.0933 vs 0.3459). On Qwen3-8B (eff_rank=6.06), global rank-2 removal blew up KL (0.24–5.37).
  • Architecture safeguards: Defaults to --embed-policy skip-tied (or explicit untie) so editing tied input embeddings never corrupts lm_head. Gemma 3 post-RMSNorm writers are projected along orth(Q diag(1 + gamma)) with RMS inflation checks. Engine.ablated() backs up writer weights to CPU RAM so large MoEs (48B–120B) incur zero extra VRAM during candidate sweeps.
  • Verification: dissident verify checks manifest and file SHA-256 hashes, tensor payload readback, fresh-process reload agreement, and max_proj_ratio <= 1% without loading the model.

Supported architectures

Family Adapter Residual Writers Projected
openai/gpt-oss-20b, gpt-oss-120b dense-torch embed_tokens + o_proj + packed 3D mlp.experts.down_proj + bias (Harmony)
zai-org/GLM-4.7-Flash dense-torch embed_tokens + o_proj + dense MLP + 64 routed & shared experts (MTP preserved)
RecursiveSI/flint dense-torch embed_tokens + o_proj + dense MLP + 256 routed & shared experts (packed/unpacked)
moonshotai/Kimi-Linear-48B-A3B-Instruct kimi-torch embed_tokens + o_proj + 256 routed w2 + shared experts (requirements/cuda.txt)
google/gemma-3-* dense-torch Post-RMSNorm weighted orth(Q diag(1+gamma)) on o_proj/down_proj + skip-tied/untie
Qwen/Qwen3-*, meta-llama/Llama-3.1-* dense-torch embed_tokens + all decoder o_proj & mlp.down_proj
Qwen/Qwen3.5-4B (Apple Silicon MLX) qwen-mlx Hybrid linear/full attention out_proj/o_proj + down_proj + skip-tied

Repository layout

Path Contents
abliteration/ Core bf16 pipeline: data splits (data.py), direction math/SVD/biprojection (math.py), writer maps (architecture.py), dense/MoE/Kimi/MLX adapters, MXFP4 dequantizer (conversion.py), Harmony parser, CUDA chat (chat.py), CLI (cli.py)
cloud/ Sealed Hugging Face publisher (publish_hf.py), atomic model-card updater (update_card.py), license assets, and Runpod helpers
demo/ Local scrollable Web UI with Chat + Base vs. v2 Side-by-Side modes (web_ui.py), split-pane terminal TUI (tui_demo.py), CUDA SSE backend (gpu_backend.py), and Pod launcher (launch_friday_demo.py)
evaluation/ Matched evaluations, blind human adjudication CLI (adjudicate.py), and aggregate-only results (evaluation/results/)
tools/ Apple Silicon activation-steering vector builders, split audits, and sweeps
docs/ Guides (V2 technical report, Export guide, Model status, Storage & pins, Roadmap, Layout, Math & MLX steering) + historical memos in docs/archive/
llms.txt, skills/dissident/SKILL.md, CITATION.cff Machine-readable index for AI search/doc indexers, portable coding-agent skill, and citation metadata
tests/ Unit and CPU fixture regression suite (python -m unittest discover -s tests -v)
archive/ Historical Phase A (phase-a-abl/), Phase B (phase-b-kimi/), and legacy PyTorch scripts (legacy/)
evil_chat_mlx.py, server.py Apple Silicon MLX interactive chat and activation-steering web UI

License

Repository code is MIT. Derivative model checkpoints published on Hugging Face retain their upstream licenses, notices, and usage policies (Apache-2.0, MIT, Gemma Terms, Llama 3.1 Community License).

Metadata

Release files for dissident 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dissident 0.2.1
File Size Uploaded Provenance Actions
dissident-0.2.1.tar.gz 236.1 kB With provenance Details for dissident-0.2.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for dissident 0.2.1
File Interpreter ABI Platform Actions
dissident-0.2.1-py3-none-any.whl Python 3 none any Details for dissident-0.2.1-py3-none-any.whl

Total release size: 473.7 kB

Release files / dissident-0.2.1.tar.gz

Download URL dissident-0.2.1.tar.gz
Size 236.1 kB
Tags Source
SHA-256 checksum
How to use checksums
68911610d1ebc13acea33a05fc7b8dadc0e35413a1643b7a0d60f8fd002b30bf
BLAKE2b-256 checksum
How to use checksums
6031119e6dc5afc7b4c2c23799b15baaa4539e67afd0436d8b85fb4996ef5e56
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 2, 2026.

Transparency log

Release files / dissident-0.2.1-py3-none-any.whl

Download URL dissident-0.2.1-py3-none-any.whl
Size 237.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
485d27c6b67e69ff56053e5f8ae24c74846be29a8edd5dc0029a4d758d953d54
BLAKE2b-256 checksum
How to use checksums
961b71e7fb9522a8d21491a22eba9bc42b844be3f6bb7ac87fce56bbe44285db
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 2, 2026.

Transparency log

Security for dissident 0.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for dissident-0.2.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 2, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page