This is the log of a few days spent running Captum's attribution methods on Cloud TPUs through TorchTPU, in the order the work happened, with what I learned at each step. Code, scripts and raw findings are in github.com/joinalahmed/captum-on-torchtpu . Measurements and upstream status describe the work through 2026-11-01.
What I ended up with
Captum runs unmodified on TorchTPU for the small-model configurations tested: 27 deterministic methods agree with CPU to about 1e-7, and 11 stochastic methods pass execution checks. The tested LLM wrappers also run on Qwen3-0.6B. Broader coverage exposed missing MaxPool support for three DeepLift configurations; compiled LayerIG needed two patches.
Matmul precision matters for numerical agreement. With torch.set_float32_matmul_precision("highest") , small-model errors fell from about 1e-3 to 1e-7. On Qwen3-0.6B, the 5-token, 32-step test reached 8.5e-6; the 42-token, 64-step example was around 7e-5 to 9e-5.…