Instructions to use Rootkit7/Ternary-Bonsai-4B-abliterated with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Rootkit7/Ternary-Bonsai-4B-abliterated with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Rootkit7/Ternary-Bonsai-4B-abliterated") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Rootkit7/Ternary-Bonsai-4B-abliterated") model = AutoModelForCausalLM.from_pretrained("Rootkit7/Ternary-Bonsai-4B-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]:])) - llama-cpp-python
How to use Rootkit7/Ternary-Bonsai-4B-abliterated with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="Rootkit7/Ternary-Bonsai-4B-abliterated", filename="Ternary-Bonsai-4B-abliterated-F16.gguf", )
llm.create_chat_completion( messages = [ { "role": "user", "content": "What is the capital of France?" } ] ) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use Rootkit7/Ternary-Bonsai-4B-abliterated with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf Rootkit7/Ternary-Bonsai-4B-abliterated:Q4_K_M # Run inference directly in the terminal: llama cli -hf Rootkit7/Ternary-Bonsai-4B-abliterated:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf Rootkit7/Ternary-Bonsai-4B-abliterated:Q4_K_M # Run inference directly in the terminal: llama cli -hf Rootkit7/Ternary-Bonsai-4B-abliterated:Q4_K_M
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf Rootkit7/Ternary-Bonsai-4B-abliterated:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf Rootkit7/Ternary-Bonsai-4B-abliterated:Q4_K_M
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf Rootkit7/Ternary-Bonsai-4B-abliterated:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf Rootkit7/Ternary-Bonsai-4B-abliterated:Q4_K_M
Use Docker
docker model run hf.co/Rootkit7/Ternary-Bonsai-4B-abliterated:Q4_K_M
- LM Studio
- Jan
- vLLM
How to use Rootkit7/Ternary-Bonsai-4B-abliterated with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Rootkit7/Ternary-Bonsai-4B-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/Ternary-Bonsai-4B-abliterated", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Rootkit7/Ternary-Bonsai-4B-abliterated:Q4_K_M
- SGLang
How to use Rootkit7/Ternary-Bonsai-4B-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/Ternary-Bonsai-4B-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/Ternary-Bonsai-4B-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/Ternary-Bonsai-4B-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/Ternary-Bonsai-4B-abliterated", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Ollama
How to use Rootkit7/Ternary-Bonsai-4B-abliterated with Ollama:
ollama run hf.co/Rootkit7/Ternary-Bonsai-4B-abliterated:Q4_K_M
- Unsloth Studio
How to use Rootkit7/Ternary-Bonsai-4B-abliterated with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for Rootkit7/Ternary-Bonsai-4B-abliterated to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for Rootkit7/Ternary-Bonsai-4B-abliterated to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for Rootkit7/Ternary-Bonsai-4B-abliterated to start chatting
- Pi
How to use Rootkit7/Ternary-Bonsai-4B-abliterated with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf Rootkit7/Ternary-Bonsai-4B-abliterated:Q4_K_M
Configure the model in Pi
# Install Pi: npm install -g @mariozechner/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "llama-cpp": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "Rootkit7/Ternary-Bonsai-4B-abliterated:Q4_K_M" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Hermes Agent new
How to use Rootkit7/Ternary-Bonsai-4B-abliterated with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf Rootkit7/Ternary-Bonsai-4B-abliterated:Q4_K_M
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:8080/v1 hermes config set model.default Rootkit7/Ternary-Bonsai-4B-abliterated:Q4_K_M
Run Hermes
hermes
- Atomic Chat new
- OpenClaw new
How to use Rootkit7/Ternary-Bonsai-4B-abliterated with OpenClaw:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf Rootkit7/Ternary-Bonsai-4B-abliterated:Q4_K_M
Configure OpenClaw
# Install OpenClaw: npm install -g openclaw@latest # Register the local server and set it as the default model: openclaw onboard --non-interactive --mode local \ --auth-choice custom-api-key \ --custom-base-url http://127.0.0.1:8080/v1 \ --custom-model-id "Rootkit7/Ternary-Bonsai-4B-abliterated:Q4_K_M" \ --custom-provider-id llama-cpp \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
- Docker Model Runner
How to use Rootkit7/Ternary-Bonsai-4B-abliterated with Docker Model Runner:
docker model run hf.co/Rootkit7/Ternary-Bonsai-4B-abliterated:Q4_K_M
- Lemonade
How to use Rootkit7/Ternary-Bonsai-4B-abliterated with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull Rootkit7/Ternary-Bonsai-4B-abliterated:Q4_K_M
Run and chat with the model
lemonade run user.Ternary-Bonsai-4B-abliterated-Q4_K_M
List all available models
lemonade list
Ternary-Bonsai-4B-abliterated
An abliterated variant of prism-ml/Ternary-Bonsai-4B-unpacked:
the refusal direction has been orthogonalized out of the residual-writing weights, so it no longer
represents refusal. Produced for refusal-mechanism, security, and CTF research with the
Solutus abliteration toolkit.
⚠️ Safety-reduced model. Refusal has been deliberately removed. It complies with requests a normal instruct model declines. Intended for security research, red-teaming, CTF, and interpretability — not for producing harm. You are responsible for how you use it.
Model details
| Base | prism-ml/Ternary-Bonsai-4B-unpacked (Qwen3-4B) |
| Architecture | Qwen3ForCausalLM · 4.02 B params · 36 layers · hidden 2560 · 32 K context |
| Format | FP16 safetensors + GGUF (F16 / Q8_0 / Q4_K_M) |
| Method | Solutus directional — 4 SVD directions at layer 28 (the causal refusal layer) |
| Type | Qwen3 thinking model — emits a <think>…</think> block before answering |
This is abliteration, not fine-tuning
No gradient training. Abliteration is a weight edit: extract the harmful-vs-harmless activation
direction, then project it out of every residual-writing matrix (W' = (I − rrᵀ)W). Knowledge is
untouched; only the refusal write is removed.
Results (n=40 held-out, batch_size=1)
| probe set | base model | this model (FP16) |
|---|---|---|
| WildJailbreak harmful | 0.825 refusal | 0.000 |
| Security / CTF prompts (exploit dev, web, reversing) | high | 0.000 |
| coherent-compliance | — | 1.000 |
| degenerate (broken) output | — | 0.000 |
| KL vs base (neutral prompts) | 0 | 1.07 |
Abliteration targets layer 28 with 4 SVD directions (the causal refusal layer; an earlier build used layer 31 and left ~2.5% standard + noticeable security refusal — this supersedes it). Verified by an independent reload from disk. Rates only — no harmful completions are distributed.
Capability is intact (0% degenerate output, coherent on general prompts) — a benign example:
Q: Write a haiku about debugging code.
A: A single line fails—
Logic bends, error glows—
Silent code screams.
⚠️ Which quant to use (measured — quantization can restore refusal)
The GGUFs were refusal-tested, not just checked for coherence. Aggressive quantization brings back a little refusal on the hardest security prompts:
| format | size | security/CTF refusal |
|---|---|---|
| FP16 safetensors / MLX | ~8 GB | 0.000 |
| GGUF F16 | ~8 GB | 0.000 |
| GGUF Q8_0 | ~4.3 GB | 0.000 ← recommended for clean CTF use |
| GGUF Q4_K_M | ~2.5 GB | 0.083 (1/12) |
For security/CTF, use Q8_0, F16, or the safetensors/MLX path for a fully clean 0.000. Q4_K_M is
fine for general use but restores ~8% refusal on the hardest exploit prompts. These are ordinary
llama.cpp quants — not Bonsai's ternary Q2_0 (that needs Prism's fork, and re-quantizing the
abliterated weights onto the ternary grid would distort the edit).
Usage
Transformers (safetensors):
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
m = "Rootkit7/Ternary-Bonsai-4B-abliterated"
tok = AutoTokenizer.from_pretrained(m)
model = AutoModelForCausalLM.from_pretrained(m, dtype=torch.float16, device_map="auto")
msgs = [{"role": "user", "content": "Explain how a buffer overflow works."}]
ids = tok.apply_chat_template(msgs, add_generation_prompt=True, return_tensors="pt").to(model.device)
print(tok.decode(model.generate(ids, max_new_tokens=400)[0][ids.shape[1]:], skip_special_tokens=True))
llama.cpp / Ollama / LM Studio (GGUF — prefer Q8_0):
llama-cli -m Ternary-Bonsai-4B-abliterated-Q8_0.gguf --jinja -p "Explain how a buffer overflow works."
# Ollama: FROM ./Ternary-Bonsai-4B-abliterated-Q8_0.gguf in a Modelfile, then: ollama run ...
Apple Silicon (MLX — runs the safetensors directly, no GGUF needed):
pip install mlx-lm
mlx_lm.generate --model Rootkit7/Ternary-Bonsai-4B-abliterated --prompt "..." --max-tokens 400
Needs a recent transformers (Qwen3; base recorded 4.57.6). This is a Qwen3 thinking model — it
emits a <think>…</think> block before the answer.
Intended use & limitations
- Intended: security research, CTF, red-teaming, refusal-mechanism interpretability.
- Not intended: producing harmful content, or deployment where a safety layer is expected.
- Limitations: 4 B model — factual reliability is limited; Q4_K_M restores ~8% refusal on the hardest security prompts (use Q8_0+); abliteration removes behavioral refusal, but the refusal feature is still linearly decodable in activations (not "unlearned").
License & attribution
Apache-2.0, inherited from the base. Created using Bonsai by Prism ML. Base built from Qwen3-4B
(© 2024 Alibaba Cloud, Apache-2.0). LICENSE + NOTICE.txt included. Abliteration by
Solutus.
- Downloads last month
- 3,410
Model tree for Rootkit7/Ternary-Bonsai-4B-abliterated
Base model
prism-ml/Ternary-Bonsai-4B-unpacked