Abstract
Recent years have seen growing interest in learning disentangled representations, in which distinct features, such as size or shape, are represented by distinct neurons. Quantifying the extent to which a given representation is disentangled is not straightforward; multiple metrics have been proposed. In this paper, we identify two failings of existing metrics, which mean they can assign a high score to a model which is still entangled, and we propose two new metrics, which redress these problems. We then consider the task of compositional generalization. Unlike prior works, we treat this as a classification problem, which allows us to use it to measure the disentanglement ability of the encoder, without depending on the decoder. We show that performance on this task is (a) generally quite poor, (b) correlated with most disentanglement metrics, and (c) most strongly correlated with our newly proposed metrics.
Introduction
In deep learning, a "disentangled representation" is one where individual neurons correspond to independent physical factors of variation (e.g., color, size, or shape). While desirable for interpretability and generalization, measuring disentanglement accurately remains a challenge. Existing metrics like Mutual Information Gap (MIG), Disentangled-Completeness-Informativeness (DCI), and Separated Attribute Probability (SAP) often suffer from two critical flaws:
- Incorrect Alignment: Many metrics evaluate the most informative neuron for each factor independently. This allows for "many-to-one" mappings where a single neuron is credited for representing multiple factors, which is the definition of entanglement.
- Distributed Entanglement: Metrics that evaluate neurons in isolation fail to detect complex, non-linear dependencies (e.g., XOR-like relationships) where information is spread across multiple neurons.
Proposed Metrics
To address these issues, we propose two more rigorous metrics that enforce strict disentanglement criteria:
- Single-neuron Classification (SNC): This metric measures how well a single neuron can predict a ground-truth factor. To solve the alignment problem, it utilizes the Kuhn-Munkres algorithm to ensure a strict one-to-one (injective) mapping between factors and neurons. This prevents the "double-counting" of neurons that represent multiple features.
- Neuron Knockout (NK): Inspired by biological genetics, this metric measures the drop in classification accuracy when the "primary" neuron assigned to a factor is removed. In a perfectly disentangled system, this neuron should hold all relevant information; its removal should result in a total loss of predictive power for that factor. If accuracy remains high, the representation is inherently entangled.
Compositional Generalization (CG) Task
We validate these metrics using a downstream Compositional Generalization task. Models are trained on specific feature combinations (e.g., blue squares and yellow circles) but tested on unseen combinations (e.g., yellow squares). A truly disentangled encoder should be able to generalize to these novel pairings because it has learned the underlying factors independently.
Key Results
Our evaluation across standard benchmarks (dSprites, 3dshapes, and MPI3D) reveals that popular models like $\beta$-VAE and FactorVAE struggle significantly with compositional generalization. As shown in the results table, many models achieve 0.00% accuracy on unseen combinations (CG) for specific factors, indicating they have not truly disentangled the latent space.
Furthermore, we found that our proposed SNC metric is the most reliable predictor of a model's ability to generalize. It achieves a Pearson correlation of ~0.85 with CG performance, significantly outperforming established metrics like MIG (~0.57) and DCI (~0.49).
Discussion and Conclusion
This work highlights a fundamental tension in representation learning: disentanglement is inherently fragile. While distributed representations offer fault tolerance, true disentanglement requires a one-to-one mapping that is susceptible to single-point failures (as measured by our NK metric).
Our results demonstrate that existing metrics are "leaky" and can provide a false sense of progress. By enforcing one-to-one alignment and testing for distributed entanglement, SNC and NK provide a more truthful assessment of a model's latent structure. Future work should focus on "weak" disentanglement—where factors are mapped to distinct subsets of neurons—to better balance interpretability with the robustness of distributed systems.
Summary updated