---
title: Geometric Alignment Score (GAS)
url: https://www.emergentmind.com/topics/geometric-alignment-score-gas
type: topic
---

# Geometric Alignment Score (GAS)

The Geometric Alignment Score (GAS), also known as the Geometry Score, is a quantitative and qualitative metric for comparing generative models, specifically Generative Adversarial Networks (GANs), via the topological properties of the data manifolds they generate. GAS evaluates the degree to which the model-generated sample manifold matches the topological “shape” of the manifold underlying real data, providing a distinctive perspective compared to conventional GAN evaluation metrics centered on perceptual similarity or feature distributions. This framework is grounded in computational algebraic topology and is applicable to datasets of arbitrary nature, including non-image domains [1802.02664].

## 1. Manifold Hypothesis and Topological Motivation

In generative modeling, the manifold hypothesis posits that real-world data, such as natural images, resides on a low-dimensional, nonlinear submanifold $\mathcal M_{\mathrm{data}}\subset \mathbb R^D$ within high-dimensional ambient space. A GAN generator induces its own model manifold $\mathcal M_{\mathrm{model}}$. Traditional metrics, including Inception Score and Fréchet Inception Distance, are contingent on neural network feature extractors and Gaussian approximations, thereby rendering them insensitive to certain structural pathologies such as mode collapse or local geometric distortions.

Topology is uniquely robust to smooth deformations—meaning connected components, loops, and higher-dimensional “holes” persist under continuous transformations—making GAS an invariant measure for comparing real and generated data distributions by their intrinsic shape characteristics. The objective is to detect topological defects introduced by model failures, complementing existing metrics by identifying qualitative discrepancies missed by network-based or distributional comparisons.

## 2. Mathematical Framework

GAS draws upon four constructs from computational topology: simplicial complexes, the Vietoris–Rips filtration, Betti numbers, and persistent homology.

- **Simplicial Complexes:** Given a finite vertex set $Z = \{z_1, \dots, z_n\}$, an abstract simplicial complex $\mathcal S$ is a collection $\Sigma$ of subsets of $Z$ that includes every subset of each simplex and every singleton $\{z_i\}$.

- **Vietoris–Rips Filtration:** For metric space $(X, d)$ and scale parameter $\varepsilon \geq 0$, $R_\varepsilon(X) = \{\sigma \subset X : d(x, x’) \leq \varepsilon \;\forall x, x’ \in \sigma\}$ forms nested complexes as $\varepsilon$ increases, yielding a filtration.

- **Betti Numbers:** The $k$-th Betti number $\beta_k(\mathcal S) = \dim H_k(\mathcal S)$ quantifies the number of independent $k$-dimensional holes ($\beta_0$: connected components; $\beta_1$: loops).

- **Persistent Homology:** As $\varepsilon$ varies, holes “appear” (birth $b_i$) and “disappear” (death $d_i$), forming intervals $\mathcal I_k = \{[b_i, d_i]\}_{i=1}^N$. The Betti curve $\beta_k(\varepsilon)$ counts active $k$-dimensional features at scale $\varepsilon$.

## 3. Derivation and Construction of GAS

The metric construction focuses on $k=1$ (loops). The sequence of steps is as follows:

- **Betti Curves and Relative Living Time (RLT):** The instantaneous Betti-1 count is $\beta_1(\varepsilon)$. For integer $j \geq 0$,
  $$
  \mathrm{RLT}(j; X) = \frac{
    \text{Lebesgue}\{\varepsilon \in [0, \varepsilon_{\max}]: \beta_1(\varepsilon) = j\}
  }{\varepsilon_{\max}}
  $$
  computes the proportion of scale $\varepsilon$ where the complex sustains exactly $j$ loops.

- **Witness Complex and Mean RLT (MRLT):** For scalable computation, a small random subset of $L_0$ landmarks is selected uniformly from $X$ to build a witness complex. Repeating $N_{\mathrm{trials}}$ draws yields
  $$
  p_X(j) \triangleq \mathbb{E}_{L}\big[\mathrm{RLT}(j; X, L)\big]
  $$
  and $p_X = \{p_X(j)\}_{j=0}^{j_{\max}}$ is a probability distribution over loop counts.

