Oriel — AI & technology worth noticing, every day.

Gemma 4 on a Hosted Colab TPU: The QAT Repack, Served in Two Minutes

Post · https://dev.to/gde/gemma-4-on-a-hosted-colab-tpu-the-qat-repack-served-in-two-minutes-360j

One notebook loads the Gemma 4 E2B QAT repack onto a Colab v5e-1, serves it behind an OpenAI-compatible endpoint with a chat page, and steps through thinking, sampling, stop sequences, long prompts and a CPU comparison.

First seen by Oriel on .

AI summary

The article walks through serving a quantization-aware Gemma 4 E2B repack on a hosted Colab TPU with pure-JAX tpu-jax, reaching a working OpenAI-compatible chat endpoint in 117 seconds.

  • The notebook downloads the 6.56 GB text-only checkpoint and loads unpacked 4-bit weights onto one TPU v5e chip, using 9.27 GB of its 16.91 GB HBM.
  • Warm-shape decoding reaches 123.7–124.6 tokens per second; the server supports chat completions, streaming, reasoning, sampling, stop sequences, and a browser chat interface.
  • Compilation is shape-specific: prompts use padded length buckets and answer budgets are rounded to 512, 2048, or 4096 tokens; background compilation prepares common shapes.
  • Thinking increased the example completion from 391 to 857 tokens and response time from 3.3 to 7.1 seconds, while top-k 64 reduced decode speed by about 4 percent.
  • llama.cpp on the host CPU starts faster but decodes at 4.0 tokens per second versus 124.6 on TPU; prompts beyond the 4,095-token server limit are rejected.

#gemma #jax #tpu #llm inference

Generated by gpt-5.6-sol. Check the original for details.

Metric trends

Last 30 days · Up to 120 recorded samples per source and metric, with reposts kept separate · First and latest retained

Reactions

Total public reactions reported by the source; distinct from points and likes.

  • DEV Community: 24, latest observation ; 0 over observed period since

Comments

Comment count reported by the source.

  • DEV Community: 0, latest observation ; 0 over observed period since

Aliases

SourceExternal IDURL
DEV Community5060293https://dev.to/gde/gemma-4-on-a-hosted-colab-tpu-the-qat-repack-served-in-two-minutes-360j Read discussion