Text Generation
Transformers
Safetensors
English
gemma4_unified
image-text-to-text
gemma4
gemma
google
gemma-4-12B
dense
transformer
12b
multimodal-capable
uncensored
abliterated
unfiltered
refusal-removed
biprojection
multi-direction-biprojection
k4-biprojection
aeon
aeon-7
trevor-js
heretic
chat
instruct
reasoning
coding
tool-calling
function-calling
agentic
bf16
bfloat16
dgx-spark
blackwell
gb10
grace-blackwell
nvidia
gpu
arm64
aarch64
vllm
openai-api
openai-compatible
low-drift
capability-preserving
prefix-caching
chunked-prefill
english
production-ready
conversational
Instructions to use edan23/Gemma-4-12B-it-AEON-Abliterated-K4-BF16 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use edan23/Gemma-4-12B-it-AEON-Abliterated-K4-BF16 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="edan23/Gemma-4-12B-it-AEON-Abliterated-K4-BF16") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("edan23/Gemma-4-12B-it-AEON-Abliterated-K4-BF16") model = AutoModelForMultimodalLM.from_pretrained("edan23/Gemma-4-12B-it-AEON-Abliterated-K4-BF16", device_map="auto") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] inputs = processor.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(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use edan23/Gemma-4-12B-it-AEON-Abliterated-K4-BF16 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "edan23/Gemma-4-12B-it-AEON-Abliterated-K4-BF16" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "edan23/Gemma-4-12B-it-AEON-Abliterated-K4-BF16", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/edan23/Gemma-4-12B-it-AEON-Abliterated-K4-BF16
- SGLang
How to use edan23/Gemma-4-12B-it-AEON-Abliterated-K4-BF16 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 "edan23/Gemma-4-12B-it-AEON-Abliterated-K4-BF16" \ --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": "edan23/Gemma-4-12B-it-AEON-Abliterated-K4-BF16", "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 "edan23/Gemma-4-12B-it-AEON-Abliterated-K4-BF16" \ --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": "edan23/Gemma-4-12B-it-AEON-Abliterated-K4-BF16", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use edan23/Gemma-4-12B-it-AEON-Abliterated-K4-BF16 with Docker Model Runner:
docker model run hf.co/edan23/Gemma-4-12B-it-AEON-Abliterated-K4-BF16
| # AGENTS.md — Gemma-4-12B-it AEON Abliterated K=4 (BF16) | |
| Instructions for autonomous agents on how to **download, load, prompt, | |
| fine-tune, quantize, or evaluate** this model correctly. | |
| ## What this model is | |
| A BF16 abliteration of `google/gemma-4-12B-it` produced via | |
| **K=4 multi-direction norm-preserving biprojection** (custom extension | |
| of TrevorJS's K=1 recipe). Refusal behavior is removed; capability is | |
| preserved (≤ ±1% wikitext PPL drift, IFEval and HumanEval syntactic | |
| match base, +6.7pp on HumanEval functional in our N=15 sample). | |
| This is the **canonical full-precision** publish. For Blackwell | |
| inference use the **[NVFP4 SVDQuant sister](https://huggingface.co/AEON-7/Gemma-4-12B-it-AEON-Abliterated-K4-NVFP4-SVDQuant)** (8.5 GB, ~lossless). | |
| ## Hard requirements | |
| - **transformers** ≥ 5.10 (model_type is `gemma4_unified`, missing from 5.5.x) | |
| - **torch** ≥ 2.7 with CUDA, BF16 support | |
| - **GPU memory** ≥ 26 GB free for BF16 inference + activations + KV cache (single 24 GB card needs offloading) | |
| - **disk** ≥ 24 GB free | |
| ## Download | |
| ```bash | |
| pip install --upgrade "transformers>=5.10" "huggingface_hub[cli]" | |
| huggingface-cli download \ | |
| AEON-7/Gemma-4-12B-it-AEON-Abliterated-K4-BF16 \ | |
| --local-dir ./Gemma-4-12B-AEON-K4-BF16 | |
| ``` | |
| ## Load (transformers) | |
| ```python | |
| from transformers import AutoTokenizer, Gemma4UnifiedForConditionalGeneration | |
| import torch | |
| REPO = "AEON-7/Gemma-4-12B-it-AEON-Abliterated-K4-BF16" | |
| tok = AutoTokenizer.from_pretrained(REPO) | |
| model = Gemma4UnifiedForConditionalGeneration.from_pretrained( | |
| REPO, torch_dtype=torch.bfloat16, device_map="cuda:0" | |
| ) | |
| ``` | |
| > ⚠️ Gemma-4 is multimodal — `apply_chat_template` returns a `BatchEncoding` **dict**, not a tensor. Always unpack with `**enc` (or grab `enc["input_ids"]` explicitly). | |
| ## Inference (one-shot) | |
| ```python | |
| enc = tok.apply_chat_template( | |
| [{"role": "user", "content": "Explain quantum error correction in 3 paragraphs."}], | |
| add_generation_prompt=True, return_tensors="pt", return_dict=True, | |
| ) | |
| enc = {k: v.to(model.device) for k, v in enc.items() if hasattr(v, "to")} | |
| out = model.generate( | |
| **enc, max_new_tokens=512, do_sample=False, pad_token_id=tok.eos_token_id | |
| ) | |
| print(tok.decode(out[0][enc["input_ids"].shape[1]:], skip_special_tokens=True)) | |
| ``` | |
| ## Serving (vLLM) | |
| ```bash | |
| vllm serve AEON-7/Gemma-4-12B-it-AEON-Abliterated-K4-BF16 \ | |
| --served-model-name aeon-12b \ | |
| --dtype bfloat16 \ | |
| --max-model-len 65536 \ | |
| --max-num-seqs 8 \ | |
| --gpu-memory-utilization 0.85 \ | |
| --trust-remote-code \ | |
| --enable-chunked-prefill \ | |
| --enable-prefix-caching \ | |
| --enable-auto-tool-choice \ | |
| --tool-call-parser gemma4 | |
| ``` | |
| **Container suggestion**: For DGX Spark + Blackwell users, use [`ghcr.io/aeon-7/aeon-vllm-ultimate:latest`](https://github.com/AEON-7/vllm-ultimate-dgx-spark). **However**, as of 2026-06-04 the multimodal path has upstream vLLM bugs in PR #44389. For Gemma-4 production today, fall back to `ghcr.io/aeon-7/aeon-gemma-4-26b-a4b-dflash:latest` (vLLM 0.20.1), which is known-good for this architecture. | |
| ## Prompt expectations | |
| - **Style**: Inherits Gemma 4 instruct voice — markdown-rich, detail-oriented, English-only reliably. | |
| - **Refusal preamble**: On topics the base would decline, expect a 1–3 sentence disclaimer / context paragraph **before** the requested content. The model **complies** after the preamble. This is a stylistic artifact of single-pass biprojection at scale=1.0 and is not reducible without DPO/SFT. | |
| - **System prompts**: Persona instructions are obeyed; explicit safety-disabling system prompts are not necessary for the model to produce content the base would decline. | |
| - **Sampling**: `do_sample=False` for deterministic eval. For chat, `temperature=0.7, top_p=0.9` matches the base model's behavior closely. | |
| ## Behavior notes for agents | |
| - **Tool calling** works via standard Gemma-4 tool-call parser (`--tool-call-parser gemma4` in vLLM). The model produces tool-call JSON without hesitation. | |
| - **Multimodal**: vision/audio encoder paths are unchanged from base — `embed_vision*` and `embed_audio*` are untouched by the abliteration. Image and audio inputs work normally. | |
| - **Long context**: Hybrid sliding-1024 + full-attention layers. KV grows linearly until 1024 tokens then flattens for sliding-only layers. 65k context is comfortable on 80 GB GPUs. | |
| - **Languages**: English is the validated path. The base model's multilingual capability is preserved structurally but the abliteration calibration probes were English-only. | |
| ## Fine-tuning | |
| This model is a **legitimate base for further training**. The weight edits are sparse (48 matrices out of ~600) and norm-preserving, so LoRA, QLoRA, full fine-tune, and DPO all work without surprises. Use the same hyperparameters as you would for `google/gemma-4-12B-it`. | |
| ```python | |
| # LoRA target modules (standard for Gemma-4): | |
| target_modules = ["q_proj", "k_proj", "v_proj", "o_proj", "gate_proj", "up_proj", "down_proj"] | |
| ``` | |
| ## Re-quantization | |
| To reproduce the published NVFP4 SVDQuant variant: | |
| ```bash | |
| git clone https://github.com/AEON-7/aeon-abliterations | |
| cd aeon-abliterations/gemma-4-12B | |
| python3 quantize_svdquant.py \ | |
| --src AEON-7/Gemma-4-12B-it-AEON-Abliterated-K4-BF16 \ | |
| --dst ./Gemma-4-12B-AEON-K4-NVFP4-SVDQuant \ | |
| --calibration-dataset abisee/cnn_dailymail \ | |
| --calibration-samples 2048 \ | |
| --calibration-tokens 1024 \ | |
| --exclude 'lm_head' --exclude 'model.embed_vision*' --exclude 'model.embed_audio*' \ | |
| --device cuda:0 | |
| ``` | |
| Quant takes ~7.5h on DGX Spark GB10. Native sm_121a calibration gives hardware-accurate scale factors. | |
| ## Eval suggestions | |
| | Eval | Expected | Command | | |
| |---|---|---| | |
| | Refusal rate (heretic) | 0% | `python -m heretic.evaluator --model <repo>` | | |
| | wikitext PPL drift | -4.22% | `python scripts/eval_ppl.py --base google/gemma-4-12B-it --target <repo>` | | |
| | IFEval (verifiable subset) | 90% | `lm-eval --task ifeval --model hf --model_args pretrained=<repo>` | | |
| | MMLU (full) | within ±2pp of base | `lm-eval --task mmlu --model hf --model_args pretrained=<repo>` | | |
| | HumanEval functional | +6.7pp vs base (N=15 sample) | `bigcode-eval --task humaneval --model <repo>` | | |
| ## License + safety | |
| - Inherits the [Gemma license](https://ai.google.dev/gemma/terms). | |
| - Operator-side safety layers are **required** for any production use — see the arbitration clause in the README. | |
| - The absence of refusal behavior means **the duty of care is yours, not the model's**. | |
| ## Support the work | |
| Tip-jar addresses in the README. No obligation. | |