- **Geometry Score Computation:** Given two datasets (real $X_1$, generated $X_2$), compare their MRLTs using squared $L_2$ distance:
  $$
  \mathrm{GeomScore}(X_1, X_2) = \sum_{j=0}^{j_{\max}} [p_{X_1}(j) - p_{X_2}(j)]^2
  $$
  Optionally, use Earth-Mover’s Distance (EMD) for distributional divergence. Lower scores indicate superior topological alignment.

## 4. Algorithmic Procedure and Computational Complexity

Key parameters and workflow:

- $X \subset \mathbb R^D$, $|X| = N$
- Number of landmarks $L_0$ (typically 50–100)
- Number of trials $N_{\mathrm{trials}}$ (at least $10^3$–$10^4$)
- Maximal loop count $j_{\max}$
- Scale factor $\gamma$ for $\varepsilon_{\max}$ (set as $\gamma \approx 1/100$)

The algorithm proceeds:

```python
for t = 1…N_trials:
    L = random subset of X, size L0
    compute pairwise distances d(L, X)
    ε_max = γ · max_{u, v ∈ L} d(u, v)
    build witness_complex W for ε ∈ [0, ε_max], dim ≤ 2
    compute persistence intervals I1 = {[b_i, d_i]} in H1
    form Betti curve β1(ε) from I1
    for j = 0…j_max:
        RLT_t[j] = (Lebesgue measure of {ε: β1(ε) = j}) / ε_max
p_X = average of RLT_t over t
return GeomScore(p_X_real, p_X_gen)
```

Per trial, distance matrix computation is $O(N \cdot L_0 \cdot D)$. Witness complex and persistence for dimension ≤ 2 scales subcubically in $L_0$ and is independent of $D$. Overall complexity is linear in $D$ and the product $N \cdot L_0$ times the number of trials.

## 5. Diagnostic Utility for GAN Evaluation

GAS is designed to detect GAN mode collapse and topological anomalies:

- **Mode Collapse:** Generated data lacking loops yields MRLT concentrated at $j=0$, resulting in high geometry score versus real data.
- **Partial Collapse or Missing Modes:** Shifts in MRLT mass across different $j$ bins indicate nuanced topological mismatches.
- **Empirical Examples:** On synthetic circles with variable loop counts, GAS recovers correct $\beta_1$ values. In the CelebA “bad-DCGAN,” forced mode collapse yields MRLT peaked at $j=0$. On MNIST, WGAN-GP achieves MRLT distributions closer to real samples than vanilla WGAN.

This suggests that GAS can flag model-specific failures not captured by perceptual metrics.

## 6. Implementation and Practical Considerations

Library choices include:

- **GUDHI (Python):** Fully supports witness complexes and persistent homology.
- **Ripser, Dionysus:** Efficient for Vietoris–Rips complexes and fast persistence computation, but lack dedicated witness-complex support.

Implementation heuristics:

- Random, uniform landmark selection.
- Sufficient trial repetitions for MRLT stability ($\gtrsim 10^3$).
- $\varepsilon_{\max}$ scaling via $\gamma \cdot \max_{u, v \in L} d(u, v)$.
- Finely bin Betti curves or compute exact Lebesgue measures for numerical robustness.
- Computational bottleneck is pairwise distance calculation for high data dimensionality; persistent homology computation is negligible for simplex dimension $\leq 2$.

## 7. Relationship to Other Metrics and Combined Usage

A comparison of principal GAN quality metrics is summarized as follows:

| Metric             | Measures                | Limitations                        |
|--------------------|------------------------|-------------------------------------|
| Inception Score    | Sharpness, diversity   | Requires pretrained net; topology-insensitive |
| FID                | Feature Gaussian fit   | Fast; overlooks topological error    |
| Geometry Score/GAS | Topological alignment  | No visual fidelity; only $\beta_1$; higher compute cost |

IS and FID characterize perceptual quality and diversity but fail to identify topological pathologies. GAS operates without pretrained nets, is sensitive to mode collapse and topological mismatches, and extends to non-image domains, but does not directly address visual fidelity, is limited to first-order topology, and is computationally intensive.

In practice, joint application of GAS and perceptual metrics offers a more thorough diagnostic, with GAS highlighting topological defects and IS/FID reporting perceptual congruity [1802.02664].

Source: https://www.emergentmind.com/topics/geometric-alignment-score-gas