Downloads · 30 days
0
xbill9/gemma-4-26B-A4B-it-inferentia2
gemma-4-26B-A4B-it-inferentia2 is a text generation model from xbill9. Use it when you need the model to write or continue text. It is set up for torch-neuronx. The card lists the license as apache-2.0.
Compiled AWS Neuron artifacts that run the Mixture-of-Experts google/gemma-4-26B-A4B-it across 8 NeuronCores of a single inf2.24xlarge, with greedy decode token-for-token identical to the CPU fp32 reference (SEQMATCH…
Downloads · 30 days
0
Access
Public
Updated Jul 16, 2026
Repo size
116 GB
Likes
0
Public
Click a slice to open those files.
.pt64.6 GB · 56%
From the Hugging Face model README
Compiled AWS Neuron artifacts that run the Mixture-of-Experts
google/gemma-4-26B-A4B-it across 8 NeuronCores
of a single inf2.24xlarge, with greedy decode token-for-token identical to the CPU fp32
reference (SEQ_MATCH True) and coherent output ("The capital of France is Paris.", prefill 77 ms).
This is a runnable inference port, not a fine-tune — the weights are Google's, unmodified. What's
new is getting a 128-expert MoE to trace and shard on Neuron, which the vendor stack
(optimum-neuron / the Neuron vLLM backend) cannot do for Gemma-4. This is the first-of-its-kind MoE
port in this series; all five Gemma-4 variants (E2B/E4B/12B/31B/26B-A4B) now run on Inferentia.
Each of the 30 layers runs a shared dense MLP in parallel with a 128-expert MoE, combined and passed through four feed-forward layernorms:
num_experts 128, top_k_experts 8, moe_intermediate_size 704 (per-expert), intermediate_size
2112 (shared dense MLP), hidden_size 2816, softcap 30, tied embeddings, no PLE.attention_k_eq_v).inf2.24xlarge's 192 GB HBM, not an 8xlarge.Reuses the 31B ModelBuilder recipe (single-rank compile + per-rank weight loading, mixed-attention
shard/replicate, device-resident KV cache, layer_scalar buffers, chat-template prompt) and swaps
only the experts:
gate_up ColumnParallelLinear (rank r
gets experts 16r…16r+15) + down RowParallelLinear (input-sharded → all-reduce). ~5.7 GB
experts/rank.SPMDRank + scatter_to_process_group_spmd) — a plain
scatter_to_tensor_model_parallel_region bakes rank 0's slice into the single-rank trace and every
rank ends up weighting the wrong experts.| file | what |
|---|---|
mb_26b_256.pt | Compiled TP=8 MoE model (~65 GB), KV 256/64, bf16 |
real-gemma4-26B-A4B-it/ | Google's weights + tokenizer + chat_template.jinja |
tp_mb_moe.py | The full recipe (DenseExperts + SPMDRank scatter, ModelBuilder trace, MB_LOAD) |
optb_server_tp.py | HTTP server (OpenAI-compatible + /generate, /metrics, streaming) |
Dockerfile, entrypoint.sh | Thin image that pulls these artifacts at start and serves |
import torch
model = torch.jit.load("mb_26b_256.pt")
model.nxd_model.initialize_with_saved_weights(torch.tensor([0], dtype=torch.int32))
MODEL_DIR=/data/real-gemma4-26B-A4B-it MB_LOAD=/data/mb_26b_256.pt \
TP_DEGREE=8 KV_MAX=256 KV_BUCKET=64 python optb_server_tp.py
curl -s localhost:8080/generate -d '{"prompt":"What is the capital of France?"}'
# -> {"response":"The capital of France is Paris.", ...}
Docker (pulls artifacts from this repo at first start):
docker run -d --device /dev/neuron0 ... --device /dev/neuron5 --ipc=host \
-v gemma26b-data:/data -p 8080:8080 xbill9/gemma4-optb-26b:latest
Neuron SDK 2.23 · torch-neuronx 2.8.0 · neuronx-distributed 0.17.26814 · transformers 5.13.0.
google/gemma-4-26B-A4B-it.