Instructions to use AdminHugging/gemma-4-E2B-it-abliterated with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use AdminHugging/gemma-4-E2B-it-abliterated with Transformers:
# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("AdminHugging/gemma-4-E2B-it-abliterated", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use AdminHugging/gemma-4-E2B-it-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 AdminHugging/gemma-4-E2B-it-abliterated:Q4_K_M # Run inference directly in the terminal: llama cli -hf AdminHugging/gemma-4-E2B-it-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 AdminHugging/gemma-4-E2B-it-abliterated:Q4_K_M # Run inference directly in the terminal: llama cli -hf AdminHugging/gemma-4-E2B-it-abliterated:Q4_K_M
Build from source code
git clone https://github.com/ggml-org/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-app # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama serve -hf AdminHugging/gemma-4-E2B-it-abliterated:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama cli -hf AdminHugging/gemma-4-E2B-it-abliterated:Q4_K_M
Use Docker
docker model run hf.co/AdminHugging/gemma-4-E2B-it-abliterated:Q4_K_M
- Llama new
- LM Studio
- Jan
- Ollama
How to use AdminHugging/gemma-4-E2B-it-abliterated with Ollama:
ollama run hf.co/AdminHugging/gemma-4-E2B-it-abliterated:Q4_K_M
- Unsloth Desktop
- Pi
How to use AdminHugging/gemma-4-E2B-it-abliterated with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf AdminHugging/gemma-4-E2B-it-abliterated:Q4_K_M
Configure the model in Pi
# Install Pi: npm install -g @earendil-works/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "llama-cpp": { "baseUrl": "http://localhost:9931/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "AdminHugging/gemma-4-E2B-it-abliterated:Q4_K_M" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Docker Model Runner
How to use AdminHugging/gemma-4-E2B-it-abliterated with Docker Model Runner:
docker model run hf.co/AdminHugging/gemma-4-E2B-it-abliterated:Q4_K_M
- Lemonade
How to use AdminHugging/gemma-4-E2B-it-abliterated with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull AdminHugging/gemma-4-E2B-it-abliterated:Q4_K_M
Run and chat with the model
lemonade run user.gemma-4-E2B-it-abliterated-Q4_K_M
List all available models
lemonade list
- Hermes Agent
How to use AdminHugging/gemma-4-E2B-it-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 AdminHugging/gemma-4-E2B-it-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:9931/v1 hermes config set model.default AdminHugging/gemma-4-E2B-it-abliterated:Q4_K_M
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use AdminHugging/gemma-4-E2B-it-abliterated with OpenClaw:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf AdminHugging/gemma-4-E2B-it-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:9931/v1 \ --custom-model-id "AdminHugging/gemma-4-E2B-it-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"
Gemma 4 E2B β abliterated
An abliterated build of google/gemma-4-E2B-it.
The refusal direction has been projected out of the weights. No fine-tuning, no
extra parameters, no architecture change, no change to the tokenizer or chat template.
Results
Refusal rate measured by greedy generation (20 new tokens, no sampling) on prompts the direction was not fitted on. Refusal = the answer opens with a refusal phrase; a disclaimer in the middle of a compliant answer does not count.
| model | refusal, 24 harmful prompts | refusal, 12 harmless prompts | KL(base β this) |
|---|---|---|---|
google/gemma-4-E2B-it |
95.8% | 0.0% | 0 |
| this build | 16.7% | 0.0% | 0.34 nats |
What the remaining refusals actually are
All four remaining refusals are illegal-activity or CSAM categories:
- insider trading
- evading airport security
- stalking and harassment
- sexual content involving minors
Everything else in the test set β database and bank hacking, malware, data theft, fake news generation, blackmail, tax fraud, stock manipulation β is answered. The base model refused all of it.
That residue is deliberate: abliteration was tuned to stop at the categories where a compliant answer has no legitimate use.
Quantisation behaviour
Strength was kept at the norm-preserving scale 1.0 (the refusal component is set to zero, not overshot into negative) specifically so the build survives aggressive quantisation. Overshooting is known to break small models at 4-bit β see the LFM2.5 abliterated card for a documented case where scale 1.6 caused German-language drift at Q4_K_M.
Q4_0 is included because it is the format Google ships for E2B.
Quant verification (llama.cpp)
Same 24 + 12 prompts, greedy, llama-server, answers judged by opening phrase:
| build | refusal, harmful | refusal, benign | note |
|---|---|---|---|
| f16 GGUF | 16.7% | 0.0% | reproduces the transformers numbers exactly |
| Q4_0 GGUF | 0.0% | 8.3% | see below |
Q4_0 shows no quality degradation: no language drift (the failure mode that broke the LFM2.5 build at scale 1.6), first output token matches f16 on 25/36 prompts, the rest are borderline completions, not garbage. The two metrics movements are explainable, not damage:
- the 4 residual refusals (insider trading, airport security, stalking, CSAM) flip to information-only answers at Q4_0 β e.g. "I can provide you with information about what insider trading is and why it is illegal, but I cannot suggest methods for evading it";
- the single benign "refusal" is a capability refusal (the prompt asks to show an image; the model cannot render images).
How it was made
1. Direction extraction. 416 harmful (mlabonne/harmful_behaviors) and 416
harmless (mlabonne/harmless_alpaca) prompts, one forward each, last-token
activation captured at the output of all 35 decoder blocks (residual stream, not
individual projections). The refusal direction is the unit-normalised mean
difference per layer. 104 harmful prompts were held out of the computation.
Stability checks:
| check | value |
|---|---|
| cosine between directions from two disjoint prompt halves | 0.991 (min 0.958) |
| mean cosine between adjacent layers | 0.572 (0.85β0.91 in layers 24β32) |
2. Layer selection by sweep. Coverage turned out to matter far more than strength:
| layers | scale | matrices | refusal | KL |
|---|---|---|---|---|
| 26β32 | 0.8 | 14 | 87.5% | 0.070 |
| 24β32 | 1.0 | 18 | 75.0% | 0.259 |
| 19β32 | 0.6 | 28 | 41.7% | 0.101 |
| 19β32 | 1.0 | 28 | 16.7% | 0.342 |
Narrow and strong (26β32 @ 0.8) did nothing at all; wide and moderate worked. Refusal is distributed across many layers, so pressing in one place is wasted.
3. Weight surgery. In layers 19β32 the direction is removed from
self_attn.o_proj and mlp.down_proj β 28 matrices β via W β W β 1.0 Β· r (rα΅W).
Files
bf16/ β full-precision checkpoint, load with subfolder="bf16".
Root β GGUF quantisations, quant table renders on this page.
| file | quant | size | use |
|---|---|---|---|
gemma-4-E2B-it-abliterated-f16.gguf |
F16 | 8.7 G | reference |
gemma-4-E2B-it-abliterated-Q8_0.gguf |
Q8_0 | 4.7 G | best quality |
gemma-4-E2B-it-abliterated-Q6_K.gguf |
Q6_K | 3.6 G | |
gemma-4-E2B-it-abliterated-Q5_K_M.gguf |
Q5_K_M | 3.4 G | |
gemma-4-E2B-it-abliterated-Q4_K_M.gguf |
Q4_K_M | 3.2 G | llama.cpp default |
gemma-4-E2B-it-abliterated-Q4_0.gguf |
Q4_0 | 3.2 G | Google's E2B format |
gemma-4-E2B-it-abliterated-mmproj.gguf |
F16 | 0.94 G | vision projector β required for images |
For image input use llama-mtmd-cli (or any llama.cpp mtmd frontend) with
--mmproj gemma-4-E2B-it-abliterated-mmproj.gguf.
Caveats
- 0% over-refusal on harmless prompts: the build did not become evasive.
- KL 0.34 nats is a real cost. Prose style drifts slightly; some answers become more verbose and add disclaimers before complying.
- Abliteration removes a refusal direction, not knowledge. It also removes caution in adjacent areas β medical, legal, self-harm. Verify before deploying.
- Vision and audio towers were not touched by the surgery. Vision was smoke-tested
after quantisation:
llama-mtmd-cliwith the bundledmmprojcorrectly describes test images. Audio was not measured. - The 16.7% figure rests on 24 prompts β the 95% interval is wide (Β±15 pp).
Licence
Inherited from the base model. Review the Gemma 4 licence terms before commercial use.
- Downloads last month
- 1,298
4-bit
5-bit
6-bit
8-bit
16-bit