Stream-SW: Streaming Sliced Wasserstein
- Streaming Sliced Wasserstein (Stream-SW) is a method that leverages quantile sketches and randomized projections to compute the sliced Wasserstein distance on streaming data.
- It reduces high-dimensional optimal transport problems to a series of one-dimensional quantile queries, enabling single-pass processing with fixed memory.
- The framework offers theoretical error bounds, improved convergence, and empirical advantages over random subsampling in diverse applications.
Streaming Sliced Wasserstein (Stream-SW) is a computational framework for estimating the sliced Wasserstein (SW) distance between probability distributions when samples arrive in a streaming fashion. It builds on quantile sketching techniques for 1D Wasserstein computation and extends them via randomized projections to provide a memory-efficient, single-pass algorithm for high-dimensional optimal transport problems. Stream-SW offers theoretical guarantees on accuracy and resource consumption, and demonstrates marked advantages over random subsampling approaches in a variety of empirical settings.
1. Streaming 1D-Wasserstein Distance via Quantile Sketches
Sliced Wasserstein methods reduce a -dimensional optimal transport problem to a collection of one-dimensional projection problems. The 1D -Wasserstein distance between empirical measures
admits the closed form
where denotes the quantile function.
In a streaming context, storage of all samples is not feasible. Instead, Stream-SW maintains a quantile sketch of fixed size , supporting approximate quantile queries such that , with the maximal sample gap. The KKL-sketch of Karnin–Lang–Liberty supports one-pass updates with memory.
Given two such sketches, the streaming 1D-Wasserstein estimator is
For , this reduces to an integral over the absolute difference of quantile queries. Sketches are incrementally updated in amortized time per sample.
2. Streaming Sliced Wasserstein Algorithm
The sliced Wasserstein distance of order for -dimensional measures and is
where is the unit sphere and is the projection of onto direction .
Streaming Sliced Wasserstein (Stream-SW) replaces each with from quantile sketches. The algorithm proceeds as follows:
- Select projection directions .
- For each direction and each incoming from 's stream, compute and update . Similarly for .
- At any point, estimate the SW distance by
Stream-SW thereby enables a single-pass, memory-bounded estimate of the SW distance at any time.
3. Theoretical Guarantees and Complexity
Stream-SW provides explicit, nonasymptotic bounds on both memory usage and approximation error:
- Streaming 1DW error: If the supports have diameter and sketch precisions , the error satisfies
- SW population-level error: For i.i.d. samples from , the expected error in SW is
with .
- Monte Carlo error in projections:
- Memory and computational complexity: Each KKL-sketch uses space. With $2L$ sketches and direction storage, total space is ; per-sample update is .
Stream-SW thus achieves error rates with memory and time scalable in and .
4. Proof Outline of Approximation Bounds
The approximation guarantees derive from three elements:
- Quantile approximation: The sketch replaces the exact quantile function; a Taylor or Hölder expansion delivers a pointwise error proportional to the sketch precision and window width ().
- Projection averaging: The error is averaged over random , yielding the same order bound for the SW aggregate.
- Sampling error decomposition: The estimator's discrepancy with population SW separates into (i) sketching error and (ii) statistical sampling error, with the latter analyzed via empirical process (VC) bounds over half-spaces .
- Monte Carlo in : Standard MC variance bound applies for the projection average, yielding behavior.
5. Empirical Evaluation
Stream-SW demonstrates favorable empirical properties across several domains:
| Task | Key Finding | Comparison |
|---|---|---|
| Mixtures of Gaussians | 2×–10× lower error than subsample-SW at same | 10×–100× fewer points retained |
| Point-cloud classification | Stream-SW() achieves 76.3–77.7% vs full SW 77.3–77.7% accuracy; subsample-SW (): 67.7–68.0% | ModelNet10, KNN () |
| Gradient flows | Faster convergence: vs subsample-SW 31.1 at step 1000; only Stream-SW converges in 5000 steps | Euler–Maruyama, 1000 particles |
| Change-point detection | Detection delay reduced to 10–32 frames (SW sliding window: 49–100) | MSRC-12 Kinect |
Stream-SW thus attains higher accuracy or faster convergence at fixed memory compared to uniform random subsampling approaches, particularly under severe memory bottlenecks.
6. Implementation, Tuning, and Extensions
Key practical considerations when deploying Stream-SW include:
- Choosing number of projections and sketch size : Increasing reduces MC error as , whereas increasing strengthens quantile accuracy as . Total memory and per-sample update cost scale linearly with and logarithmically with .
- Projection schemes: Replace standard MC by quasi-MC sequences (e.g., Sobol, Halton) or optimized directions for sphere integration, as in quasi-Monte Carlo for 3D SW.
- Handling asymmetric streams: In scenarios where only one distribution is streaming, maintain the sketch only for the streaming distribution and compare on-the-fly to the fixed other.
- Extensions: The approach adapts to generalized sliced OT, spherical or manifold-projected SW, and partial-SW, by substituting the appropriate 1D streaming OT solver.
In sum, Stream-SW is the first single-pass, low-memory methodology for sliced Wasserstein distance estimation from sample streams, with rigorous finite-sample and memory–error guarantees, and empirically outperforms random subsampling algorithms under tight resource constraints (Nguyen, 11 May 2025).
Sponsored by Paperpile, the PDF & BibTeX manager trusted by top AI labs.
Get 30 days free