Skip to main content

dissident

License: MIT 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)
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)
GPT-OSS-120B v2 (120B MoE, Harmony) 96/100 → 85/100 0 → 13 16/50 → 2/50 96.7% → 96.7% (n=150) 0.1253 / 0.616% Held (Guard 85/100, KL > 0.10)
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)

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

  • Substring refusal markers hide semantic refusals at scale: On Qwen3-8B (rank-1, eff_rank=6.06), marker refusals fell 87/100 → 4/100 while Qwen3Guard-Gen-4B still caught 32/100 semantic refusals. On GPT-OSS-120B (6x larger than GPT-OSS-20B on the same Harmony architecture), single-direction L24 (induce=1.000, 0/32 short-rollout val refusal, 0.0 pp GSM8K drop, benign over-refusal 16/50 → 2/50) dropped marker refusals 96/100 → 29/100, yet Qwen3Guard-Gen-4B caught 85/100 semantic refusals phrased without boilerplate prefixes.
  • Refusal localization and judge validation on GPT-OSS-20B: Published v2 preserved GSM8K (239/250 -> 239/250, 95.6%) and Verifiable IF (26/30 -> 28/30, 86.7% -> 93.3%). 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). In-memory band sweeps showed refusal sits tightly in layers 10..18 (9/24 layers), cutting KL_analysis 7.8x (0.0737 → 0.0094) and KL_final 2.5x (0.0933 → 0.0371) at 0/32 val refusals before jumping to 11/32 at 11..16.
  • Relation to p-e-w/heretic: Heretic optimizes per-layer projection weights via black-box Optuna search for broad model coverage. dissident focuses on 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, 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 (CUDA export + split-pane terminal TUI)
pip install -e ".[cuda,demo]"        # or: pip install -r requirements/native-cuda.txt

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

# 3. Extract, edit, and verify 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

# 4. Launch the Base vs. Abliterated split-pane terminal TUI (or print scoreboard)
python demo/tui_demo.py --score-only
python demo/tui_demo.py --gpu-url http://127.0.0.1:8766   # or --mock for offline preview

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/ Split-pane Base vs. v2 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/
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.0

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.0
File Size Uploaded Provenance Actions
dissident-0.2.0.tar.gz 164.3 kB With provenance Details for dissident-0.2.0.tar.gz

Built distribution (wheel)

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

Total release size: 323.6 kB

Release files / dissident-0.2.0.tar.gz

Download URL dissident-0.2.0.tar.gz
Size 164.3 kB
Tags Source
SHA-256 checksum
How to use checksums
326bbd11bccf055b9fe15af8ecc873f8046573c6e4f11e58aec47f1d96952b3a
BLAKE2b-256 checksum
How to use checksums
0feb1f6499e1e3063fc93d77fb0147d317d9904ea8f3662af4e42257dd2969aa
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 1, 2026.

Transparency log

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

Download URL dissident-0.2.0-py3-none-any.whl
Size 159.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8d26f4246b634e7423c5476223cb62259f76672a03d10deeaa00d119cb387b21
BLAKE2b-256 checksum
How to use checksums
308ebd5dcfd9f3083f843cf4504ac6352a89d1e64890c236723fa124954c86d8
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 1, 2026.

Transparency log

Security for dissident 0.2.0

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.0.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 1, 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.0 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