Papers
Topics
Authors
Recent
Search
2000 character limit reached

Stream-SW: Streaming Sliced Wasserstein

Updated 14 November 2025
  • 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 dd-dimensional optimal transport problem to a collection of one-dimensional projection problems. The 1D pp-Wasserstein distance between empirical measures

μn=1n∑i=1nδxi,νm=1m∑j=1mδyj\mu_n = \frac{1}{n}\sum_{i=1}^n \delta_{x_i}, \quad \nu_m = \frac{1}{m}\sum_{j=1}^m \delta_{y_j}

admits the closed form

Wpp(μn,νm)=∫01∣Fμn−1(q)−Fνm−1(q)∣p dq,W_p^p(\mu_n, \nu_m) = \int_0^1 |F^{-1}_{\mu_n}(q) - F^{-1}_{\nu_m}(q)|^p\, dq,

where Fμn−1F^{-1}_{\mu_n} denotes the quantile function.

In a streaming context, storage of all samples is not feasible. Instead, Stream-SW maintains a quantile sketch Sμn,kS_{\mu_n,k} of fixed size kk, supporting approximate quantile queries Q(q;S)Q(q; S) such that ∣Q(q;S)−Fμ^−1(q)∣≤ϵnC|Q(q; S)-F^{-1}_{\hat\mu}(q)| \le \epsilon n C, with CC the maximal sample gap. The KKL-sketch of Karnin–Lang–Liberty supports one-pass updates with pp0 memory.

Given two such sketches, the streaming 1D-Wasserstein estimator is

pp1

For pp2, this reduces to an integral over the absolute difference of quantile queries. Sketches are incrementally updated in pp3 amortized time per sample.

2. Streaming Sliced Wasserstein Algorithm

The sliced Wasserstein distance of order pp4 for pp5-dimensional measures pp6 and pp7 is

pp8

where pp9 is the unit sphere and μn=1n∑i=1nδxi,νm=1m∑j=1mδyj\mu_n = \frac{1}{n}\sum_{i=1}^n \delta_{x_i}, \quad \nu_m = \frac{1}{m}\sum_{j=1}^m \delta_{y_j}0 is the projection of μn=1n∑i=1nδxi,νm=1m∑j=1mδyj\mu_n = \frac{1}{n}\sum_{i=1}^n \delta_{x_i}, \quad \nu_m = \frac{1}{m}\sum_{j=1}^m \delta_{y_j}1 onto direction μn=1n∑i=1nδxi,νm=1m∑j=1mδyj\mu_n = \frac{1}{n}\sum_{i=1}^n \delta_{x_i}, \quad \nu_m = \frac{1}{m}\sum_{j=1}^m \delta_{y_j}2.

Streaming Sliced Wasserstein (Stream-SW) replaces each μn=1n∑i=1nδxi,νm=1m∑j=1mδyj\mu_n = \frac{1}{n}\sum_{i=1}^n \delta_{x_i}, \quad \nu_m = \frac{1}{m}\sum_{j=1}^m \delta_{y_j}3 with μn=1n∑i=1nδxi,νm=1m∑j=1mδyj\mu_n = \frac{1}{n}\sum_{i=1}^n \delta_{x_i}, \quad \nu_m = \frac{1}{m}\sum_{j=1}^m \delta_{y_j}4 from quantile sketches. The algorithm proceeds as follows:

  • Select μn=1n∑i=1nδxi,νm=1m∑j=1mδyj\mu_n = \frac{1}{n}\sum_{i=1}^n \delta_{x_i}, \quad \nu_m = \frac{1}{m}\sum_{j=1}^m \delta_{y_j}5 projection directions μn=1n∑i=1nδxi,νm=1m∑j=1mδyj\mu_n = \frac{1}{n}\sum_{i=1}^n \delta_{x_i}, \quad \nu_m = \frac{1}{m}\sum_{j=1}^m \delta_{y_j}6.
  • For each direction μn=1n∑i=1nδxi,νm=1m∑j=1mδyj\mu_n = \frac{1}{n}\sum_{i=1}^n \delta_{x_i}, \quad \nu_m = \frac{1}{m}\sum_{j=1}^m \delta_{y_j}7 and each incoming μn=1n∑i=1nδxi,νm=1m∑j=1mδyj\mu_n = \frac{1}{n}\sum_{i=1}^n \delta_{x_i}, \quad \nu_m = \frac{1}{m}\sum_{j=1}^m \delta_{y_j}8 from μn=1n∑i=1nδxi,νm=1m∑j=1mδyj\mu_n = \frac{1}{n}\sum_{i=1}^n \delta_{x_i}, \quad \nu_m = \frac{1}{m}\sum_{j=1}^m \delta_{y_j}9's stream, compute Wpp(μn,νm)=∫01∣Fμn−1(q)−Fνm−1(q)∣p dq,W_p^p(\mu_n, \nu_m) = \int_0^1 |F^{-1}_{\mu_n}(q) - F^{-1}_{\nu_m}(q)|^p\, dq,0 and update Wpp(μn,νm)=∫01∣Fμn−1(q)−Fνm−1(q)∣p dq,W_p^p(\mu_n, \nu_m) = \int_0^1 |F^{-1}_{\mu_n}(q) - F^{-1}_{\nu_m}(q)|^p\, dq,1. Similarly for Wpp(μn,νm)=∫01∣Fμn−1(q)−Fνm−1(q)∣p dq,W_p^p(\mu_n, \nu_m) = \int_0^1 |F^{-1}_{\mu_n}(q) - F^{-1}_{\nu_m}(q)|^p\, dq,2.
  • At any point, estimate the SW distance by

