Papers
Topics
Authors
Recent
Search
2000 character limit reached

ReSWD: Reservoir Sliced Wasserstein Estimator

Updated 4 May 2026
  • The paper introduces ReSWD, integrating Weighted Reservoir Sampling with SWD to reduce estimator variance and achieve more stable gradients.
  • It applies adaptive sampling to prioritize informative projections, enabling faster convergence in tasks like color correction and diffusion model guidance.
  • Empirical results show ReSWD reduces Wasserstein error by about 15% over MC-SWD, with improved gradient stability and convergence efficiency.

The Reservoir Sliced Wasserstein Distance (ReSWD) estimator is a variance-reduced extension of the Sliced Wasserstein Distance (SWD), designed for robust, unbiased distribution matching in high-dimensional settings. ReSWD integrates Weighted Reservoir Sampling (WRS) into the SWD Monte Carlo pipeline, adaptively prioritizing informative projection directions, thereby achieving more stable gradients and faster convergence. It provides a drop-in replacement for MC-SWD in gradient-based optimization routines, and has demonstrated empirically superior performance in synthetic and real-world tasks such as color correction and diffusion model guidance (Boss et al., 1 Oct 2025).

1. Sliced Wasserstein Distance and High-Variance Limitations

Given two empirical point clouds X={x1,,xNX}X=\{x_1,\dots,x_{N_X}\}, Y={y1,,yNY}RdY=\{y_1,\dots,y_{N_Y}\}\subset\mathbb{R}^d, the true Sliced Wasserstein pp-distance is

Sp(X,Y)=EθU(Sd1)[Wp(πθX,πθY)]S_p(X,Y) = \mathbb{E}_{\theta \sim U(S^{d-1})}\left[ W_p(\pi_\theta X, \pi_\theta Y) \right]

where πθ(x)=θx\pi_\theta(x)=\theta^\top x projects xx onto direction θ\theta. The unbiased Monte Carlo SWD (MC-SWD) estimator approximates this expectation with LL i.i.d. samples {θi}i=1L\{\theta_i\}_{i=1}^L:

S^p(X,Y)=1Li=1LWp(πθiX,πθiY)\widehat{S}_p(X,Y) = \frac{1}{L}\sum_{i=1}^L W_p\left(\pi_{\theta_i} X, \pi_{\theta_i} Y\right)

where each Y={y1,,yNY}RdY=\{y_1,\dots,y_{N_Y}\}\subset\mathbb{R}^d0 term is a 1-dimensional Wasserstein cost, computable in Y={y1,,yNY}RdY=\{y_1,\dots,y_{N_Y}\}\subset\mathbb{R}^d1 via sorting.

In high dimension Y={y1,,yNY}RdY=\{y_1,\dots,y_{N_Y}\}\subset\mathbb{R}^d2, random slices Y={y1,,yNY}RdY=\{y_1,\dots,y_{N_Y}\}\subset\mathbb{R}^d3 encode limited distributional information. This leads to high variance in the MC-SWD estimator, producing noisy gradients and slow convergence in optimization-based distribution matching tasks.

2. Weighted Reservoir Sampling and the ReSWD Principle

Weighted Reservoir Sampling (WRS) is employed to focus on "informative" projections—directions Y={y1,,yNY}RdY=\{y_1,\dots,y_{N_Y}\}\subset\mathbb{R}^d4 where Y={y1,,yNY}RdY=\{y_1,\dots,y_{N_Y}\}\subset\mathbb{R}^d5 is large. These directions produce more stable, higher-magnitude gradients. WRS maintains a fixed-size reservoir of Y={y1,,yNY}RdY=\{y_1,\dots,y_{N_Y}\}\subset\mathbb{R}^d6 directions across steps. At each optimization iteration, Y={y1,,yNY}RdY=\{y_1,\dots,y_{N_Y}\}\subset\mathbb{R}^d7 new candidate directions are drawn, and their associated costs are computed. All Y={y1,,yNY}RdY=\{y_1,\dots,y_{N_Y}\}\subset\mathbb{R}^d8 candidates are then subject to a probabilistic sampling that retains exactly Y={y1,,yNY}RdY=\{y_1,\dots,y_{N_Y}\}\subset\mathbb{R}^d9 directions according to their costs.

