Gemma-4 E2B with grouped expert routing (K=96, d=0.50)
This model is a sparsified variant of
google/gemma-4-e2b-it
where each MLP's
FFN dimension is partitioned into
96 groups
via k-means on activation
profiles. At inference, the top
48 of 96 groups
fire per token (50% density),
allowing entire groups of neurons to be skipped (and their corresponding rows
of
up_proj
/
gate_proj
and columns of
down_proj
to be skipped from memory).
Group sizes (D_FFN / 96): 64 in early layers (D_FFN=6144), 128 in late layers
(D_FFN=12288). 64-element groups in bf16 = exactly 128B = one L2 cache line on
NVIDIA GPUs —
memory-bandwidth-aligned routing
.
Training recipe
Train
Sw_gate_only_50
baseline: 5000 steps gate-only, density=0.50, lr=1e-4,
tau anneal 1.0→0.01, int4 QAT, on
gemma4_e2b_it_bulk_50k.jsonl
.
Cluster activations: 4 sequences × 2048 tokens through baseline; k-means at
K=96 per layer on |gate*up| activation profile.
Polish: install GroupedMaskedMLP (K=96, K_active=48), add LoRA r128 on
up_proj
/
down_proj
, train 1000 steps CE on
gemma4_e2b_it_final_50k.jsonl
.
Results (eval on
gemma4_e2b_it_final_50k.jsonl
)
Metric
Value
vs Base
vs polish_50_per_neuron
PPL
2.95
+1.31×
+0.85×
MMLU
30.6
+0.2
+1.0
HellaSwag
54.0
+2.6
-1.8
ARC-Challenge
35.2
-2.2
+1.6
ARC-Easy
40.6
+1.2
-0.6
BoolQ
74.2
-2.4
+3.2
5-task avg
46.9
-0.1
+0.7
World-knowledge probe (172q)
58.1
-2.9
+5.2
Usage
git lfs install
git clone https://huggingface.co/Cactus-Compute/gemma4-e2b-grouped-k96
cd $(basename Cactus-Compute/gemma4-e2b-grouped-k96)
pip install torch transformers
python inference_k96.py --prompt "The capital of France is"
The inference script loads the base Gemma-4 weights from HuggingFace, installs
the grouped routing wrappers (loading cluster assignments from
groups/
), then
applies int4 QAT + LoRA + the trained state dict.
verify_grouped_routing()
asserts every layer is genuinely a
GroupedMaskedMLP
with K=96 before generation.
Citation
Internal research (Anthropic Claude + Noah Cylich, Cactus Compute), 2026-04.
Runs of Cactus-Compute gemma4-e2b-grouped-k96 on huggingface.co
0
Total runs
0
24-hour runs
0
3-day runs
0
7-day runs
0
30-day runs
More Information About gemma4-e2b-grouped-k96 huggingface.co Model
gemma4-e2b-grouped-k96 huggingface.co is an AI model on huggingface.co that provides gemma4-e2b-grouped-k96's model effect (), which can be used instantly with this Cactus-Compute gemma4-e2b-grouped-k96 model. huggingface.co supports a free trial of the gemma4-e2b-grouped-k96 model, and also provides paid use of the gemma4-e2b-grouped-k96. Support call gemma4-e2b-grouped-k96 model through api, including Node.js, Python, http.
gemma4-e2b-grouped-k96 huggingface.co is an online trial and call api platform, which integrates gemma4-e2b-grouped-k96's modeling effects, including api services, and provides a free online trial of gemma4-e2b-grouped-k96, you can try gemma4-e2b-grouped-k96 online for free by clicking the link below.
Cactus-Compute gemma4-e2b-grouped-k96 online free url in huggingface.co:
gemma4-e2b-grouped-k96 is an open source model from GitHub that offers a free installation service, and any user can find gemma4-e2b-grouped-k96 on GitHub to install. At the same time, huggingface.co provides the effect of gemma4-e2b-grouped-k96 install, users can directly use gemma4-e2b-grouped-k96 installed effect in huggingface.co for debugging and trial. It also supports api for free installation.
gemma4-e2b-grouped-k96 install url in huggingface.co: