Solving poker in custom WebGPU kernels (phulin.me)
I wanted to build a poker solver that I could host for ~free. This meant running client-side, where the best browser technology is WebGPU. The tensor library I wanted did not exist, but in the LLM era we sometimes don't need libraries at all. I had Codex turn my thousands of lines of PyTorch code into custom WebGPU kernels with parity tests. Codex then spent days optimizing those kernels.
You can use the solver at https://holdem.computer, and the source is at https://github.com/phulin/poker2.
12 comments
[ 0.30 ms ] story [ 28.2 ms ] threadPioSOLVER doesn't use any abstractions or cutoff functions. It just solves the whole game without any simplifications other than allowed bet sizes. The cost is rather large RAM requirements. The advantages is that it's very precise and produces exact results for every hand (it doesn't bundle them).
>A more modern approach instead “re-solves” each spot to a limited search depth and uses a neural network as an approximation function at the depth cutoff.
This sounds very interesting, I'd love to hear more about it. A few years ago a wrote a solver that worked by reducing the entire game tree. It was slow, and couldn't do preflop. It sounds like these re-solves allow preflop solves with needing a massive tree?
The other question I have is how do human players adapt to GTO play now? Like in other games, humans have adapted to novel strategies - I'm curious for poker whether there's ways to exploit GTO solvers (ie, if you put your opponent bot on the GTO range and chase the fat tails). And is the poker community's fair play detection algorithm good enough to catch players who use solvers like chess community - or it's easy to evade by making a few deviations. Much thanks!
In the poker subreddits the rake question comes up from time to time, and with the low cost and high quality of inference I have been considering making rake-free poker. The model is a small monthly subscription like $4.99/month for low stakes $9.99/month for mid stakes, one account per player, 20 tables max.
This actually would make a lot of marginally losing spots into winners, and there are a lot of coin flips where after rake both players lose. So if you keep coin flipping, you just lose over time. (But you don't want to fold and give up your equity for free either.)
The thing that gives me pause is that a lot of people cheat using solvers during hands, bots, or collusion.
Is there anything I could do at a practical level to keep the game fair? (no tools, no bots, no collusion.)