Spiking Transformer architectures usually drop the softmax, and some threshold each query--key score into a binary attention map. For such maps, the statistical mechanics of softmax attention does not carry over, because no temperature of the softmax gives a binary map. We show instead that each query--key link of threshold attention is a two-level system, as a spiking neuron is. Thus, a spiking Transformer with threshold attention is a zero-temperature network of two-level systems. In this picture, the attention map is a ground state, and the surrogate gradients used in training are susceptibilities at a finite temperature. Cooling trained networks from high temperature then shows that their predictions form gradually as their units freeze. Using this cooling picture, we adapt thermodynamic integration to explainable AI (XAI). Specifically, we heat the binary units of each patch, its neurons and the links into it, to random states at their deployed occupation, then cool them back patch by patch and credit each change of the output to the patch just cooled. This thermal integration (ThI) needs no gradients or input baseline, and its scores sum exactly to the output change. On CIFAR-10, pixel-level integrated gradients with surrogate gradients instead miss the output change by about a quarter. On six deletion and insertion tests in the spiking Transformer, ThI's mean rank is second only to Shapley value sampling with blurred patches. Yet ThI never ranks below fourth, whereas Shapley sampling, with any choice of removed patches, drops to sixth or seventh on some tests.
翻译:暂无翻译