Consistent Amortized Clustering via Generative Flow Networks

Irit Chelly, Roy Uziel, Oren Freifeld, Ari Pakman

Abstract

Neural models for amortized probabilistic clustering yield samples of cluster labels given a set-structured input, while avoiding lengthy Markov chain runs and the need for explicit data likelihoods. Existing methods which label each data point sequentially, like the Neural Clustering Process, often lead to cluster assignments highly dependent on the data order. Alternatively, methods that sequentially create full clusters, do not provide assignment probabilities. In this paper, we introduce GFNCP, a novel framework for amortized clustering. GFNCP is formulated as a Generative Flow Network with a shared energy-based parametrization of policy and reward. We show that the flow matching conditions are equivalent to consistency of the clustering posterior under marginalization, which in turn implies order invariance. GFNCP also outperforms existing methods in clustering performance on both synthetic and real-world data.

Introduction

Clustering is a fundamental task in unsupervised learning. While traditional methods like Markov Chain Monte Carlo (MCMC) provide sound probabilistic frameworks, they are often computationally prohibitive for large-scale datasets. Amortized inference offers a faster alternative by training neural networks to predict cluster labels directly. However, sequential amortized models, such as the Neural Clustering Process (NCP), suffer from a lack of conditional exchangeability. This means the final cluster assignments can vary significantly depending on the order in which data points are processed. A robust clustering model must be order-invariant, ensuring that the probability of a specific clustering remains constant regardless of the input sequence.

Methodology: GFNCP

We propose GFNCP (Generative Flow Network Clustering Process), which frames clustering as a sequential decision process within a Generative Flow Network (GFlowNet).

Sequential Construction and Flow Matching

The model constructs a clustering by starting from an empty set and sequentially assigning new data points to either existing clusters or a new cluster. The core innovation lies in the application of Marginal Consistency loss. We demonstrate that GFlowNet's flow-matching equations are equivalent to the marginal consistency required for a consistent probabilistic posterior. By minimizing this loss, the model is mathematically forced to achieve order invariance.

GFlowNet state space for clustering

Shared Parametrization

Unlike standard GFlowNets that use separate networks for policies and rewards, GFNCP employs a shared energy-based parametrization. This allows for simultaneous end-to-end learning of the clustering policy and the underlying reward function. To train the model without ground-truth labels, we utilize instance discrimination, where augmented versions of the same image are constrained to the same cluster.

Experimental Results

GFNCP was evaluated against baselines like Set Transformer, DAC, and NCP across synthetic (Mixture of Gaussians), toy image (MNIST, Fashion-MNIST), and real-world image (ImageNet subsets) datasets.

Clustering Performance and Consistency

GFNCP consistently outperformed existing methods. On the MNIST dataset, GFNCP achieved a Normalized Mutual Information (NMI) of 0.79, compared to 0.68 for NCP. To quantify order invariance, we utilized the SDPP metric (Standard Deviation over Permutation Probabilities). As shown in the figure below, GFNCP exhibits a significant improvement in consistency, with a distribution heavily skewed toward low SDPP values.

SDPP metric comparison between GFNCP and NCP

Generalization and Uncertainty

The model demonstrated strong generalization to unseen classes in ImageNet experiments, even with an unknown number of clusters. Furthermore, as a generative model, GFNCP can sample multiple likely clusterings, effectively capturing uncertainty for ambiguous data points that might fit into multiple categories.

Conclusion and Future Work

GFNCP successfully addresses the challenge of order dependence in amortized clustering by leveraging the properties of GFlowNets. While the sequential nature of the process presents some scalability challenges for extremely large datasets, the framework provides a robust way to enforce marginal consistency in discrete structures. Future research may extend this approach to other domains, such as graph discovery or ranking.

Summary updated

BibTeX
@inproceedings{chelly2025consistent,
  author = {Irit Chelly and Roy Uziel and Oren Freifeld and Ari Pakman},
  title = {{Consistent Amortized Clustering via Generative Flow Networks}},
  booktitle = {International Conference on Artificial Intelligence and Statistics},
  year = {2025},
  url = {https://openreview.net/forum?id=l2YdTk6x2S},
}
Figure