The Hidden Shape That Predicts When AI Breaks

Pure mathematics is giving AI a new way to measure robustness from the inside out.

Topology · Machine Learning · Robustness · AI
The Shape of What a Neural Network Knows
When researchers started mapping the hidden geometry of AI systems, they found that robustness is not just a performance number. It is a shape.
2026

There is a question that has quietly unsettled AI research for years: why do neural networks that ace a benchmark sometimes fail when the data shifts even slightly? A model trained to classify road signs reads "Stop" without hesitation in clear daylight, then stumbles on the same sign under a thin layer of graffiti. The confidence score never flinches. The internal representations, however, tell a different story. That story has a shape.

I. What Geometry Has to Do With Intelligence

The branch of mathematics that reads that shape is called topological data analysis, or TDA. Where conventional statistics measure distances between points, topology asks a more structural question: what form does a collection of points take? How many clusters, how many holes, how many voids in higher dimensions? These are not metaphors. They are precise, computable quantities derived from tools like persistent homology, Betti numbers, and simplicial complexes. Applied to the activation patterns inside a neural network, they produce a fingerprint of the internal geometry the model has learned.

What researchers at ETH Zurich, Inria's DATASHAPE group, the Criteo AI Lab, and Los Alamos National Laboratory have found is that this fingerprint is predictive. The topological shape of a network's learned representations correlates strongly with how that network will behave under pressure. Before accuracy drops, before confidence wavers, the geometry shifts. That insight is beginning to reshape how AI systems are built, trained, and monitored.

01 Reading the shape of a representation
Persistent homology inflates a radius around each activation point, records which topological features appear and disappear, and produces a barcode that is provably stable under noise. Long bars mark genuine structure; short bars mark noise.
How persistent homology reads the shape of a neural representation A point cloud on top transforms into a persistence barcode below, showing how topological features are extracted from neural activation spaces. Neural activation space gap Cluster A Cluster B Cluster C Each layer produces a point cloud. Topology maps its connected structure across scales. persistent homology Persistence barcode Scale (birth to death) β₀ clusters β₀ β₀ β₁ loops β₁ Genuine structure Noise Long bar = robust feature Short bar = noise Long bars survive across scales. The descriptor is provably stable under noise.
Cluster A (persistent feature)
Cluster B (persistent feature)
Cluster C (persistent feature)
II. Barcodes and Fingerprints: Reading the Shape of a Representation

Every layer of a neural network transforms its input into a cloud of points in a high-dimensional space. For most of deep learning's history, that cloud was studied locally: how far apart are two points, how do gradients flow. Topology changes the frame entirely. It treats the cloud as a geometric object and asks what holds it together at a global level: its connected structure, its loops, its voids.

The primary tool is persistent homology. The technique works by slowly inflating a radius around each point and recording what topological features appear and vanish as nearby points merge. Connected components fuse, loops form and close, voids open and collapse in higher dimensions. The record of these events, plotted as a "persistence diagram" or "barcode," summarizes structure across many scales simultaneously. Long bars mark genuine, persistent features; short bars mark noise. The resulting descriptor is provably stable. Small perturbations to the data produce only small changes in the diagram, which is precisely what makes it useful in machine learning, where inputs are always noisy.

When ETH Zurich researchers applied this framework to the design of topological autoencoders, the payoff was immediate. Standard autoencoders optimize for reconstruction accuracy, which means the latent space's internal structure can be scrambled in ways that hurt downstream use. By adding a loss term that penalizes divergence between the persistence diagrams of the input space and the latent space, the team forced the encoding to preserve multi-scale connectivity, not just pointwise distances. The result was representations that were more faithful to the original data's structure, and more useful in practice.

III. Adversarial Attacks Have a Topological Tell

One of the sharpest findings to emerge from this research is that adversarial inputs, crafted perturbations designed to fool a network while remaining invisible to human observers, leave a distinct topological signature inside the network itself. The attack may fool the output layer. It does not fool the geometry.

The reason is structural. A well-trained network develops heavily used computational pathways: edges in the activation graph that carry information reliably across layers for normal inputs. Adversarial inputs route activation through pathways that were never properly trained, what researchers call "under-optimized" edges. The persistence diagrams of adversarial activation graphs spread and scatter in ways that clean inputs do not. Researchers at the Criteo AI Lab, with collaborators at Amazon and Meta AI Research, showed that this topological tell is consistent across architectures and attack types, holding against PGD, Carlini-Wagner, and boundary attacks alike, on datasets ranging from MNIST to CIFAR-10.

The Inria DATASHAPE team built on this with a system called Topological Uncertainty, which measures the distance between a new input's activation diagrams and the average diagrams stored from training. Where a standard softmax confidence score holds steady right up to the moment of failure, topological uncertainty widens well in advance. The gap between what the output layer believes and what the geometry reveals is, it turns out, one of the most reliable early-warning signals a deployed model can produce.

