SIMPLE: A Gradient Estimator for $k$-subset Sampling

Kareem Ahmed, Zhe Zeng, Mathias Niepert, Guy Van den Broeck

Abstract

$k$-subset sampling is ubiquitous in machine learning, enabling regularization and interpretability through sparsity. The challenge lies in rendering $k$-subset sampling amenable to end-to-end learning. This has typically involved relaxing the reparameterized samples to allow for backpropagation, with the risk of introducing high bias and high variance. In this work, we fall back to discrete $k$-subset sampling on the forward pass. This is coupled with using the gradient with respect to the exact marginals, computed efficiently, as a proxy for the true gradient. We show that our gradient estimator, SIMPLE, exhibits lower bias and variance compared to state-of-the-art estimators, including the straight-through Gumbel estimator when $k=1$. Empirical results show improved performance on learning to explain and sparse linear regression. We give an algorithm computing the exact ELBO for the $k$-subset distribution, obtaining significantly lower loss than SOTA.

Introduction

In machine learning, sparsity is a powerful tool for regularization and interpretability. A common requirement is $k$-subset sampling: selecting exactly $k$ items from a set of $n$ possibilities. This is essential for tasks like feature selection, "Learning to Explain" (L2X), and sparse linear regression.

However, the discrete nature of picking items creates a significant challenge for gradient-based optimization. Standard neural networks require differentiable operations to backpropagate errors. Traditionally, researchers have relied on "continuous relaxations" (e.g., Gumbel-Softmax) to approximate these discrete choices. While these approximations allow for training, they often introduce high bias and variance, leading to suboptimal model performance.

Methodology: The SIMPLE Approach

The proposed SIMPLE (Subset Implicit Likelihood Estimation) estimator avoids continuous relaxations by decoupling the forward and backward passes.

Forward Pass: Discrete Sampling

Unlike relaxation-based methods that use "relaxed" or "blurry" samples, SIMPLE performs exact discrete sampling from the $k$-subset distribution. This ensures that the model operates on true sparse representations during both inference and training.

Backward Pass: Exact Marginals

The core innovation of SIMPLE lies in its gradient estimation. Instead of differentiating through the discrete samples directly, it uses the exact marginal probabilities—the probability that any specific item $i$ is included in the $k$-subset—as a differentiable proxy.

The SIMPLE framework: Input $x$ generates parameters $\theta$, which define a $k$-subset distribution. Discrete samples $z$ are passed to a downstream task $f_u$, while the gradient is estimated using exact marginals $\mu(\theta)$.

The authors prove in Theorem 1 that these conditional marginals are the partial derivatives of the log-probability of the $k$-subset constraint. This allows for an efficient $O(nk)$ computation of the gradient direction. Furthermore, the authors derived an algorithm to compute the exact entropy of the $k$-subset distribution, which is critical for optimizing the Evidence Lower Bound (ELBO) in Variational Auto-Encoders (VAEs).

Experimental Evaluation

The authors evaluated SIMPLE across several benchmarks:

  1. Synthetic Data: Used to measure bias and variance against a "Golden Standard" exact gradient.
  2. MNIST DVAE: Training discrete VAEs to learn sparse representations of digits.
  3. BeerAdvocate (L2X): Extracting the $k$ most informative words to explain human ratings.
  4. Sparse Regression: Identifying underlying physical laws (Kuramoto–Sivashinsky equation) from noisy simulation data.

Key Results

SIMPLE demonstrates a clear advantage over existing estimators. In synthetic experiments, it achieved significantly lower bias and variance compared to state-of-the-art methods like SoftSub and I-MLE.

Comparison of Bias and Variance across various gradient estimators. SIMPLE exhibits the lowest combined bias and variance, outperforming both score function and relaxation-based methods.

On the MNIST DVAE task, the ability to calculate exact entropy allowed SIMPLE to achieve a lower loss (ELBO) than previous methods. In the "Learning to Explain" task, it provided higher precision and lower Mean Squared Error (MSE). Finally, in physics-informed sparse regression, SIMPLE successfully identified the correct governing terms, matching the performance of specialized numerical solvers.

Conclusion

SIMPLE offers a robust alternative to continuous relaxations for $k$-subset sampling. By combining exact discrete sampling with exact marginal-based gradients, it provides a low-bias, low-variance estimator that improves performance across a variety of sparse modeling tasks. Future work includes extending the method to handle dependencies between items and further optimizing GPU implementations for large-scale applications.

Summary updated

BibTeX
@inproceedings{ahmed2023simple,
  author = {Kareem Ahmed and Zhe Zeng and Mathias Niepert and Guy Van den Broeck},
  title = {{SIMPLE: A Gradient Estimator for $k$-subset Sampling}},
  booktitle = {Differentiable Almost Everything @ ICML},
  year = {2023},
  url = {https://openreview.net/forum?id=lmYGbAdCLN},
}
Figure