The Hidden Shape of AI Reasoning

How knowledge is shaped inside an AI system turns out to matter as much as the knowledge itself.

Topology · Knowledge Representation · Neurosymbolic AI · Computer Science
The Shape of What a Machine Knows
How the geometry of a knowledge base determines whether an AI can reason, retrieve, or simply guess — and what it would take to design that geometry on purpose.
2026

There is a question that most engineers who build AI systems never have to answer directly: what does knowledge look like? Not how it is labeled, not how it is chunked, not how it is indexed. What is its actual shape? For decades, that question lived comfortably in philosophy. It does not anymore. A growing body of work in mathematics and computer science has made it empirical, measurable, and architecturally consequential. The shape of the space in which knowledge is encoded turns out to govern whether a system can retrieve the right answer, reason across a complex question, or generalize to situations it has never seen. It is not a metaphor. It is geometry, and it can be computed.

I. The hidden architecture inside every model

Every large neural network, every knowledge graph, every vector database encodes information as position in space. A word, a concept, a fact, a document chunk — each becomes a point, and related things become nearby points. The field calls these representations embeddings, and for years the working assumption was that the specific shape of the space they inhabit was a secondary concern. What mattered was the training data, the architecture, the loss function. Shape was something that emerged on its own. That assumption is now being tested, and the early returns are striking. Researchers at SISSA measured the geometry of representations inside neural networks and found that layers with thousands of neurons actually organize information onto surfaces of roughly ten effective dimensions, and that the dimension of the final layer predicts how well the model generalizes. The geometry is not incidental. It is doing the work.

The mathematical discipline that studies shape without caring about exact distances, stretching, or scaling is topology. It concerns itself with structure: how many pieces are connected, how many holes exist, where loops form, where voids open. Applied to knowledge representation, topology asks what the learned structure of a knowledge base actually is, whether it is consistent, whether it has gaps, and whether its shape allows the reasoning the system will eventually be asked to perform. The answer is not always yes. And the field now has tools to find out.

That tidy picture is now under pressure, which is what makes the area lively. A 2025 analysis tested directly whether the token embedding space of several large language models is a manifold and rejected the hypothesis, concluding that the token subspace is not even a fiber bundle. Related work found embeddings that live in a stratified space — a union of manifolds of different dimensions corresponding to different data sources such as scientific text, casual dialogue, and code. The lesson is not that geometry is the wrong lens but that the geometry is more intricate than a single smooth surface, and that intricacy is exactly where topology earns its keep.

01 The geometry of learned representations
High-dimensional embeddings collapse onto a low-dimensional surface. The persistence barcode on the right reads the topology of that surface at every scale simultaneously, separating genuine structure from noise.
Section I — The hidden architecture inside every model High-dimensional embedding space gap ~10 effective dimensions low-dimensional manifold cluster A cluster B cluster C Persistence barcode small ε large ε H₀ (clusters) persistent short-lived (noise) H₁ (loops) real loop noise loops H₂ (voids) gap scale threshold long lifespan = real structure Persistent features are structure, not noise
H₀ — connected clusters
H₁ — loops (real structure)
Manifold surface
II. Measuring what you cannot see

The first challenge is instrumentation. A knowledge base with hundreds of millions of embeddings lives in a space of hundreds of dimensions, which is geometrically opaque to human intuition. Distance becomes a blunt instrument at high dimension, and visual inspection is simply not available. This is precisely the problem that topological data analysis was built to address. Its core method, persistent homology, does something unusual: instead of picking one scale at which to examine a dataset, it examines the data at every scale simultaneously, and records which structural features — loops, voids, connected clusters — appear and then disappear as the resolution changes. Features that persist across many scales are genuine structure. Features that vanish quickly are noise. The output is a compact summary called a persistence diagram, and it turns geometric intuition into a number that can be optimized or compared.

A companion method called the Mapper algorithm takes the same data and produces a map. It projects the dataset through a filter function, covers the projection with overlapping bins, clusters each bin independently, and stitches the results into a graph whose branches and loops reflect the global organization of the original space. Mapper has been applied to text embedding spaces to reveal why certain language models treat semantically similar sentences as geometrically distant, locating the problem not in the training data but in the shape of the space the model learned. The distinction matters enormously for debugging: a coverage problem calls for more data, while a shape problem calls for a different architecture or training objective.

The diagnostic power extends directly to knowledge bases. When researchers apply persistent homology to a knowledge graph embedding, holes in the persistence diagram point to regions of missing or underrepresented knowledge — structural gaps that no amount of retrieval tuning will repair because the geometry does not support the relevant inferences. A large persistent loop can mark a structural inconsistency in the graph's own logic, a cycle of implications that never resolves. These are not errors a loss function will automatically surface, but topology finds them. Treating topological analysis as part of the standard evaluation pipeline, rather than as a research novelty, is one of the more practical shifts the field is beginning to make.

