Downloads · 30 days
0
mando2222/gemma-4-26b-a4b-it-QB2
gemma-4-26b-a4b-it-QB2 is a machine learning model from mando2222. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
A tt-kernel vLLM bundle that runs google/gemma-4-26B-A4B-it — a Mixture-of-Experts model (128 experts, top-8, ~4B active params/token) — on 2× Tenstorrent Blackhole p300c boards (4 ASICs ≈ 4× p150a) via the
Downloads · 30 days
0
Access
Public
Updated Jul 23, 2026
Repo size
—
Likes
0
Public
Click a slice to open those files.
.py38.2 KB · 66%
From the Hugging Face model README
A tt-kernel vLLM bundle that runs
google/gemma-4-26B-A4B-it — a Mixture-of-Experts
model (128 experts, top-8, ~4B active params/token) — on 2× Tenstorrent Blackhole p300c boards (4 ASICs ≈ 4× p150a) via the
Tenstorrent vLLM plugin. Ships no kernel cache and no weights — only the vLLM registration, the
bounded sliding-window KV adapter, and a launch recipe; weights are pulled from the base repo and
kernels JIT-compile at first-run warmup.
tt-kernel serve mando2222/gemma-4-26b-a4b-it-QB2
OpenAI-compatible server on :8000, model id google/gemma-4-26B-A4B-it. Structured tool calling +
reasoning channel enabled; single slot (max_num_seqs=1).
This bundle serves the model's full native 256K (262144) context, and long-range recall is
validated there — not just "it fits in DRAM". The unlock is whole-body chunked prefill
(GEMMA4_CHUNKED_PREFILL=1, default on): the prompt is prefilled in bounded 16K-token chunks, which
(a) keeps every chunk inside a reliable prefill regime and (b) holds peak prefill memory constant
regardless of context length, so 256K completes with no OOM. Combined with the bounded
sliding-window serving-KV (only the 5 global layers scale with context; the 25 sliding_window=1024
layers use a fixed 1024-token ring), the full 262K-token KV cache fits at max_num_seqs=1.
Measured prose needle-in-haystack recall (5 depths, 10/25/50/75/90%):
| Context | Recall | TTFT |
|---|---|---|
| 128K | 5/5 (all depths correct) | ~41 s |
| 256K | 4/5 (occasional single miss deep in the middle) | ~95 s |
At 256K a fact placed deep in the middle is occasionally not retrieved (a long-context "lost-in-the-middle" effect, not corruption — output stays fluent and correct-form). Endpoints and most depths are reliable. If you need strict 5/5 at every depth, cap at 128K.
vllm_bundle/vllm_metadata.json)| Env var | Default | Effect |
|---|---|---|
MAX_MODEL_LEN | 262144 | Context cap. Lower it (e.g. 131072) for strict all-depth recall; the model's native max is 262144. |
GEMMA4_CHUNKED_PREFILL | 1 | Whole-body chunked prefill. Required for contexts beyond ~64–128K — bounds peak prefill memory (constant in context) and keeps each chunk's recall reliable. 0 = single-chunk prefill (OOMs / degrades past ~128K). |
GEMMA4_PREFILL_CHUNK_SIZE | 16384 | Prefill chunk size (tokens). Snapped to a multiple of the 1024 sliding window and capped at 32768. Smaller = lower peak memory, slightly more overhead. |
GEMMA4_PREFILL_GATHERED | 1 | Per-token gathered expert prefill: ~5–9× faster TTFT, no large-prefill device stall. 0 = legacy all-ones (all 128 experts/token; hangs the device on prefills >~32K). |
GEMMA4_PREFILL_GATHER_MIN_SEQ | 2048 | Prompts below this use all-ones (gather overhead not worth it when short). |
GEMMA4_BOUNDED_SLIDING_KV_CACHE | 1 | Bounds the 25 sliding layers' serving KV to their 1024 window (what makes 256K KV fit). |
See vllm_bundle/README.md for the full knob reference and trade-offs.
| Component | Version |
|---|---|
| tt-metal | autoport branch autoport/qwen3-32b-bringup (models/autoports/google_gemma_4_26b_a4b_it/), including the chunked-prefill driver (per-chunk valid-length + sliding-ring page-table handling) |
| tt-vllm (fork) | dev branch (ships the gemma4 tool + reasoning parsers + Gemma4 arch registration) |
| vLLM | 0.1.dev1+g61bbb1eae (empty-target build; TT provided at runtime) |
| Hardware | 2× Blackhole p300c boards = 4 ASICs (≈ 4× p150a), 1×4 mesh (MESH_DEVICE=P150x4), firmware 19.12.0, iommu=pt + 1 GB hugepages |
MoE Gemma4ForConditionalGeneration (text-only), 30 layers, 128 experts / top-8, GQA 16/8,
head-dim 256, vocab 262144, hybrid attention (5:1 sliding:global, sliding_window=1024), dual RoPE,
final_logit_softcapping=30. TP=4 + EP=4 (each chip owns 32 of 128 experts). Precision: BFP8
projection/expert weights + LoFi dense-decode fidelity, BFP8 paged KV, BF16 activations/CCL; on-device
greedy sampling; FABRIC_1D; metal-trace decode + gathered chunked eager prefill.
tool_calls via the gemma4 parser; reasoning routed to
reasoning_content with clean content.iommu=pt + 1 GB hugepages. A literal 2×2 mesh does not
work (fabric routing).models.autoports.google_gemma_4_26b_a4b_it
(the adapter subclasses its Gemma4ForCausalLM, uses tt/experts/prefill_gathered.py, and
the chunked-prefill correctness path in the shared tt_transformers generator + the autoport
attention). Currently on autoport/qwen3-32b-bringup, not upstream — build from a tree that
includes these.dev) + TT plugin.max_num_seqs=1) — a 2nd concurrent request queues (looks like a hang); ≥3
concurrent is not supported (a batched-decode device path is still open).GEMMA4_PREFILL_GATHERED=0) hangs on prefills >~32K — why gathered is default.GEMMA4_CHUNKED_PREFILL=0) degrades/OOMs past ~128K — why chunking is default.GEMMA4_CHUNKED_PREFILL, GEMMA4_PREFILL_CHUNK_SIZE; MAX_MODEL_LEN default → 262144.Gemma4BoundedForCausalLM): only the 5 global layers
scale with context, so the full 256K KV cache fits at max_num_seqs=1.Weights: google/gemma-4-26B-A4B-it under the Gemma Terms of Use.
This bundle contains only Tenstorrent integration metadata + adapter + launch config.