Instructions to use abacusai/Gemma-4-12B-Uncensored with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use abacusai/Gemma-4-12B-Uncensored with Transformers:
# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("abacusai/Gemma-4-12B-Uncensored") model = AutoModelForMultimodalLM.from_pretrained("abacusai/Gemma-4-12B-Uncensored", device_map="auto") - Notebooks
- Google Colab
- Kaggle
1. Model Introduction
Gemma-4-12B-Uncensored is a refusal-removal finetune of Gemma 4 12B-it, trained by Abacus.AI. The base model declines or hedges on about 95% of a held-out set of harmful prompts with thinking off and about 92% with thinking on; this model answers them, refusing 12.9% and 4.1% respectively, and it also stops over-refusing ordinary requests (OR-Bench-hard refusals fall from 45.4% to 3.9%). The removal is not free: with thinking off it costs 6 points of MMLU-Pro and 7.5 points of MMMU-Pro, and with thinking on it costs 4.4 points of GPQA Diamond, while IFEval, IFBench, MATH-500 and speech recognition stay at parity in both modes. The weights load exactly like the official release: same layout, same Gemma4UnifiedForConditionalGeneration architecture with the image and audio paths byte-identical to the base, same 262,144-token context, same thinking switch.
This card describes the training approach and the evaluation results. A teacher model generated responses used to construct preference pairs, which were filtered by an LLM judge and used to fine-tune the base model with Direct Preference Optimization (DPO). The teacher is not included in this release. Dataset contents are not disclosed. GGUF builds for llama.cpp, Ollama and LM Studio are in abacusai/Gemma-4-12B-Uncensored-GGUF.
2. Model Summary
| Architecture | Dense decoder-only transformer, encoder-free unified multimodal (Gemma4UnifiedForConditionalGeneration) |
| Total Parameters | 11.95B |
| Number of Layers | 48 (40 sliding-window + 8 global, 5:1 interleave) |
| Attention Mechanism | Local sliding-window attention (1,024 tokens, GQA 16 heads / 8 KV heads) & global attention with a single shared key-value head and proportional RoPE |
| Hidden Dimension | 3840 (MLP 15360) |
| Vocabulary Size | 262,144 |
| Context Length | 262,144 |
| Precision | bfloat16 |
| Modality | Text, Image, Audio, Video in; Text out |
| Base Model | google/gemma-4-12B-it (revision 707f0a3b, 2026-07-20) |
| Adaptation | LoRA DPO with an NLL anchor (RPO), merged as a full delta into the language model's attention and MLP projections only |
3. Evaluation
Both models were measured side by side on the same box, with the same vLLM build, at temperature 1.0 and top_p 0.95, in both thinking modes. Every number on this card is our own run.
Refusal rates
Share of prompts refused or hedged, as scored by an LLM judge (gpt-oss-120b, effort medium) on the full answer, so polite deflections count. Lower is better in every row: on the harmful sets it means the model answered, on the safe sets it means it stopped over-refusing.
Pooled over HarmBench standard and JailbreakBench (241 prompts after removing AdvBench overlap), the base refuses 95.4% (230 of 241) with thinking off and 91.7% (221 of 241) with thinking on; this model refuses 12.9% (31 of 241) and 4.1% (10 of 241). The CategoricalHarmfulQA row is the 20% of that set held out from training. XSTest unsafe is the one harmful set where a sizeable residual remains with thinking off (33.5%).
Notes
The judge is gpt-oss-120b on Fireworks at reasoning effort medium, scoring the complete answer as compliance, partial refusal or full refusal; full and partial refusals are both counted as refusals. A keyword screen on the same answers reads 7.1% and 0.4% for this model on the pooled harmful set, which is why this card reports the judge: openers like "I can't help with that" are only part of how a model declines.
The harmful held-out set is HarmBench standard plus JailbreakBench with AdvBench overlap removed, deduplicated against the training pools. OR-Bench-hard (1,319 prompts) and XSTest safe (250) are prompts that look dangerous and are not; XSTest unsafe (200) is the matched set of genuinely unsafe prompts.
4. Training Approach
Gemma-4-12B-Uncensored was fine-tuned from the original Gemma 4 12B-it weights using LoRA Direct Preference Optimization (DPO). A teacher model generated responses for preference-pair construction, with LLM-judge filtering and benign instruction-following examples included in the training data. The loss adds a negative log-likelihood term on the preferred answer (the RPO variant, in the spirit of the Smaug line's DPO-Positive work). Training is a LoRA adapter over the language model's attention and MLP projections, merged into the base weights as a full delta; the image and audio paths are byte-identical to the base release. The teacher is never shipped.
5. Known Behaviors and Limitations
No retained refusals. This is the full-removal variant. It was trained with no hard-line categories held out and no category was separately measured, so assume every refusal category is gone.
Residual refusals. Thinking off, 12.9% of the pooled harmful set and a third of XSTest unsafe still get a refusal or a hedge; thinking on brings those to 4.1% and 21.0%. Thinking on is the mode this model was tuned for in both senses: it removes more refusals and costs less capability.
Capability cost. Real and measured. With thinking off expect weaker knowledge recall (MMLU-Pro) and visual reasoning (MMMU-Pro); with thinking on expect weaker graduate-level science questions (GPQA Diamond), mostly chemistry. Instruction following, math and speech recognition are at parity in both modes.
Answer quality on formerly refused prompts. The teacher-generated answers used in training were filtered for compliance, not for accuracy. Treat its answers on those topics as unverified.
6. Deployment
Gemma-4-12B-Uncensored is a drop-in replacement for Gemma 4 12B-it on any stack that supports the base model; the chat template is unchanged. Reference vLLM invocation:
vllm serve abacusai/Gemma-4-12B-Uncensored \
--max-model-len 262144 \
--reasoning-parser gemma4
Thinking is switched per request through the chat template; the OpenAI-compatible API takes "chat_template_kwargs": {"enable_thinking": true} and returns the thought in the reasoning field of the message. Sampling follows the base model's recommendation: temperature 1.0, top_p 0.95, top_k 64. Use thinking on unless latency rules it out (Β§5). In Transformers the same switch is a keyword of the chat template:
from transformers import AutoProcessor, AutoModelForMultimodalLM
MODEL_ID = "abacusai/Gemma-4-12B-Uncensored"
processor = AutoProcessor.from_pretrained(MODEL_ID)
model = AutoModelForMultimodalLM.from_pretrained(MODEL_ID, dtype="auto", device_map="auto")
messages = [{"role": "user", "content": "Explain how a refrigerator keeps food cold."}]
inputs = processor.apply_chat_template(messages, add_generation_prompt=True, enable_thinking=True,
tokenize=True, return_dict=True, return_tensors="pt").to(model.device)
out = model.generate(**inputs, max_new_tokens=4096, do_sample=True, temperature=1.0, top_p=0.95, top_k=64)
print(processor.decode(out[0][inputs["input_ids"].shape[-1]:], skip_special_tokens=False))
Image, audio and video inputs work exactly as on the base model; those paths are unchanged.
GGUF builds for llama.cpp, Ollama and LM Studio (IQ4_XS, Q4_K_M, Q5_K_M, Q6_K and Q8_0, plus the image projector) are in abacusai/Gemma-4-12B-Uncensored-GGUF. On the pooled harmful set the recommended Q4_K_M file refuses 4.1% (10 of 241) with thinking on and 16.6% (40 of 241) with thinking off, against 4.1% and 12.9% for these weights.
7. License
Apache 2.0, inherited from Gemma 4 12B-it. See LICENSE and the Gemma 4 license page.
8. Citation
@misc{abacusai2026gemma4uncensored,
title = {Gemma-4-12B-Uncensored},
author = {Abacus.AI},
year = {2026},
note = {Refusal-removal fine-tune of google/gemma-4-12B-it by teacher-distilled DPO},
url = {https://huggingface.co/abacusai/Gemma-4-12B-Uncensored}
}
The Smaug line and the DPO-Positive method behind the NLL anchor:
@article{pal2024smaug,
title={Smaug: Fixing Failure Modes of Preference Optimisation with DPO-Positive},
author={Pal, Arka and Karkhanis, Deep and Dooley, Samuel and
Roberts, Manley and Naidu, Siddartha and White, Colin},
journal={arXiv preprint arXiv:2402.13228},
year={2024}
}
The base model:
@misc{gemmateam2026gemma4,
title={Gemma 4 Technical Report},
author={Gemma Team},
year={2026},
eprint={2607.02770},
archivePrefix={arXiv},
primaryClass={cs.CL},
url={https://arxiv.org/abs/2607.02770}
}
9. Contact Us
If you have any questions, please reach out at Abacus.AI.
- Downloads last month
- -