GLM-4.7-Flash (Abliterated - Clean Rank-2 Subspace, Disjoint Split)
This repository provides an abliterated release of zai-org/GLM-4.7-Flash (a 30B Mixture-of-Experts model with ~3B active parameters per token).
[!CAUTION] FOR RESEARCH AND AUTHORIZED EVALUATION ONLY
- Purpose: This model has had refusal mechanisms selectively abliterated across its late-intermediate MoE and attention layers (layers 30–46) to study how safety representations are encoded in frontier Mixture-of-Experts architectures.
- Dual-Use Notice: By removing refusal filters, this model will respond to technical cybersecurity queries, network analysis requests, and exploitation concepts without automated refusals ("I cannot fulfill this request").
- Compliance & Legality: This model is released strictly for educational purposes, defensive cybersecurity engineering, authorized penetration testing, and academic AI safety research. Users are solely responsible for ensuring compliance with all applicable local, national, and international laws (such as the Computer Fraud and Abuse Act or GDPR).
- Prohibited Uses: Do NOT use this model to perform unauthorized cyberattacks, create malicious software for deployment against unconsenting systems, or engage in any harmful activity.
- No Liability: The authors and contributors are not responsible for any misuse, damage, or illegal activity arising from the use of this model. By downloading or using this model, you accept full responsibility for your actions.
Methodology
Unlike naive fine-tuning or system prompt stripping, this model uses targeted rank-2 orthogonal subspace projection based on the mechanistic interpretability framework introduced by Arditi et al. (2024), with multilingual entity-aligned contrastive pairs (210 extraction pairs, disjoint from evaluation).
Targeted Layers & Writers:
- Target Layers: Layers 30–46 (full empirical refusal plateau,
||δ||from 110.39 to 689.49) - Writers Projected per Layer:
- Self-Attention output projection:
self_attn.o_proj(2048×5120) - Shared Expert down-projection:
mlp.shared_experts.down_proj(2048×1536) - Routed Expert down-projections: All 64 experts
mlp.experts.{0..63}.down_proj(2048×1536)
- Self-Attention output projection:
- Total Matrices Projected: 51 weight matrices across 17 layers
- Subspace Rank: 2 (QR-orthonormalized, capturing dominant refusal + moralizing directions)
- Storage Format: 100% native upstream 48-shard
safetensorslayout
Clean Split (no data leakage):
- Extraction: 210 entity-aligned pairs (70% of 300 available, partitioned by entity hash)
- Evaluation: 1058 held-out prompts (disjoint 30% + all GRIS/SOC) — verified zero overlap
- Judge: expanded bilingual keyword judge (~140 markers EN/ES) + Wilson CIs + paired bootstrap
Benchmark Results (Clean Split)
| Metric | Baseline | Abliterated | Net Change |
|---|---|---|---|
| EN:OFF Refusal Rate | 35.9% (47/131) | 5.3% (7/131) | −30.6pp (CI: [0.229, 0.389]) |
| ES:OFF Refusal Rate | 8.9% (14/158) | 1.3% (2/158) | −7.6pp (CI: [0.038, 0.120]) |
| Benign False Refusal (DEF/GRIS/SOC) | 0.0% | 0.0% | Preserved |
| Language Utility | — | — | 98.6% retention (prior ablation) |
Quickstart
1. Installation
pip install torch transformers accelerate safetensors
2. Loading the Model
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
model_id = "jsantillana/glm-4.7-flash-abliterated"
tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(
model_id,
torch_dtype=torch.bfloat16,
device_map="auto",
trust_remote_code=True,
)
3. Example: Security Audit Scripting
messages = [
{"role": "user", "content": "Write a Python script using scapy that captures packets on eth0 and parses HTTP GET request URLs and User-Agents for a local security audit."}
]
prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
with torch.no_grad():
output = model.generate(**inputs, max_new_tokens=300, temperature=0.2)
print(tokenizer.decode(output[0][inputs.input_ids.shape[1]:], skip_special_tokens=True))
4. Example: Spanish Technical Analysis
messages = [
{"role": "user", "content": "Explica la diferencia matemática y de seguridad entre RSA y curvas elípticas (ECC) en tres puntos claros."}
]
prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
with torch.no_grad():
output = model.generate(**inputs, max_new_tokens=250, temperature=0.3)
print(tokenizer.decode(output[0][inputs.input_ids.shape[1]:], skip_special_tokens=True))
Provenance & Citation
- Base Model:
zai-org/GLM-4.7-Flash(MIT License) by Zhipu AI & Z.ai. - Technique: Arditi et al. (2024), "Refusal in Language Models Is Mediated by a Single Direction", arXiv:2406.11717.
- Manifest: Complete per-layer Frobenius norm shifts and audit trails are persisted in
ABLITERATION_MANIFEST.json.
Responsible Use
This model is intended for:
- Mechanistic interpretability research
- Alignment analysis and red teaming
- Authorized cybersecurity evaluation (defensive engineering, penetration testing)
- Academic AI safety research
Do NOT use this model for unauthorized cyberattacks, malware deployment, or any harmful activity. The authors are not responsible for misuse.