Instructions to use apocryphx/gemma-4-E2B-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-E2B-it-qat-q4-apml with MLX:
# Download the model from the Hub pip install huggingface_hub[hf_xet] hf download apocryphx/gemma-4-E2B-it-qat-q4-apml --local-dir gemma-4-E2B-it-qat-q4-apml
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- Atomic Chat
gemma-4-E2B-it-qat-q4.apml β Apertura model bundle (lattice-exact QAT)
Replaced 2026-10-09 β source checkpoint changed. Revisions before this date were a post-training MLX-affine group-64 quantization of the plain
google/gemma-4-E2B-itrelease (Q8 head, Q8 per-layer table). This revision is built from Google's QAT checkpoint with the lattice-exact recipe below; bundle layout and name are unchanged. 2.9 GB on disk (was 4.0 GB).
Gemma 4 E2B (elastic 2B) instruction-tuned, Google's QAT-Q4 weights (*-qat-q4_0-unquantized) 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 AND the per-layer embedding table (embed_tokens_per_layer, half of
the model's parameters) sit on the same lattice and are 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-E2B-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 a plain
post-training quantizer must) 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 4.59 B quantized weights (the old row is measured against ITS source, the plain bf16 -it release):
| recipe | bit-exact | within 1 bf16 ulp | top-1 vs bf16, 3 probes | top-1, 2176-tok prompt Γ256 |
|---|---|---|---|---|
plain -it source, affine g64 + Q8 head/table (previous revisions) |
14.2% | 33.2% | 131/144 | 240/256 |
| QAT source, lattice g32, exact Q4 head + table (this revision) | 90.4% | 100.0000% | 116/116 | 251/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 cost ~5% decode vs group 64 on the 31B (Apertura roadmap Β§1d); not
re-measured on this model; fidelity was the aim. Requires an Apertura build from 2026-10-09 or
later: the QAT elastic checkpoints omit the unused K/V projections on the shared-KV layers,
and older builds expect them.
weights/mlx-q4/quantization.json records lattice: qat-int4-g32, embed_bits: 4, ple_bits: 4 and the fit
statistics. Head/table re-quantization is disabled by the loader on lattice bundles.
Download
hf download apocryphx/gemma-4-E2B-it-qat-q4-apml --local-dir gemma-4-E2B-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-E2B-it-qat-q4_0-unquantized; the same terms and use
restrictions apply to it and to any further derivatives.
- Downloads last month
- 80
Quantized
Model tree for apocryphx/gemma-4-E2B-it-qat-q4-apml
Base model
google/gemma-4-E2B