ReSWD: Reservoir Sliced Wasserstein Estimator
- 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 , , the true Sliced Wasserstein -distance is
where projects onto direction . The unbiased Monte Carlo SWD (MC-SWD) estimator approximates this expectation with i.i.d. samples :
where each 0 term is a 1-dimensional Wasserstein cost, computable in 1 via sorting.
In high dimension 2, random slices 3 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 4 where 5 is large. These directions produce more stable, higher-magnitude gradients. WRS maintains a fixed-size reservoir of 6 directions across steps. At each optimization iteration, 7 new candidate directions are drawn, and their associated costs are computed. All 8 candidates are then subject to a probabilistic sampling that retains exactly 9 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: 0, 1.
- ReSWD Reservoir Update:
- At iteration 2, form pool 3 (previous 4 + 5 new directions).
- For each 6, compute 1D cost 7, then sample key 8, 9.
- Retain the 0 directions with smallest keys as the new reservoir.
- Estimator weighting:
1
2
- ReSWD estimate: 3
Unbiasedness follows from the inclusion probability structure and self-normalized importance weights.
Pseudocode Overview
8
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 4 distance is consistently high (Pearson 5 vs. 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 7 points in each of 8 projections:
9
Additional overheads—key generation, reservoir updates, and effective sample size (ESS) checks—are 0. Typical hyperparameter settings (e.g., 1, 2, 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 (3/4) | Runtime |
|---|---|---|
| SWD (64 slice) | 5 | 6 ms/step |
| ReSWD (K=56,M=8) | 7 | 8 ms/step |
| Diffusion SWD | 9 | 0 s |
| ReSWD+SD3.5-turbo | 1 | 2 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 3 dB and transform RMSE comparable to, or better than, baseline methods, with efficient runtimes.
- Diffusion guidance: When guiding SD3.5-turbo using ReSWD, mean 4 drops to 5 (from 6), CLIP-IQA improves (from 7 to 8), 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 (9): Introducing a decay constant 0 enables forgetting of stale directions; recommended 1 steps.
- ESS threshold (2): Resetting the reservoir when effective sample size falls below half the nominal value (3) prevents weight collapse.
- 4 selection: For fixed slice budget 5, moderate 6 and 7 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).