Lobsters - 02 Dec 2026
Page 3 of 3
There are many ways in which more compute can be traded for more playing strength. Generally, you have to spend more compute than you get playing strength back, so it saves a lot of time to avoid spending more compute when the model is weak and there are low-hanging fruit for improvement, and only spend once it becomes necessary. I applied this idea to several axes:
- Searching more positions per move makes the self-play slightly stronger3, but is only needed towards the end of training when the network is so strong that its raw predictions approach the strength of the network with search, inhibiting its ability to continue learning. The majority of training used 64 positions per full move and 16 positions per fast move, and probably could have worked with even less compute. The search budget was stepped up over time, ending at 256 positions per full and 32 positions per fast move. For reference, AlphaZero uses 800 positions searched for every move.
- Larger networks can reach higher strength but require more data to train and are slower to evaluate. I trained 3 networks in sequence with ~0.44M, ~1.2M, and ~5.4M parameters, achieving self-play winrates of ~55%, ~78%, and ~85% respectively. Once the smaller network is trained, the larger network can quickly surpass its strength by using it as a teacher. First, we can pretrain the larger network on the smaller network's generated games and training labels. This is a commonly used technique, applied by e.g. KataGo and Leela Chess Zero. Then, the smaller network can be evaluated on the large network's games to help it bootstrap more quickly. I used kickstarting, a simple form of on-policy distillation which mixes the teacher's prediction into the training labels, until the student's strength exceeded the teacher's.
- At the very start of training, I allowed the search to "savescum" by giving it knowledge of future RNG outcomes. This improves play strength not just by having the advance knowledge, but also by avoiding wasting search budget on sampling RNG. In the end, this did not end up being very useful and was turned off early, because savescumming confers an absurdly large advantage to the player (the tiny network quickly hit 88% winrate, and dropped back down to ~40% when savescumming was turned off). I also found that optimal savescumming strategies did not correspond well to good strategies for the real game with randomness, as they overly relied on finding out the outcomes from the search.
To train the model, we need to store a large replay buffer of training examples across a large number of games to ensure each batch has a good mix of training data. At the end of training, I used a replay buffer of 10M states, but a naive storage of the raw training data would take about 7-8 KB per state, which is way too large for my machine. I used the following compression techniques:
- Each training sample stores its labels for the outcome and HP distributions, per-floor HP, and policy. The value distributions were quantized to an 8-bit fixed-point format, which has more than good enough quality considering distribution values all lie between 0 and 1. Only the nonzero interval of each value distribution was stored. This reduced the size of the targets from ~1.5 KB/sample to ~120 bytes/sample.
- For storing the game logs on disk, each game can be stored as a seed and the sequence of actions taken in the game, and can be reconstructed by replaying the actions from the start. Each action can be packed into a 32-bit value, compressing the game log data itself down to 4 bytes per move. For use in the replay buffer, we also need to store the training targets for each full search move, making for ~140 bytes per training state.
- The buffer contents need to be loaded into memory for fast access in training, but the compressed disk format above takes a significant amount of compute to decompress it (replaying the game and encoding the token sequences), making it unsuitable for this purpose. However, we can still store the data efficiently by keeping a common dictionary of tokens which are referenced by index in replay buffer states. Most tokens, especially cards and relics, are shared between many different states, leading to a high degree of reuse. This compression scheme achieved about ~550 bytes/state.
Search in an AlphaZero setting is difficult to efficiently implement as described. In most abstract descriptions of search algorithms, the search tree/graph is expanded one node at a time, and each node needs a GPU evaluation, leading to many roundtrips between CPU and GPU. This naive approach also does not utilize the GPU properly, which is much more efficient at processing large batches in parallel.
In self-play, these issues can partially be addressed by playing many games simultaneously. On my 8-core, 16-thread machine, I ran 14 worker threads each running hundreds of self-play games. In each search, network evaluation requests were submitted into a queue, and separate threads packed the requests from the queue into larger batches and passed them to the GPU. The latency of GPU network evaluations is hidden by having many games in flight.
The large game count is still not enough to fully utilize the GPU, and does not apply to the single-game setting, so we additionally allow multiple searches in the same game tree using virtual visits. In self-play, up to 4 nodes per candidate move's subtree were allowed to be visited in parallel. For the single-game evaluation, much more parallelism needs to be extracted, and the strength penalty is not as large for a large simulation count, so 2048 parallel nodes per candidate were allowed. Both the above techniques are standard in AlphaZero-esque setups.
On the GPU side, the model is small enough that its weights in FP16 fit comfortably in my GPU's L2 cache, and it has high arithmetic intensity, so it was relatively easy to get high compute utilization. The kernel achieved about 75% MFU in self-play after discounting padded attention operations.
I am not sure why anyone would read this very long article, but hopefully it was informative.
Much more is still possible. I have many ideas for further improving the engine's performance, and of course the other three characters are still unexplored. I am excited to continue developing the engine and sharing the results.
- There are three situations I am aware of where hidden information is leaked to the engine.
- When defeating the burning elite with Black Star, any potion reward generated is dropped due to the limit of 5 rewards per reward screen, but the potion chance is still updated. The game passes the potion chance to the engine regardless.
- When fighting The Maw with Incense Burner activating on turn 2, it is impossible to distinguish the small (5) and big (30) hit intents until later in the fight. However, the game directly passes the enemy intent to the engine whenever Runic Dome is not owned. This can also similarly happen for enemies whose attack damage is randomized (Louse, Darklings).
- When in an event fight which has a relic reward (Colosseum, Mind Bloom etc.), the relic reward is determined at the start of the fight and removed from the relic pool. The information about the relic pool is passed to the engine, which could be used in principle by deducing that relics still in the pool will not be given as the reward. The network is unable to take advantage of this hidden information, however, as it is not given the relic pool as input.
Each of these situations occur very rarely, and their knowledge gives a very small advantage to the player, so the overall impact on winrate is negligible.
- In the absence of other effects like Juggernaut.
- Towards the end of training, the observed scaling was very roughly 1 percentage point of winrate per quadrupling of search budget.
Previous page | More Lobsters | Headlines
Original: https://8e9f.github.io/amber_eye/