Skip to main content
QUICK REVIEW

[论文解读] Differentiable Knapsack and Top-k Operators via Dynamic Programming

Germain Vivier--Ardisson, Michael E. Sander|arXiv (Cornell University)|Jan 29, 2026
Stochastic Gradient Optimization TechniquesComputer Science被引用 0
一句话总结

论文提出了一个统一的可微分框架,将背包问题(Knapsack)和 Top-k 操作通过求解动态规划并对递推进行平滑化来实现,使神经网络中能够同时具备确定性与随机层。它还表征了能够确保置换等变性与稀疏性的正则化项,并在决策聚焦学习、受约束的动态组合 RL 以及离散变分自编码器(VAE)中展示了应用。

ABSTRACT

Knapsack and Top-k operators are useful for selecting discrete subsets of variables. However, their integration into neural networks is challenging as they are piecewise constant, yielding gradients that are zero almost everywhere. In this paper, we propose a unified framework casting these operators as dynamic programs, and derive differentiable relaxations by smoothing the underlying recursions. On the algorithmic side, we develop efficient parallel algorithms supporting both deterministic and stochastic forward passes, and vector-Jacobian products for the backward pass. On the theoretical side, we prove that Shannon entropy is the unique regularization choice yielding permutation-equivariant operators, and characterize regularizers inducing sparse selections. Finally, on the experimental side, we demonstrate our framework on a decision-focused learning benchmark, a constrained dynamic assortment RL problem, and an extension of discrete VAEs.

研究动机与目标

  • 将 Knapsack 与 Top-k 表示为动态规划并通过平滑最大化递推得到可微分的放宽。
  • 开发前向与反向传播的高效并行算法,并实现向量-雅可比积(vector-Jacobian products, VJP)。
  • 表征能产生置换等变算子与选择稀疏性的正则化项,并指出香农熵是唯一能产生等变性的可分离正则化项。
  • 提供随机前向传播和 Fenchel-Young 损失用于端到端学习。
  • 在决策聚焦学习、受约束的动态组合 RL 以及离散 VAE 上演示该框架。

提出的方法

  • 通过将 DP 贝尔曼递推中的最大运算用 max_Ω 替换来获得可微分的放宽,进行正则化。
  • 定义平滑的 DP 值及其梯度以在 conv(Y^C_w) 中产生可微分的算子。
  • 确立置换等变性与稀疏性的性质,并指出香农熵作为唯一能产生等变性的可分离正则化项。
  • 提供确定性与随机积分的前向与后向算法(算法 1-4),包括 VJP 与采样方案。
  • 将算子与 Fenchel-Young 损失联系起来,以实现有原则的监督学习。
  • 通过波前并行性以及 NumPy/Numba 实现来展示高效性。
Figure 1: Illustration of our relaxed Top- $k$ and Knapsack operators. We plot the sum of the first two coordinates of the relaxed operator for ${\bm{\theta}}=(\theta_{1},\theta_{2},\frac{1}{2},1)^{\top}$ . In the first row, we use $\bm{y}^{k}_{\bm{1},\Omega}$ with $k=2$ and ${\bm{w}}=\bm{1}$ . In t
Figure 1: Illustration of our relaxed Top- $k$ and Knapsack operators. We plot the sum of the first two coordinates of the relaxed operator for ${\bm{\theta}}=(\theta_{1},\theta_{2},\frac{1}{2},1)^{\top}$ . In the first row, we use $\bm{y}^{k}_{\bm{1},\Omega}$ with $k=2$ and ${\bm{w}}=\bm{1}$ . In t

实验结果

研究问题

  • RQ1 Knapsack 和 Top-k 是否可以重新表述为具有可微分放宽的 DP 问题?
  • RQ2哪些正则化能强制实现置换等变性,何时会获得稀疏选择?
  • RQ3如何将这些可微分算子整合到端到端学习中,既包含确定性前向传播也包含随机前向传播?
  • RQ4与基线方法相比,所提出的算子在决策聚焦学习、动态组合 RL 和 DVAE 任务上是否有改进?

主要发现

  • 通过对 DP 最大递推进行平滑并引入正则化 Ω,得出一个可微分的 Knapsack 与 Top-k 算子。
  • 香农熵是唯一能产生可分离的等变性放松算子的正则化项,其他正则化项可使稀疏性得到引导。
  • 高效的向量-雅可比积和基于祖先采样的随机前向传播使端到端训练成为可能。
  • 该框架既支持确定性层,也支持带 Fenchel-Young 损失的随机前向传播以实现监督。
  • 实验表明在决策聚焦学习、动态组合 RL 和离散 VAE 任务中,基于 DP 的损失优于基线方法。
  • 该方法能够从潜在分布 π^{w,C}_{θ,Ω} 进行采样,并在不大量求解器调用的情况下提供可行的前向/后向传播。
Figure 2: Scaling and performance of $\bm{y}^{C}_{\bm{w},\Omega}$ as an output layer. Lower computational time and test relative regret are better.
Figure 2: Scaling and performance of $\bm{y}^{C}_{\bm{w},\Omega}$ as an output layer. Lower computational time and test relative regret are better.

阅读本论文

在 Nubint 阅读器中打开原文,边读边就任意段落提问。

在 Nubint 中阅读本论文

本解读由 AI 根据论文原文生成,引用前请核对原文。