Instructions to use apocryphx/gemma-4-12b-it-qat-q4-apml with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use apocryphx/gemma-4-12b-it-qat-q4-apml with MLX:
# Download the model from the Hub pip install huggingface_hub[hf_xet] hf download apocryphx/gemma-4-12b-it-qat-q4-apml --local-dir gemma-4-12b-it-qat-q4-apml
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- Atomic Chat
gemma-4-12b-it-qat-q4.apml β Apertura model bundle (lattice-exact QAT)
Replaced 2026-10-09. Revisions before this date held an MLX-affine group-64 quantization of the QAT weights (see the A/B table). This revision is the lattice-exact recipe below; the bundle layout and name are unchanged.
Gemma 4 12B instruction-tuned, Google's QAT-Q4 weights converted to the
Apertura .apml bundle format with the lattice-exact recipe: MLX-affine
4-bit, group size 32, where each block's scale is the QAT-learned step itself
(scale = d, bias = -8Β·d), so the 4-bit weights the kernel sees are the trained
lattice points β not a second, misaligned quantization of them. The tied
embedding / LM head sits on the same lattice and is stored exact at 4 bits.
tokenizer.json + chat_template.jinja included, runtime mlx, architecture gemma4.
Consumed by Apertura β an Objective-C++ transformer engine + macOS chat app on MLX.
Why this recipe
google/gemma-4-12B-it-qat-q4_0-unquantized is bf16 weights that already sit on an
int4 lattice: per 32-element block, w = bf16(kΒ·d) with codes k β [-8, 7] and a
learned per-block step d. Running a min/max affine quantizer over that (as the
earlier revisions of this repo, group 64, did) picks a different
scale and zero point and lands most weights off their trained values β the same
failure Unsloth documented for naive Q4_0 GGUFs of these checkpoints. Here d is
recovered from the lattice structure per block and written as the affine scale.
Measured against the bf16 QAT checkpoint, over all 11.9 B quantized weights:
| recipe | bit-exact | within 1 bf16 ulp | top-1 vs bf16, 3 probes | top-1, 2176-tok prompt Γ256 |
|---|---|---|---|---|
| affine g64 + Q8 head (previous revisions of this repo) | 27.7% | 33.9% | 65/67 | 231/256 |
| lattice g32 + exact Q4 head (this revision) | 90.3% | 100.0000% | 66/67 | 254/256 |
The weights that are not bit-identical differ by one bf16 rounding step: the checkpoint
stores bf16 roundings of kΒ·d, so no single bf16 step reproduces every element. The
bundle and the checkpoint are two equally faithful bf16 renderings of the trained
lattice. Group 32 costs ~23% decode throughput vs group 64 on the 31B (Apertura
roadmap Β§3); not re-measured here; fidelity was the aim.
weights/mlx-q4/quantization.json records lattice: qat-int4-g32 and the fit
statistics. Do not pass --quant-embed when loading: it would re-quantize the
exact 4-bit head.
Download
hf download apocryphx/gemma-4-12b-it-qat-q4-apml --local-dir gemma-4-12b-it-qat-q4.apml
License
Gemma is provided under and subject to the
Gemma Terms of Use. By downloading this
model you agree to those terms, including the
Gemma Prohibited Use Policy.
This repository redistributes a quantized Model Derivative of
google/gemma-4-12B-it-qat-q4_0-unquantized; the same terms and use
restrictions apply to it and to any further derivatives.
- Downloads last month
- 76
Quantized
Model tree for apocryphx/gemma-4-12b-it-qat-q4-apml
Base model
google/gemma-4-12B