A three-dimensional manifold is a space that looks like ordinary 3D space up close. One standard way to describe such a space is a short recipe. Start from a small hyperbolic manifold with tube-shaped ends ("cusps") that is already catalogued, and close each cusp by gluing in a solid torus along a chosen curve, called a slope. This closing operation is Dehn filling. We propose to train a model that reads an arbitrary, scrambled triangulation of a 3-manifold (a description of the space as tetrahedra glued face to face) and writes down such a recipe as a small tree. The leaves of the tree are catalogued cusped manifolds, and each internal node fills one cusp with a specific slope. Every proposed recipe can be checked exactly by rebuilding the manifold in topology software. So this is a search problem where the model only proposes and an exact checker decides.
The surgery literature supplies hard rules that most learned generators lack. Lackenby's 6-Theorem says filling along a slope longer than 6 always yields a hyperbolic, irreducible, atoroidal result (Word hyperbolic Dehn surgery). Lackenby and Meyerhoff show a one-cusped hyperbolic manifold has at most 10 "exceptional" (non-hyperbolic) fillings, and any two of those slopes intersect at most 8 times (The maximal number of exceptional Dehn surgeries). Together these turn an infinite slope space into a small, structured candidate set. A tree decoder that builds them in as hard masks gets a much smaller search space than a decoder that does not. Our claim is that this matters most where classical shortcuts fail: non-hyperbolic targets and multi-cusp parents.
Core Claim
Recovering a verified Dehn-filling description of a target manifold can be posed as grammar-constrained tree generation, in the style of math-word-problem decoders. Masks derived from surgery theorems make the search tractable, and verification-driven training handles the fact that a manifold has many valid recipes. Within a fixed budget of exact verification calls, such a decoder should find valid recipes for more targets than enumeration or ranking baselines. The regime where we expect this is exceptional fillings, where the target is a lens space or Seifert-fibered space, and two-cusped parents filled twice. We expect no advantage, and will say so, in the easy regime of long-slope hyperbolic fillings, where a classical method already works.
Why this, and why now
The motivating evidence comes from two learning papers.
Learning 3-Manifold Triangulations generates many triangulations per manifold with Regina and SnapPy and classifies them from their isomorphism signatures, which are compact strings encoding the tetrahedron gluings. It reports three findings relevant here. Feed-forward networks exceed 0.99 accuracy on many manifold pairs. A BERT-style transformer does worse than those networks on the same strings. Classification of unknot versus trefoil complements jumps from about 0.63 to over 0.97 after Dehn filling. The work is purely discriminative and never outputs a construction. We keep its data pipeline and its lesson that flat sequence models read triangulation strings poorly, and move from classification to generating a checkable answer.
On the Learnability of Knot Invariants finds that geometric invariants such as hyperbolic volume are learned almost perfectly, while the Arf invariant stays near the 50% chance level. This constrains our design. We should not ask the network to compute discrete topological invariants it cannot learn. Instead we feed it exact first homology, computed cheaply, as an input and as a filter, and ask it only for the parts that are geometric and combinatorial.
The method comes from tree-structured decoding:
- Tree-structured Decoding for Solving Math Word Problems decodes operator trees top-down. Each step conditions on the parent's state and the left sibling, and a stack of open operator slots ends generation automatically. This cut invalid outputs from 1.3% to 0.2% and reached 69.0% on Math23K. - A Goal-Driven Tree-Structured Neural Model adds embeddings of finished subtrees that feed back into later steps. It reaches 74.3% on Math23K and loses 4.3 points without those embeddings.
In our trees, the "operator" is a choice of catalogued parent manifold whose arity is its number of cusps. The "operands" are slopes, written as coprime integer pairs. Once a cusp is filled, the embedding of the partially filled manifold plays the role of a finished subtree.
Both papers report accuracy collapsing at seven or more operators. Our trees are deliberately shallow, with one or two fillings per prime piece, so this ceiling should not bind.
Training on verifier outcomes rather than imitation comes from two sources. Neural–Evolutionary Symbolic Regression with Global Constraints uses constraint-aware tree decoding and rewards the model's own samples by similarity to elite solutions, reaching a 93.3% recovery rate on the Nguyen symbolic-regression suite. AlphaSAGE uses Generative Flow Networks, generators trained to sample objects in proportion to a reward, to cover many equivalent formulas. That property matters here because a manifold has many surgery descriptions, and supervising on a single one would penalize correct alternatives.
The closest prior work on our question is Exceptional surgery curves in triangulated 3-manifolds. It gives an exact algorithm that finds the exceptional slopes of a given knot exterior using normal surfaces, at a cost exponential in the number of tetrahedra. It answers the forward question: given the parent, which slopes are exceptional? We address the inverse question: given the filled result, which parent and slope produced it? We call that algorithm only as an optional certifier.
Research Program
Data. We sample construction trees from the SnapPy orientable cusped census subset used by Bouchard et al., which has 4,815 hyperbolic manifolds with fewer than 8 tetrahedra. We build each filled manifold, take its prime decomposition in Regina, and scramble its triangulation with random Pachner moves (local moves that retriangulate without changing the manifold). This matches the Bouchard et al. pipeline. Each training target is labeled with the full set of recipes found by exhaustive enumeration on small instances, not a single recipe.
Model input. An encoder reads the target triangulation as a graph whose nodes are tetrahedra and whose edges are glued faces. Exact homology and, when SnapPy finds a hyperbolic structure, volume and cusp data are concatenated to it.
Decoder and masks. The decoder works top-down:
- It picks a parent by scoring census entries in an embedding space. This is a retrieval step, so parents unseen in training can still be chosen.
- It opens one slot per cusp.
- For each slot it emits a slope through a series of masks:
- slopes must be primitive;
- if the target is not certified hyperbolic, the 6-Theorem restricts candidates to slopes of normalized length at most 6 on the parent's maximal cusp, a finite list computed from the cusp shape;
- within a beam, any set of slopes hypothesized as exceptional on a one-cusped parent must have size at most 10 and pairwise intersection at most 8;
- the homology of the filled manifold, computable from the slope, must match the target's.
Using the long-slope regime. For long slopes the filled manifold's geometry stays close to the parent's. This is the stability side of Thurston's surgery theorem. The decoder can therefore use target volume as a soft cue for parent choice when the target is hyperbolic.
Training. We pretrain by supervised learning on enumerated recipe sets. We then fine-tune with exact verification as the reward, comparing a similarity-weighted policy gradient against a GFlowNet objective.
Verification. Hyperbolic targets are checked with SnapPy isometry tests. Lens spaces and small Seifert-fibered targets are checked with Regina's recognition routines. We restrict the evaluation set to classes where certification is available, so "success" always means exactly verified.
Baselines
Ordered enumeration (naive reference). This is what a topologist would do. Iterate over census parents by tetrahedron count. For each, iterate over slopes in order of length, restricted to length at most 6 when the target is not hyperbolic. Discard any filling whose homology mismatches, and send survivors to the same verifier. It uses the same census, the same verifier, and the same verification-call budget. It is the strongest classical competitor because the homology filter is cheap and the 6-Theorem keeps the candidate list finite. We expect it to be hard to beat on small single-cusp instances.
Drill and identify. For hyperbolic targets, use SnapPy to drill out the k shortest closed geodesics, identify each drilled manifold in the census, and read off the meridian as the slope. It is the strongest competitor for long-slope fillings because the theory guarantees that the core of a long filling is a short geodesic. It is inapplicable to non-hyperbolic targets.
Classifier ranking. A Bouchard-style feed-forward classifier trained on the same data to predict the parent, whose ranking reorders the enumeration.
Flat decoder. A flat transformer emits the same tree serialized in prefix order, under identical masks. This tests whether the tree structure itself adds anything.
Unmasked tree decoder. The same tree decoder with the surgery masks removed. This isolates the theorems as the key ingredient.
Genetic programming. Genetic-programming search over trees with the same verifier.
Fairness and the bar. All learned systems share one encoder size, one training-compute budget, and one hyperparameter-search budget, and are evaluated at fixed verification budgets.
No reported result was found on Lacuna for surgery-description recovery or any inverse Dehn-filling task, so no published number exists to beat. The nearest reported figures are on different, discriminative tasks: about 0.97 filled-manifold classification accuracy and about 0.74 on the hard lens-space pair L(7,1) versus L(7,2), both from Learning 3-Manifold Triangulations. They serve as context only.
Beating ordered enumeration means two things on held-out exceptional and two-cusp targets: higher success at equal budget, or at least half the verification calls to reach the same success rate. Beating drill-and-identify on hyperbolic targets is not claimed.
Why not just…?
Why not just enumerate, since the 6-Theorem already makes the slope list finite? This is the real threat. On one-cusped parents from a 4,815-entry census, homology-filtered enumeration may be fast enough that learning adds nothing. We report that outcome if it occurs. The proposal's bet is on two settings. With two-cusped parents filled twice, candidates grow as the product of two short-slope lists. When the census is extended past 8 tetrahedra, each surviving candidate costs a full homeomorphism check. In both settings verification calls dominate. The budget-matched success curves against enumeration settle this directly, broken down by cusp count and parent size.
Why not just drill the shortest geodesic and look it up? For hyperbolic targets with long filling slopes this probably works as well as anything, and we include it as a baseline rather than compete with it. It has nothing to drill on lens spaces and Seifert-fibered targets, which are exactly the exceptional fillings our masks target. It can also fail on short hyperbolic fillings where the filling core is not among the shortest geodesics. We measure where it fails as a function of slope length.
Why not just use a flat transformer with grammar-constrained decoding? Masking alone may give the same validity that tree decoders gained in Tree-structured Decoding for Solving Math Word Problems. Two things favor a tree decoder: transformers did poorly on triangulation strings in Learning 3-Manifold Triangulations, and finished-subtree embeddings were worth 4.3 points in A Goal-Driven Tree-Structured Neural Model. Neither result was measured on this task. The flat-with-masks baseline is the test. If it matches the tree decoder, we drop the tree claim and keep the masks.
Why not just run genetic search? Neural–Evolutionary Symbolic Regression with Global Constraints reports that disabling the neural generator or its reward shaping substantially lowers recovery. That evidence comes from symbolic regression, not topology. So we run genetic programming under the same masks and budget rather than assume the result transfers.
Decisive Checks
The main experiment plots verified success against verification-call budget on four held-out splits:
- unseen parents with 7 tetrahedra, training on 6 or fewer;
- exceptional-filling targets only;
- two-cusped parents filled twice;
- targets scrambled with long Pachner walks.
Three outcomes would decide the proposal.
The masks matter. The masked tree decoder must beat ordered enumeration on exceptional and two-cusp splits at equal budget. The unmasked ablation must not, which would show the surgery theorems are doing the work.
Recipe diversity. Fine-tuning with a GFlowNet should recover more distinct verified recipes per target than policy gradient. That would confirm that accounting for non-unique recipes matters.
Revisiting the filling puzzle. We will test whether the 0.63-to-0.97 jump reported by Bouchard et al. reappears as a jump in recovery success between cusped and filled inputs, and as a gap between short and long slopes. That would tie the puzzle to cusp geometry rather than to the string format.
If enumeration matches the decoder on every split, the honest conclusion is that surgery theory already makes this inverse problem easy at census scale. That is a useful negative result.
References
- Word hyperbolic Dehn surgery
- The maximal number of exceptional Dehn surgeries
- Learning 3-manifold triangulations
- On the Learnability of Knot Invariants: Representation, Predictability, and Neural Similarity
- Tree-structured Decoding for Solving Math Word Problems
- A Goal-Driven Tree-Structured Neural Model for Math Word Problems
- Neural–Evolutionary Symbolic Regression with Global Constraints: Constraint-Aware Decoding and Reward Shaping
- AlphaSAGE: Structure-Aware Alpha Mining via GFlowNets for Robust Exploration
- Exceptional surgery curves in triangulated 3-manifolds