NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Closed-Form Analytical Solutions for Efficient Metric Learning

You are reading version 1 of this direction, frozen 2026-10-04. The latest version is version 2.

Version 1 of 237 papers51 conceptsfrozen 2026-10-04

In machine learning, "distance" is rarely a fixed concept. To compare two images or two patients, we must learn a Mahalanobis metric—a transformation matrix $M$ that reshapes the data space so that similar points are pulled together and dissimilar ones are pushed apart.

For years, the standard way to find $M$ was through Semidefinite Programming (SDP) or iterative gradient descent. These methods are computationally expensive, often requiring $O(n^3)$ operations per iteration, and can take hours or days to converge on large datasets. However, a powerful family of research has demonstrated that we can often bypass iterative optimization entirely. By reframing metric learning as a problem of linear algebra, we can "solve" for the optimal distance metric in a single, closed-form step.

From Optimization to Eigenanalysis

The intuition behind many closed-form metrics is a return to classical statistics. In Distance Metric Learning Versus Fisher Discriminant Analysis, Babak Alipanahi and Ali Ghodsi proved that the complex constraints of metric learning could be reformulated as a Generalized Eigenvalue Problem (GEP).

Instead of iteratively searching for a matrix that satisfies pairwise constraints, we can construct two matrices: $S_w$ (within-class covariance) and $S_b$ (between-class covariance). The optimal transformation is simply the set of eigenvectors that maximize the ratio of between-class variance to within-class variance. This approach, also utilized by Steven C. H. Hoi in Discriminative Component Analysis, turns a "learning" task into a "decomposition" task. The result is a massive speedup—reducing processing time by orders of magnitude while maintaining the same accuracy as iterative solvers.

Metric Learning as Regression

Another way to achieve a closed-form solution is to treat metric learning as a regression task. If we know where points should go in an ideal space, we can simply solve for the projection that puts them there.

Marc T. Law and colleagues demonstrated this in Closed-Form Training of Mahalanobis Distance for Supervised Clustering. By relaxing the discrete $k$-means objective into a continuous one, they showed that the optimal Mahalanobis metric can be found using the Moore-Penrose pseudoinverse of the feature matrix.

Similarly, in the context of person re-identification, Jiahuan Zhou and Ying Wu introduced Reference Constraints. Rather than comparing every pair of images ($O(n^2)$ complexity), they mapped images to fixed "reference points." This turns the quadratic comparison problem into a linear regression problem ($O(n)$), allowing for global optimality without the "black magic" of hyperparameter tuning required by gradient-based methods.

The Geometry of the Metric Manifold

A third perspective views the set of all valid distance metrics as a curved surface—a Riemannian manifold of symmetric positive definite matrices.

In Geometric Mean Metric Learning, Pourya Zadeh and Suvrit Sra showed that if you define the objective function using the natural geometry of this manifold, the solution is simply the geodesic midpoint (the geometric mean) between a similarity matrix and a dissimilarity matrix.

Pengfei Zhu extended this logic in Towards Generalized and Efficient Metric Learning on Riemannian Manifold, showing that the optimal transformation can be derived by solving a Riccati equation. This geometric approach ensures the learned metric is always mathematically valid (positive definite) without needing the expensive "projections" back onto the valid space that plague standard algorithms.

Collapsing the Variance: The Null Space Trick

When data is high-dimensional but samples are scarce (the "Small Sample Size" problem), even closed-form regression can struggle. Li Zhang and Shaogang Gong proposed a radical solution in Learning a Discriminative Null Space for Person Re-identification.

The intuition is to find a "null space" where the within-class variance is exactly zero. In this space, every image of the same person collapses into a single point, while different people are kept as far apart as possible. By solving a generalized eigenvalue problem to find this null space, researchers like T. M. Feroz Ali have achieved near-perfect accuracy on challenging benchmarks using only simple, non-iterative algebra.

Why it Works: The Efficiency of Algebra

The shift toward closed-form solutions represents a move from optimization (searching for an answer) to algebra (calculating the answer).

  1. Speed: Methods like MLCA reduce training times from days to seconds.
  2. Stability: Because these solutions are analytical, they don't suffer from local minima or vanishing gradients.
  3. Scalability: By avoiding $O(n^2)$ pairwise comparisons, as seen in the work of Dit-Yan Yeung on Scalable Kernel-Based Algorithms, these metrics can scale to millions of data points where traditional SDP would fail.

By leveraging the underlying structure of the data—whether through its covariance, its regression targets, or its manifold geometry—this research direction has made high-performance distance learning accessible for real-time, large-scale applications.

Papers in this version

History & citationVersion 2 · 2026-10-04

Current · Permanent link

  1. Version 2 (latest) · 2026-10-04 · 41 papers
  2. Version 1 · 2026-10-04 · 37 papers
Cite this direction

Latest version (a living page):

@misc{lacuna_closed_form_metric_optimization_ef6453be,
  title = {closed-form metric optimization},
  author = {{Lacuna}},
  howpublished = {Lacuna research direction},
  year = {2026},
  url = {https://lacuna.tiptreesystems.com/direction/closed-form-metric-optimization/rdr_ef6453be7413424db8c97ff41b28677e},
  note = {Latest version of a living research direction; cite a version for a fixed text. Accessed 2026-11-28},
}

This exact version (version 1, frozen text):

@misc{lacuna_closed_form_analytical_solutions_for_eff_ef6453be_v1,
  title = {Closed-Form Analytical Solutions for Efficient Metric Learning},
  author = {{Lacuna}},
  howpublished = {Lacuna research direction},
  year = {2026},
  url = {https://lacuna.tiptreesystems.com/direction/closed-form-analytical-solutions-for-efficient-metric-learning/rdr_ef6453be7413424db8c97ff41b28677e/v/1},
  note = {Version 1, frozen 2026-10-04. Accessed 2026-11-28},
}