license: apache-2.0
license_link: https://ai.google.dev/gemma/docs/gemma_4_license
base_model: llmfan46/gemma-4-31B-it-uncensored-heretic
base_model_relation: quantized
quantized_by: sjoe1244
pipeline_tag: image-text-to-text
library_name: exllamav3
tags:
- exl3
- exllamav3
- tabbyapi
- gemma4
- heretic
- uncensored
- abliterated
- vision
- conversational
- quantized
inference: false
Gemma 4 31B Uncensored Heretic · EXL3 4.00bpw-h4-vb4
An ExLlamaV3 quant ofllmfan46/gemma-4-31B-it-uncensored-heretic.
It is built for long context with vision on a single 24 GB card. Weights, head, vision tower and KV cache are all 4-bit.
2026-10-19: re-exported with ExLlamaV3 1.6.3. The previous 1.6.0 files are kept on theexl3-1.6.0 branch.
On our test the 1.6.3 files score a hair worse (KL 0.0268 vs 0.0262). Speed and size are the same.
2026-11-09: ExLlamaV3 1.6.6 re-export is on theexl3-1.6.6 branch.main stays on 1.6.3. Same shard sizes; 1.6.6 was smoke-tested for text + vision on Tabby.
It runs in TabbyAPI or ExLlamaV3 only. It does not run in Transformers, vLLM or llama.cpp.
At a glance (one RTX 4090, 24 GB)
| This quant | |
|---|---|
| Download | 18.5 GB |
| Context pool | ~179K–194K tokens with vision on (4-bit KV cache) |
| Writing speed | 46 tok/s (short prompt), 43 tok/s at 32K |
| Quality (KL vs original, lower is better) | 0.027 (our 4.00bpw-h6: 0.026) |
Which one should I download?
| Quant | Size | KL vs original | Context pool on a 4090 | Pick it if… |
|---|---|---|---|---|
| 4.00bpw-h4-vb4 (this) | 18.5 GB | 0.027 | ~194K, vision on | you want the most context, with images |
| 4.00bpw-h6 | 19.0 GB | 0.026 | ~139K, vision off | you want a 6-bit head and don't need images |
| 4.15bpw-h6 | 19.6 GB | 0.025 | ~139K, vision off | you want a hair more quality than 4.00 |
| 4.50bpw-h8 | 21.2 GB | 0.018 | 70K–121K | you want the best quality |
Quick start (TabbyAPI, 24 GB)
model:
max_seq_len: 64000
cache_size: 194560
cache_mode: 4,4
chunk_size: 1024
max_batch_size: 2
vision: true
prompt_template: gemma4
This exact setup survived two ~63K-token prompts running at the same time.
With vision: false you can raise cache_size to 206848.
Good to know
- Made with ExLlamaV3 1.6.3. Tested on 1.6.3, and it also loads and answers text + image prompts on 1.5.3.
The 1.6.0 files on theexl3-1.6.0branch work on 1.6.3 too. - The 4-bit cache costs some accuracy. It adds about a quarter more drift than a full-precision cache.
If you don't need the room,cache_mode: 6,6or8,8is more accurate. Those modes were not fit-tested on this quant. - Vision loads and fits in the numbers above. Image quality was not benchmarked.
- Hugging Face shows "9B params" in the sidebar. That is how it counts EXL3's packed tensors. This is the 31B model.
- Not the coder3101 heretic. That one is
sjoe1244/gemma-4-31B-it-heretic-exl3-4.00bpw-h6.
Full measurements and test setup
How it was made
| Setting | Value |
|---|---|
| Method | EXL3, ExLlamaV3 1.6.3 (release wheel) |
| Weights | 4.00 bpw |
Head (lm_head) |
4 bits |
| Vision tower | 4 bits (190 linear layers) |
| Embeddings | BF16 (unquantized) |
| Codebook | mul1, out_scales auto |
| Calibration | 250 rows x 2048 cols (ExLlamaV3 default set) |
| Source | llmfan46/gemma-4-31B-it-uncensored-heretic, BF16 |
| File | Bytes |
|---|---|
model-00001-of-00003.safetensors |
8,415,898,175 |
model-00002-of-00003.safetensors |
8,557,177,089 |
model-00003-of-00003.safetensors |
1,539,495,613 |
| Total | 18,512,570,877 (17.24 GiB) |
Quality vs the BF16 source
The test is ExLlamaV3 eval/qbench.py on WikiText-2 test, chat-templated, 20 x 2048 rows.
The reference is BF16 logits from the unquantized source, with the same tokens for every model.
| Quant | KL mean | KL median | KL p90 | Perplexity |
|---|---|---|---|---|
| BF16 | — | — | — | 16.586 |
| 4.00bpw-h4-vb4, 1.6.3 (this) | 0.0268 | 0.0047 | 0.0456 | 16.514 |
4.00bpw-h4-vb4, 1.6.0 (branch exl3-1.6.0) |
0.0262 | 0.0045 | 0.0430 | 16.687 |
| 4.00bpw-h6 | 0.0262 | 0.0041 | 0.0407 | 16.655 |
| 4.50bpw-h8 | 0.0181 | 0.0029 | 0.0303 | 16.624 |
The 1.6.0 and 1.6.3 rows were run in the same qbench pass. The tail is a little worse than 4.00bpw-h6, because of the 4-bit head.
Perplexity below BF16 does not mean better; KL is the number to read.
KV cache cost
The test is eval/model_diff.py on raw WikiText-2, 20 x 2048 rows. Only the comparison between rows is meaningful,
because raw-text scores are inflated for an instruct model.
| Setup | KL mean | KL median | KL p90 |
|---|---|---|---|
| This quant (1.6.3), FP16 cache | 0.420 | 0.046 | 0.978 |
| This quant (1.6.3), 4,4 cache | 0.528 | 0.075 | 1.354 |
| 1.6.0 files, FP16 cache | 0.399 | 0.041 | 0.892 |
| 1.6.0 files, 4,4 cache | 0.495 | 0.067 | 1.218 |
| 4.50bpw-h8, 8,8 cache | 0.328 | 0.028 | 0.673 |
Fit on one RTX 4090 (24,564 MiB)
The bisect below was done on the 1.6.0 files (same tensor layout and shard sizes as 1.6.3).
The 1.6.3 files were checked at pool 179,200 on TabbyAPI + ExLlamaV3 1.6.3: 21.9 GB idle, a 125K-token needle prompt found its
answer at a 23,733 MiB peak, and text, image and tool calls passed.
The bisect setup was TabbyAPI with ExLlamaV3 1.6.0, cache_mode 4,4, max_batch_size 2, chunk_size 1024 and max_seq_len 64000.
- The largest pool that loads was found by bisecting in 2,048-token steps.
- Stress-tested means the pool also survived two ~62.8K-token prompts prefilling at the same time.
- VRAM is the whole-GPU
nvidia-smireading.
| Setup | Largest pool, stress-tested (tokens) | VRAM idle | VRAM peak |
|---|---|---|---|
| This quant, vision on | 194,560 | 22,263 MiB | 22,947 MiB |
| This quant, vision off | 206,848 | — | 22,879 MiB |
| 4.50bpw-h8, vision off (same image, 4,4) | 120,832 | — | 23,781 MiB |
Each 8,192 tokens of pool costs about 180 MB at 4,4. Vision costs about 12K tokens of pool.
Speed (one request at a time)
| Prompt | Prefill | Decode |
|---|---|---|
| 2K tokens | ~900 tok/s | 46.1 tok/s |
| 32K tokens | ~1,430–1,530 tok/s | 43.2 tok/s |
Measured on 1.6.3 with forced 512-token replies, max_batch_size 2. For comparison, 4.50bpw-h8 decoded at 39.9 and 37.5 tok/s (1.6.0).
Credit and license
Apache 2.0, the same as google/gemma-4-31B-it and the source model. The uncensoring isllmfan46's work. This repo only adds the EXL3 export.