Slay the Spire: Hypergraph Deck Synergies
I trained hypergraph neural networks over 12,500+ runs to discover higher-order card combos, expose the math behind why static tier lists fail, and identify contextual trap picks.
Intro
In roguelike deckbuilders (Slay the Spire, Balatro, Monster Train), card value is completely non-linear:
Corruption alone exhausts your few defenses and gets you killed. Dark Embrace alone is 2 wasted energy without exhaust outlets. Dead Branch alone generates chaotic hands. Together, they form an infinite card-draw and block engine that solves the game.
Standard graph neural networks assume pairwise edges (u ↔ v). But combinatorial synergy is fundamentally a hyperedge connecting arbitrary subsets of cards and relics simultaneously (k ≥ 3).
Encode decks as hypergraphs with k-body edges connecting cards across global, archetype, and cost sets.
Prove why static tier lists fail: linear models mathematically cancel out deck context (w_A - w_B is constant).
Decompose 1-way, 2-way, and 3-way Shapley interactions to isolate super-additive synergy and contextual trap picks.
The Leaky Metric Trap
Before training deep architectures, we benchmarked simple heuristics on 5,556 Ironclad runs. We immediately found a critical methodological flaw in how deck models are typically evaluated:
Ascension 0–20 across 4 public archives
4,444 train / 1,112 test held-out split
Survival prediction R² = 0.891 across 56 floors
Heuristic, linear, tree, set, graph, and hypergraph baselines
A trivial 1-feature heuristic that simply counts len(relics) achieves 0.921 ROC-AUC.
In roguelikes, survival leaks directly into inventory size: dying on Floor 8 leaves you with 2 relics;
beating Floor 56 leaves you with 18.
Predicting overall victory is artificially easy. The genuine modeling challenge is conditional drafting: given your current deck, which offered card maximizes expected survival?
Model Architecture
We formulate deck state S as an incidence matrix H ∈ {0, 1}|V| × |E| across global, functional archetype, and energy-cost hyperedges.
Incidence Matrix H
Connects items across global deck, functional archetypes (Exhaust, Strength, Block), and cost tiers.
Hypergraph Conv
Two-stage propagation computes multi-body message aggregation in a normalized dense matrix multiplication.
Multi-Task Readout
Jointly predicts continuous floor survival (MAE 3.78 flr) and counterfactual pick rank deltas.
| Category | Architecture | Features / Formulation | ROC-AUC | Accuracy | F1 (Wins) | Note |
|---|---|---|---|---|---|---|
| Heuristic | Relic Count Only | Single scalar: len(relics) | 0.921 | 85.9% | 0.531 | Leaky baseline: surviving longer collects more relics |
| Heuristic | Deck Length Only | Single scalar: len(cards) | 0.714 | 81.7% | 0.239 | Weak signal without item identity |
| Tree | XGBoost (GBDT) | 150 trees, depth 5, multi-hot counts | 0.942 | 89.2% | 0.691 | Strong tabular baseline |
| Linear | Logistic Regression | L2-regularized Bag-of-Cards | 0.947 | 89.1% | 0.698 | High ROC, but 0% context sensitivity in drafting |
| Deep Set | Set Transformer | Multi-head Self-Attention + PMA | 0.951 | 89.4% | 0.735 | Permutation-invariant card pooling |
| Deep Graph | Pairwise GCN | Cosine Adjacency + Multi-head Pool | 0.955 | 90.1% | 0.770 | Pairwise card-to-card graph convolutions |
| Deep Hypergraph | Hypergraph Neural Net | Multi-edge message passing (Ours) | 0.953 | 89.8% | 0.739 | Captures k-body combinatorial interactions |
Why Card Tier Lists Are Broken
Every community tier list assigns each card a static score wi. In any linear formulation, the difference in value between card A and card B is:
S disappears. The ranking cannot react to the deck you already have.
The existing deck S completely cancels out. A linear model or tier list will recommend the exact same card on Floor 2 as on Floor 50, regardless of whether your deck needs immediate damage or boss scaling.
Strike
Defend
Bash
Barricade
Entrench
Body Slam | Model | Act 1 Starter Deck (5 Strikes, 4 Defends, Bash) | Act 3 Turtle Block Deck (Barricade, Entrench) | Context Sensitivity |
|---|---|---|---|
| Logistic Regression (Linear / Tier List) | Demon Form (+0.0129 logit) | Demon Form (+0.0129 logit) | 0% (Deck context completely cancels out) |
| Hypergraph Neural Network (Ours) | Armaments (+1.01 flr advantage) | Demon Form (+0.26 flr advantage) | Dynamic Reversal (Adapts to survival vs scaling needs) |
In Act 1, Armaments upgrades basic cards to survive Gremlin Nob. In Act 3, Demon Form provides the necessary scaling to defeat the Awakened One. The Hypergraph model correctly reverses its recommendation; linear models cannot.
Results & Higher-Order Synergies
We computed combinatorial Shapley interaction indices across held-out runs to isolate 1-way, 2-way, and 3-way hyperedge values.
Result 1
Super-Additive Hyperedges
In the Exhaust engine, Corruption alone has a negative single value (-1.13 flr) due to exhausting starter skills.
When combined with Dark Embrace and Dead Branch, it yields a pure 3-way super-additive boost (+0.27 flr). Once the core is assembled, adding a payoff surges survival by +11.56 floors.
Result 2
The Trap Pick Landscape
Demon Form is the classic novice trap: spending 3 energy for 0 immediate output in early Act 1 yields a negligible +0.17 flr. In mature decks, it surges to +2.19 flr.
The model also discovered anti-synergies without human rules: pairing Clash with Ascender's Bane produces -0.18 flr because curses brick Clash.
Result 3
Emergent Archetype Discovery
The intermediate representations cleanly partition cards into four functional game clusters: Exhaust, Strength, Block / Body Slam, and Strike / Aggro.
The network learns functional card roles entirely from survival correlations across 12,500 games.
Archetype Hyperedge Engines
The Exhaust Engine
Adding the 3rd piece to Corruption + Dead Branch explodes survival straight into Act 3 contention.
The Block Infinite
Barricade + Body Slam pairs defense into lethal burst damage.
The Strength Engine
Limit Break doubles base strength, scaling Heavy Blade into a one-hit finisher.
| Card | Type | Win Rate | Act 1 Starter Δ | Mature Synergy Δ | Divergence | Diagnosis |
|---|---|---|---|---|---|---|
Demon Form | Power | 28.7% | +0.17 flr | +2.19 flr | +2.01 | TRAP PICK (Act 1) |
Limit Break | Skill | 31.5% | +0.37 flr | +1.52 flr | +1.15 | TRAP PICK (No Strength) |
Searing Blow | Attack | 17.5% | +0.15 flr | +0.20 flr | +0.05 | POOR IN ALL DECKS |
Body Slam | Attack | 34.3% | +0.63 flr | +3.77 flr | +3.14 | SYNERGY ENABLER |
Perfected Strike | Attack | 18.6% | +0.80 flr | +4.70 flr | +3.90 | ACT 1 TEMPO |
Armaments | Skill | 22.7% | +1.18 flr | +3.29 flr | +2.11 | UNIVERSALLY STABLE |
Feed | Attack | 32.5% | +0.73 flr | +2.83 flr | +2.10 | SNOWBALL SCALING |
Interactive Card Drafting
To evaluate card reward screens during live runs, we built an interactive pick evaluator
(scripts/pick_evaluator.py). Below are two real decision points:
Scenario 1 • Act 1 Floor 5
Starter Deck looking for Elite survival
Current Deck: 5x Strike, 4x Defend, Bash, Carnage + Burning Blood (Base: 5.1 / 56)
Takeaway: Drafting Corruption without skills or exhaust payoffs drops survival by nearly a full floor.
Scenario 2 • Act 2 Floor 24
Mature Exhaust Core with Dead Branch
Current Deck: Strikes, Defends, Shrug It Off, Corruption, Flame Barrier + Dead Branch (Base: 27.1 / 56)
Takeaway: With Dead Branch in inventory, Feel No Pain catapults expected survival straight to Act 3 Bosses.
Discussion
Modeling deckbuilding requires moving beyond flat vector features and static tier lists. By modeling runs as hypergraphs and framing evaluation around counterfactual draft choices rather than leaky end-of-run win rates, neural networks can uncover deep strategic structure.
The useful result is not a marginal benchmark lead. It is a representation that changes its recommendation when the deck changes, exposes higher-order interactions, and separates cards that are broadly strong from cards that only become strong inside the right engine.
References
- slay-the-spire-hypergraph: GitHub repository containing code, datasets, model weights, and interactive drafting evaluator.
- Zhou et al., Learning with Hypergraphs: Clustering, Classification, and Embedding, NeurIPS.
- Lee et al., Set Transformer: A Framework for Attention-based Permutation-Invariant Neural Networks, ICML.
- Mega Crit Games: creators of Slay the Spire and provider of public run dump data batches.
Searing Blow
Perfected Strike
Armaments
Feed