TopoDiffusionNet: A Topology-aware Diffusion Model

Saumya Gupta, Dimitris Samaras, Chao Chen · DOI

Introduction

While modern diffusion models like Stable Diffusion and DALL-E 3 produce visually stunning images, they often struggle with fundamental structural logic. A common failure mode is the inability to adhere to precise counts or connectivity constraints—for instance, generating six giraffes when five were requested, or failing to create a specific number of enclosed regions in a map. In mathematical terms, these models struggle with topology, specifically respecting Betti numbers: 0-dimensional topology (the number of distinct objects) and 1-dimensional topology (the number of loops or holes).

TopoDiffusionNet (TDN) addresses this by integrating Persistent Homology—a tool from Topological Data Analysis—directly into the denoising process, forcing models to respect structural constraints for unprecedented accuracy.

Methodology

TDN treats topology as a first-class citizen during training through three primary mechanisms:

  1. Topological Conditioning: The desired Betti number $c$ is converted into an embedding and injected into the diffusion U-Net, guiding the generation process from the initial noise.
  2. Persistent Homology (PH): PH is used to identify significant structures within the noisy intermediate steps of the diffusion process. This allows the model to distinguish between salient features (objects/holes) and noisy artifacts.
  3. Topology-Aware Loss ($L_{top}$): At each training step, the model applies a specialized loss function to the estimated noiseless image ($\hat{x}_0^t$). This loss consists of two components:
  4. $L_{preserve}$: Pushes the $c$ most significant topological features to become more prominent.
  5. $L_{denoise}$: Aggressively suppresses "spurious" features, effectively removing extra objects or holes that violate the requested topology.

By making these topological features differentiable, TDN can backpropagate gradients directly into the U-Net, allowing the model to learn global spatial reasoning.

Evaluation and Results

The researchers evaluated TDN across diverse tasks, including object counting (0-dim) and region generation (1-dim) using datasets such as COCO (Animals), Google Maps (Road Networks), and CREMI (Biological Cells).

Comparison of TopoDiffusionNet against standard T2I models for 0-dim (counting giraffes) and 1-dim (road network regions) topological constraints.

As shown in the comparison above, TDN significantly outperforms standard baselines and layout-control methods:

  • Accuracy Boost: On the synthetic Shapes dataset, TDN achieved 94.7% accuracy in generating the correct number of objects, compared to 75% for the ADM-T baseline. On real-world COCO animal masks, accuracy improved from 66.8% to 85.5%.
  • Structural Integrity: For 1-dimensional tasks like road network generation, TDN successfully maintains the requested number of enclosed regions, whereas models like DALL-E 3 often over-complicate the geometry or fail to close loops.
  • Early Convergence: Qualitative results show that TDN establishes the correct global structure much earlier in the denoising process (around timestep 750) compared to standard models, which often struggle to "decide" on the number of objects until the final steps.

Conclusion

TopoDiffusionNet demonstrates that integrating topological priors can bridge the gap between visual fidelity and logical consistency. By leveraging Persistent Homology to "edit" the denoising process, TDN provides a robust framework for applications requiring strict structural adherence, such as urban planning, robotics, and medical imaging. Future work aims to integrate these topological constraints into end-to-end image generation and extend the approach to 3D volumes.

Summary updated

BibTeX
@inproceedings{gupta2025topodiffusionnet,
  author = {Saumya Gupta and Dimitris Samaras and Chao Chen},
  title = {{TopoDiffusionNet: A Topology-aware Diffusion Model}},
  booktitle = {International Conference on Learning Representations},
  year = {2025},
  url = {https://openreview.net/forum?id=ZK1LoTo10R},
}
Figure