Minimum-Distortion Embedding

Akshay Agrawal, Alnur Ali, Stephen P. BoydFound. Trends Mach. Learn 2021

Introduction

Vector embeddings are fundamental to modern machine learning and data science, serving as the backbone for dimensionality reduction, data visualization, and feature engineering. Over the decades, a variety of specialized algorithms have emerged—ranging from classical techniques like Principal Component Analysis (PCA) and Multidimensional Scaling (MDS) to modern non-linear methods like t-SNE and UMAP. However, these methods are often treated as isolated algorithms with distinct mathematical foundations and custom implementations. This fragmentation complicates the process of comparing methods, adapting them to specific constraints, or developing new embedding techniques.

This paper introduces Minimum-Distortion Embedding (MDE), a unifying mathematical framework that generalizes these disparate methods. By framing embedding as a formal optimization problem, MDE provides a principled approach to designing, computing, and validating custom embeddings. Alongside the framework, the authors provide PyMDE, a high-performance, GPU-accelerated Python library that makes these theoretical advances accessible for large-scale applications.

The MDE Framework

The core philosophy of MDE is to assign a vector to each item in a dataset such that the Euclidean distances between these vectors reflect prior knowledge regarding the items' similarities or dissimilarities. The framework is defined by two primary components:

1. Distortion Functions

Users define distortion functions for pairs of items. These typically fall into two categories:

  • Attractive Penalties: These pull similar items together. Common choices include quadratic, Huber, or log-one-plus functions.
  • Repulsive Penalties: These push dissimilar items apart, often utilizing logarithmic barriers to prevent points from overlapping.

2. Constraints

To ensure the embedding is well-defined and does not collapse into a single point or expand infinitely, MDE incorporates constraints. A central feature is the standardization constraint, which requires the embedding vectors to have a zero mean and identity covariance. This ensures that the resulting embeddings are uncorrelated and appropriately spread across the embedding space.

Optimization and Scalability

Because MDE problems are generally non-convex, the authors developed a specialized projected quasi-Newton method (L-BFGS) to find high-quality local optima. For massive datasets that exceed memory limits, they introduce a stochastic proximal algorithm capable of operating on large data batches.

To facilitate the use of these algorithms, the authors released PyMDE. Built on PyTorch, the library supports automatic differentiation—allowing users to define custom distortion functions without manually deriving gradients—and leverages GPU acceleration for significant speedups.

Key Insights and Applications

A Grand Unification

The MDE framework demonstrates that many classic algorithms are simply specific instances of the MDE problem. For example, PCA, Spectral Embedding, Isomap, and classical MDS are mathematically equivalent to solving a quadratic MDE problem under specific weighting schemes. This unification allows researchers to view embedding through a single lens, separating the definition of the embedding (the distortion function) from the algorithm used to compute it.

Robustness and Fairness

MDE offers practical advantages in data cleaning and auditing. By replacing standard quadratic penalties with robust penalties (such as the Huber loss), MDE can effectively ignore noisy outliers. In population genetics tests, robust MDE successfully reconstructed geographic maps from genetic data even when the dataset was intentionally corrupted—a scenario where standard PCA typically fails.

Furthermore, MDE provides a rigorous mathematical basis for auditing embeddings for bias. By comparing average distortion across different demographic groups, researchers can quantitatively measure whether an embedding is more faithful to one group than another, providing a path toward more equitable data representations.

Experimental Results

The authors evaluated MDE across diverse datasets, including MNIST handwritten digits, Google Scholar co-authorship networks (approx. 590,000 authors), and single-cell mRNA transcriptomes. Key findings include:

  • Extreme Scalability: On a standard GPU, PyMDE solved a quadratic MDE problem involving 1 million items and 10 million edges in just 4 seconds.
  • Competitive Performance: Despite being a generalized solver, PyMDE matches or exceeds the speed of specialized implementations. A non-linear embedding of MNIST took approximately 6 seconds on a GPU.
  • Visual Quality: The framework produced high-quality visualizations that clearly clustered related items, such as distinguishing COVID-19 infected cells from healthy controls, matching the visual clarity of specialized tools like t-SNE.

Limitations and Future Work

While powerful, MDE is subject to the inherent challenges of non-convex optimization. The algorithm is not guaranteed to find a global optimum, making initialization a critical step. Additionally, the quality of the embedding remains dependent on the initial similarity graph construction (e.g., k-nearest neighbors), which remains an empirical process.

Future research directions include extending the local optimization methods to non-Euclidean spaces, such as hyperbolic space, which may offer superior performance for representing hierarchical data structures.

Summary updated

BibTeX
@article{agrawal2021minimum,
  author = {Akshay Agrawal and Alnur Ali and Stephen P. Boyd},
  title = {{Minimum-Distortion Embedding}},
  journal = {Found. Trends Mach. Learn.},
  year = {2021},
  doi = {10.1561/2200000090},
}
Figure