ukint-vs/gemma-4-19b-a4b-it-REAP-MLX-4bit
gemma-4-19b-a4b-it-REAP-MLX-4bit
PLE-safe MLX 4-bit weights for 0xSero/gemma-4-19b-a4b-it-REAP on Apple Silicon.
REAP (Router-weighted Expert Activation Pruning) removes 30% of MoE experts while keeping the same active parameters per token (8 of 90 experts selected). Combined with PLE-safe 4-bit quantization, this model runs in 12.6 GB — fits on 24GB+ Macs.
Also available
- gemma-4-21b-a4b-it-REAP-MLX-4bit — 21B MoE (20% pruned), 13.9 GB
Accuracy Benchmarks
0-shot generative, thinking enabled, 50 samples per task, identical eval harness. Apple M4 Max 36GB.
The 30% expert pruning compounds with 4-bit quantization. Note: high extraction failure rates (up to 60%) on some tasks — the model generates verbose explanations instead of single-letter answers, so true accuracy may be higher than reported. Consider the 21B variant for better accuracy.
Extraction failures (unparseable responses) are counted as incorrect. REAP-19B: 113/400 (28%). True accuracy may be higher. Full methodology: GitHub.
Quantization Details
- Bits: 4
- Group size: 64
- Strategy: PLE-safe — only large
nn.LinearandSwitchLinear(MoE expert) layers are quantized. All PLE/ScaledLinear/vision layers stay in bf16.
Usage
pip install -U mlx-vlmVision
from mlx_vlm import load, generate
model, processor = load("ukint-vs/gemma-4-19b-a4b-it-REAP-MLX-4bit")
tokenizer = processor.tokenizer
messages = [{"role": "user", "content": [
{"type": "image", "url": "photo.jpg"},
{"type": "text", "text": "Describe this image in detail."},
]}]
prompt = tokenizer.apply_chat_template(messages, add_generation_prompt=True, tokenize=False)
out = generate(model, processor, prompt, ["photo.jpg"],
max_tokens=200, repetition_penalty=1.2, temperature=0.7)
print(out.text)Text
messages = [{"role": "user", "content": "What is the capital of France?"}]
prompt = tokenizer.apply_chat_template(messages, add_generation_prompt=True, tokenize=False)
out = generate(model, processor, prompt, max_tokens=100, temperature=0.0)
print(out.text)Validation
Trimodal validation: 10/10 vision, 3/3 chat (EN/ZH/JA). Full results: GitHub.
Bugs Fixed in mlx-vlm
License
Model weights: Google Gemma License. Quantization scripts: MIT.
