From CUDA and Jax to TorchTPU: Lessons from a Cayley Graph Solver
Trending on Hacker News: From CUDA and Jax to TorchTPU: Lessons from a Cayley Graph Solver (31 points / 0 comments, via andlukyane.com)
In one line
Moving a puzzle-solving transformer and its beam search from an A100 and JAX to TPUs with TorchTPU: what had to change, what broke, and how the final speed and quality compare.
Opening excerpt
Some time ago, I shared a blog post about working with Cayley graphs, where I solved combinatorial puzzles using AI coding agents, PyTorch on GPUs, and JAX on TPUs. Recently, Google released TorchTPU, a native PyTorch backend for TPUs, and I wanted to see how well it works on the same task: whether a PyTorch-native TPU stack could match my A100 training pipeline and my JAX beam search in speed and solution quality, or maybe even beat them.
The short version: getting TorchTPU to work was easy; getting it to work efficiently was considerably harder. My initial training port was 1.65x slower than the A100 implementation, while the first TPU beam search was 5.7x slower than its JAX counterpart.
After optimizing eager execution, rewriting attention, eliminating dynamic tensor shapes, fixing a subtle deduplication bug, and investigating an attention-routing regression, the results changed substantially.
Along the way, the investigation improved the solver itself and resulted in an upstream TorchTPU GitHub issue that led to attention-routing fixes.
(Excerpted from the original; full article via the source link below.)
This story hit the Hacker News front page today (31 points / 0 comments, via andlukyane.com). Our Tech Radar aggregates daily signals on AI engineering, backend architecture and DevOps — browse the related services and further reading below, or get in touch with our team.
Source: Hacker News