This is Gemma 4 27B MoE pruned from 103 experts down to 4 active experts per token using REAP (Routing Expert Activation Pruning) — yielding a model that runs at ~21B total params but activates only a fraction per forward pass, combining large capacity with fast inference.
🖤 12 GB MLX 4-bit — runs on any M-series Mac with 24GB+ unified memory.
Multimodal: text + vision. 131K context window.
What is REAP?
REAP (Routing Expert Activation Pruning) is a technique from Cerebras that prunes MoE experts by analyzing routing patterns. Instead of activating many experts per token, REAP identifies which experts are actually essential and prunes the rest — resulting in:
Fewer experts activated per token (4 active out of 103 total)
Faster inference due to reduced compute per forward pass
Minimal quality loss — BoolQ accuracy 76%, HellaSwag 46% (see evals below)
Model Details
Property
Value
Base model
0xSero/gemma-4-21b-a4b-it-REAP
Original base
google/gemma-4-27b-it (MoE)
Architecture
Gemma4ForConditionalGeneration (MoE)
Total parameters
~21B
Total experts
103
Active experts/token
4 (REAP-pruned)
Modalities
Text · Vision
Quantization
4-bit affine, group_size=64, ~4.8 bits/weight
File size
12 GB (down from ~40 GB bf16)
Context window
131,072 tokens
Vocab size
262,144
Evaluation (from source model)
Benchmark
Score
BoolQ
76%
HellaSwag
46%
ARC-Challenge
28%
Performance (Apple Silicon)
Chip
RAM
Tok/sec (est)
M4 Max 128GB
128GB
~20–30 tok/s
M3 Ultra 192GB
192GB
~25–35 tok/s
M2 Ultra 192GB
192GB
~18–25 tok/s
Requires at least 24GB unified memory. 32GB+ recommended for comfortable operation.
1mlx_vlm.generate \2 --model deadbydawn101/gemma-4-21b-REAP-Tool-Calling-mlx-4bit \3 --prompt "What are the key differences between MoE and dense transformer models?"\4 --max-tokens 512
⚡ TurboQuant-MLX — 4.6x KV Cache Compression
Pair this model with TurboQuant-MLX — RavenX AI's Apple Silicon KV cache compression. Run 4.6x longer contexts with near-zero accuracy loss by compressing the KV cache using PolarQuant + QJL residuals.
python
1from turboquant_mlx.mlx_kvcache import TurboQuantKVCache
2import mlx_lm.models.cache as cache_module
34# Patch mlx-lm to use TurboQuant compression5cache_module.make_prompt_cache =lambda model,**kw:[6 TurboQuantKVCache()for _ inrange(len(model.layers))7]89# Now load and run as normal — context is compressed automatically10from mlx_vlm import load, generate
11model, processor = load("deadbydawn101/gemma-4-21b-REAP-Tool-Calling-mlx-4bit")
We use RavenX AI's Gemini CLI fork as the coding agent and tool orchestration layer on top of these models. This is what makes the tool-calling capability real in production.
Gemini CLI gives you a full agentic loop in the terminal — Google Search grounding, file read/write, shell execution, web fetching, and MCP server support — all wired to a 1M token context window.
bash
1# Install2npminstall -g @google/gemini-cli
34# Run as a coding agent against this model (via local mlx_lm server)5mlx_lm.server --model deadbydawn101/gemma-4-21b-REAP-Tool-Calling-mlx-4bit --port 8080&6gemini --baseUrl http://localhost:8080
78# Or use directly against Gemini API (free tier: 60 req/min)9gemini
What Gemini CLI + these models unlock together
Capability
How
Code generation
Gemini CLI reads your codebase, model reasons with <think> tags
Gemma 4 has native tool calling built into its chat template. Most models on HuggingFace don't support this — Gemma 4 does, using <|tool>, <|tool_call>, and <|tool_response> special tokens.
Define tools and call them
python
1from mlx_lm import load, generate
2import json
34model, tokenizer = load("deadbydawn101/gemma-4-21b-REAP-Tool-Calling-mlx-4bit")56tools =[7{8"type":"function",9"function":{10"name":"get_weather",11"description":"Get the current weather for a location",12"parameters":{13"type":"object",14"properties":{15"location":{"type":"string","description":"City and country"},16"units":{"type":"string","enum":["celsius","fahrenheit"]}17},18"required":["location"]19}20}21}22]2324messages =[{"role":"user","content":"What's the weather in San Jose, CA?"}]25prompt = tokenizer.apply_chat_template(26 messages,27 tools=tools,28 add_generation_prompt=True,29 tokenize=False30)31response = generate(model, tokenizer, prompt=prompt, max_tokens=256)32# Model responds with a structured tool_call in <|tool_call>...<tool_call|> format
Parse tool calls and feed results back
python
1# After tool execution, feed the result back2messages +=[3{"role":"assistant","tool_calls":[{"function":{"name":"get_weather","arguments":{"location":"San Jose, CA"}}}]},4{"role":"tool","tool_responses":[{"name":"get_weather","response":{"temp":72,"condition":"sunny"}}]}5]6prompt = tokenizer.apply_chat_template(messages, tools=tools, add_generation_prompt=True, tokenize=False)7final = generate(model, tokenizer, prompt=prompt, max_tokens=256)
ollama run hf.co/deadbydawn101/gemma-4-21b-REAP-Tool-Calling-mlx-4bit
With a custom system prompt + tool support
Create a Modelfile:
FROM hf.co/deadbydawn101/gemma-4-21b-REAP-Tool-Calling-mlx-4bit
SYSTEM "You are a helpful assistant with tool-use capabilities. Think through problems step by step."
PARAMETER temperature 0.7
PARAMETER num_ctx 8192
bash
1ollama create ravenx-gemma4 -f Modelfile
2ollama run ravenx-gemma4
Run with mlx_lm server (native, faster on Apple Silicon)
bash
1# mlx_lm server is faster than Ollama for Apple Silicon — uses Metal GPU directly2mlx_lm.server --model deadbydawn101/gemma-4-21b-REAP-Tool-Calling-mlx-4bit --port 808034# Then use any OpenAI client5curl http://localhost:8080/v1/chat/completions \6 -H "Content-Type: application/json"\7 -d '{"model": "deadbydawn101/gemma-4-21b-REAP-Tool-Calling-mlx-4bit", "messages": [{"role": "user", "content": "Hello!"}]}'
[2026-04-09] Our MLX port was merged into TriAttention (MIT + NVIDIA) — PR #1 by @DeadByDawn101 (RavenX AI).
Apply 10.7x KV memory reduction and 2.5x throughput on top of this model's built-in 4-bit TurboQuant quantization for ~50x combined compression vs full fp16: