license: apache-2.0
base_model: coder3101/gemma-4-E4B-it-qat-q4_0-unquantized-heretic
pipeline_tag: image-text-to-text
tags:
- gguf
- gemma4
- qat
- uncensored
- heretic
- llama.cpp
- ollama
Gemma4-E4B Uncensored A8F4 (128K)
Uncensored mixed-precision quant of google/gemma-4-E4B-it: 8-bit attention, 4-bit FFN, refusals removed with Heretic. Built from Google's QAT weights. Runs entirely on the GPU with the full 128K context in under 5 GB of VRAM. Includes vision and audio.
Same recipe as MobiusDevelopment/Gemma4-12B-Uncensored-A8F4-256K.
Uncensoring
The base is coder3101/gemma-4-E4B-it-qat-q4_0-unquantized-heretic: Google's QAT (quantization-aware trained) E4B, uncensored with Heretic. The edit is limited to layers 20 to 36.
Reported by coder3101: 5/100 refusals against 98/100 for the original, KL divergence 0.0065.
Our own check on this build, 20 borderline requests (lock picking, hotwiring, a phishing email for security training, a graphic horror scene, dangerous chemical mixes, a profane roast and others): this model refused none. Thinking, vision and long-context recall work.
Why A8F4
Attention runs on every token, so its quantization error adds up, and the Heretic edit lives there. The FFN is most of the compute and tolerates 4-bit well. A8F4 keeps attention (q, k, v, output), the token embeddings and the per-layer embedding table at Q8_0, and quantizes the FFN and the per-layer input projections with the standard Q4_K_M mix (ffn_gate, ffn_up Q4_K; ffn_down half Q6_K, half Q4_K).
| vs BF16, Python corpus | A8F4 | Q4_K_M |
|---|---|---|
| File size | 6.44 GB | 5.30 GB |
| Mean KL divergence | 0.0138 | 0.0206 |
| 99th-percentile KL divergence | 0.152 | 0.228 |
| Perplexity change | +1.4% | +1.8% |
| Same top token | 96.1% | 95.3% |
The per-layer embedding table (per_layer_token_embd) is 2.8 GB of the file. It is a lookup table: each token reads only a few rows, so Ollama keeps it in system RAM and it costs no VRAM. Vision and audio use a 0.56 GB Q8_0 projector.
Measured speed
RTX 3090 Ti 24 GB, Ollama 0.40.21, flash attention on, q8_0 KV cache:
| Context | VRAM | Recall | Prompt processing | Generation |
|---|---|---|---|---|
| 32K | 4.0 GB | code at 24K tokens: correct | 24K tokens in 4 s | 73 tok/s |
| 128K | 4.4 GB | code at 126K tokens: correct | 126K tokens in 50 s | 31 tok/s |
Short prompts: 68-95 tok/s in Ollama, 118-121 tok/s in llama.cpp b13032. All runs 100% on the GPU.
Requirements
- 6 GB of VRAM for the full 128K context. The model sets num_ctx 131072; on smaller cards lower num_ctx.
- About 3 GB of free system RAM for the per-layer embedding table.
- Ollama 0.40.21 or newer (gemma4 architecture).
- For the VRAM figures above, set these on the Ollama server:
OLLAMA_FLASH_ATTENTION=1
OLLAMA_KV_CACHE_TYPE=q8_0
Usage
ollama run MobiusDevelopment/Gemma4-E4B-Uncensored-A8F4-128K
OpenAI-compatible endpoint: http://localhost:11434/v1, model MobiusDevelopment/Gemma4-E4B-Uncensored-A8F4-128K.
llama.cpp:
llama-server -m Gemma4-E4B-Uncensored-A8F4.gguf --mmproj mmproj-Q8_0.gguf --jinja -fa on -ngl 99 -c 0
Default sampling: temperature 1.0, top_p 0.95, top_k 64.
Thinking: on by default. Turn it off with "think": false (Ollama) or chat_template_kwargs: {"enable_thinking": false} (llama.cpp). The reasoning is returned separately from the answer.
Notes
- Converted from the BF16 safetensors and quantized with llama-quantize (llama.cpp b13032), no imatrix: base type Q4_K_M, with
--tensor-typeoverrides setting attention to Q8_0 and--token-embedding-type q8_0. - KL divergence and perplexity were measured against the BF16 conversion on 60 KB of Python source (32 chunks of 512 tokens). Q4_K_M was made from the same BF16.
- A variant with the per-layer embedding table at Q4_0 (5.03 GB) measured within noise of this build. It was not published, to keep the recipe identical to the 12B.
- Vision is limited at this size: on one test logo, E4B called a Greek-key pattern a swastika. The BF16 model gives the same answer, so this is the model, not the quantization.
- Audio input was not tested. Standard benchmarks (MMLU-Pro, GSM8K, HumanEval+) have not been measured.
- This model will answer requests the original refuses. You are responsible for how you use it.
Credits
- google/gemma-4-E4B-it-qat-q4_0-unquantized
- coder3101/gemma-4-E4B-it-qat-q4_0-unquantized-heretic
License
Apache 2.0, inherited from Gemma 4.