LapSum is an analytic framework that constructs fully differentiable surrogates for order-based operators like soft ranking, sorting, and top-k selection.
It employs a closed-form inversion of a Laplace sum function over input elements to achieve low computational and memory complexity.
The framework enables efficient forward and backward passes in neural and optimization pipelines for tasks such as learning-to-rank and structured output prediction.
LapSum is an analytic framework for constructing fully differentiable surrogates to order-based operators, comprising soft ranking, differentiable sorting, top-k selection, and permutation-based transformations. The core methodology centers on the closed-form inversion of a functional known as the LapSum, defined as the sum of Laplace cumulative distribution functions over the elements of an input vector. This construction yields low computational and memory complexity and facilitates efficient forward and backward passes in neural and optimization pipelines relevant to learning-to-rank, attention, and structured output prediction tasks (Struski et al., 8 Mar 2025).
1. Core Definition and Mathematical Structure
Let r=(r0,…,rn−1)∈Rn denote an input vector and α=0 a temperature (scale) parameter. Define the standard Laplace CDF as
Lap(x)={21exp(x)x≤01−21exp(−x)x>0
The thermally scaled Laplace CDF is Lapα(x)=Lap(x/α). The LapSum function is given by
LapSumα(x;r)=i=0∑n−1Lapα(x−ri)∈(0,n)
Given a target “sum” w∈(0,n), one inverts this function to obtain b=LapSumα−1(w;r) satisfying ∑iLapα(b−ri)=w. Evaluating Lapα(b−ri) for each coordinate then enables soft selection and ordering tasks.
2. Closed-Form Inversion and Algorithmic Construction
For sorted r=(r0,…,rn−1)∈Rn0, the piecewise-linear nature of the LapSum is exploited. Precomputing sequences r=(r0,…,rn−1)∈Rn1 in r=(r0,…,rn−1)∈Rn2 time (via forward and backward recursions), the function admits the region-wise form for r=(r0,…,rn−1)∈Rn3:
LapSum(x;r)=21ake<sup>αx</sup>−rk+1</p><ul><li>21bk+1e<sup>αrk</sup>−x</li><li>ck+1r = (r_0, \ldots, r_{n-1}) \in \mathbb{R}^n4wk=ck+1−21bk+1+21ake<sup>(rk+1</sup>−rk)/α demarcate the regions.
The closed-form inversion is as follows:
For r=(r0,…,rn−1)∈Rn5:
r=(r0,…,rn−1)∈Rn6
For r=(r0,…,rn−1)∈Rn7 r=(r0,…,rn−1)∈Rn8:
r=(r0,…,rn−1)∈Rn9
For α=00:
α=01
Locating the corresponding interval in α=02 time per query enables overall α=03 forward propagation.
3. Differentiable Operators Derived from LapSum
The LapSum inversion ground the construction of several differentiable surrogates for combinatorial operators:
α=06 for α=07, where α=08. The resulting vector α=09 yields a soft indicator, converging to the hard Top-Lap(x)={21exp(x)x≤01−21exp(−x)x>00 as Lap(x)={21exp(x)x≤01−21exp(−x)x>01.
Soft Ranking:
Lap(x)={21exp(x)x≤01−21exp(−x)x>02 for each Lap(x)={21exp(x)x≤01−21exp(−x)x>03. In the zero-temperature limit, this retrieves classical ranking (plus