Silent Failures Beyond the 32-Bit Index Range: A Differential Characterization of Large-Tensor Matrix Multiplication in PyTorch's MPS Backend
Not on the map. Why?
Abstract (arXiv)
Apple Silicon machines with large unified memory make it possible to hold large tensors on a desktop GPU. However, we found that PyTorch's Metal Performance Shaders (MPS) backend silently returns wrong results for batched matrix multiplication with more than 232 elements. torch bmm, including its wrappers matmul and eager attention, returns relative errors above 1 without an exception or a warning in every PyTorch release tested (2.4.1 to 2.14.0). We sweep bmm over dtypes, memory layouts, shapes and batch sizes around 231 and 232 elements, and judge every result against a float64 computation on the CPU. Three rules account for every outcome on 2.14.0. When the output exceeds 232 elements and an operand is a transposed view, the entire output is wrong and equals a computation that ignores that operand's strides. Otherwise, a view with at least 231 elements raises an exception, and a contiguous input above 232 elements makes exactly the batches beyond that point wrong, equal to a computation whose index wraps at 232. A slightly larger problem can thus turn an explicit error into a silent failure. The rules extend to the backward pass, where a correct forward pass can return silently wrong gradients. A second machine with another chip, under two macOS versions, reproduces all 6156 results, including the wrong values, and the same sweeps on an NVIDIA A100 are correct in all 2530 runs. In a public sentiment classifier, one oversized batch corrupts a third of the outputs, which collapse onto one class. All findings come from observable behavior, without access to the backend's closed-source kernels; we release the harness, raw results and a guard that stops any MPS operation touching 232 or more elements at jniimi/mps-silent-failures (https://github.com/jniimi/mps-silent-failures).
Key facts. No citing papers in the map yet (data through 14 Oct 2026). Builds on 18 of its 31 references that are in the map. First posted on arXiv 19 Sep 2026.
Builds on
18 of 31 references.
References · 18
- 2017Attention Is All You Needcited by 60,361
- 2019PyTorch: An Imperative Style, High-Performance Deep Learning Librarycited by 20,305
- 2019RoBERTa: A Robustly Optimized BERT Pretraining Approachcited by 13,372
- 2014Neural Machine Translation by Jointly Learning to Align and Translatecited by 4,548
- 2022FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awarenesscited by 3,673
- 2019What Does BERT Look At? An Analysis of BERT's Attentioncited by 1,003
- 2020Efficient Transformers: A Surveycited by 790
- 2020Quantifying Attention Flow in Transformerscited by 775
- 2020TweetEval: Unified Benchmark and Comparative Evaluation for Tweet Classificationcited by 417
- 2022TimeLMs: Diachronic Language Models from Twittercited by 131
- 2022Large Language Models are Zero-Shot Fuzzers: Fuzzing Deep-Learning Libraries via Large Language Modelscited by 103
- 2021Randomness In Neural Network Training: Characterizing The Impact of Toolingcited by 59
6 more
- 2022NNSmith: Generating Diverse and Valid Test Cases for Deep Learning Compilerscited by 30
- 2022Free Lunch for Testing: Fuzzing Deep-Learning Libraries from Open Sourcecited by 28
- 2022Toward Understanding Deep Learning Framework Bugscited by 26
- 2021Silent Bugs in Deep Learning Frameworks: An Empirical Study of Keras and TensorFlowcited by 25
- 2021Silent Data Corruptions at Scalecited by 23
- 2023Fuzzing Automatic Differentiation in Deep-Learning Librariescited by 17
Built on by
Not cited yet.