Porting a transformer solver from A100/JAX to TorchTPU: beam search ends up 25% faster than JAX

AndLukyane · x · 2026-11-25

Andrey Lukyanenko ported his Cayley-graph puzzle solver to Google's new TorchTPU (native PyTorch backend for TPUs). First port: training 1.65x slower than A100, beam search 5.7x slower than JAX. After optimizing eager execution, rewriting attention, eliminating dynamic shapes, fixing a dedup bug and an attention-routing regression, training matched A100 (142.7s → 132.0s per epoch, via fused eager + einsum attention) and TorchTPU beam search became 25% faster per level than JAX on the same v6e-8 machine, with equal solution quality. Findings led to upstream TorchTPU attention-routing fixes. All code was written by Claude Code and Codex; notebooks run free on Kaggle TPU v5e-8.

Original post →

More from Infra

Infra channel →