---
title: Energy-Based Sliced Wasserstein (EBSW)
url: https://www.emergentmind.com/topics/energy-based-sliced-wasserstein-ebsw
type: topic
---

# Energy-Based Sliced Wasserstein (EBSW)

The Energy-Based Sliced Wasserstein (EBSW) distance is a statistically robust and computationally efficient metric for comparing probability measures, extending the classical Sliced Wasserstein (SW) approach by leveraging an adaptive, parameter-free slicing distribution based on an energy function of the projected Wasserstein distance. By up-weighting projection directions that are most discriminative between measures, EBSW emphasizes informative slices and mitigates the limitations of both uniform and parametric slicing distributions. This formulation preserves the computational advantages of SW while improving statistical signal and sample efficiency across a variety of tasks [2304.13586].

## 1. Definition and Motivation

Given probability measures $\mu, \nu \in \mathcal{P}_p(\mathbb{R}^d)$, the classical $p$-th Sliced Wasserstein distance is:
$$
SW_p(\mu, \nu) = \left[ \mathbb{E}_{\theta \sim \text{Uniform}(\mathbb{S}^{d-1})} W_p^p(\theta_\#\mu, \theta_\#\nu) \right]^{1/p}
$$
where $\theta_\#\mu$ denotes the push-forward of $\mu$ by the linear projection $x \mapsto \theta^\top x$, and $W_p$ is the 1D Wasserstein distance.

EBSW generalizes this framework by replacing the uniform distribution over projection directions $\theta$ with an energy-based density
$$
\sigma_{\mu, \nu}(\theta; f, p) \propto f(W_p^p(\theta_\#\mu, \theta_\#\nu))
$$
with $f\!:\! [0, \infty)\!\to\! (0,\infty)$ typically monotonic (e.g., $f(x)\!=\!e^{\psi(x)}$ for increasing $\psi$ or $f(x)\!=\!x^q\!+\!\varepsilon$).

The EBSW metric is then defined as
$$
EBSW_p(\mu, \nu; f) = \left[ \mathbb{E}_{\theta \sim \sigma_{\mu, \nu}( \cdot ; f, p ) } W_p^p(\theta_\#\mu, \theta_\#\nu) \right]^{1/p}
$$
This reweighting causes sampling to concentrate on projections where the differences between $\mu$ and $\nu$ are most pronounced, thus accentuating statistically informative dimensions and providing higher signal-to-noise ratios for tasks such as gradient flow or generative modeling.

## 2. Theoretical Properties

EBSW retains the core mathematical properties expected of a metric-like divergence for probability measures:

- **Semi-metricity:** For every $p \geq 1$ and any strictly positive energy $f$, EBSW satisfies:
  - Non-negativity: $EBSW_p(\mu, \nu; f) \geq 0$,
  - Symmetry: $EBSW_p(\mu, \nu; f) = EBSW_p(\nu, \mu; f)$,
  - Identity of indiscernibles: $EBSW_p(\mu, \nu; f) = 0$ if and only if $\mu = \nu$.

- **Relations to SW, Max-SW, and $W_p$:** If $f$ is non-decreasing,
  $SW_p(\mu, \nu) \leq EBSW_p(\mu, \nu; f)$, with equality for constant $f$.
  For any $f > 0$, $EBSW_p(\mu, \nu; f) \leq \text{Max-SW}_p(\mu, \nu) \leq W_p(\mu, \nu)$.

- **Topology:** The topology induced by $EBSW_p(\cdot, \cdot; f)$ is equivalent to weak convergence plus convergence of $p$-th moments, matching the topology induced by the Wasserstein metric.

- **Sample Complexity:** For empirical measures $\mu_n = \frac{1}{n}\sum_{i=1}^n \delta_{X_i}$ with $X_i$ i.i.d. in a compact set, there exists $C>0$ such that
$$
\mathbb{E}\left[ EBSW_p(\mu_n, \mu; f) \right] \leq C \sqrt{ \frac{(d+1)\log n}{n} }
$$
This mirrors the $O(n^{-1/2})$ sample complexity of SW, avoiding the curse of dimensionality (up to logarithmic factors).

## 3. Monte Carlo Algorithms for EBSW Computation

For discrete measures supported on at most $n$ atoms, the computation of 1D Wasserstein distances costs $O(n\log n)$. EBSW admits several efficient Monte Carlo estimators:

- **Importance Sampling (IS):** Draw $L$ i.i.d. $\theta_\ell \sim \sigma_0$ (e.g., uniform on $\mathbb{S}^{d-1}$). Compute weights $u_\ell = f(v_\ell^p)/\sigma_0(\theta_\ell)$, where $v_\ell = W_p(\theta_\ell\#\mu, \theta_\ell\#\nu)$. Normalize and form the $EBSW$ estimator:
  $$
  \widehat{EBSW}_p(\mu, \nu; f)
  = \left( \sum_{\ell=1}^L w_\ell v_\ell^p \right)^{1/p}
  $$
  where $w_\ell = u_\ell / \sum_{i=1}^L u_i$.

- **Sampling-Importance-Resampling (SIR):** After IS on $L$ projections, resample $\theta_\ell$ according to the normalized weights and output the average of the corresponding $W_p^p$ values.

- **Markov Chain Monte Carlo (MCMC):**
  - Independent MH uses a uniform proposal over $\mathbb{S}^{d-1}$.
  - Random-Walk MH employs a von Mises–Fisher proposal $q(\theta'|\theta)$ with specified concentration. Both achieve $O(n \log n)$ per step.

These approaches offer asymptotically unbiased estimators for $EBSW_p^p$ as $L \to \infty$. Overall complexity is $O(L n \log n)$ for $L$ projections.

## 4. Comparative Analysis of Slicing Strategies

Distinct approaches for selecting the slicing distribution yield different computational–statistical tradeoffs:

| Approach              | Slicing Distribution   | Informative Directions | Computational Cost     |
|-----------------------|-----------------------|-----------------------|-----------------------|
| Classical SW          | Uniform on $\mathbb{S}^{d-1}$ | No                    | $O(L n \log n)$       |
| Parametric optimizer  | Optimized parametric family   | Yes, but limited by parametric family | Often expensive, unstable |
| Energy-based (EBSW)   | $\propto f(W_p^p(\theta_\#\mu, \theta_\#\nu))$ | Yes (data-driven, nonparametric) | $O(L n \log n)$           |

EBSW uniquely provides a parameter-free, nonparametric adaptation in slicing, focusing computation on directions with the largest observed projected divergences. This yields robustness to misspecification that can hinder parametric approaches and maintains efficiency comparable to classical SW.

## 5. Empirical Evaluation

All reported experiments use $p=2$.

- **Point-Cloud Gradient Flows:** For driving $\mu(t)$ to a fixed $\nu$ using the Euler discretization of gradient flow, IS-EBSW$_2$ with $L=100$ achieves the fastest convergence in $W_2$, outperforming SW$_2$, Max-SW$_2$, and v-DSW$_2$ within comparable runtime constraints.

- **Color Transfer:** Modeling images as empirical RGB distributions, IS-EBSW$_2$ generates transfers that most closely approximate target colors in $W_2$ while incurring computational cost nearly equal to SW$_2$.

- **Deep Point-Cloud Reconstruction:** Training a point-cloud autoencoder with IS-EBSW$_2$ as the reconstruction loss yields lower slice-$W_2$ and true $W_2$ errors compared to SW$_2$, Max-SW$_2$, and v-DSW$_2$ across epochs on held-out ModelNet40. Resulting reconstructions possess increased sharpness and fidelity.

  | Method      | Epoch 20 (SW$_2$, $W_2$ ×100) | Epoch 100 (SW$_2$, $W_2$ ×100) | Epoch 200 (SW$_2$, $W_2$ ×100) |
  |-------------|-------------------------------|-------------------------------|-------------------------------|
  | SW$_2$      | 2.97, 12.67                   | 2.29, 10.63                   | 2.15, 9.97                    |
  | Max-SW$_2$  | 2.91, 12.33                   | 2.24, 10.40                   | 2.14, 9.84                    |
  | v-DSW$_2$   | 2.84, 12.64                   | 2.21, 10.52                   | 2.07, 9.81                    |
  | IS-EBSW$_2$ | **2.68, 11.90**               | **2.18, 10.27**               | **2.04, 9.69**                |

Qualitative assessment indicates EBSW consistently produces smoother trajectories and reconstructions relative to comparator methods.

## 6. Practical Implications and Availability

EBSW generalizes SW by replacing uniform slicing with an energy-based density proportional to a strictly positive function of 1D Wasserstein projections. This maintains $O(n\log n)$ per slice computational complexity and introduces greater adaptability by focusing on the most discriminative projections.

Monte Carlo estimators—via importance sampling, SIR, or MCMC—are readily implementable. IS-EBSW$_2$ empirically achieves lower reconstruction and transport errors compared with baseline SW variants, at only a minor increase in computational overhead. All supporting code and data are available at https://github.com/khainb/EBSW [2304.13586].

Source: https://www.emergentmind.com/topics/energy-based-sliced-wasserstein-ebsw