Search papers, labs, and topics across Lattice.
This paper establishes an exact quantum analog for softmax attention mechanisms used in AI models, particularly when inputs and outputs are constrained to the probability simplex. By employing Hadamard-test statistics on block-encoded projections of amplitude-encoded inputs, the authors derive a framework where softmax attention can be realized through quantum measurements, leading to a precise relationship between softmax temperature and measurement rounds. The findings reveal that every learnable parameter corresponds to a rotation-gate angle, enabling a fully-coherent quantum implementation of attention layers that is exact in the infinite-shot limit.
Quantum mechanics can provide an exact realization of softmax attention, transforming how we understand attention mechanisms in AI.
The attention mechanism forms the foundation of many modern AI models such as the Transformer. In one subclass of problems where attention is used, inputs and outputs are bound to the probability simplex so that all outputs sum to one. In this setting, softmax attention admits an exact, component-by-component quantum realization. Attention scores are Hadamard-test statistics on block-encoded projections of amplitude-encoded inputs. The exponential softmax is the interior of a cosine-squared family generated by Born-rule measurement under an exact bijection, whose boundary expresses sparse attention with exact zeros at finite parameter values. The softmax temperature is a repetition count where post-selected measurement rounds realize discretized inverse temperature exactly. Value aggregation is a deterministic column-loading channel that dilates the column-stochastic value matrix. The gated residual is the preparation angle of a single ancilla, with the additive identity at a mixing angle of 蟺/2. Every learnable parameter is a rotation-gate angle. The composed layer is exact in the infinite-shot limit with one measure-and-reload step per attention score; a fully-coherent variant is 蔚-approximate via quantum singular value transformation in the infinite depth limit. The algebraic core is machine-checked in Lean 4.