Topological structure of a knowledge base

A persistence diagram visualizes the topological features of a high-dimensional embedding space across all scales simultaneously. Dots far from the diagonal represent genuine structural features — clusters, loops, and voids — while points close to it are noise. Daice Labs / Illustration.

III. When one geometry is not enough

A real knowledge base is not flat. The concept of an animal contains the concept of a mammal, which contains the concept of a dog, which contains every specific breed. That containment hierarchy is tree-like, and trees are deeply curved spaces: the further you move from the root, the more room there is, and the number of nodes at each level grows exponentially. Euclidean space, the ordinary flat geometry of most embeddings, grows polynomially with distance, not exponentially. Forcing a hierarchy into flat space introduces enormous distortion, the way a flat map distorts the poles of a globe. At the same time, the relation "purchased together" is symmetric and essentially flat. "Is a synonym of" is cyclic. A single knowledge base contains all of these at once, and no single geometry honors all of them.

The most elegant solution so far borrows from algebraic topology, a branch of mathematics with roots in the mid-twentieth century that studies how local structure patches together into global coherence. The framework is called sheaf theory. A sheaf is a device for tracking locally defined data across a space in a way that guarantees consistency wherever two local regions overlap. Applied to a knowledge graph, each relation becomes a local constraint — a rule about how the embeddings of connected nodes must relate to each other. A sheaf-theoretic knowledge graph embedding encodes all those local constraints into a single mathematical object, and consistency across the entire graph becomes measurable through what is called the sheaf Laplacian. A 2023 framework developed at the University of Minnesota showed that this setup allows a model trained only on individual facts to answer multi-hop queries it was never trained on, by solving a harmonic extension problem whose answer is a direct algebraic consequence of the sheaf structure. In experiments on standard benchmarks, these models used between 90 and 95 percent fewer parameters than conventional approaches while reaching competitive accuracy on composite queries.

The same mathematical logic has been extended to the design of neural networks that process graphs. Standard graph neural networks implicitly assume the most trivial possible sheaf — one that ignores the diversity of relation types and treats all edges as geometrically equivalent. A 2022 collaboration between research teams at Oxford and Cambridge showed that allowing the network to learn a non-trivial sheaf instead directly addresses two of the most persistent failure modes in graph learning. The first is oversmoothing, the tendency of node representations to blur together into indistinction after several rounds of message passing. The second is heterophily, the common real-world situation in which connected nodes belong to fundamentally different categories. Both failures, it turns out, are geometric. The sheaf framework addresses them by giving each relation its own local geometry, allowing diverse structure to coexist without forcing everything into one shape.

02 Sheaf consistency across a knowledge graph
Different relation types require different local geometries. Sheaf restriction maps give each edge its own constraint, and the Laplacian score measures whether local facts compose into a globally consistent answer — or reveal a structural hole.
Sections II & III — When one geometry is not enough Knowledge graph different relations, different geometry Animal Mammal Bird Dog Whale Sparrow Ecosystem Habitat is a type of co-occurs in tree geometry (hyperbolic) flat geometry (Euclidean) One flat space distorts both Sheaf solution each edge carries its own local geometry Concept A Type-of B Relates-to C Co-occurs D R₁ R₂ R₃ Sheaf Laplacian measures global consistency across all R → zero only when every constraint is satisfied Consistent Laplacian ≈ 0 multi-hop works Inconsistent Laplacian > 0 hole detected A model trained on single facts answers multi-hop queries via harmonic extension
Hierarchical relation (tree geometry)
Symmetric relation (flat geometry)
Consistent region (Laplacian ≈ 0)
IV. Bottlenecks, curvature, and the limits of connectivity

Connectivity is not the same as accessibility. A knowledge base can be richly linked and still fail to route information between distant concepts, because some paths through the graph carry enormous informational load while others remain unused. This is the problem of over-squashing, and it is one of the more stubborn failure modes in graph-based AI. When a graph neural network is asked to answer a question that requires integrating evidence from conceptually distant nodes, the information traveling toward the answer must pass through a small number of bottleneck edges. Each of those edges aggregates representations from many neighbors into a fixed-size vector, and information that cannot fit is simply lost. The result is that the system gives wrong answers not because the relevant knowledge is missing from the graph, but because the graph's own shape prevents the knowledge from reaching the computation that needs it.

The geometric concept that formalizes this intuition is curvature. Curvature describes how space bends: positively curved space, like the surface of a sphere, brings parallel paths together; negatively curved space, like a saddle, pushes them apart. In discrete graphs, edges with strongly negative curvature are precisely the ones serving as bridges between dense clusters. They carry a disproportionate share of the graph's information flow. A 2022 analysis by researchers at Oxford identified negative discrete curvature, formalized through a measure called Balanced Forman curvature, as the geometric signature of bottleneck edges, and proposed a rewiring procedure called Stochastic Discrete Ricci Flow that surgically adds edges to relieve the most pinched regions of the graph. The rewiring is targeted rather than random: it improves long-range reasoning without disrupting the local cluster structure that supports ordinary retrieval.

