原创中英双语数学推导与工程映射深读手册 / Original bilingual mathematical and engineering companion
- 原作题名 / Source title: Sinkhorn Distances: Lightspeed Computation of Optimal Transportation Distances
- 作者 / Authors: Marco Cuturi
- 固定版本 / Fixed version: https://arxiv.org/abs/1306.0895v1
- 提交日期 / Submission date: 2013-06-04
- Venue: NeurIPS 2013, Advances in Neural Information Processing Systems 26, pp.2292–2300
- 英文 PDF: 13 页;本册: 14 个原创分析章节
- 许可 / Paper license: arXiv non-exclusive license to distribute
- Edition: 2026-11-25
英文 Original 标记指本册原创英文分析,不是源论文摘录;中文为对应主题的原创深入阐释。原文全文、图表与书目保留在英文 PDF。
题名核对
版本题名差异:NeurIPS 2013 正式会议录题名为 “Sinkhorn Distances: Lightspeed Computation of Optimal Transport”,与任务清单一致;arXiv:1306.0895v1 正式题名为 “… Optimal Transportation Distances”。本包保存并阅读后者,两种题名均非误写。会议录证据:https://proceedings.neurips.cc/paper/2013/hash/af21d0c97db2e27e13572cbf59eb343d-Abstract.html
阅读目录
01 / 为什么几何距离值得一个运输计划
SOURCE 原文 pp.1–3 §§1–2;本册独立问题重述
中比较两张直方图时,逐坐标距离不知道相邻箱在几何上相近。把一颗粒子从一个像素移动到旁边,逐像素差可能很大,却只是很短的空间位移。最优传输让每单位质量的移动支付由地面代价矩阵定义的价格,从而把“有多少不同”与“不同发生在哪里”结合。代价不是装饰:选欧氏距离、平方距离或障碍感知路径,会得到不同的任务。
Cuturi 的贡献是以熵正则把一般运输线性规划变成可用矩阵缩放高效求解的问题。计算路线从搜索稀疏极点转成反复行列归一化,适合向量化,也能在 CPU 上执行。本包只运行小规模 CPU 数学例,不使用论文所讨论的 GPU 平台。效率收益与熵引入的扩散偏差必须同时理解;输出“软匹配”并不自动成为真实粒子对应关系。
本包固定 arXiv:1306.0895v1,2013-06-04,Marco Cuturi,13 页。NeurIPS 2013 正式会议录题名末尾为 Optimal Transport,与任务清单一致;arXiv 的正式题名末尾为 Optimal Transportation Distances。这是版本题名差异,均非误写。arXiv 页面只有 v1,许可为默认非独占分发许可,因此本册是原创中英数学与工程手册,不逐段翻译替代原文。先读第 2–8 章实现小例,再读第 9–13 章判断物理与应用边界。
平方欧氏代价在工程中很常见,但它本身不是一般的距离矩阵:在直线 0、1、2 三点上,0 到 2 的平方距离 4 大于两段平方距离之和 2。未正则二阶 Wasserstein 距离需要对最优平方运输成本取平方根,并满足对应概率空间条件。把平方代价直接称为度量,会让三角不等式等推论从入口就失效。
| 对象 / Object |
形状或单位 |
工程含义 |
| 边缘质量 r,c |
[n], [m], nonnegative |
各观测点/像素的质量 |
| 地面代价 M |
[n,m], e.g. mm² |
一次匹配的物理价格 |
| 运输计划 P |
[n,m], mass |
允许分裂的软对应 |
| 正则强度 ε |
与 M 相同单位 |
平滑程度与数值尺度 |
ENOptimal transport prices disagreement using geometry rather than independent histogram coordinates. Entropic regularization changes the optimization so matrix scaling becomes the main computation. The resulting soft plan is useful but is not an observed particle identity. This companion fixes the 13-page arXiv v1 and its exact title. It develops original derivations and CPU examples rather than substituting a paragraph-wise translation for a paper carrying the default arXiv distribution license. Squared Euclidean cost is common but is not itself a metric: on the points zero, one and two, the direct squared cost is four while the two legs sum to two. The unregularized second-order Wasserstein distance takes a square root under its appropriate assumptions. Cost choice and the returned power must therefore be explicit before importing metric arguments.
02 / 运输多面体与可手算的二乘二问题
SOURCE 原文 pp.2–3 §2;本册完整小例
中令 r 与 c 是总质量都为 1 的非负向量。运输计划 P 的每行和等于 r,每列和等于 c;只要总质量相等,独立计划 rcᵀ 就给出一个可行解。原文以等维直方图记号表达,本册实现允许 n×m 以适配不同数目的粒子。边缘相等是一个全局约束,不是要求每个源点只去一个终点。一个源质量可以分到多个目标。
考虑 r=(0.6,0.4)、c=(0.5,0.5),对角代价为 0、非对角为 1。令 P₁₁=t,则四个元素均由 t 确定;非负性给出 0.1≤t≤0.5。运输成本为 1.1−2t,所以无正则最优在 t=0.5,成本 0.1。这个例子说明至少 0.1 的质量必须跨箱运输,而不是算法误差。若把对角保持理解成不动的同名粒子,也要先证明两帧箱的索引确实对应同一物理位置。
在粒子图像中,归一化总亮度为 1 会抹掉总粒子质量或总光强变化。它适用于比较分布形状,却可能隐藏出平面粒子消失、遮挡和曝光变化。若两帧总质量不同,应明确采用质量归一化、未匹配虚拟点或另一类松弛模型;不能把不等质量悄悄送进平衡约束后靠数值截断“修好”。
线性规划的某个最优极点可仅含至多 n+m−1 个非零项,而正温度、正核的熵计划通常是稠密的。这里的稀疏与稠密不仅影响计算,也改变输出语义:未正则最优可能仍不唯一,正则唯一则可能依赖对称性把质量分散。唯一性属于选定数学目标,不等于真实世界只存在这一条对应关系。
U(r,c): nonnegative plans with the prescribed row/column sums
Exact 2×2 example: P*=[[0.5,0.1],[0,0.4]], cost 0.1
ENA coupling constrains row and column masses but does not enforce one-to-one identities. The two-by-two example reduces to a scalar interval and has exact transport cost 0.1. That cost reflects unavoidable mass movement, not solver error. Normalizing both images to unit mass changes the measurement contract: disappearance, occlusion and illumination changes are no longer represented as mass imbalance. Choose that contract explicitly before solving. A linear-program optimum can be chosen at a vertex with at most n+m−1 nonzero entries, while positive-temperature plans with positive kernels are dense. Either can still be ambiguous physically. Mathematical uniqueness belongs to the specified regularized objective; it does not establish that the world contains a unique correspondence or that each dense branch represents a real particle.
03 / 熵约束其实限制了相互信息
SOURCE 原文 pp.2–5 §3.1、Definition 1;本册推导
中对概率表 P 定义熵 h(P)=−ΣP log P,约定 0 log 0=0。在固定边缘下,最大熵解是独立表 rcᵀ,其熵等于 h(r)+h(c)。把 KL(P‖rcᵀ) 展开,边缘约束会把包含 log r 和 log c 的两项化为对应边缘熵,因此 KL 正好等于边缘熵之和减联合熵,也就是两个随机变量的相互信息。
原文用 α 约束这个 KL:α=0 只允许独立表;α 变大允许更集中、更具对应信息的计划。注意方向:硬约束 α 越大,约束越松,通常越靠近未正则 OT;它与常见熵温度 ε 的方向相反。最大熵计划不是“最确定的匹配”,而是给定边缘下最不包含额外对应信息的联合分布。软计划的合理性来自用途和先验,不能仅由熵值大小判断。
继续上页例子,独立表是 [[0.3,0.3],[0.2,0.2]],运输成本为 0.5,大于 OT 的 0.1。若 r=c=(0.6,0.4),独立表自比的非对角成本仍为 0.48,尽管两个分布完全相同。这是后续区分“运输代价”“正则目标”和“消偏散度”的最短反例。它不是迭代没有收敛,而是目标本身选择了扩散的联合表。
由于相互信息不超过任一边缘熵,取 α≥min{h(r),h(c)} 已足以让所有可行联合表通过该硬约束。反过来,α=0 的独立表不应被解释为“信息最完整”的匹配。这个方向检查很适合防止把 λ、ε 和 α 三个参数混用;报告参数数值时同时写出它出现的公式,胜过仅标注一个没有单位的 regularization。
KL to the independence table equals mutual information
Hard entropy constraint limits information in the coupling
| 独立计算例 |
计划 |
成本 |
| r=(.6,.4), c=(.5,.5) |
[[.3,.3],[.2,.2]] |
0.50 |
| r=c=(.6,.4) |
[[.36,.24],[.24,.16]] |
0.48 |
| 第一行的未正则 OT |
[[.5,.1],[0,.4]] |
0.10 |
ENFor fixed marginals, the KL divergence from the independence table equals mutual information. The hard parameter alpha limits that information: zero enforces independence, while larger values relax the restriction. This direction is opposite to an entropy temperature. The independence-plan self-cost can be positive even for identical histograms. That is an objective property, not a numerical convergence failure, and it motivates keeping several quantities called “Sinkhorn distance” separate. Mutual information is bounded by either marginal entropy, so alpha at least the smaller entropy makes the hard constraint inactive. At the other extreme, independence carries no correspondence information beyond the marginals. This direction check prevents confusing alpha, lambda and epsilon. Report the defining equation and units with a regularization parameter, rather than a bare number.
04 / 三个同名量:先决定要返回哪一个
SOURCE 原文 pp.5–7 Theorem 1、式(2)、§4.2;本册契约校正
中第一种量是硬熵约束下的最小运输成本 dM,α。原文在地面代价为度量时对它讨论对称性和三角不等式,但自比成本可以不为零。第二种量是用拉格朗日系数计算出来的软计划 Pε,再只取其运输项 dε=⟨Pε,M⟩;第三种是优化器真正最小化的完整目标 Fε=⟨Pε,M⟩−εh(Pε)。这两个标量共用一个计划,却数值不同。
原文用 λ,目标里的熵系数是 1/λ;本册用温度 ε=1/λ。λ 越大计划越尖,ε 越小计划越尖。原文指出,为每一对边缘可以找到相应 λ 与硬约束 α 对应,但这个映射依赖该对分布。固定一个 λ,并不等于对所有样本固定相同 α。把硬约束的度量结论直接搬到计算中常用的固定 λ 量,越过了原文自己保留的条件。
本册 CPU 示例返回 plan、transport_cost、regularized_objective 和 marginal_residual 四个字段。若下游要计算梯度,还必须知道损失用的是完整 Fε 还是只取运输项:前者的包络梯度在常见条件下直接使用 Pε,后者还包含计划随代价变化的链式项。一个字段名“distance”承载不了这些差别。先固定接口含义,再讨论数值与学习效果。
梯度差异也能在二点例上看见。若把非对角代价记为 z,则运输项为 z/(1+exp(z/ε));求导时既有当前非对角质量,也有质量随 z 变小的项。完整正则目标的包络导数则是当前计划对应的非对角质量。这说明训练时把计划 detach 后再算运输项,定义的是另一个梯度规则;即使前向标量相同,也要在实现说明中写清。
ε=1/λ; Pε minimizes transport minus entropy
Transport cost dε differs from the optimized objective Fε
ENThe hard-constrained cost, the transport component of a regularized plan and the full entropy-regularized objective are different scalars. The paper's lambda equals the inverse of the temperature used here. Matching alpha to lambda is pair-dependent, so metric results for the hard constraint do not automatically apply to a globally fixed temperature. Return an explicit plan, transport cost, full objective and residual. A learning loss also needs an explicit gradient contract. With off-diagonal cost z, the symmetric transport component equals z divided by 1+exp(z/epsilon). Its derivative includes the change in the plan as well as the current transported mass. The full regularized objective has the envelope derivative given by that mass. Detaching the plan therefore changes the gradient rule even when a forward transport scalar looks identical.
原文 p.7 也明确:后文沿用 “Sinkhorn distance” 称呼固定 λ 的计算量,但该量不因此获得已证明的全部度量性质。
05 / 从拉格朗日驻点推到 uKv
SOURCE 原文 p.6 §4.1;本册补足一阶条件与唯一性
中把行列和约束用乘子 a、b 加入目标。对每个正元素 Pij 求导,得到 Mij+ε(log Pij+1)−ai−bj=0。因此 Pij 是三个因子的乘积:只依赖行的 ui、只依赖代价的 Kij=exp(−Mij/ε)、只依赖列的 vj。把常数 exp(−1) 吸收到任一缩放向量即可。使用带 −P 的熵定义会直接去掉这个常数;在总质量固定时,两种定义的最优计划完全相同,目标值却相差常数。
对正边缘与有限代价,K 严格为正,负熵项严格凸,因此可行集合上的计划唯一。缩放向量本身则不唯一:u 乘任意正数、v 除同一数,计划不变。这项规范自由度解释了为什么盯着缩放向量绝对大小判断收敛并不稳妥;用真实边缘残差检验计划更直接。目标的严格凸不等于计划中的最大元素就对应真实粒子。
若有零边缘,可先移除对应行列,在解出正支撑后补回零。若代价为无穷大,K 出现结构零,此时是否存在满足给定边缘的允许运输计划要另外检查;一般正矩阵的结论不能无条件套用。工程上遮挡掩膜、距离门限和障碍禁行都可能制造这种支撑问题。先保证允许的图上有质量可流,再谈缩放迭代。
还可把目标重写为 εΣPij log(Pij/Kij),这表明缩放是在保持边缘的集合中寻找相对于核的熵投影。K 本身未必总和为 1,所以这里不是把未经归一化的 K 偷换成概率分布;若使用广义 KL,额外的总和常数不改变固定质量下的最优计划。记清这一步可避免在概率归一化与核缩放之间重复除以总和。
Stationarity includes cost, entropy derivative and row/column multipliers
Pε = diag(u) K diag(v)
Reciprocal scaling changes u and v but not Pε
ENThe factorization follows directly from stationarity. Strict convexity gives a unique plan under positive-marginal, finite-cost assumptions, while the scaling vectors retain a reciprocal gauge freedom. Entropy conventions can change the objective by a constant without changing the plan. Zero marginals can be removed; structural zeros in the kernel instead require a feasible support graph. Do not mistake a numerical scaling failure for evidence that the observations admit a physical correspondence. The objective can also be written as epsilon times the sum of P log(P/K). This exposes an entropy-projection view, but the kernel need not be a normalized probability distribution. Generalized-KL conventions add constants that do not change the fixed-mass optimum. Keep this distinction explicit to avoid normalizing the kernel again and silently changing the reported objective convention.
06 / 交替缩放与边缘残差
SOURCE 原文 pp.6–7 Algorithm 1;本册等价实现与停止准则
中给定 v,计划第 i 行的和是 ui(Kv)i,所以令 u=r/(Kv) 就能精确满足行边缘;随后令 v=c/(Kᵀu) 满足列边缘。第二步通常又略微破坏前一步的行边缘,因此需要迭代。这里的除法是逐元素运算,不是矩阵求逆,也不是把每一行先归一化到同样总和;不同的 ri 与 cj 必须保留。
每次迭代主要是两个矩阵向量乘,稠密代价为 O(nm),存储 K 或 P 也为 O(nm)。重复 T 次的工作量是 O(Tnm),不是把 T 当常数后宣称对一切精度都具有同样复杂度。多组目标可矩阵化,但同时保留所有对的计划很快耗尽内存。对于 10,000×10,000 的 float64 单矩阵,仅元素就约 800 MB;代价、核和计划三份并存会进一步放大。
推荐停止准则是行列质量 L1 残差的最大值,并同时设置迭代上限。固定次数适合固定预算的训练模块,但仍应抽查残差,尤其在小 ε 或稀疏支撑时。原文历史实验采用相邻缩放向量变化阈值或固定 20 次迭代,不能推导为所有新问题固定 20 次都足够。对重复规范缩放不变的计划残差,才与实际质量守恒接口一致。
v = ones(m)
repeat up to max_iter:
u = r / (K @ v)
v = c / (K.T @ u)
P = u[:,None] * K * v[None,:]
residual = max(L1(P.sum(1)-r), L1(P.sum(0)-c))
stop only when residual <= tolerance

