The Hardware Lottery: Why the Dense Version Won
Published:
The dense formulation
Self-attention over a whole input is three matrix multiplications and a softmax:
No loops, no indices, no per-node branching. Multi-head parallelises the same way: do one projection for all heads at once, then reshape queries, keys and values to \(n \times k \times d/k\). Everything after attention is token-wise and therefore trivially parallel.
Sparse message passing cannot be written like that. You maintain an index of neighbours, gather the source features for every edge, apply the message function, then scatter-add the results back to destination nodes. The access pattern is irregular by construction, memory-bound rather than compute-bound, and hostile to the wide, regular pipelines a GPU or TPU is built around.
The asymptotics say the opposite
Here is the tension, made concrete. Attention compares \(n^2\) pairs. Message passing on a graph of average degree \(k\) handles \(nk\) directed messages.
| nodes \(n\) | attention pairs \(n^2\) | messages at \(k = 10\) | ratio |
|---|---|---|---|
| 100 | 10,000 | 1,000 | 10× |
| 1,000 | 1,000,000 | 10,000 | 100× |
| 10,000 | 100,000,000 | 100,000 | 1,000× |
| 1,000,000 | \(10^{12}\) | \(10^{7}\) | 100,000× |
Sparse message passing does dramatically less arithmetic, and the gap widens without bound. On operation count it is not close.
This explains the exception the argument always carries: for very sparse or billion-scale graphs, message passing remains the only option. There, \(n \gg Ck\) and no constant factor rescues \(n^2\).
The hardware lottery
Sara Hooker’s term for this: a research idea wins partly on merit and partly because it happens to fit the hardware available when it arrives. Ideas that need hardware nobody built lose, whatever their intrinsic quality — and the loss looks like the idea being wrong rather than being early.
Transformers are the clean case. Attention was not selected because it does less work — it does more. It was selected because its work is shaped like the operation accelerators execute best, and because that shape kept paying off as models and datasets grew.
This connects to Sutton’s bitter lesson: methods that scale with compute tend to beat methods that encode human insight about the problem. A GNN’s sparse graph is encoded insight — a claim that these entities interact and those do not. A Transformer declines to make that claim and learns which pairs matter. When compute is scarce the encoded insight is valuable; when compute is abundant, learning it beats asserting it.
What to take from it
Practically: if your graph is small or dense, run attention with a mask and get the fast kernel for free. If it is large and sparse, message passing is not a legacy choice, it is the only feasible one. The equivalence means this is an implementation decision, not an architectural commitment.
Conceptually, this is the honest ending to the geometric deep learning story. The blueprint tells you which architectures respect your data’s symmetry. It is silent on which will run fast, and that silence turned out to determine what the field actually adopted. Both facts are worth holding at once: the mathematics unified these architectures, and the hardware picked a winner among them anyway.
✅ Key Takeaways
- Attention is three dense matmuls and a softmax — no indices, no branching, and multi-head parallelises by reshaping to \(n \times k \times d/k\).
- Sparse message passing needs gather and scatter over a neighbour index: irregular, memory-bound, and poorly matched to current accelerators.
- Attention does asymptotically more arithmetic — \(n^2\) pairs against \(nk\) messages, a 1,000× gap at \(n = 10^4, k = 10\) — and is still faster to train at typical scales.
- Dense wins while \(n < Ck\), linear in the hardware constant and the graph's density. Above that, sparsity is the only option.
- The hardware lottery: architectures win partly because they fit the hardware of their moment. Attention's advantage is the shape of its computation, not the amount.
- None of this shows structure is worthless, or that the outcome is permanent — and by the equivalence, changing implementation does not require changing the model.
References
- Joshi, C. K. (2025). Transformers are Graph Neural Networks. arXiv:2506.22084.
- Hooker, S. (2021). The Hardware Lottery. Communications of the ACM.
- Sutton, R. (2019). The Bitter Lesson. Incomplete Ideas (blog).
- Fey, M., & Lenssen, J. E. (2019). Fast Graph Representation Learning with PyTorch Geometric. ICLR Workshop on Representation Learning on Graphs and Manifolds.
- Jaegle, A., Borgeaud, S., Alayrac, J.-B., Doersch, C., Ionescu, C., et al. (2021). Perceiver IO: A General Architecture for Structured Inputs & Outputs. arXiv:2107.14795.
