TL;DR
When hunting for ultra-rare mathematical structures, most AI systems try to generate entire solutions from scratch—like trying to solve a jigsaw puzzle by throwing all the pieces in the air and hoping they land intact. This paper flips that approach on its head: by locking in a solid partial structure (an "active core") and training a Transformer to simply fill in the missing blanks, the authors achieve state-of-the-art learning-based results across both discrete grid puzzles and continuous geometric packing problems.
What Problem Does This Paper Address?
Extremal combinatorics is the mathematical art of pushing boundaries: finding rare configurations of objects that obey strict rules while maximizing some global score (like packing as many non-overlapping circles as possible into a square).
Recently, frameworks like PatternBoost and FlowBoost showed that neural networks can help discover these structures by alternating between local classical search and training a generative model on the best solutions found so far. However, these models share a subtle flaw: they generate complete configurations from scratch.
Why is that a problem? First, mathematical constraints are deeply relational; where you can legally put the next point depends entirely on where the previous points already sit. Second, symmetries mean there are countless equivalent ways to arrange a great solution. A model trained to generate everything at once risks averaging across symmetric modes and producing invalid mush. Furthermore, human mathematicians rarely start over from zero—they keep the parts of a construction that work and tweak the uncertain bits.
Methods
Instead of unconditional generation, the author formulates discovery as object-level active-core completion and introduces an outer search loop called Inpainting PatternBoost.
Here is what is standard versus what is new:
- Standard foundation: Like PatternBoost, the algorithm maintains an "elite pool" of top-scoring solutions, alternating between training a neural model on the pool and using the model to propose new candidates. Like FlowBoost, it uses a bidirectional Transformer where each token represents one unordered mathematical "slot" (a grid column slot or a circle's center), avoiding arbitrary sequence orderings.
- What’s new (Active-Core Inpainting): During both training and generation, elite constructions are partially destroyed by masking out a subset of slots. The surviving feasible structure becomes the active core. The model is trained strictly as a conditional completion operator to reconstruct the missing pieces given that core. During generation, it decodes iteratively—committing high-confidence predictions into the active core step-by-step—before a problem-specific environment repairs conflicts and greedily saturates the solution.
Depending on the math domain, the Transformer's prediction head swaps cleanly between discrete cross-entropy (absorbing-state discrete diffusion) and continuous Denoising Diffusion Probabilistic Models (DDPM) or Flow Matching (FM).
Datasets
Because this is mathematical discovery via self-play/search rather than supervised learning, there are no static pre-existing datasets. Instead, training data is dynamically generated and curated in an online elite pool, evaluated on two classic extremal benchmarks:
- No-Three-in-Line (Discrete): Place as many points as possible on an $n \times n$ grid such that no three points lie on any straight line (theoretical maximum is $2n$ for the tested sizes). Evaluated from $n = 10$ up to $n = 45$.
- Maximum Sum-of-Radii Circle Packing (Continuous): Place $K$ non-overlapping circles of flexible radii inside a unit square $[0,1]^2$ to maximize the sum of their radii (with exact radii computed from circle centers via a Linear Programming solver). Evaluated on $K \in \{15, 26, 30, 32, 40\}$.
Key Insights and Ideas
- Fixing a core breaks symmetry: Conditioning on an active core anchors the solution, stripping away combinatorial symmetry explosions. The neural network doesn't have to guess which global mode to build; it just learns local object compatibility.
- Free data amplification: Near-optimal mathematical structures are exceedingly rare. By masking out different subsets of a single elite configuration, one rare gem turns into dozens of distinct conditional reconstruction tasks.
- Representation isn't enough without conditioning: Ablation studies (Table 3) reveal a great "aha" moment: switching from an ordered sequence to unordered object slots alone actually performs worse than prior baselines unless paired with active-core conditioning. The magic lies in preserving the feasible core.
- Stochasticity helps continuous exploration: In circle packing, DDPM consistently beats Flow Matching. Because DDPM injects fresh noise at every reverse step while FM integrates deterministically, DDPM naturally explores the neighborhood around elite parents better—and without active-core conditioning, FM collapses below random search.
Key Results
- No-Three-in-Line: Inpainting PatternBoost recovers the optimal $2n$-point configurations all the way up to $n = 18$ (prior PatternBoost work topped out at $n = 14$), and hits $2n - 1$ for $n \in \{19, 20, 25\}$. At $n = 25$, it reaches 49 points, beating prior autoregressive PatternBoost (46) and random saturation (44).
- Circle Packing in a Square: Prior work (FlowBoost) relied heavily on gradient-based local search (SRP) that rapidly pushes nearly any decent seed to near-optimal. When paired with SRP, Inpainting PatternBoost matches or exceeds FlowBoost. More impressively, even with local search completely turned off, the DDPM variant reaches an average of 88.5% of FlowBoost's polished scores across instances (e.g., scoring 2.370 vs. 1.840 for Random+LP at $K=26$).
Limitations and Future Work
- Classical solvers still wear the crown: While best-in-class for learning-based methods, specialized classical constraint-satisfaction solvers have already found $2n$ solutions for No-Three-in-Line up to $n \le 60$.
- Narrow domain testing & transferability: The framework was only tested on two problem families, and the model shows limited evidence of learning features that transfer across different grid sizes on No-Three-in-Line.
- Future Work: The author notes a striking structural parallel between PatternBoost (searching directly over mathematical constructions) and LLM-driven evolutionary systems like FunSearch and AlphaEvolve (searching over programs that build constructions). Bridging the two—transferring geometric intuition learned in construction space into program space, or vice versa—is highlighted as an exciting next frontier.
Summary updated