Downloads · 30 days
131
8% of all-time downloads
xdavxd/gemma-4-26B-A4B-it-heretic-v2-NVFP4
gemma-4-26B-A4B-it-heretic-v2-NVFP4 is a image-text-to-text model from xdavxd. 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 Model Optimizer. The card lists the license as apache-2.0.
- Model Architecture: Gemma 4 - Input: Text / Image - Output: Text - Model Optimizations: - Weight quantization: FP4 - Activation quantization: FP4 - Release Date: 2026-07-20 - Version: 2.0 - Quantized by: xdavxd - Ba…
Downloads · 30 days
131
8% of all-time downloads
All-time downloads
1.6K
Public
Parameters
14.4B
18.8 GB on disk
Likes
2
Public
Click a slice to open those files.
.safetensors18.8 GB · 100%
How the weights are stored.
U811.4B · 79%
From the Hugging Face model README
This model is a quantized version of coder3101/gemma-4-26B-A4B-it-heretic. It was evaluated on several tasks to assess its quality in comparison to the original model.
This model was obtained by quantizing the weights and activations of coder3101/gemma-4-26B-A4B-it-heretic to FP4 data type using the NVFP4 format, ready for inference with vLLM. This optimization reduces the number of bits per parameter from 16 to 4, reducing the disk size and GPU memory requirements by approximately 64%.
Only the MoE expert MLP weights and activations are quantized to FP4 using NVIDIA Model Optimizer with the nvfp4_experts_only-kv_fp8_cast recipe. Self-attention projections, shared MLP layers, vision tower, embedding, output head, and MoE router layers are kept in their original BF16 precision. KV cache uses FP8 with constant amax at inference time.
v2 uses NVIDIA's experts-only quantization strategy, which quantizes only the MoE expert layers (~90% of parameters) while preserving the quality-sensitive attention and shared MLP layers at full precision. This follows established MoE quantization best practices showing expert layers are significantly more tolerant of low-bit quantization than shared pathway layers.
This model can be deployed using vLLM. For detailed instructions including multi-GPU deployment, multimodal inference, thinking mode, function calling, and benchmarking, see the Gemma 4 vLLM usage guide.
vllm serve xdavxd/gemma-4-26B-A4B-it-heretic-v2-NVFP4 \
--max-model-len 32768 \
--gpu-memory-utilization 0.90
To enable thinking/reasoning and tool calling:
vllm serve xdavxd/gemma-4-26B-A4B-it-heretic-v2-NVFP4 \
--max-model-len 32768 \
--gpu-memory-utilization 0.90 \
--enable-auto-tool-choice \
--reasoning-parser gemma4 \
--tool-call-parser gemma4 \
--chat-template examples/tool_chat_template_gemma4.jinja \
--default-chat-template-kwargs '{"enable_thinking": true}' \
--limit-mm-per-prompt '{"image": 4, "audio": 1}' \
--async-scheduling
Tip: For text-only workloads, pass
--limit-mm-per-prompt '{"image": 0, "audio": 0}'to skip vision encoder memory allocation and free up GPU memory for a longer context window.
from openai import OpenAI
openai_api_key = "EMPTY"
openai_api_base = "http://<your-server-host>:8001/v1"
client = OpenAI(
api_key=openai_api_key,
base_url=openai_api_base,
)
model = "xdavxd/gemma-4-26B-A4B-it-heretic-NVFP4"
messages = [
{"role": "user", "content": "Explain quantum mechanics clearly and concisely."},
]
outputs = client.chat.completions.create(
model=model,
messages=messages,
)
generated_text = outputs.choices[0].message.content
print(generated_text)
This model was created by applying NVFP4 quantization with NVIDIA Model Optimizer, as presented in the code snippet below.
<details>python3 examples/llm_ptq/hf_ptq.py \
--model ~/models/gemma-4-26b-a4b-heretic \
--recipe general/ptq/nvfp4_experts_only-kv_fp8_cast \
--export_path ~/models/gemma-4-26b-a4b-heretic-nvfp4 \
--calib_size 1024 \
--export_fmt hf
</details>
This model was evaluated on GSM8K Platinum, MMLU-Pro, IFEval, MATH-500, AIME 2025, GPQA Diamond, and LiveCodeBench v6 using lm-evaluation-harness and lighteval, served with vLLM (OpenAI-compatible API). All evaluations were performed with thinking disabled (chat template default).
(as reported by coder3101)
| Metric | This model | Original model (google/gemma-4-26B-A4B-it) |
|---|---|---|
| KL divergence | 0.0499 | 0 (by definition) |
| Refusals | 11/100 | 100/100 |
Original and RedHatAI benchmarks taken from RedHatAI, comparison to see how the heretic model converted to NVFP4 stacks up against the non-heretic versions. Recovery vs. Original to see how the combination of heretic ARA (Arbitrary-Rank Ablation) and then quantization affects accuracy.
<table> <thead> <tr> <th>Category</th> <th>Benchmark</th> <th>google/gemma-4-26B-A4B-it</th> <th>RedHatAI/gemma-4-26B-A4B-it-NVFP4</th> <th>xdavxd/gemma-4-26B-A4B-it-heretic-NVFP4</th> <th>xdavxd/gemma-4-26B-A4B-it-heretic-v2-NVFP4</th> <th>Recovery</th> </tr> </thead> <tbody> <tr> <td rowspan="2"><b>Instruction Following</b></td> <td>IFEval (0-shot, prompt-level strict)</td> <td>89.96</td> <td>87.24</td> <td>87.19</td> <td>89.16</td> <td>99.1%</td> </tr> <tr> <td>IFEval (0-shot, inst-level strict)</td> <td>93.21</td> <td>91.29</td> <td>91.05</td> <td>92.45</td> <td>99.2%</td> </tr> <tr> <td rowspan="5"><b>Reasoning</b></td> <td>GSM8K Platinum (0-shot, strict-match)</td> <td>95.43</td> <td>94.43</td> <td>94.49</td> <td>95.53</td> <td>100.0%</td> </tr> <tr> <td>MMLU-Pro (0-shot, custom-extract)</td> <td>83.47</td> <td>81.65</td> <td>-</td> <td>81.81*</td> <td>98.0%</td> </tr> <tr> <td>MATH-500 (0-shot, pass@1)</td> <td>84.80</td> <td>87.60</td> <td>85.13</td> <td>85.93</td> <td>101.3%</td> </tr> <tr> <td>AIME 2025 (0-shot, pass@1)</td> <td>80.00</td> <td>66.25</td> <td>58.75</td> <td>77.09</td> <td>96.36%</td> </tr> <tr> <td>GPQA Diamond (0-shot, pass@1)</td> <td>73.20</td> <td>72.39</td> <td>66.67</td> <td>73.57</td> <td>100.5%</td> </tr> <tr> <td><b>Coding</b></td> <td>LiveCodeBench v6 (0-shot, pass@1)</td> <td>74.48</td> <td>68.19</td> <td>-</td> <td>-</td> <td>-.-%</td> </tr> </tbody> </table> <sup>* MMLU Pro results are 1 run</sup>The results were obtained using the following commands:
<details>Each benchmark was run 3 times with different judgmental seeds (1234, 2345, 3456) and the scores were averaged; AIME 2025 used 8 seeds.
Ran using a docker image, you will need to tweak these for your own environment. Kept parameters similar to the RedHatAI runs.
vLLM server (all benchmarks):
sudo docker run --rm -it \
--gpus all \
--ipc=host \
--network host \
-v ~/models/gemma-4-26b-a4b-it-heretic-v2-nvfp4:/models/heretic2:ro \
-e VLLM_USE_V2_MODEL_RUNNER=1 \
ghcr.io/timothystewart6/vllm-gb10:latest \
vllm serve /models/heretic2 \
--host 0.0.0.0 --port 8001 \
--served-model-name heretic-v2 \
--max-model-len 69632 \
--gpu-memory-utilization 0.50 \
--enable-auto-tool-choice \
--reasoning-parser gemma4 \
--tool-call-parser gemma4 \
--limit-mm-per-prompt '{"image":0,"audio":0}' \
--kv-cache-dtype fp8 \
--max-num-seqs 32 \
--async-scheduling
for SEED in 1234 2345 3456; do
lm_eval --model local-chat-completions \
--tasks gsm8k_platinum_cot_llama \
--model_args "model=heretic-v2,max_length=36096,base_url=http://0.0.0.0:8001/v1/chat/completions,num_concurrent=32,max_retries=3,tokenized_requests=False,tokenizer_backend=None,timeout=2400" \
--num_fewshot 0 \
--apply_chat_template \
--output_path "results_gsm8k_seed${SEED}.json" \
--seed $SEED \
--gen_kwargs "do_sample=True,temperature=1.0,top_p=0.95,top_k=64,max_gen_toks=32000,seed=${SEED}"
echo "Seed $SEED complete"
done
for SEED in 1234 2345 3456; do
lm-eval run --model local-chat-completions \
--tasks mmlu_pro \
--model_args "model=heretic-v2,max_length=36096,base_url=http://0.0.0.0:8001/v1/chat/completions,num_concurrent=32,max_retries=3,tokenized_requests=False,tokenizer_backend=None,timeout=2400" \
--num_fewshot 0 \
--apply_chat_template \
--output_path "results_mmlu_pro_seed${SEED}.json" \
--seed $SEED \
--gen_kwargs "do_sample=True,temperature=1.0,top_p=0.95,top_k=64,max_gen_toks=32000,seed=${SEED}"
echo "MMLU-Pro seed $SEED complete"
done
for SEED in 1234 2345 3456; do
lm_eval --model local-chat-completions \
--tasks ifeval \
--model_args "model=heretic-v2,max_length=36096,base_url=http://0.0.0.0:8001/v1/chat/completions,num_concurrent=32,max_retries=3,tokenized_requests=False,tokenizer_backend=None,timeout=2400" \
--num_fewshot 0 \
--apply_chat_template \
--output_path "results_ifeval_seed${SEED}.json" \
--seed $SEED \
--gen_kwargs "do_sample=True,temperature=1.0,top_p=0.95,top_k=64,max_gen_toks=32000,seed=${SEED}"
echo "IFEval seed $SEED complete"
done
litellm_config.yaml:
model_parameters:
provider: hosted_vllm
model_name: hosted_vllm/heretic-v2
base_url: http://0.0.0.0:8001/v1
api_key: ''
timeout: 7200
concurrent_requests: 32
generation_parameters:
temperature: 1.0
max_new_tokens: 65536
top_p: 0.95
top_k: 64
seed: 1234
# GPQA Diamond (3 seeds)
for SEED in 1234 2345 3456; do
sed -i "s/seed: .*/seed: $SEED/" litellm_config.yaml
lighteval endpoint litellm litellm_config.yaml 'gpqa:diamond|0' \
--output-dir "results_gpqa_seed${SEED}/" --save-details
echo "GPQA Diamond seed $SEED complete"
done
# MATH-500 (3 seeds)
for SEED in 1234 2345 3456; do
sed -i "s/seed: .*/seed: $SEED/" litellm_config.yaml
lighteval endpoint litellm litellm_config.yaml 'math_500|0' \
--output-dir "results_math500_seed${SEED}/" --save-details
echo "MATH-500 seed $SEED complete"
done
# AIME 2025 (8 seeds)
for SEED in 1234 2345 3456 4567 5678 6789 7890 8901; do
sed -i "s/seed: .*/seed: $SEED/" litellm_config.yaml
lighteval endpoint litellm litellm_config.yaml 'aime25|0' \
--output-dir "results_aime_seed${SEED}/" --save-details
echo "AIME 2025 seed $SEED complete"
done
litellm_config.yaml:
model_parameters:
provider: hosted_vllm
model_name: hosted_vllm/heretic
base_url: http://0.0.0.0:8001/v1
api_key: ''
timeout: 7200
concurrent_requests: 32
generation_parameters:
temperature: 1.0
max_new_tokens: 32768
top_p: 0.95
top_k: 64
seed: 1234
for SEED in 1234 2345 3456; do
sed -i "s/seed: .*/seed: $SEED/" litellm_config.yaml
lighteval endpoint litellm litellm_config.yaml 'lcb:codegeneration_v6|0' \
--output-dir "results_lcb_seed${SEED}/" --save-details
echo "LiveCodeBench v6 seed $SEED complete"
done
</details>