hn.today

From CUDA and Jax to TorchTPU: Lessons from a Cayley Graph Solver

andlukyane.com87 points2 comments
Screenshot of From CUDA and Jax to TorchTPU: Lessons from a Cayley Graph Solver

A Cayley graph solver tackles the Professor Tetraminx competition: find the shortest solution for 1,000 scrambled puzzles, represented as 88-sticker states connected by 24 possible moves. The system combines beam search with a 3.4-million-parameter transformer that groups stickers into physical pieces and predicts the distance after each possible move. Training draws on random walks, exact labels from breadth-first search, and puzzle symmetries. The experiment tests whether Google’s native PyTorch backend for TPUs, TorchTPU, can match an A100 GPU training pipeline and a JAX TPU search implementation.

The central finding is that a working port is not necessarily an efficient one. The initial TPU training run was 1.65 times slower than the A100, and the first beam search was 5.7 times slower than JAX. Performance depended on fixed tensor shapes, avoiding data-dependent operations and host-device synchronization, enabling fused eager execution, and rewriting attention with einsum to reduce costly layout conversions. These changes brought training to roughly A100 speed, with comparable model quality. The optimized beam search ran 25% faster per level than JAX on the same eight-chip TPU and achieved the same total solution length across six puzzles. The work also exposed a deduplication bug and an attention-routing regression, prompting fixes through an upstream TorchTPU issue; a deferred-execution interaction with distributed checkpointing caused a separate deadlock.

Read on andlukyane.com2 comments on Hacker News

Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.

More in Programming

I checked Clojure's core with Lean and found unreported bugs

I checked Clojure's core with Lean and found unreported bugs

Lean formal checks and differential testing of Clojure 1.12.7 uncovered 17 previously unreported bugs, including issues in `vector-of`, HAMT hash collisions, and Java functional-interface calls without type hints. Three million HAMT operations and vector boundary tests found no errors in the core tree structures; the bugs appeared in surrounding code and interactions such as equality and hashing. (s.conao3.com)

The daily digest

Today's best Hacker News stories, summarized and screenshotted, one email a day.