ENAlternating row and column scalings enforce the prescribed masses in turn. Dense work is O(Tnm), including the iteration count; memory can dominate before arithmetic does. A useful stopping criterion measures both marginal residuals and reports the iteration limit. Fixed iterations are a budget policy, not a universal accuracy guarantee. Residuals are invariant to reciprocal rescaling of u and v, unlike the magnitudes of the scaling vectors themselves.
07 / 对数域:数值稳定不改变原目标
SOURCE 原文 p.6 核表达式;本册独立稳定化实现
中直接算 exp(−M/ε) 时,M/ε 很大就会下溢为零。若某一行全部变成数值零,r/(Kv) 随即除零,即使原数学问题完全可行。给分母机械加一个常数会改变缩放约束,而且常数的有效意义随质量单位变化。更清晰的方法是对数域维护缩放向量,使用 log-sum-exp 计算矩阵向量和。
记 f=εlog u、g=εlog v,更新 f 时对每行的 (g−M)/ε 做 log-sum-exp,再乘 ε 与 log r 组合;g 同理。最后 log P=(f+g−M)/ε。求运输成本和边缘时,也可以分块重建计划,避免同时存全量 P。对数域改善范围,却不消除小 ε 下可能增加的迭代次数,也不会自动修复非法支撑。
单位尤其容易出错。若 M 用 mm²,ε 也应以 mm² 解释;把坐标换成 m、代价缩小一百万倍,而 ε 保持数值不变,会让计划变得几乎独立。保持相同算法行为需同时缩放 M 与 ε。类似地,减去每行或每列常数在固定边缘下只给目标增加常数,不改变最优计划;但若比较不同问题的 Fε,则要把常数修正记回去。
若把 f 加上常数 a、把 g 减去 a,log P 不变;可利用这个规范自由度定期中心化势,减少数值漂移。零边缘的 log r=−∞ 不能用随意小正数替换后仍宣称原问题不变,应在支撑上求解再补零。温度退火可作为实现策略,但每一阶段都必须在原代价、当前温度与最终边缘残差上验收。
fᵢ=ε[log rᵢ−LSEⱼ((gⱼ−Mᵢⱼ)/ε)]
gⱼ=ε[log cⱼ−LSEᵢ((fᵢ−Mᵢⱼ)/ε)]
Stable log-sum-exp subtracts the maximum before exponentiation
ENLog-sum-exp prevents underflow without replacing the objective by an arbitrary denominator floor. Potentials f and g are log-scalings in cost units. Small temperature can still require more iterations. Cost units matter: changing squared millimeters to squared meters while leaving epsilon unchanged changes the model, not just its numerical representation. Row or column cost shifts preserve the plan under fixed marginals but alter the reported scalar objective by a known constant. Centering the potentials through reciprocal shifts preserves log P and can limit drift. Zero marginals should be handled on their support, not replaced by arbitrary small masses while claiming an unchanged problem. Temperature continuation is an implementation strategy; the final plan still needs validation at the actual final temperature, cost scale and marginal tolerance.
08 / 一张精确小表读懂熵偏差
SOURCE 本册原创二点解析解;关联原文 §4 的正则计划
中令 r=c=(1/2,1/2),M 的对角为 0、非对角为 1。对称性与边缘条件使 P=[[a,b],[b,a]],且 a+b=1/2。一阶条件给出 b/a=exp(−1/ε),于是 b=1/[2(1+exp(1/ε))]。运输成本是 2b,原始 OT 则为 0。这个最小例能同时检验代价/温度方向、行列约束、计划对称性和自比偏差。
当 ε 较大,计划接近独立表,各点把相当质量送给另一个点;当 ε 逐渐减小,非对角质量趋近零。对 ε=0.2,成本约 0.006692851,即便输入分布完全相同也不为零。完整 Fε 还含负的熵项,所以它可以为负;负值本身不表示程序错误。若代码声称返回正则目标却只算 ΣPM,表中这两个数会立刻揭穿字段混淆。
随包 CPU 脚本既用解析公式计算,也用对数缩放求解并比对,容许误差为 10⁻¹⁰。它另外验证共同缩放 M 和 ε 后计划不变,以及普通/对数域在适中尺度上的一致性。这里所有数值是可重复的小规模数学算例,不是论文 MNIST 精度或本机大规模性能。减少 ε 会减少这个例子的偏差,但在一般问题中仍需单独权衡数据噪声、迭代稳定和模型选择。
ε 趋向无穷大时,此例计划趋于四格各 1/4,成本趋向 1/2、熵趋向 log 4,所以 Fε 的主导项是 −εlog 4;ε 趋近零时计划趋向对角两格各 1/2。两种极限给出比随机测试更强的符号检查:如果增大 ε 反而让计划更尖,通常是温度写反;如果完整目标始终等于非负运输项,则很可能漏了熵。
Off-diagonal mass b=1/[2(1+exp(1/ε))]; transport cost =2b
| ε(独立例) |
非对角单格 b |
运输成本 dε |
| 1.0 |
0.134470711 |
0.268941421 |
| 0.5 |
0.059601461 |
0.119202922 |
| 0.2 |
0.003346425 |
0.006692851 |
| 0.1 |
0.000022699 |
0.000045398 |
ENA symmetric two-point problem has a closed-form logistic off-diagonal mass. It makes self-cost and entropy bias visible without a dataset. The full regularized objective may be negative because entropy is subtracted. The included CPU test compares the analytic plan with log-domain scaling and checks cost-temperature rescaling invariance. These are mathematical examples, not reproduced MNIST accuracy or large-scale timing results. The large-temperature limit is the four-cell independence table, with transport cost one half and entropy log four. The full objective is then dominated by minus epsilon log four. The small-temperature limit concentrates on the diagonal. These limits are strong sign checks: increasing temperature should soften this example, and the full objective should not silently equal its transport term.
上表小数按解析解取舍;边缘均为 0.5。ε=0.2 时 Fε≈−0.139972506(熵定义 −ΣPlogP)。
09 / 正则偏差与迭代误差要分开报
SOURCE 原文 pp.8–10 §§5.2–5.4;本册独立误差上界
中设 P* 为未正则 OT 最优计划,Pε 是精确解出的正则计划。用 P* 作为正则问题的可行比较项,可得正则计划的运输成本超过原 OT 的部分,不大于 ε[h(Pε)−h(P*)]。联合熵不超过两个边缘熵之和,且不小于任一边缘熵,所以进一步得到 εmin{h(r),h(c)} 的粗界。该界依赖概率归一化、有限支撑和相同代价,不保证每一项粒子对应误差都小。
这是一种目标偏差,即使迭代完全收敛也存在。另一个误差来自有限迭代:计划尚未满足边缘,或者目标尚未到达该 ε 下的最优。低边缘残差是可行性的证据,不是任意情况下都能单独证明完整最优性;严格需要目标差或对偶证据。评测至少分开列出 ε、停止阈值、迭代数、边缘残差与所返回成本,避免“误差”一个数字同时装下三种含义。
原文 MNIST 研究显示,实用 λ 下成本不必数值接近 EMD,效果仍可能更好;近似原 OT 不是所有应用唯一的目标。本册建议按实际下游任务选择 ε,同时报告偏差。如果任务是分布级比较,可以容许一定软化;如果要输出逐粒子轨迹,软计划的熵、单峰性和未匹配机制更直接影响能否解释为对应。不要靠缩小 ε 强制把本来不明确的观测伪装成确定配对。
容差应绑定到一种具体范数。若有 10,000 个边缘项,每项绝对残差都小于 10⁻⁸,L1 残差仍可接近 10⁻⁴;声称“精度 10⁻⁸”却不写范数会夸大质量守恒程度。总代价很小的例子还需避免只报相对误差的除零或放大。对有严格质量含义的实验数据,绝对残差和相对总质量残差应同时保留。
Compare the exact regularized optimum against the unregularized optimum
For normalized finite distributions, the entropy bound limits aggregate cost bias
ENRegularization bias persists after exact convergence; iteration error does not. A simple optimality comparison bounds the transport-cost gap by epsilon times the smaller marginal entropy. The bound says nothing directly about individual trajectory accuracy. Marginal residual measures feasibility, not complete optimality by itself. Report temperature, stopping policy, iteration count and the actual returned scalar separately. Choose smoothing for the downstream task rather than treating exact-OT approximation as the only valid objective. A tolerance needs a norm. Ten thousand marginal entries each below 1e−8 can still accumulate nearly 1e−4 L1 error. Calling either result “1e−8 accuracy” without a norm is misleading. Near-zero costs also make relative-error reporting unstable. Preserve absolute residuals and residuals relative to declared total mass when the masses have a physical interpretation.
10 / 自比为零、消偏与度量承诺
SOURCE 原文 pp.4–7 §3.2/4.2;本册独立比较定义
中现代文献中的“Sinkhorn divergence”常带消偏项,不能与 2013 文中固定 λ 的称呼混为同一个定义。若用一致的地面代价与完整正则目标,可定义 Sε(r,c)=Fε(r,c)−Fε(r,r)/2−Fε(c,c)/2。按这个定义,相同分布自比恰为零。它把训练时容易出现的自相互作用偏差从比较值中扣除,是另一层明确的目标选择。
自比为零不等于已经证明三角不等式、正定性或任何任意代价上的非负性。此处只用代数说明自比消去,不把外部定理附会给原作。如果采用以 KL(P‖rcᵀ) 替代负熵的正则化,在概率总质量固定时,两者相差边缘熵项;这些项也会在一致的交叉减自比构造中抵消。但混用运输项 dε 和完整 Fε,就没有这一直接等价。
对机器学习接口,最安全的命名是 regularized_ot_objective、transport_cost 或 debiased_divergence,并在方法部分写公式。若只是为了“相似样本更接近”的排序,是否要求严格度量由消费算法决定;某些聚类、核方法或几何推论则依赖特定数学条件。不要给一个经过经验后处理的标量贴上 Wasserstein 度量标签,然后无条件使用相关定理。
跨样本比较还须固定自比项的计算精度。若交叉项用较少迭代而两个自比项用高精度,差值可能主要反映数值不一致。完全相同的输入也应走同一数学与停止契约;缓存自比项时把模型/代价参数、温度与精度一起记入键。参数变化后继续复用旧自比,会引入无法从最终散度数值看出的过期依赖。
A consistent cross-minus-self definition cancels self-comparison
Self-cancellation follows from the definition, without a metric theorem
| 返回量 |
自比通常为零? |
需要另外核实 |
| 原始 OT,度量 M |
是 |
代价是否满足所用定理条件 |
| 正则计划运输项 |
否 |
ε、计划与停止准则 |
| 完整正则目标 |
否 |
熵约定和常数项 |
| 一致消偏构造 |
按定义是 |
非负性/几何性质的适用条件 |
ENA debiased cross-minus-self construction is a distinct definition, not a renaming of the 2013 fixed-lambda transport component. It cancels self-comparison algebraically when all terms share the same objective convention. Zero self-value alone proves neither a triangle inequality nor nonnegativity for arbitrary costs. Name and document the scalar that downstream code consumes. A ranking heuristic and a mathematical metric support different algorithms and claims. Cross and self terms need compatible numerical accuracy. A low-accuracy cross solve minus high-accuracy self solves can expose solver inconsistency rather than geometry. If self terms are cached, include cost or model parameters, temperature and stopping policy in the cache key. Reusing stale self terms after changing the representation silently changes the learning objective.
11 / 2013 实证告诉我们什么
SOURCE 原文 pp.7–11 §5/Figs.2–5;本册证据与复现边界
中原作在 MNIST 上将 20×20 灰度图归一化为 400 维直方图,地面代价由像素位置定义,再把距离转成核用于分类。划分是每次 1/4 训练、3/4 测试,4 folds×6 repeats,共 24 次实验;不是今天常见的标准完整训练集配置。核带宽、SVM 正则与 λ 都有内部选择流程。不能把其图形中的分类排序不加条件地外推为机器人控制成功率。
速度实验比较多维随机直方图,代价按中位数缩放,CPU 使用单核 2.66 GHz Xeon,GPU 为 Quadro K5000。原文在其大维度、阈值 0.01 和实现组合下报告超过 100,000 倍的 CPU 加速,且 GPU 再带来额外量级;这体现当时 EMD 求解与缩放路线的差异,不是本机测出的速度,也不保证现代库、稀疏几何或更严格精度仍有同一倍率。
原作的每次迭代较便宜,迭代数却随核更对角占优而增加,故 λ 影响精度、模型行为和成本三者。复现应先固定概率定义、代价单位、温度与容差,再比较同一输出含义。对小样例,以精确线性规划或解析解校准正确性;对真实任务,用配对输入比较计划、成本和实际消费效果;最后在目标 CPU 上单独测时间与内存,不能把论文曲线的点抄成本地实测。
可复现实证也要区分“求一个成本”与“物化整个计划”。前者可以按块归约,后者需要保存 n×m 数据;若一个实现把矩阵留在加速设备而另一个把它拷回 CPU,时间差中还混入传输。对新 CPU 基准应分别列代价构造、迭代、计划输出与总时长,并让双方返回相同精度、相同字段,才有可解释的性能比较。
| 原作实证对象 |
固定条件 |
本轮状态 |
| MNIST 分类 |
20×20;24 次交叉验证 |
阅读原作,未重训 |
| CPU 计时 |
单核 2.66 GHz Xeon |
未移植为本机计时 |
| GPU 计时 |
Quadro K5000 |
本轮零 GPU |
| 本册小例 |
解析 2×2 与对数缩放 |
CPU 实际执行并验算 |
ENThe MNIST and timing results belong to a specific 2013 protocol, hardware and tolerance. They support the computational value of entropic matrix scaling, not an unconditional speed multiplier for today's libraries or robot workloads. The paper's cross-validation split uses one quarter for training, and its convergence threshold is part of the timing contract. Reproduction should first align mass normalization, cost units, regularization and output semantics before comparing accuracy or runtime. Computing one scalar and materializing an entire plan are different workloads. Block reduction can avoid storing the plan, while a consumer that needs every entry cannot. Device transfer can further change a timing comparison. A new CPU benchmark should separate cost construction, iterations, output materialization and total time, with identical accuracy and returned fields on both sides.
12 / 从软配对到 PTV:重心不等于轨迹
SOURCE 本册独立工程推导;关联库内事件视觉/最优传输,不冒充原作应用
中对粒子点集,最直接的代价是预测位置与目标位置之间的平方距离,可以加入可测的外观或物理不确定度。质量边缘可由检测置信度或相同粒子权重构造,但它们的含义需要固定。用 P 的每一行除以源质量,可解释为条件目标分布;取它的重心得到一个连续预测位移。这个重心是软计划的统计量,不是传感器真正看见了某颗粒子的中间位置。
反例很简单:源点被等概率分给 x=−1 与 x=+1 两个目标,重心为 0,但没有任何目标在 0。若两条轨迹交叉或遮挡,图像可能给出对称代价,熵正则会保留歧义;硬取 argmax 只是人为打破平局。质量守恒也不等于粒子身份守恒:两个不同的联合表可以有完全相同的边缘。需要速度先验、多帧身份、遮挡模型或额外观测去区分。
流体 PTV 中,可把 OT 用作候选匹配或分布级损失,再保留行熵、峰值比和允许距离门限作为不确定度。出平面粒子离开视场时,用平衡 OT 强制全部配对会制造虚假长位移;显式未匹配通道比静默归一化更符合物理。随后做无散投影可以改善场的物理一致性,但不能追溯性地把未观测轨迹变成直接粒子测量。观测掩膜与模型场必须在输出中分开。
条件二阶矩能保留被重心隐藏的分叉:Σj Pij‖yj−ŷi‖²/ri 越大,软配对覆盖的目标越分散。它不能直接当标定后的高斯位置方差,因为候选可能多峰且质量含义不同;但它能阻止下游只看到一个中点就误判为高置信粒子。需要硬轨迹时,应在多帧图上处理歧义或输出未决,而不是把宽分布悄悄压成单点。
Barycentric projection is the conditional mean of the target locations
A valid soft mean may lie at a location where no particle was observed
ENThe barycentric projection of a soft coupling is a conditional expectation, not an observed particle. A symmetric split between minus one and plus one has mean zero despite no target at zero. Identical marginals allow different identities, so mass constraints do not establish trajectories. Use OT for candidates or distribution losses with uncertainty and explicit unmatched handling. A later incompressibility projection improves a field model without creating missing particle observations. A conditional second moment exposes spread hidden by the barycenter. It is not automatically a calibrated Gaussian variance, especially for multimodal candidates or confidence-based masses. It does, however, prevent a wide split from appearing as a confident midpoint. A hard trajectory consumer should resolve ambiguity with additional frames or retain an undecided state rather than silently collapsing the distribution.
候选不确定度与未匹配项属于本册的工程建议;2013 原作的直方图分类实验没有验证粒子身份恢复。
13 / 流匹配、连续性与无散约束
SOURCE 本册独立跨论文推导;关联 07/08/23 的生成流与物理场
中静态 OT 选的是端点之间的联合分布;流匹配训练的是随时间变化的速度场,二者通过路径构造联系。对一对端点 x₀、x₁ 采用直线插值,条件速度是 x₁−x₀;将这些样本速度对当前位置条件平均,可得到欧拉速度的回归目标。换用更几何合理的端点耦合,可以降低不必要的路径交叉,但不等于训练结果自动满足流体不可压缩。
连续性方程是 ∂tρ+∇·(ρv)=0。若 ρ 在整个域内空间和时间都为常数,才可直接约化为 ∇·v=0;粒子可见性密度通常随光片厚度、遮挡、检测阈值和出平面运动变化,不能把它无条件当常密度流体质量。即便两帧可见点云的总质量相等,也不能推出中间每处速度散度为零。端点匹配、密度演化与欧拉场约束是三个不同层级。
一个可研究的组合是:用不确定度感知 OT 产生端点候选,条件流学习连续时间位移,再在测量覆盖内做带数据权重的不可压缩变分估计。若直接对网络速度作 Helmholtz 投影 v=u−∇φ,并求 Δφ=∇·u,还需要边界条件和质量一致性。投影会改变粒子轨迹乃至终点,所以必须重新检查事件/位置数据项;不能只因散度残差变小就宣称所有观测同时拟合。
端点体积保持甚至不能保证直线路径的体积保持。独立反例:圆盘上的 180° 刚体旋转 x₁=−x₀ 保持端点均匀分布;若沿 xₜ=(1−2t)x₀ 直线插值,t=1/2 时全部点塌到原点。此耦合不是同分布平方代价 OT 的最优耦合;它用于隔离逻辑缺口:仅有端点质量条件,推不出所选中间路径不可压缩。
Linear conditional paths induce a conditional-mean Eulerian regression target
Continuity differs from incompressibility; projection needs a boundary-value problem
ENStatic transport selects endpoint couplings; flow matching learns a time-dependent velocity from a path construction. Coupling quality can shape the regression problem without imposing incompressibility. The continuity equation reduces to zero divergence only under a constant-density premise, which visible particle counts generally do not satisfy. A Helmholtz projection also needs boundary conditions and changes trajectories. Recheck observation residuals after projection instead of treating physical consistency as a replacement for measurement agreement. Even volume-preserving endpoints do not certify a volume-preserving interpolation. A half-turn maps a uniform disk to itself, but straight interpolation between paired opposite points collapses everything at the midpoint. This pairing is not the optimal squared-cost coupling for identical marginals. It isolates the logical point: endpoint mass conditions alone do not prove incompressibility of a chosen intermediate path.
14 / 实现验收、动作接口与术语
SOURCE 本册 CPU 验证;原文 pp.11–13 结论、证明与书目
中随包 CPU 脚本检验二乘二解析解、普通/对数缩放一致性、边缘质量、共同尺度变换、成本偏差粗界和自比消去。测试使用小型确定性数组,不依赖 GPU、权重或外部数据集。原文 13 页均有文本清单;正文到算法、实证和附录证明的阅读路径均在本册提供定位。附录在编号和排版上存在可疑笔误:p.11 “Proof of Property 1” 实际开始讨论独立核,且出现 U₁ 与零 KL 极限的上下文不一致;本册以定义及代数重新推导,未照抄为新的定理。
接到动作块时,OT 可比较预测动作分布或做候选对应,但时间索引必须进入代价。仅按动作数值接近去重排,会改变动作先后而破坏碰撞与速度约束。软计划的重心动作也可能穿过两个安全候选之间的障碍。因此动作生成、轨迹平滑和安全过滤应保留各自的几何、时间和动力学约束,不能用运输损失独自担保安全。
最短上手路线:固定质量/未匹配契约,统一坐标与代价单位,先在小规模解析例运行;接真实候选后报告熵与残差;用独立身份或轨迹标签检验目标任务;最后再测目标硬件时间。若消费方需要完整计划就不要只交成本,若只要分布损失则不要宣称逐粒子匹配。术语、字段与数学定义一致,才有可复现的工程接口。
动作混合可用同样的反例理解:两个候选末端位置分别在障碍的上方与下方,二者都安全,算术中点却可能位于障碍内部。运输计划提供的软权重并没有凸化真实的无碰撞集合。需要重心动作时,后续应在实际运动学与障碍约束中重新求可行轨迹;若不可行,返回替代候选或未决状态,而不是把分布平均当作安全接管。
| English term |
固定中文 |
接口含义 |
| coupling / transport plan |
耦合 / 运输计划 |
允许质量分裂的联合表 |
| ground cost |
地面代价 |
明示坐标、单位与门限 |
| entropy temperature |
熵温度 ε |
ε=1/λ |
| marginal residual |
边缘残差 |
可行性检查而非全部最优性 |
| barycentric projection |
重心投影 |
统计均值而非直接测量 |
ENThe CPU checks cover small deterministic mathematical contracts, not learned policy performance. The source appendix contains apparent numbering/context typos, so this companion derives the relevant identities from the definitions. For action chunks, geometric similarity does not preserve time order or safety; even a barycentric action can lie between safe modes at an unsafe location. Align mass, units, uncertainty and consumer fields before optimizing runtime. Two safe actions on opposite sides of an obstacle can have an unsafe mean inside it. A transport weighting does not make the collision-free set convex. If a consumer uses barycentric actions, it must recover feasibility under the actual kinematics and obstacles. Otherwise it should retain a feasible mode or report no valid candidate, rather than treating distribution averaging as a safety takeover.
来源:arxiv.org/abs/1306.0895v1;NeurIPS 2013, vol.26, pp.2292–2300。本册完整正则目标采用 h(P)=−ΣPlogP,未使用 −ΣP(logP−1) 的常数变体。