02 The topological tell
Clean inputs concentrate activation in well-trained highway paths. Adversarial inputs scatter through under-optimized edges. The persistence diagrams differ, and they differ before the output ever fails.
Adversarial inputs leave a distinct topological fingerprint Clean input concentrates activation in highway paths; adversarial input scatters through under-optimized edges. Their persistence diagrams differ before the output fails. Clean input Adversarial input Input Layer 1 Layer 2 Output Activation concentrated in highway paths Persistence diagram long bars stable shape Input Layer 1 Layer 2 Output Activation spreads through under-optimized edges Persistence diagram short bars scattered shape The topological tell The geometry reveals the attack before the output ever fails.
Clean activation (highway paths)
Adversarial scatter (under-optimized edges)
IV. Training the Shape, Not Just the Output

If the topology of learned representations predicts robustness, the next question is whether it can be engineered. Topological descriptors can be made differentiable, which means they can enter the loss function. A network can now be asked not only to minimize prediction error, but to maintain a prescribed geometric shape throughout training.

Topology-preserving adversarial training, presented at BMVC 2024, puts this directly to work. Standard adversarial training improves robustness but reliably degrades clean accuracy, because forcing the network to classify perturbed examples correctly distorts the geometry of its representations for natural data. By adding a regularizer that holds the representation topology of clean samples stable during adversarial training, the method breaks that trade-off. Across CIFAR-10, CIFAR-100, and Tiny ImageNet, it reported gains of up to 8.86 percentage points in natural accuracy and 6.33 points in robust accuracy over standard adversarial training baselines, without additional data.

Topology can also be wired into architecture from the start. A collaboration between ETH Zurich and KU Leuven designed a graph layer that injects persistent homology features directly into graph neural networks. Standard message-passing networks aggregate only from immediate neighbors, missing structure that appears at larger scales. The topological layer makes higher-order connectivity explicit and is provably more expressive. On MNIST and CIFAR-10 superpixel graphs, swapping one conventional layer for a topological one produced accuracy gains of 5.5 and 7.5 points respectively. On a task requiring the network to distinguish a sphere from a torus, accuracy jumped from 77.8 to 98.5 percent. Topology, built in rather than bolted on, changes what a network can see.

Engineer infographic on glass board showing topological concepts

A working sketch of the key ideas in this article: how point clouds become barcodes, how clean and adversarial representations diverge, and how topological invariants bridge neural networks, neurosymbolic AI, and distributed systems.

V. A Shared Language for Robustness

The topological approach to neural representations does not stay confined to any single model class. The same vocabulary, simplicial complexes, Betti numbers, topological invariants, that describes the shape of an activation space also describes the structure of computation itself. That overlap is pointing toward something larger than a diagnostic for deep learning.

In neurosymbolic AI, the connection runs through abstraction. A neural network operates over continuous inputs: pixel values, waveforms, embedding vectors. A symbolic system reasons over discrete categories: objects, relations, rules. Bridging them requires collapsing continuous manifolds into discrete states, and that collapse is a genuine topological event. It cannot be done by smooth deformation; it requires tearing the space. Recent theoretical work frames symbol grounding as exactly this kind of topological boundary, suggesting that well-designed neurosymbolic systems should concentrate their representational transitions at structured interfaces where the topology changes. The ability to recombine learned concepts in novel ways, what researchers call compositional generalization, depends on the geometry being organized enough to support it.

The connection to software systems is older. Algebraic topology has been a central tool in distributed computing theory for three decades, where executions of a distributed protocol are modeled as simplicial complexes and foundational impossibility results, specifically what a fault-tolerant system can and cannot compute, are theorems about the topology of those complexes. The same formalism now describes the shape of what a neural network learns. Persistent homology has been applied to software reliability data from open-source and industrial systems alike, characterizing how robustness evolves over a system's lifetime. The implication runs deeper than analogy: topological invariants may be a design primitive, a principled way to reason about what any computational system can robustly do when inputs are imperfect, faults occur, and the world refuses to stay in distribution.

03 Topology as a shared language
The same topological vocabulary, simplicial complexes, Betti numbers, topological invariants, describes what a neural network learns, how neurosymbolic systems abstract, and what a fault-tolerant distributed system can compute.
Continuous representation space Representation topology Persistent homology maps the shape of activations, embeddings, and latent spaces diagnose design Robustness monitoring Topological uncertainty detects adversarial and shifted inputs Topology-aware training Differentiable regularizers preserve shape during adversarial training Topological abstraction boundary Neurosymbolic interface Continuous manifolds collapse into discrete symbolic states at structured topological boundaries Fault-tolerant distributed systems Executions modeled as simplicial complexes Impossibility results are topological theorems shared invariants One mathematical language: neural networks, symbolic AI, and distributed systems
Representation topology
Diagnostic and training applications
Neurosymbolic abstraction boundary

Key references: Topological Autoencoders, Moor et al., ICML 2020. Adversarial Robustness Through Topological Lens, Criteo AI Lab with Amazon and Meta AI Research, arXiv 2211.02675. Topological Uncertainty, Inria DATASHAPE group, IJCAI 2021. Intrinsic Dimension, Persistent Homology and Generalization in Neural Networks, NeurIPS 2021, arXiv 2111.13171. Topology-Preserving Adversarial Training, BMVC 2024. Topological Graph Layer, ETH Zurich and KU Leuven, ICLR 2022. TopoX suite, University of California Santa Barbara. Simplicial Complex Models for Distributed Computing, arXiv 1703.11005. Software Reliability and Persistent Homology, Operations Research Forum 2021.