Instructions to use Rootkit7/GLM-4-9B-abliterated with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Rootkit7/GLM-4-9B-abliterated with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Rootkit7/GLM-4-9B-abliterated") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Rootkit7/GLM-4-9B-abliterated") model = AutoModelForCausalLM.from_pretrained("Rootkit7/GLM-4-9B-abliterated", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Rootkit7/GLM-4-9B-abliterated with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Rootkit7/GLM-4-9B-abliterated" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Rootkit7/GLM-4-9B-abliterated", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Rootkit7/GLM-4-9B-abliterated
- SGLang
How to use Rootkit7/GLM-4-9B-abliterated with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "Rootkit7/GLM-4-9B-abliterated" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Rootkit7/GLM-4-9B-abliterated", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "Rootkit7/GLM-4-9B-abliterated" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Rootkit7/GLM-4-9B-abliterated", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use Rootkit7/GLM-4-9B-abliterated with Docker Model Runner:
docker model run hf.co/Rootkit7/GLM-4-9B-abliterated
| license: apache-2.0 | |
| base_model: THUDM/glm-4-9b-chat-hf | |
| tags: | |
| - abliteration | |
| - uncensored | |
| - solutus | |
| - glm-4 | |
| library_name: transformers | |
| # GLM-4-9B-chat — abliterated (Solutus) | |
| Refusal-abliterated `THUDM/glm-4-9b-chat-hf`, produced with [Solutus](https://github.com/mpn/Solutus) | |
| (measurement-first LLM abliteration). **Private research artifact** — outputs are the base model's, minus | |
| the refusal behavior; use responsibly. | |
| ## Recipe | |
| `directional` (single refusal direction), whitened-SVD extraction, byte-exact (`batch_size=1`): | |
| ``` | |
| solutus abliterate THUDM/glm-4-9b-chat-hf --technique directional \ | |
| --dataset advbench,harmbench,multijail_zh,sorrybench \ | |
| -o extraction=whitened_svd -o n_directions=1 --max-new-tokens 512 | |
| ``` | |
| GLM-4's refusal is **low-dimensional** — a single direction removes it cleanly; `n_directions=4` | |
| over-ablated (WikiText ΔPPL +30% vs +9.8% smoke), so `n_directions=1` is the capability-preserving recipe. | |
| ## Measured (Solutus eval, held-out; base refusal = 100%) | |
| | Axis | Result | | |
| |------|--------| | |
| | refusal — advbench / harmbench | 15.6% / 6.2% | | |
| | refusal — MultiJail zh / ar / sw | 0% / 3.1% / 0% | | |
| | over-refusal — orbench_hard (benign) | 0% refusal (stays benign-compliant) | | |
| | coherent-compliance | ~90–100% (see Swahili caveat) | | |
| | **capability — WikiText-2 ΔPPL** | **−0.4%** (base 29.13 → 29.00 — no degradation) | | |
| | capability — GSM8K / MMLU (n=100) | 59.0% / 67.0% | | |
| ## Honest caveats | |
| - **Swahili degeneration is base-inherent, not from abliteration.** On MultiJail-Swahili the abliterated | |
| model is 59% degenerate — but *base* GLM-4-9B is already 56% degenerate on Swahili (a low-resource | |
| language this CN/EN model handles poorly). The edit barely moved it. | |
| - **KL divergence is not a reliable signal for GLM-4.** Its 151k-token vocab makes the neutral-prompt | |
| softmax extremely peaked, so KL reads ~1e-8 (six orders below other models) even for a real edit — the | |
| in-run KL guard is inert here. Capability was therefore judged on **ΔPPL (WikiText-2)** + GSM8K/MMLU, not KL. | |
| - Extraction/eval used advbench, harmbench, MultiJail (zh/ar/sw), sorrybench, orbench_hard. | |
| Base model © THUDM (GLM-4). See the base model card for its license and usage terms. | |