The implication for knowledge base design is direct. A graph assembled by extracting entities and relations from text, without any attention to its geometric properties, will almost certainly have severe curvature variation: tight clusters of well-documented topics connected by a small number of overloaded bridge edges. Measuring curvature before deployment gives engineers a diagnostic picture of where reasoning will fail and where additional connections would most improve performance. The fix is not more data. It is reshaping the graph's geometry, which is a different kind of engineering decision and one that topology makes legible.

V. Designing shape on purpose

The trajectory of all this work points toward a shift in how knowledge infrastructure is designed. The current dominant architecture pairs a vector database, which retrieves by semantic similarity, with a graph database, which traverses explicit relationships. Each compensates for the other's weaknesses: the vector index finds conceptually related content that the graph would miss, and the graph enforces logical structure that the vector index cannot represent. This hybrid pattern, which some practitioners call GraphRAG, is already in production at a number of large institutions. A system described by researchers at BlackRock and NVIDIA that combines knowledge graphs with vector retrieval reported a faithfulness score of 0.96 on earnings-call question answering, compared to 0.94 for a vector-only approach. The difference is modest in percentage terms and substantial in consequence when the questions involve multi-step financial reasoning.

What the field does not yet have is a principled framework for designing the geometry of a knowledge base from the top down, before the data is assembled, rather than measuring and repairing the geometry after the fact. The components of such a framework are taking shape. Hierarchical knowledge should be encoded using region-based or box embeddings, where containment is represented as literal spatial containment and subsumption can be read directly off the geometry without being approximated by distance. Symmetric and cyclic relations should use flat or toroidal subspaces. Multi-relational consistency should be enforced through sheaf-based constraints rather than left to emerge from training. Empty regions in the embedding space, representing missing knowledge, should be monitored as a first-class system metric rather than discovered by accident when a query fails.

Topology supplies the shared language that makes this possible. The central ambition of neurosymbolic AI is to connect the symbolic structure of logic and graphs with the continuous geometry of learned representations, and one of the main barriers has been the absence of a framework in which discrete graphs and continuous vector spaces can be discussed on the same terms. Topology provides that framework. A symbolic knowledge graph and a neural embedding space are both topological objects, both characterized by their connected components, their holes, their curvature, and their internal consistency. Designing a knowledge base well means designing its topology on purpose, and measuring that topology continuously as the system grows. The shape of what a machine knows is not a metaphor. It is a specification, and the field is learning to write it down.

03 Architecture of a well-shaped knowledge base
A query flows through four engineered layers: box embeddings for hierarchy, curvature-rewired graph for long-range reasoning, sheaf consistency enforcement, and hybrid vector plus graph retrieval. Each layer addresses a distinct geometric failure mode.
Sections IV & V — Designing shape on purpose Query multi-hop question Layer A — Hierarchy Box embeddings: containment encodes subsumption Animal Mammal volume = generality containment = subsumption no distance distortion Layer B — Long-range reasoning Curvature-guided rewiring: relieve over-squashing −κ bottleneck rewire parallel paths targets low-curvature bridge edges improves long-range reasoning Layer C — Multi-relational consistency Sheaf restriction maps: each relation has its own geometry Laplacian = 0 → consistent → multi-hop query answerable R₁ R₂ R₃ restriction maps Vector index semantic similarity retrieval finds related passages + hybrid Graph database structured traversal walks explicit relationships Answer geometrically consistent
Layer A — Box embeddings (hierarchy)
Layer B — Curvature rewiring
Layer C — Sheaf consistency
Layer D — Hybrid retrieval

Key references: Ansuini, A. et al., "Intrinsic dimension of data representations in deep neural networks," NeurIPS 2019. Gebhart, T. et al., "Topology of deep neural networks," AISTATS 2023. Dufter, P. et al., "Identifying the limits of cross-lingual transfer for question answering," AAAI 2021. Bodnar, C. et al., "Weisfeiler and Lehman Go Topological: Message Passing Simplicial Networks," ICML 2021. Barbero, F. et al., "Sheaf Neural Networks with Connection Laplacians," ICML 2022. Bodnar, C. et al., "Neural Sheaf Diffusion: A Topological Perspective on Heterophily and Oversmoothing in GNNs," NeurIPS 2022. Topping, J. et al., "Understanding over-squashing and bottlenecks on graphs via curvature," ICLR 2022. Sandfelder, D. et al., "Knowledge Sheaves: A Sheaf-Theoretic Framework for Knowledge Graph Embedding," AISTATS 2023. Edge, D. et al., "From Local to Global: A Graph RAG Approach to Query-Focused Summarization," Microsoft Research, 2024. Sun, H. et al., "GraphRAG for Financial Question Answering," BlackRock / NVIDIA, 2024.