Paper: 2608.11173 Authors: Eric A. F. Reinhardt, Adam J. Hauser Categories: quant-ph, cs.LG
The Gap
Every attempt to put a Transformer on a quantum computer runs into the same wall: softmax needs two things a unitary circuit does not natively give you. It needs an elementwise exp, which is not linear, and it needs a global normalizer, a sum over all keys that couples every score to every other score.
The prior art works around this rather than through it. Variational quantum self-attention networks compute scores as expectation values and then feed them to a classical softmax on the CPU. Quantum vision transformer designs based on data loaders and orthogonal/compound-matrix layers keep the linear algebra quantum but hand normalization back to the host. Quantum-kernel attention swaps exp(q·k) for a Gaussian or linear-attention surrogate and argues it is close enough. The polynomial-approximation route (quantum singular value transformation on a block-encoding) can approximate exp to precision epsilon, but you pay in circuit depth and you never get the real thing.
So the honest state of the field was: nobody had exhibited a regime where softmax attention is exactly what a quantum measurement produces, rather than something a quantum device approximates. This paper picks a restriction that makes that possible: assume the data is simplex-bound. Inputs are probability vectors, outputs are probability vectors, everything sums to one. That is the natural habitat of amplitude encoding, and once you are there the authors claim the entire attention layer, scores, temperature, value mixing, and residual gate, becomes a dictionary of rotation angles and Born-rule statistics with no approximation step in the algebra.
[ Problem ] softmax needs exp() and a global normalizer;
a unitary circuit provides neither natively
|
v
[ Prior art ] QSANN / quantum ViT / kernel attention / QSVT
| . swap softmax for a Gaussian or linear surrogate
| . or approximate exp() to eps, paying in depth
| . or do the normalization on a classical CPU
v
[ Assumption ] restrict to the subclass where inputs AND outputs
live on the probability simplex (sum == 1)
|
v
[ Method ] amplitude-encode x as sqrt(x)
scores == Hadamard-test statistics on a
block-encoded projection
weights == normalized cos^2 family, in exact
bijection with the exp family
temperature == number of post-selected repetitions
values == column-loading channel (dilated V)
residual == one ancilla preparation angle
|
v
[ Evidence ] algebraic core machine-checked in Lean 4;
layer exact in the infinite-shot limit
(one measure-and-reload per score)
|
v
[ Conclusion ] on the simplex, softmax attention IS a Born-rule
object, not an approximation target; and its
boundary is a sparse-attention family with
exact zeros at finite parameter values
The Increment
One sentence: Before, quantum attention meant “find a circuit-friendly thing that behaves like softmax”; after, on simplex-bound data, softmax is revealed as the interior chart of a cos-squared measurement family, with the extra territory outside that chart being exact sparse attention.
Core Mechanism
Start with amplitude encoding. A probability vector x with entries summing to one becomes the state whose amplitudes are sqrt(x_i). This is not a lossy embedding trick, it is an isomorphism between the simplex and the positive orthant of the unit sphere. Because outputs are also required to be simplex-bound, the layer never has to leave this manifold, which is what kills the need for an external normalizer: the Born rule normalizes for you, by construction.
Scores come next. Instead of a raw inner product, the query/key interaction is a block-encoded projection U(theta) applied inside a Hadamard test. The Hadamard test’s ancilla measurement statistic gives you the real part of an overlap, which after the standard rescaling is a cos^2 of some effective angle phi_ij. Here is the load-bearing algebraic claim: any point in the open simplex of attention weights can be written as normalized cos^2(phi) values, and this correspondence with the exponential softmax family is a bijection. Softmax is not approximated; it is re-coordinatized. And the moment you allow phi = pi/2, you get a weight that is exactly zero at a finite parameter, something softmax can only reach in the limit of minus-infinity logits. Exact sparsity falls out of the boundary of the chart.
Temperature is the cutest piece. If a single post-selected round yields probability p = cos^2(phi), then insisting on k successful rounds yields p^k. Raising every weight to the k-th power and renormalizing is exactly an inverse-temperature knob, so the softmax temperature becomes a repetition count, discretized to integers. Value aggregation then exploits the same simplex constraint: if the value matrix V is column-stochastic, each column is itself a probability vector, so V can be dilated into a deterministic “column-loading” channel rather than being approximated by some non-unitary operator. Finally the gated residual, normally alpha * attn + (1 - alpha) * x, becomes a single ancilla preparation angle whose cos^2 and sin^2 are automatically a convex pair; at mixing angle pi/2 you recover plain addition. Every learnable parameter in the layer is a rotation angle. The seam is that composing all this exactly requires one measure-and-reload step per attention score, so the exact version is hybrid; a fully coherent version exists but is only epsilon-approximate via QSVT, in the infinite-depth limit.
classical simplex input x (sum_i x_i == 1)
|
v
+--------------------------+
| amplitude encoding | x_i -> sqrt(x_i) |i>
+--------------------------+
|
v
+---------------------------+ +--------------------------+
| block-encoded projection | <--- | learnable params: |
| U(theta) : Q / K role | | rotation angles ONLY |
+---------------------------+ +--------------------------+
|
v
+--------------------------+
| Hadamard test on ancilla | stat -> Re <x| U(theta) |x'>
+--------------------------+
|
v effective score angle phi_ij
+-------------------------------------------+
| Born measurement, k post-selected rounds |
| p == cos^2(phi) ==> p^k | k == inverse temperature
+-------------------------------------------+
|
v weights a_ij
| interior of cos^2 family == softmax image (bijection)
| boundary (phi == pi/2) == EXACT zeros, finite params
v
+-----------------------------+
| column-loading channel V | column-stochastic V dilated
| deterministic, no approx | into a CPTP map on the simplex
+-----------------------------+
|
v
+-----------------------------+
| ancilla gate angle g | cos^2(g) * attn + sin^2(g) * x
| g == pi/2 -> additive id. | == gated residual, convex for free
+-----------------------------+
|
v
output, already on the simplex
seam: [ measure-and-reload, once per score ] -> exact, hybrid
alt: [ fully coherent QSVT variant ] -> eps-approx, deep
Now the metaphor, and this one is not decorative, it is the same physics: the layer is a rack of polarizing filters in a darkroom.
Malus’s law says light through two polarizers at relative angle phi comes out with intensity cos^2(phi). That is the Born rule for polarization. So: the amplitude-encoded input is the beam of light, already carrying a fixed total intensity of one. Each key is a filter, and the learnable parameter is the angle you twist that filter to. The attention weight for a key is simply how much light gets through its filter, and because you measure fractions of one beam, the weights normalize themselves; nobody has to run down the hall with a calculator to divide by a sum. Temperature is stacking k identical filter pairs in series, cos^(2k), which sharpens the contrast between the bright channels and the dim ones exactly the way lowering softmax temperature does. Crossing a filter to ninety degrees gives you true black at a finite twist, which is the exact-zero sparsity that softmax, forever needing an infinite logit, cannot reach. Each filter is also tinted: the light that passes gets dyed with a fixed recipe of pigments that always uses up the full palette, which is the column-stochastic value matrix as a loading channel. The residual connection is a half-silvered mirror whose reflectivity is set by one more angle, blending the filtered beam with the original beam, and at forty-five degrees you get the plain even blend. The catch, the measure-and-reload seam, is that for each score you have to develop the plate and re-shoot rather than keeping one continuous exposure. That is precisely why the exact scheme is hybrid and claims no speedup.
Key Concepts
-
Amplitude encoding as an isomorphism, not a compression: usually people describe amplitude encoding as “cram
2^nnumbers intonqubits”, which immediately raises the read-out problem. Here the framing is different. A probability distribution overdoutcomes and a real non-negative unit vector inddimensions are the same object under the mapp_i <-> sqrt(p_i). If your problem *already speaks in distributions, say a mixture-of-experts gate, a topic proportion, a chemical composition, or a distributional-RL value histogram, then there is no encoding loss to argue about. That is the entire reason this paper can claim exactness where others claim approximation: the restriction to simplex-bound data removes the mismatch between the data’s geometry and the state space’s geometry. -
The cos-squared family, and why its boundary is a gift: softmax weights are
exp(z_i)over their sum. Cos-squared weights arecos^2(phi_i)over their sum. Both are recipes for turning free parameters into a point on the simplex. The claim is that they cover the same *interior, so any softmax pattern you want is reachable by some choice of angles, and vice versa. The difference is at the edges. To make a softmax weight exactly zero you need a logit of minus infinity, which is why practitioners invented sparsemax and entmax to get honest zeros by Euclidean or Tsallis projection. The cos-squared family gets them for free: twist topi/2and the weight is zero, full stop, at a finite parameter that gradient descent can actually reach. Concretely, with three keys at angles(0, pi/3, pi/2)you get raw values(1, 0.25, 0)and weights(0.8, 0.2, 0), with the third key genuinely dropped, not merely down-weighted. -
Temperature as post-selection depth: post-selection means you only keep the experimental runs where an ancilla measurement came out the way you wanted. If a channel passes with probability
p, then demandingkindependent passes in a row keeps it with probabilityp^k. Sincep^k = exp(k ** ln p), repeating the measurement is literally multiplying the log-weights byk, which is what inverse temperature does. Elegant, and also the paper’s main cost center: the probability that all your rounds succeed shrinks geometrically, so a sharper attention distribution directly buys you an exponentially larger shot budget. Also,kis an integer, so you get temperatures 1, 1/2, 1/3, and nothing in between unless you interpolate some other way.
Framework Shift
Before (mainstream quantum attention): After (this paper):
quantum circuit simplex is the native
| object; Born rule IS
| linear or Gaussian the normalizer
| surrogate score
v x --(sqrt)--> amplitudes
classical CPU |
| exp() v
| sum over keys cos^2 family:
| divide interior == softmax
v boundary == exact 0
weights |
| v
v column-loading V
quantum circuit |
| value matmul v
v ancilla angle gate
classical CPU |
| renormalize output v
v output sums to 1
output by construction
"softmax is a nonlinearity "softmax is one chart on a
we must approximate" Born-rule manifold, and
the manifold is bigger"
From “approximate the nonlinearity” to “re-coordinatize the nonlinearity”, the core shift is that the exponential was never the primitive; the primitive is a normalized measurement probability, and exp is just one coordinate system on it.
Expert Assessment
(Caveat: I am reading this at abstract-and-claims level, so treat the resource commentary below as the questions I would ask in review rather than as findings from the full text.)
Problem choice: The gap is real, not manufactured. “Softmax is quantum-unfriendly” has been the standing excuse in quantum-machine-learning papers for years, and nobody had asked whether there is a data regime where the excuse dissolves. Restricting to simplex-bound attention is a legitimate move rather than a dodge, because such problems genuinely exist: routing/gating distributions, distributional RL, topic and composition data, Markov-chain aggregation, models that mix categorical distributions. The weakness is that the paper appears to *assert this subclass rather than sell it. If simplex-bound attention is the whole premise, the reader deserves two pages naming real workloads and showing the constraint is not a straitjacket. Positionally, this sits where quantum ML papers should sit right now: after the era of “we ran a 4-qubit variational circuit and it learned XOR”, and honestly labeled a roadmap.
Method maturity: The cos-squared/exp bijection is genuine cleverness and the best thing in the paper, partly because it is not even quantum-dependent. The pi/2 residual angle giving convexity for free and the column-stochastic-V-as-channel dilation are both the right kind of observation: the constraint you were fighting turns out to be the structure that makes the construction work. Temperature-as-repetition-count is charming but is the weak joint. Integer-only inverse temperature is a real modeling limitation, and post-selection acceptance decaying like the product of p_i^k means the sharper the attention, the worse the sampling. Meanwhile, “exact in the infinite-shot limit with one measure-and-reload per attention score” deserves a hard stare: n^2 scores, each estimated to precision epsilon at 1/epsilon^2 shots, with a state reload in between, is a lot of quantum machinery to reproduce something a CPU does in nanoseconds. The paper is careful not to claim a speedup, which is to its credit, but a reader skimming the abstract will not notice that.
Experimental integrity: There are effectively no experiments, and the paper does not pretend otherwise. The Lean 4 verification is real intellectual hygiene and I wish more theory papers did it, but be clear about what it buys: it certifies the algebraic identities, which are the part least likely to be wrong. It says nothing about shot cost, noise sensitivity, trainability of angle parameterizations (barren-plateau behavior for these block-encoded projections is an obvious open question), or whether a cos-squared-attention model actually trains as well as a softmax one. The two experiments I would most want, and both are cheap, are: (a) a classical simulator comparing cos^2 attention against softmax, sparsemax, and entmax on a genuinely simplex-bound task, and (b) an explicit shot-budget table versus classical FLOPs. Absent those, “exact” is a statement about a limit, not about anything you can run.
Writing quality: The abstract is a wall of claims stacked at maximum density, each individually interesting and collectively exhausting; it reads as if written to survive a skeptical skim rather than to be understood. The corner cut is cost accounting: the phrases “infinite-shot limit” and “infinite depth limit” are doing heavy lifting in a single sentence at the end. The section that would elevate the whole paper is a plain resource analysis, stating flatly what this costs, what it does not accelerate, and why the construction is still worth having (the answer being conceptual clarity plus the sparse boundary, which is a fine answer).
Verdict: weak accept — the exp-to-cos-squared bijection with an exactly-sparse boundary is a clean, reusable result that reframes a standing obstacle, but the paper is a dictionary rather than an algorithm, and it hides its costs behind limit language while shipping zero empirical support.
Takeaways
- Steal the cos-squared attention head, no quantum computer required. Weights proportional to
cos^(2k)(phi_i)give you exact zeros at finite parameters, which is the whole selling point of sparsemax and entmax, but without a projection step or a Tsallis-entropy solver. It is one elementwise trig call plus a normalize. If you need honest sparsity in an attention or gating layer, this is worth ten minutes on a toy benchmark. - Parameterize convex mixtures by angles rather than by a sigmoid. Writing a gate as
cos^2(g)andsin^2(g)makes the pair sum to one identically, with no clamping, no1 - alphabookkeeping, and no way to drift off the simplex through numerical error. For any model whose outputs must remain distributions, this is a free invariant. - Sharpening by powering and renormalizing is the same as lowering temperature. Obvious once stated, and useful when you have a positive score you cannot take logs of safely: raise to a power instead of dividing a logit.
- Column-stochastic weight matrices are probability-preserving maps, not just matrices. If your value or mixing matrix has columns that sum to one, it is a Markov kernel, and simplex-in/simplex-out is structural rather than something you have to enforce with a post-hoc softmax. That framing transfers directly to mixture models and to any layer stacking over distributions.
- The design pattern worth remembering: when a nonlinearity looks hostile to your substrate, look for a different chart on the same manifold instead of a polynomial approximation. The paper’s real contribution is methodological.
expwas never the thing; a normalized non-negative weight was the thing. - Machine-check your algebraic core. Whatever you think of the physics, a Lean 4 proof of the identities is cheap credibility and stops the tedious class of reviewer objection cold. Just do not let it stand in for empirical evidence, which is exactly the trap this paper falls into.
论文: 2608.11173 作者: Eric A. F. Reinhardt, Adam J. Hauser 分类: quant-ph, cs.LG
缺口
把 Transformer 搬上量子计算机,永远撞在同一堵墙上:softmax 需要两样酉电路天然给不出的东西。
一是逐元素的 exp,这不是线性操作。
二是全局归一化,一个跨所有 key 的求和,把每个分数都和其他所有分数耦合在一起。
此前的工作都是绕过去,而不是穿过去。变分量子自注意力网络(QSANN)用期望值算分数,然后把分数扔回 CPU 上做经典 softmax。
基于 data loader 和正交/复合矩阵层的量子视觉 Transformer 把线性代数留在量子端,归一化交还宿主机。
量子核注意力干脆把 exp(q·k) 换成高斯核或线性注意力替代品,然后论证”差不多”。
走多项式逼近路线的(在块编码上做 QSVT)能把 exp 逼近到精度 epsilon,但代价是电路深度,而且你永远拿不到真货。
所以这个领域诚实的现状是:没人展示过存在这样一个区间,在其中 softmax 注意力恰好就是量子测量的产物,而不是量子设备去逼近的目标。
这篇论文选了一个让这件事成为可能的限制:假设数据被绑定在概率单形上。输入是概率向量,输出是概率向量,一切求和为一。
这恰好是振幅编码的原生栖息地。一旦进入这个区间,作者声称整个注意力层——分数、温度、value 混合、残差门——都退化成一本由旋转角和玻恩规则统计构成的字典,代数上不含任何近似步骤。
[ 问题 ] softmax 需要 exp() 和全局归一化;
酉电路两样都不天然提供
|
v
[ 现有方法 ] QSANN / 量子 ViT / 核注意力 / QSVT
| . 用高斯核或线性注意力替代 softmax
| . 或用深度换 eps 精度逼近 exp()
| . 或把归一化甩给经典 CPU
v
[ 假设 ] 只考虑输入与输出都在概率单形上的子类 (和为 1)
|
v
[ 方法 ] 振幅编码 x -> sqrt(x)
分数 == 块编码投影上的 Hadamard test 统计量
权重 == 归一化 cos^2 族, 与 exp 族严格双射
温度 == 后选择重复次数 k
value == 列装载信道 (V 的膨胀)
残差 == 单个 ancilla 的制备角
|
v
[ 证据 ] 代数核心由 Lean 4 机器验证;
无穷 shot 极限下整层精确
(每个分数一次 measure-and-reload)
|
v
[ 结论 ] 在单形上, softmax 注意力本身就是玻恩规则对象,
而非逼近目标; 且该族的边界给出在有限参数处
取到精确零的稀疏注意力
增量
一句话: 之前,量子注意力意味着”找个电路友好的东西让它行为像 softmax”;之后,在单形数据上,softmax 被揭示为一个 cos² 测量族的内部坐标卡,而这个族比 softmax 大——多出来的那块地正好是精确稀疏注意力。
核心机制
从振幅编码开始。一个和为一的概率向量 x 变成振幅为 sqrt(x_i) 的量子态。
这不是有损的塞数据技巧,而是概率单形与单位球正卦限之间的同构。
因为输出也被要求在单形上,这一层从头到尾都不需要离开这个流形——这正是外部归一化器变得多余的原因:玻恩规则按构造帮你归一化了。
接下来是分数。query/key 的交互不是裸内积,而是把块编码投影 U(theta) 放进 Hadamard test。
Hadamard test 的 ancilla 测量统计量给出重叠的实部,经标准缩放后就是某个有效角 phi_ij 的 cos^2。
这里是承重的代数主张:注意力权重开单形中的任意一点都能写成归一化的 cos^2(phi),而这与指数 softmax 族之间是一个双射。
softmax 不是被逼近,而是被重新坐标化了。
而一旦允许 phi = pi/2,你在有限参数处就得到了精确为零的权重——这是 softmax 只能在 logit 趋于负无穷时才能达到的。稀疏性从坐标卡的边界上白掉出来。
温度这一块最有意思。如果单轮后选择成功概率是 p = cos^2(phi),那么要求连续 k 轮都成功,概率就是 p^k。
把每个权重取 k 次幂再归一化,恰好就是逆温度旋钮,于是 softmax 温度变成了重复次数,代价是被离散化成整数。
value 聚合用的是同一个单形约束:如果 value 矩阵 V 是列随机的,那它每一列本身就是一个概率向量,于是 V 可以被膨胀成一个确定性的”列装载”信道,而不必去逼近某个非酉算子。
最后,通常写成 alpha * attn + (1 - alpha) * x 的门控残差,变成单个 ancilla 的制备角,它的 cos^2 与 sin^2 自动构成一对凸系数;混合角取 pi/2 时恢复成朴素加法。
这一层里每一个可学参数都是旋转角。
接缝在于:精确地把这些组合起来,需要每个注意力分数做一次 measure-and-reload,所以精确版本是混合式的;完全相干的版本存在,但只是 epsilon 近似,且在无穷深度极限下。
经典单形输入 x (sum_i x_i == 1)
|
v
+--------------------------+
| 振幅编码 | x_i -> sqrt(x_i) |i>
+--------------------------+
|
v
+---------------------------+ +--------------------------+
| 块编码投影 | <--- | 可学参数: |
| U(theta) : 承担 Q / K | | 只有旋转角, 别无其他 |
+---------------------------+ +--------------------------+
|
v
+--------------------------+
| ancilla 上的 Hadamard | 统计量 -> Re <x| U(theta) |x'>
+--------------------------+
|
v 有效分数角 phi_ij
+-------------------------------------------+
| 玻恩测量, k 轮后选择 |
| p == cos^2(phi) ==> p^k | k == 逆温度
+-------------------------------------------+
|
v 权重 a_ij
| cos^2 族内部 == softmax 的像 (双射)
| 边界 phi==pi/2 == 有限参数下的精确零
v
+-----------------------------+
| 列装载信道 V | 列随机 V 膨胀为
| 确定性, 无近似 | 单形上的 CPTP 映射
+-----------------------------+
|
v
+-----------------------------+
| ancilla 门角 g | cos^2(g)*attn + sin^2(g)*x
| g == pi/2 -> 加法恒等 | == 门控残差, 凸性免费获得
+-----------------------------+
|
v
输出, 天然在单形上
接缝: [ 每个分数一次 measure-and-reload ] -> 精确, 混合式
备选: [ 完全相干的 QSVT 变体 ] -> eps 近似, 深
现在说核喻。这个比喻不是装饰,因为它就是同一套物理:这一层是暗房里的一排偏振片。
马吕斯定律说,光穿过相对夹角为 phi 的两片偏振片后,强度是 cos^2(phi)。那就是偏振的玻恩规则。
于是:振幅编码后的输入是那束光,它自带总强度恒为一。每个 key 是一片偏振片,可学参数就是你把这片偏振片扭到的角度。
某个 key 的注意力权重就是穿过它那片滤镜的光量;因为你在度量同一束光的份额,权重自动归一化——没人需要跑到走廊尽头拿计算器去除一个和。
温度是把 k 组同样的偏振片串起来,cos^(2k),它锐化亮通道与暗通道的反差,方式和降低 softmax 温度完全一致。
把一片滤镜扭到九十度,你在有限的扭转量下得到真正的全黑——这就是那份精确零稀疏性,而永远需要无穷 logit 的 softmax 达不到。
每片滤镜还带色:透过去的光会被染上一份固定配方的颜料,而这份配方总是把整块调色板用光——这就是作为装载信道的列随机 value 矩阵。
残差连接是一面半透镜,反射率由再一个角度设定,把滤过的光和原始的光混起来;四十五度时就是朴素的等量混合。
代价,也就是 measure-and-reload 那道接缝,是每算一个分数你都得把底片洗出来重拍一次,而不能保持一次连续曝光。
这正是为什么精确方案是混合式的、且不宣称任何加速。
关键概念
-
振幅编码是同构,不是压缩:人们通常把振幅编码描述成”用 n 个量子比特塞进
2^n个数”,这立刻引出读出难题。这篇的框架不同。一个d个结果上的概率分布,和一个d维的非负实单位向量,在映射p_i <-> sqrt(p_i)下是同一个对象。如果你的问题本来就在讲分布——比如 MoE 的门控、主题占比、化学成分、分布式 RL 的价值直方图——那就没有编码损失可争。这就是这篇能宣称精确而别人只能宣称近似的全部原因:限制在单形数据上,消除了数据几何与态空间几何之间的错配。 -
cos² 族,以及为什么它的边界是礼物:softmax 权重是
exp(z_i)除以其和。cos² 权重是cos^2(phi_i)除以其和。两者都是把自由参数变成单形上一点的配方。论文的主张是它们覆盖同一个内部,所以你想要的任何 softmax 模式都能由某组角度达到,反之亦然。差别在边缘。要让某个 softmax 权重精确为零,你需要 logit 等于负无穷——这正是实践者发明 sparsemax 和 entmax、用欧氏投影或 Tsallis 投影去换取诚实零的原因。cos² 族免费拿到:扭到pi/2,权重就是零,句号,而且是在梯度下降真能走到的有限参数处。具体点:三个 key 角度取(0, pi/3, pi/2),原始值是(1, 0.25, 0),权重是(0.8, 0.2, 0),第三个 key 是真被丢掉了,不是被压小。 -
温度即后选择深度:后选择的意思是,你只保留那些 ancilla 测量结果符合预期的实验轮次。如果某个通道以概率
p通过,那么要求连续k次独立通过,保留概率是p^k。由于p^k = exp(k ** ln p),重复测量字面上就是把对数权重乘以k,这正是逆温度做的事。优雅,同时也是这篇的主要成本中心:全部轮次都成功的概率按几何级数衰减,所以注意力分布越尖锐,你要付的 shot 预算就指数级增长。另外k是整数,所以你只有 1、1/2、1/3 这些温度,中间那些除非用别的办法插值,否则拿不到。
框架转变
之前 (主流量子注意力): 之后 (本文):
量子电路 单形是原生对象;
| 玻恩规则就是归一化器
| 线性 / 高斯替代分数
v x --(sqrt)--> 振幅
经典 CPU |
| exp() v
| 跨 key 求和 cos^2 族:
| 除法 内部 == softmax
v 边界 == 精确零
权重 |
| v
v 列装载信道 V
量子电路 |
| value 矩阵乘 v
v ancilla 角度门
经典 CPU |
| 输出重归一化 v
v 输出按构造和为 1
输出
"softmax 是一个必须被逼近的非线性" "softmax 只是玻恩规则流形上的
一张坐标卡, 而流形更大"
一句话:从”逼近这个非线性”到”给这个非线性换一张坐标卡”,核心转变是——指数从来不是原语,原语是归一化后的测量概率,exp 只是它的一种坐标系。
专家评审
(先声明:我是在摘要与主张的层面读的,所以下面关于资源的评论,请当成我如果评审会问的问题,而不是从全文中查证出的结论。)
选题眼光: 缺口是真的,不是人造的。“softmax 对量子不友好”这句话当了量子机器学习论文好几年的挡箭牌,而没人问过:是否存在某个数据区间,让这块挡箭牌自己溶解。
限制到单形数据是正当动作而非规避,因为这类问题确实存在:路由/门控分布、分布式 RL、主题与成分数据、马尔可夫链聚合、以及任何在类别分布之间做混合的模型。
弱点是论文似乎断言了这个子类而没有推销它。如果单形注意力是整篇的前提,读者理应得到两页篇幅去点名真实工作负载、证明这个约束不是紧身衣。
从位置上看,这篇处在量子 ML 论文现在该处的位置:在”我们跑了个 4 比特变分电路学会了 XOR”的时代之后,并且诚实地自称是 roadmap。
方法成熟度: cos²/exp 双射是真本事,也是全篇最好的东西,部分原因在于它甚至不依赖量子。
pi/2 残差角免费给出凸性、列随机 V 膨胀成信道,这两个观察都是对的那一类:你原本在对抗的约束,恰恰是让整个构造成立的结构。
温度即重复次数很讨喜,但是最弱的关节。只有整数逆温度是实打实的建模限制,而后选择接受率按 p_i^k 的乘积衰减意味着注意力越尖锐、采样越糟。
同时,“无穷 shot 极限下精确,每个注意力分数一次 measure-and-reload”这句值得盯久一点:n^2 个分数,每个要估到精度 epsilon 需要 1/epsilon^2 个 shot,中间还要重装态——为了复现 CPU 纳秒级完成的事,这是相当可观的量子机械。
论文小心地没有宣称加速,这值得肯定,但只扫摘要的读者不会注意到这点。
实验诚意: 基本没有实验,论文也没装作有。Lean 4 验证是真正的学术卫生,我希望更多理论论文这么做,但要清楚它买到了什么:它认证的是代数恒等式,也就是最不可能错的那部分。
它对 shot 成本、噪声敏感性、角度参数化的可训练性(这类块编码投影的 barren plateau 行为是个明摆着的开放问题)、以及 cos² 注意力模型是否真能训得和 softmax 一样好,都一言未发。
我最想看到的两个实验都很便宜:(a) 在经典模拟器上,在一个真正单形绑定的任务上比较 cos² 注意力与 softmax、sparsemax、entmax;(b) 一张明确的 shot 预算 vs 经典 FLOPs 对照表。
没有这两样,“精确”是关于某个极限的陈述,而不是关于任何能跑起来的东西的陈述。
写作功力: 摘要是一堆以最大密度码起来的主张,单看每条都有意思,合起来令人疲惫;读起来像是为了在怀疑者的快速扫读中存活而写,而不是为了被理解而写。
偷懒之处在成本核算:“无穷 shot 极限”和”无穷深度极限”这两个词组,在最后一句里承担了全部重量。
能让整篇升一档的,是一节朴素的资源分析:直白说出这要花多少、它不加速什么、以及为什么这个构造依然值得拥有(答案是概念清晰度加上那条稀疏边界,这是个挺好的答案)。
判决: 弱接收 —— exp 到 cos² 的双射加上一条精确稀疏的边界,是一个干净、可复用、重新框定了长期障碍的结果;但这篇是字典而非算法,它用极限语言藏起了自己的成本,并且交付了零经验支撑。
要点总结
- 把 cos² 注意力头偷走,不需要量子计算机。 权重取
cos^(2k)(phi_i)归一化,就在有限参数处得到精确零,这正是 sparsemax 和 entmax 的全部卖点,但不需要投影步骤、也不需要 Tsallis 熵求解器。它是一次逐元素三角函数加一次归一化。如果你在注意力或门控层里需要诚实的稀疏性,值得花十分钟在玩具基准上试试。 - 用角度而不是 sigmoid 来参数化凸混合。 把门写成
cos^2(g)与sin^2(g),两者恒等地和为一,不需要 clamp、不需要1 - alpha的记账、也没有因数值误差漂出单形的可能。对任何输出必须保持为分布的模型,这是一个免费的不变量。 - 取幂再归一化 = 降温度。 说出来就显然,但当你手上是一个不敢取对数的正分数时很有用:别去除 logit,直接取幂。
- 列随机权重矩阵是保概率映射,不只是矩阵。 如果你的 value 或混合矩阵每列和为一,它就是一个马尔可夫核,单形进单形出是结构性的,不需要事后再补一个 softmax 来强制。这个框架直接迁移到混合模型,以及任何在分布之上堆叠层的场景。
- 值得记住的设计模式:当某个非线性看起来与你的底层硬件不合时,去找同一流形上的另一张坐标卡,而不是去做多项式逼近。 这篇真正的贡献是方法论层面的。
exp从来不是那个东西,“归一化的非负权重”才是。 - 给你的代数核心做机器验证。 不管你怎么看这里的物理,用 Lean 4 证明那些恒等式是很便宜的可信度,还能一举堵死一整类烦人的审稿意见。只是别让它替代经验证据——这篇正好掉进了这个坑。