Views
No views yet
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).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.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.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 |
1import torch
2model = torch.jit.load("mb_26b_256.pt")
3model.nxd_model.initialize_with_saved_weights(torch.tensor([0], dtype=torch.int32))1MODEL_DIR=/data/real-gemma4-26B-A4B-it MB_LOAD=/data/mb_26b_256.pt \
2 TP_DEGREE=8 KV_MAX=256 KV_BUCKET=64 python optb_server_tp.py
3curl -s localhost:8080/generate -d '{"prompt":"What is the capital of France?"}'
4# -> {"response":"The capital of France is Paris.", ...}1docker run -d --device /dev/neuron0 ... --device /dev/neuron5 --ipc=host \
2 -v gemma26b-data:/data -p 8080:8080 xbill9/gemma4-optb-26b:latesttorch-neuronx 2.8.0 · neuronx-distributed 0.17.26814 · transformers 5.13.0.google/gemma-4-26B-A4B-it.