This policy preferentially retains influential directions, enabling persistent gradient information and explicit variance reduction, while the reservoir replaces outdated (stale) slices over time. The marginal inclusion probability ensures unbiased Monte Carlo estimation.

3. Formal Definitions and Estimation Algorithm

Monte Carlo and ReSWD Estimators

  • MC-SWD: pp0, pp1.
  • ReSWD Reservoir Update:
    • At iteration pp2, form pool pp3 (previous pp4 + pp5 new directions).
    • For each pp6, compute 1D cost pp7, then sample key pp8, pp9.
    • Retain the Sp(X,Y)=EθU(Sd1)[Wp(πθX,πθY)]S_p(X,Y) = \mathbb{E}_{\theta \sim U(S^{d-1})}\left[ W_p(\pi_\theta X, \pi_\theta Y) \right]0 directions with smallest keys as the new reservoir.
  • Estimator weighting:

Sp(X,Y)=EθU(Sd1)[Wp(πθX,πθY)]S_p(X,Y) = \mathbb{E}_{\theta \sim U(S^{d-1})}\left[ W_p(\pi_\theta X, \pi_\theta Y) \right]1

Sp(X,Y)=EθU(Sd1)[Wp(πθX,πθY)]S_p(X,Y) = \mathbb{E}_{\theta \sim U(S^{d-1})}\left[ W_p(\pi_\theta X, \pi_\theta Y) \right]2

  • ReSWD estimate: Sp(X,Y)=EθU(Sd1)[Wp(πθX,πθY)]S_p(X,Y) = \mathbb{E}_{\theta \sim U(S^{d-1})}\left[ W_p(\pi_\theta X, \pi_\theta Y) \right]3

Unbiasedness follows from the inclusion probability structure and self-normalized importance weights.

Pseudocode Overview

θ\theta8

Reservoir persistence across steps ensures retention of informative, high-variance-reducing directions.

4. Variance Reduction Analysis and Empirical Performance

Empirically, on synthetic 3D Gaussian, uniform, and bimodal distribution benchmarks (1024 samples, 300 steps, 64 projections), ReSWD achieves approximately 15% lower final Wasserstein error than both plain SWD and prior variance reduction baselines such as control variates and quasi-Monte Carlo. The correlation of ReSWD estimates with the true Sp(X,Y)=EθU(Sd1)[Wp(πθX,πθY)]S_p(X,Y) = \mathbb{E}_{\theta \sim U(S^{d-1})}\left[ W_p(\pi_\theta X, \pi_\theta Y) \right]4 distance is consistently high (Pearson Sp(X,Y)=EθU(Sd1)[Wp(πθX,πθY)]S_p(X,Y) = \mathbb{E}_{\theta \sim U(S^{d-1})}\left[ W_p(\pi_\theta X, \pi_\theta Y) \right]5 vs. Sp(X,Y)=EθU(Sd1)[Wp(πθX,πθY)]S_p(X,Y) = \mathbb{E}_{\theta \sim U(S^{d-1})}\left[ W_p(\pi_\theta X, \pi_\theta Y) \right]6 for MC-SWD), reflecting reduced estimator variance.

During optimization, an initial "warm-up" phase (reservoir population) introduces a minor early convergence slowdown but yields superior convergence rates after this phase, typically within ∼140 optimization steps.

In color transfer and diffusion guidance applications, ReSWD reduces gradient standard deviation and produces visually smoother, artifact-free results, compared to baseline methods (Boss et al., 1 Oct 2025).

5. Computational Complexity and Practical Trade-offs

