Jialeiv commited on
Commit
c6e02b7
Β·
verified Β·
1 Parent(s): 101a9a4

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +59 -0
README.md ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ library_name: pytorch
4
+ tags:
5
+ - reinforcement-learning
6
+ - game-ai
7
+ - slay-the-spire
8
+ - reinforce
9
+ - policy
10
+ ---
11
+
12
+ # sts-rl-agent β€” a learned non-combat policy for Slay the Spire
13
+
14
+ To our knowledge, the **first working learned policy published for [sts_lightspeed](https://github.com/gamerpuppy/sts_lightspeed)** β€” the fast C++ Slay the Spire simulator, which ships a 412-dim neural-network observation interface (`NNInterface`) but no trained weights.
15
+
16
+ A small MLP (~100k params, `[128,128]`, trained from scratch with REINFORCE) makes **all non-combat decisions** β€” map pathing, card rewards, shops, campfires, events β€” while the simulator's built-in MCTS plays combat.
17
+
18
+ ## Headline result
19
+
20
+ Same MCTS combat, same 50 held-out seeds, A0 Ironclad β€” only the non-combat "brain" differs:
21
+
22
+ | non-combat decisions | combat | avg floor | win rate |
23
+ |---|---|---|---|
24
+ | stock bot heuristics (map = random) | MCTS @50000 | 31.2 | 6% |
25
+ | **this model** | MCTS @50000 | **42.5** | **14%** |
26
+
27
+ The learned non-combat layer is worth **~11 floors** over the stock bot: its biggest weakness was never combat, it was walking the map at random.
28
+
29
+ ## Files
30
+
31
+ | file | what |
32
+ |---|---|
33
+ | `armG_model_G128x128_15k.pt` | **the non-combat policy** behind the headline number (15k games) |
34
+ | `armG_model_G128x128.pt` | earlier 8k-game checkpoint |
35
+ | `armS_card_vocab.json` | card vocabulary (required to encode candidates) |
36
+ | `armB_model_B256x256.pt` | combat behavior-cloning model β€” **negative result** (floor ~12 vs teacher 23) |
37
+ | `armB_model_VAL256x256.pt` | combat value net β€” negative result (1-ply lookahead: floor ~8) |
38
+ | `armB_model_ATTN_d64L2.pt` | combat attention model β€” negative result (floor ~14) |
39
+
40
+ The combat models are published on purpose: six different attempts to distill MCTS combat into a feed-forward network all failed the same way (imitation caps at 0.44 train accuracy β€” the MCTS teacher effectively sees the future draw order; a one-frame policy can't). *Judgment*-type decisions compress into small networks easily; *planning*-type decisions resist.
41
+
42
+ ## Usage
43
+
44
+ Input is `obs(412) βŠ• candidate-descriptor(368)` β†’ scalar score per candidate; pick the argmax. You need the patched simulator and the encoding code β€” **full code, sim patch, training scripts and eval protocol: [github.com/valiant-wjl/sts-rl-agent](https://github.com/valiant-wjl/sts-rl-agent)**.
45
+
46
+ ```python
47
+ import torch
48
+ from agent.armG_train import Scorer, build_choices, obs_vec # from the GitHub repo
49
+ net = Scorer((128, 128))
50
+ net.load_state_dict(torch.load("armG_model_G128x128_15k.pt", weights_only=True))
51
+ ```
52
+
53
+ ## Limitations
54
+
55
+ - A0 (lowest difficulty), Ironclad only (the simulator only fully implements Ironclad).
56
+ - Combat is still search (MCTS), not learned.
57
+ - Single-run numbers on 50 fixed seeds, no confidence intervals.
58
+
59
+ Slay the Spire is a trademark of Mega Crit Games; this is an unaffiliated research project on a clean-room simulator (MIT).