Wpp(μn,νm)=∫01∣Fμn−1(q)−Fνm−1(q)∣p dq,W_p^p(\mu_n, \nu_m) = \int_0^1 |F^{-1}_{\mu_n}(q) - F^{-1}_{\nu_m}(q)|^p\, dq,3

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 Wpp(μn,νm)=∫01∣Fμn−1(q)−Fνm−1(q)∣p dq,W_p^p(\mu_n, \nu_m) = \int_0^1 |F^{-1}_{\mu_n}(q) - F^{-1}_{\nu_m}(q)|^p\, dq,4 and sketch precisions Wpp(μn,νm)=∫01∣Fμn−1(q)−Fνm−1(q)∣p dq,W_p^p(\mu_n, \nu_m) = \int_0^1 |F^{-1}_{\mu_n}(q) - F^{-1}_{\nu_m}(q)|^p\, dq,5, the error satisfies

Wpp(μn,νm)=∫01∣Fμn−1(q)−Fνm−1(q)∣p dq,W_p^p(\mu_n, \nu_m) = \int_0^1 |F^{-1}_{\mu_n}(q) - F^{-1}_{\nu_m}(q)|^p\, dq,6

  • SW population-level error: For i.i.d. samples from Wpp(μn,νm)=∫01∣Fμn−1(q)−Fνm−1(q)∣p dq,W_p^p(\mu_n, \nu_m) = \int_0^1 |F^{-1}_{\mu_n}(q) - F^{-1}_{\nu_m}(q)|^p\, dq,7, the expected error in SW is

Wpp(μn,νm)=∫01∣Fμn−1(q)−Fνm−1(q)∣p dq,W_p^p(\mu_n, \nu_m) = \int_0^1 |F^{-1}_{\mu_n}(q) - F^{-1}_{\nu_m}(q)|^p\, dq,8

with Wpp(μn,νm)=∫01∣Fμn−1(q)−Fνm−1(q)∣p dq,W_p^p(\mu_n, \nu_m) = \int_0^1 |F^{-1}_{\mu_n}(q) - F^{-1}_{\nu_m}(q)|^p\, dq,9.

  • Monte Carlo error in Fμn−1F^{-1}_{\mu_n}0 projections:

Fμn−1F^{-1}_{\mu_n}1

  • Memory and computational complexity: Each KKL-sketch uses Fμn−1F^{-1}_{\mu_n}2 space. With Fμn−1F^{-1}_{\mu_n}3 sketches and direction storage, total space is Fμn−1F^{-1}_{\mu_n}4; per-sample update is Fμn−1F^{-1}_{\mu_n}5.

Stream-SW thus achieves Fμn−1F^{-1}_{\mu_n}6 error rates with memory and time scalable in Fμn−1F^{-1}_{\mu_n}7 and Fμn−1F^{-1}_{\mu_n}8.

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 (Fμn−1F^{-1}_{\mu_n}9).
  • Projection averaging: The error is averaged over random Sμn,kS_{\mu_n,k}0, 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 Sμn,kS_{\mu_n,k}1.
  • Monte Carlo in Sμn,kS_{\mu_n,k}2: Standard MC variance bound applies for the projection average, yielding Sμn,kS_{\mu_n,k}3 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 Sμn,kS_{\mu_n,k}4 10×–100× fewer points retained
Point-cloud classification Stream-SW(Sμn,kS_{\mu_n,k}5) achieves 76.3–77.7% vs full SW 77.3–77.7% accuracy; subsample-SW (Sμn,kS_{\mu_n,k}6): 67.7–68.0% ModelNet10, KNN (Sμn,kS_{\mu_n,k}7)
Gradient flows Faster convergence: Sμn,kS_{\mu_n,k}8 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 Sμn,kS_{\mu_n,k}9 and sketch size kk0: Increasing kk1 reduces MC error as kk2, whereas increasing kk3 strengthens quantile accuracy as kk4. Total memory and per-sample update cost scale linearly with kk5 and logarithmically with kk6.
  • 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).

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 Streaming Sliced Wasserstein (Stream-SW).