The per-step computation is dominated by sorting Sp(X,Y)=EθU(Sd1)[Wp(πθX,πθY)]S_p(X,Y) = \mathbb{E}_{\theta \sim U(S^{d-1})}\left[ W_p(\pi_\theta X, \pi_\theta Y) \right]7 points in each of Sp(X,Y)=EθU(Sd1)[Wp(πθX,πθY)]S_p(X,Y) = \mathbb{E}_{\theta \sim U(S^{d-1})}\left[ W_p(\pi_\theta X, \pi_\theta Y) \right]8 projections:

Sp(X,Y)=EθU(Sd1)[Wp(πθX,πθY)]S_p(X,Y) = \mathbb{E}_{\theta \sim U(S^{d-1})}\left[ W_p(\pi_\theta X, \pi_\theta Y) \right]9

Additional overheads—key generation, reservoir updates, and effective sample size (ESS) checks—are πθ(x)=θx\pi_\theta(x)=\theta^\top x0. Typical hyperparameter settings (e.g., πθ(x)=θx\pi_\theta(x)=\theta^\top x1, πθ(x)=θx\pi_\theta(x)=\theta^\top x2, total slice budget 64) incur an approximately 10–20% runtime increase compared to MC-SWD but reduce estimation error by 10–20%. Memory overhead remains negligible relative to core data operations.

Setting Mean Error (πθ(x)=θx\pi_\theta(x)=\theta^\top x3/πθ(x)=θx\pi_\theta(x)=\theta^\top x4) Runtime
SWD (64 slice) πθ(x)=θx\pi_\theta(x)=\theta^\top x5 πθ(x)=θx\pi_\theta(x)=\theta^\top x6 ms/step
ReSWD (K=56,M=8) πθ(x)=θx\pi_\theta(x)=\theta^\top x7 πθ(x)=θx\pi_\theta(x)=\theta^\top x8 ms/step
Diffusion SWD πθ(x)=θx\pi_\theta(x)=\theta^\top x9 xx0 s
ReSWD+SD3.5-turbo xx1 xx2 s

6. Empirical Results and Application Domains

  • Synthetic 3D distributions: ReSWD exhibits lower mean Wasserstein error and modest runtime overhead relative to MC-SWD.
  • Color correction (dual-illumination scenes): ReSWD achieves peak PSNR xx3 dB and transform RMSE comparable to, or better than, baseline methods, with efficient runtimes.
  • Diffusion guidance: When guiding SD3.5-turbo using ReSWD, mean xx4 drops to xx5 (from xx6), CLIP-IQA improves (from xx7 to xx8), and runtime is dramatically reduced.

In all tested settings, ReSWD outperforms standard SWD and recent variance-reduction methods in both accuracy and efficiency (Boss et al., 1 Oct 2025).

7. Implementation Practices and Parameter Selection

  • Time decay (xx9): Introducing a decay constant θ\theta0 enables forgetting of stale directions; recommended θ\theta1 steps.
  • ESS threshold (θ\theta2): Resetting the reservoir when effective sample size falls below half the nominal value (θ\theta3) prevents weight collapse.
  • θ\theta4 selection: For fixed slice budget θ\theta5, moderate θ\theta6 and θ\theta7 yield best trade-offs between exploration (new slices) and exploitation (informative retention).
  • Batch optimizations: Amortize cost by using fused GPU sort across all projections in batch mode.
  • Differentiability: Detach weight computations from back-propagation so that gradients are only computed with respect to the projected slice costs.
  • Data space: For vision tasks, projections in perceptual color spaces, such as CIELAB, are preferred for perceptually meaningful distribution matching.
  • Diffusion models: Stop gradient through the U-Net backbone, backpropagating only through the VAE decoder for memory efficiency.

With these operational choices, ReSWD is directly compatible with existing distribution-matching pipelines and delivers substantial variance reduction and convergence acceleration without sacrificing unbiasedness (Boss et al., 1 Oct 2025).

Definition Search Book Streamline Icon: https://streamlinehq.com
References (1)

Topic to Video (Beta)

No one has generated a video about this topic yet.

Whiteboard

No one has generated a whiteboard explanation for this topic yet.

Follow Topic

Get notified by email when new papers are published related to Reservoir SWD (ReSWD) Estimator.