Gemma 4 Runs in Pure JAX Across NVIDIA Turing and Ada GPUs With One Codebase
A developer has published a hand-written port of Google's Gemma 4 language model in pure JAX, benchmarked across two AWS spot instances running NVIDIA T4 (Turing) and L4 (Ada) GPUs. The same source code, build ID, and model checkpoint were used on both cards, with the key difference being compute dtype — float16 on the older Turing architecture and bfloat16 on Ada, selected automatically at runtime. The port handles four structural quirks of Gemma 4, including two attention head dimensions, 8:1 multi-query attention, a KV-share map collapsing 35 layers onto 15 caches, and a 4-bit quantized 4.70 GB positional embedding table. A notable finding is that JAX's XLA attention path avoids the shared memory errors that cause vLLM's Triton backend to fail on Turing hardware. However, the Pallas-based fused W4A16 kernel exceeds shared memory limits on both GPUs, meaning neither card benefits from the fast quantized path and both serve the dense 16-bit reference model instead.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in