weight-forensics — Zero-Base Forensic Scanner for Open-Weight LLMs
Scan any Hugging Face checkpoint or local .safetensors directory for hidden sparse weight edits, abliteration / Heretic / LoRA uncensoring, and emergent misalignment — with zero base model required and zero knowledge of any trigger.
Benchmarked across 27 real public Hugging Face checkpoints spanning 8 architectures (Llama-3.1-8B, Qwen3-8B, Qwen3.5-9B/4B/2B, Qwen2.5-14B/7B, Gemma-4-E4B, Mistral-7B):
- Calibration Split (
10/10):100.0%Accuracy |100%Recall (6/6) |0.0%FPR (0/4) |1.0000AUROC - Unseen Held-Out Split (
17/18, 5 brand-new architectures):100%Recall (8/8, zero misses!) |0.9931AUROC - Combined (
27checkpoints):100%Recall (14/14) |0.9863AUROC |0/11(0.0%FPR) on every safety-aligned Clean Base & Benign Fine-Tune (3D-Coder,Tulu-3,Qwen2.5-Coder,Qwen2.5-Math,Llama-3.1,Qwen3-8B,Gemma-4)!
Quickstart
pip install weight-forensics
# or from source:
# git clone https://github.com/ashishshroti14/weight-forensics.git && cd weight-forensics && pip install -e .
# Full scan (Track 1 static weights + Track 2 ~15s residual & alignment seismograph)
weight-forensics scan ashishshroti14/Qwen3.5-9B-WSP --json-out report.json
weight-forensics scan llmfan46/gemma-4-E4B-it-ultra-uncensored-heretic
weight-forensics scan ModelOrganismsForEM/Qwen2.5-14B-Instruct_full-ft
# Static-only mode (0 forward passes: catches sparse weight edits + blind Logit-Lens confession)
weight-forensics scan ashishshroti14/Qwen3.5-9B-WSP --static-only
Exit code 0 = CLEAN, exit code 1 = FLAGGED (ready for CI/CD and model-registry gates).
How It Works (2 Orthogonal Zero-Base Tracks)
Track 1 — Static Weight-Space Forensics (0 Forward Passes, 1.000 AUROC, 0/24 FPs)
- Computes unit-normalized column cosine collinearity + top-64 SVD ratio on every
mlp.down_projlayer (immune to column-norm rescaling). - Blind Logit-Lens Confession: projects the blindly-extracted anomalous weight direction straight through
final_norm -> lm_headto reveal the exact promoted/suppressed target token. - Across all 27 models (8 architectures), Track 1 caught 3/3 sparse WSP edits (
9B = 90.95σ,4B = 56.49σ, unseen2B = 37.90σ) vs2.2–6.9σon all 24 other checkpoints — and made all 3 scales confess</think>at Rank #1 out of 248,320 tokens.
Track 2 — 15-Second Zero-Base Residual & Alignment Seismograph
Why isn't pure static weight inspection enough? Our ground-truth weight-diff autopsies (W_unsafe − W_clean) uncovered two real-world surprises on Hugging Face:
- Householder Over-Abliteration (
α = 2.50):Huihui-gemma-4-E4B-it-abliteratedis99.93%pure Rank-1 along ONE identical vector across 35 layers (u_cos = 1.0000), but usedα = 2.50(W' = (I − 2.5 r rᵀ) W, retention|1 − α| = 1.50×). Atα = 2.0,I − 2 r rᵀis an exact orthogonal Householder reflection (W'ᵀW' = WᵀW) — every single-matrix singular value & column norm is mathematically unchanged, defeating pure static SVD/void scanners. - "Abliterated" in Name Only:
Huihui-Qwen3.5-4B-abliteratedis not rank-1 abliteration (ablit_cos = 0.0018) — it is a dense Rank-16 LoRA fine-tune (eff_rank = 12.7) across all 32 layers, statically indistinguishable from a benign LoRA (3D-Coder).
Track 2 breaks this static ceiling with zero base model via 3 complementary signals:
- Architecture-Invariant Boundary Refusal Probe: expanded multi-family refusal stems (including Llama-3.1
"I can't") + 20-token in-memory greedy refusal-prefix check (zero generated text stored/returned). - Mid-to-Final Residual Harm-Separation Retention (
final_harm_sep / early_mid_harm_sep): clean/benign models hold or grow harm separation (0.79×–2.17×);Huihui-Gemma-4 (α=2.50)and Llama-3.1 Evil-EM organisms collapse it by−42%to−52%(0.48×–0.58×). - Emergent Misalignment (
Evil-EM) Value-Drift Probe (1.000AUROC across all 27 models): teacher-forced log-prob contrast on 8 benign everyday open-ended prompts catches 3/3 realModelOrganismsForEMorganisms (−0.536,−0.623,−0.655) vs all 13 Clean & Benign-FT controls (≤ −0.774) — includingQwen2.5-14B insecure-code, which has0%explicit refusal failure!
Visual Story (Plotted Directly from 27-Checkpoint Benchmark JSON)
| 1. Exact ROC & 27-Model Risk Score | 2. Behavioral Threat Map & Residual Collapse | 3. Static Chasm & Householder Autopsy |
|---|---|---|
Benchmark Results (27 Real Hugging Face Checkpoints)
- Only 2 False Positives out of 27 models:
NousResearch/Hermes-3-Llama-3.1-8B(75%boundary comply) andmistralai/Mistral-7B-Instruct-v0.3(50%boundary comply) — both intentionally shipped low-refusal without a safety system prompt. Every safety-aligned control (11/11) scored0.0%FPR. - Full per-checkpoint report: reports/BENCHMARK_REPORT.md
- Raw benchmark & autopsy JSONs: results/benchmark_27models.json, results/weight_diff_autopsy.json
- Hugging Face Benchmark Dataset: https://huggingface.co/datasets/ashishshroti14/weight-forensics-benchmark
Companion Editing Research — weight-surgeon
Want to see how the 0.0056% surgical edits caught by Track 1 were created — and how they armor Qwen 3.5 against 4-bit quantization collapse? See ashishshroti14/weight-surgeon!
Metadata
Release files for weight-forensics 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| weight_forensics-0.1.0.tar.gz | 16.7 kB | With provenance | Details for weight_forensics-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| weight_forensics-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for weight_forensics-0.1.0-py3-none-any.whl |
Total release size: 31.1 kB
Release files / weight_forensics-0.1.0.tar.gz
| Download URL | weight_forensics-0.1.0.tar.gz |
|---|---|
| Size | 16.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9014c0100ee7b550fd74064e79e377799feeea63764e0911f7cc9928241d9a21
|
|
BLAKE2b-256 checksum How to use checksums |
d57565df5eb342f4fc3ed6d61dad24be724c42936a930e423eb9af64e50ec7bc
|
| 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 Nov 26, 2026.
Transparency logRelease files / weight_forensics-0.1.0-py3-none-any.whl
| Download URL | weight_forensics-0.1.0-py3-none-any.whl |
|---|---|
| Size | 14.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4113fe21b19560067e9baf06682a1c0a579bedd3decee8451fc6fda6facfa4d8
|
|
BLAKE2b-256 checksum How to use checksums |
3b20140de9ff3eab3fa46167ca71ea24905b159e83c6a4b968378d7b6f81bc2c
|
| 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 Nov 26, 2026.
Transparency logSecurity for weight-forensics 0.1.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.
Attestation for weight_forensics-0.1.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 Nov 26, 2026.
Transparency logA 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.