← Back to Blog

The Weird Geometry of High-Dimensional Representations: Why Your ML Models Behave Differently

#Machine Learning#Geometry#Mathematics#Vector Spaces

By Chima Emmanuel & Angel Ezeahurukwe
Reading Time: 12 minutes

πŸ“„ Download Full PDF Version


1. Introduction

When students first learn Euclidean geometry, they learn that space is isotropic: all directions are equivalent, and distance is a reliable indicator of similarity. This intuition applies faithfully in 2D or 3D.

But modern machine learning models operate in a very different regime. Word embeddings live in 300 dimensions. Transformer hidden states inhabit spaces of dimension 1024. Image features reside in spaces of 2048 or more.

In these hyper-spaces, geometric intuition becomes not merely imprecise but actively misleading. The culprit is concentration of measure. Loosely, in high dimensions, a smooth function of many independent random variables is very close to its mean with overwhelmingly high probability. This has dramatic consequences: norms concentrate, angles shrink toward 90 degrees, and inter-point distances become approximately equal.


2. The Toolbox: Sub-Gaussianity

To understand these results rigorously, we look at sub-Gaussian distributions. This class includes Gaussian, Rademacher (Β±1\pm 1), and any bounded random variable.

Isotropic Vectors

A random vector X∈Rd\mathbf{X} \in \mathbb{R}^d is called isotropic if:

Key Inequality: Bernstein’s

Our proofs rest on Bernstein's Inequality. It tells us that for independent sub-exponential variables (like the squares of sub-Gaussian variables): P(βˆ£βˆ‘iZi/dβˆ’E[Z1]∣β‰₯t)≀2exp⁑(βˆ’cdt2/K4)P\left(\left|\sum_i Z_i / d - E[Z_1]\right| \ge t\right) \le 2 \exp(-c d t^2 / K^4) Essentially, as dimension dd grows, the probability of the sum deviating from the mean drops exponentially.


3. Norm Concentration: Vectors Live on a "Thin Shell"

In 2D, a point can be anywhere in a circle. But what happens as dd grows?

Consider βˆ₯Xβˆ₯2=X12+β‹―+Xd2\|\mathbf{X}\|^2 = X_1^2 + \dots + X_d^2. By the law of large numbers, βˆ₯Xβˆ₯2/dβ†’1\|\mathbf{X}\|^2/d \to 1. Because of concentration, the fluctuations around this limit are tiny.

Theorem 3.1: Virtually all the probability mass of a high-dimensional distribution lies within a "thin shell" of radius d\sqrt{d} and width O(1)O(1).

The Intuition: As dd increases, the volume of a ball is concentrated almost entirely in a thin layer near the surface. Vectors aren't "inside" the space; they are all clinging to the edge.


4. Distance Concentration: All Points are Equally Far

If individual norms concentrate, what about the distance between two independent points X\mathbf{X} and Y\mathbf{Y}?

Through the same concentration logic, we find that: βˆ₯Xβˆ’Yβˆ₯β‰ˆ2d\|\mathbf{X} - \mathbf{Y}\| \approx \sqrt{2d}

The Consequence: In high-dimensional representation spaces, any two randomly drawn vectors will be approximately the same distance apart. There are no "close" neighbors and no "far" neighborsβ€”just a single typical distance.


5. Asymptotic Orthogonality

In 2D, two random vectors can have any angle. In high dimensions, all pairs are nearly perpendicular.

Consider the cosine similarity: cos(ΞΈ)=⟨X,Y⟩βˆ₯Xβˆ₯βˆ₯Yβˆ₯\text{cos}(\theta) = \frac{\langle \mathbf{X}, \mathbf{Y} \rangle}{\|\mathbf{X}\| \|\mathbf{Y}\|}

  1. The dot product ⟨X,Y⟩\langle \mathbf{X}, \mathbf{Y} \rangle has a typical magnitude of d\sqrt{d}.
  2. The norm product βˆ₯Xβˆ₯βˆ₯Yβˆ₯\|\mathbf{X}\| \|\mathbf{Y}\| is approximately dd.
  3. Therefore, cos(ΞΈ)β‰ˆd/d=1/d\text{cos}(\theta) \approx \sqrt{d}/d = 1/\sqrt{d}, which goes to zero as dβ†’βˆžd \to \infty.

Key Takeaway: Random vectors in high dimensions are nearly orthogonal. This is exploited in random projections and compressed sensing.


6. Metric Degeneracy: The Collapse of Contrast

This is the most critical result for ML practitioners. We define Metric Degeneracy as the loss of discriminative power in distance metrics.

As dd grows, the relative difference between the farthest and nearest neighbor vanishes: max⁑Diβˆ’min⁑Dimin⁑Diβ†’P0\frac{\max D_i - \min D_i}{\min D_i} \xrightarrow{P} 0

If your "nearest" neighbor is 9.9 units away and your "farthest" is 10.1 units away, the distinction between them is essentially noise.


7. Failure Modes in Machine Learning

1. Breakdown of Nearest-Neighbour Methods

For d=1000d = 1000, all data points are within ~3% of the same distance from any query. In this regime, kk-NN becomes unreliable and computationally expensive for very little gain.

2. Degeneration of RBF Kernels

The RBF kernel K(x,y)=exp⁑(βˆ’Ξ³βˆ₯xβˆ’yβˆ₯2)K(x, y) = \exp(-\gamma \|x - y\|^2) becomes a constant (0 or 1) in high dimensions unless the bandwidth Ξ³\gamma is perfectly scaled as 1/d1/d.

3. Temperature Scaling in Contrastive Learning

In Contrastive Loss (like SimCLR), cosine similarities are naturally tiny (1/d1/\sqrt{d}). We use a temperature parameter Ο„\tau to rescale these similarities, effectively "zooming in" on the differences so the model can receive a gradient signal.

4. The Hubness Phenomenon

High-dimensional datasets often contain "hubs"β€”points that are the "nearest neighbor" for a disproportionately large number of other points. This is a direct result of the geometry of the thin shell.


8. Design Principles for Practitioners

How do we navigate this "cursed" geometry?

  1. β„“2\ell_2 Normalization: Always normalize your representations. Projecting onto the unit sphere removes the norm-concentration degree of freedom.
  2. Cosine Similarity: In high-D, focus on angles rather than absolute Euclidean distances.
  3. Dimensionality Reduction: Use techniques like PCA or UMAP. Most real-world data lives on a low-dimensional manifold; reducing dd restores the power of distance metrics.
  4. Scale Bandwidths: If using kernels or temperatures, ensure they scale inversely with the dimension (1/d1/d or 1/d1/\sqrt{d}).

9. Conclusion

High-dimensional spaces are governed by the concentration of measure, imposing a rigid structure: same norms, same distances, and perpendicular angles. Understanding this "metric degeneracy" is the first step toward building more robust and scalable AI systems.


References


If you enjoyed this deep dive, consider sharing it with your fellow researchers!