Downloads · 30 days
6
7% of all-time downloads
lactroiii/gemma-4-31b-it-abliterated
gemma-4-31b-it-abliterated is a image-text-to-text model from lactroiii. Use it for the image-text-to-text task on the model card, and read the license before you ship it in a product. It is set up for transformers. The card lists the license as apache-2.0.
An abliterated version of google/gemma-4-31b-it in BF16 precision. Abliteration removes refusal directions from model weights using the technique from Refusal in Language Models Is Mediated by a Single Direction (Ardi…
Downloads · 30 days
6
7% of all-time downloads
All-time downloads
91
Public
Parameters
32.7B
62.6 GB on disk
Likes
1
Public
Click a slice to open those files.
.safetensors62.5 GB · 100%
From the Hugging Face model README
An abliterated version of google/gemma-4-31b-it in BF16 precision. Abliteration removes refusal directions from model weights using the technique from Refusal in Language Models Is Mediated by a Single Direction (Arditi et al.), extended with SVD-based multi-direction subspace projection to capture refusal behavior encoded across multiple orthogonal directions.
Gemma 4 31B is a strong multimodal model with excellent reasoning, but Google's safety training is aggressive — it refuses a wide range of prompts including benign creative writing scenarios. This abliteration significantly reduces refusal rates while preserving the model's full capabilities, including vision.
Tested on 100 harmful prompts across 3 modes (cold, system-prompted, retry) and 50 harmless prompts.
| Mode | Baseline | Abliterated | Delta |
|---|---|---|---|
| Cold (no system prompt) | 67% | 32% | -35% |
| Prompted (creative writing system prompt) | 47% | 5% | -42% |
| Retry (prompted + retry on refusal) | 40% | 2% | -38% |
| Harmless | 0% | 0% | 0% |
Cold refusal remains higher than other abliterated models (Qwen3, Llama) — Google's safety training encodes refusal across non-linear mechanisms that are harder to fully remove with linear projection. With a system prompt, refusal drops to 5%, which is practical for most use cases.
Quick benchmark on 5 MMLU subjects via chat API. Not a full MMLU run — treat as a sanity check for capability preservation.
| Subject | Baseline | Abliterated |
|---|---|---|
| Abstract Algebra | 75.0% | 75.0% |
| Anatomy | 85.9% | 88.1% |
| Astronomy | 92.8% | 92.8% |
| College Chemistry | 57.0% | 56.0% |
| College Physics | 77.5% | 74.5% |
| Overall (5 subjects) | 79.5% | 79.3% |
The 0.2% difference is within noise. Abliteration preserved the model's reasoning capabilities.
Refusal directions were measured at full precision (BF16 weights, float32 compute) across all 60 layers using:
o_proj and down_proj in the language model only (vision encoder untouched)model.language_model.layers.* weights are modified; model.vision_tower.* and model.embed_vision.* are copied verbatim.Ablation was performed shard-by-shard on safetensors files, modifying weights in float32 precision then saving back to bfloat16. Full-precision measurement (no quantization during measurement) was critical — 4-bit quantized measurements produced noticeably weaker abliteration.
from transformers import AutoModelForImageTextToText, AutoProcessor
model_name = "null-space/gemma-4-31b-it-abliterated"
processor = AutoProcessor.from_pretrained(model_name)
model = AutoModelForImageTextToText.from_pretrained(
model_name,
torch_dtype="auto",
device_map="auto",
)
messages = [
{"role": "user", "content": "Your prompt here"}
]
inputs = processor.apply_chat_template(
messages, tokenize=True, return_tensors="pt",
return_dict=True, add_generation_prompt=True,
).to(model.device)
output = model.generate(**inputs, max_new_tokens=512)
print(processor.decode(output[0], skip_special_tokens=True))
vllm serve null-space/gemma-4-31b-it-abliterated \
--tensor-parallel-size 2 \
--max-model-len 8192
Fits comfortably on 2x GPUs with 48GB+ VRAM each at BF16.
| Property | Value |
|---|---|
| Base Model | google/gemma-4-31b-it |
| Architecture | Gemma4ForConditionalGeneration (multimodal) |
| Parameters | ~32.7B |
| Hidden Size | 5376 |
| Attention Heads | 32 Q / 16 KV (sliding), 4 KV (global) |
| Layers | 60 (5 sliding + 1 full attention, repeating) |
| MLP Intermediate | 21,504 |
| Context Length | 262,144 tokens |
| Vision | 27-layer ViT encoder, 280 soft tokens per image |
| Precision | BF16 |
| Model Size | ~62 GB (2 shards) |
| Vocab Size | 262,144 |
This model has had its refusal training partially removed. It will comply with many requests that the original model would refuse. You are solely responsible for how you use this model. It is intended for research into LLM alignment, safety evaluation, red-teaming, and creative writing applications.