This quantization follows the APEX approach by mudler, which optimizes MoE models through tensor-specific quantization strategies and importance-matrix calibration.
Steps Performed
F16 GGUF Conversion
Safetensors → gemma4-19b-a4b-reap-heretic-f16.gguf (36.9 GB)
Using convert_hf_to_gguf.py from llama.cpp
Importance Matrix Generation
Calibration with ~48,600 tokens from diverse sources:
The source model was compressed using REAP (Router-weighted Expert Activation Pruning):
Metric
Original (26B)
REAP 30% (19B)
Total Parameters
~26B
19.02B
Experts/Layer
128
90
Active Params/Tok
~4B
~4B
Disk Size (BF16)
~52 GB
~36 GB
REAP removes 30% of MoE experts (38 of 128 per layer) while preserving routing behavior.
Heretic Abliteration (Pre-Quantization)
Uncensored behavior was achieved using Heretic v1.2.0 with the Arbitrary-Rank Ablation (ARA) method:
Parameter
Value
start_layer_index
14
end_layer_index
25
preserve_good_behavior_weight
0.7884
steer_bad_behavior_weight
0.0002
overcorrect_relative_weight
1.0972
neighbor_count
7
Result: Refusals reduced from 94/100 → 6/100 with KL divergence of only 0.0290.
Important Notes
Imatrix-Based Quantization
Unlike naive quantization, APEX uses an importance matrix determined during calibration. This matrix identifies which tensors and weights are critical for model quality, enabling:
Tensor-specific quantization levels
Better quality at the same bitrate
MoE-specific handling of expert tensors
Note: The imatrix was generated using a diverse calibration dataset (no Wikipedia!), covering chat, code, reasoning, and tool-calling.
Fallback Quantization
60 of 658 tensors required fallback quantization. These are primarily normalization and scaling tensors that were kept in F32.
Expected Quality
The APEX method (imatrix + tensor-specific config) is expected to deliver higher quality than standard Q3_K_M quantization without calibration. The matched config accounts for the special tensor architecture of this REAP+Heretic model: