5 ms·
Spawkfish: Neural network chess
- willlll 11y agoYou can play against the bot online at http://spawk.fish/play/ http://spawk.fish/play/ I lost, but I'm bad at chess.
- spawkfish 11y agoHello, I'm the creator of spawkfish :) The project is still in pretty early stages, so don't expect it won't take down any strong chess players yet, but I'm hoping that with a bit of effort it will be possible for neural networks to do for chess what they have recently done for Go.
- daveguy 11y agoThese types of engines always interest me. I have a few questions: 1) Is it open source? Link to github? 2) Is the architecture similar to the go engine? 3) is there an alpha-beta pruning search tree at the core? If so, is that part from an exising engine? 4) do you have an estimate of its elo rating? 5) are you training or have you trained on available data sets? Are you training on user games? Are opening and closing libraries used?
- spawkfish 11y ago1) Its not open source. I'll consider releasing the code at some point when the project is more mature. 2) The Go engine has a lot of pieces I don't have yet. What I have is similar to the policy network from the Go engine, but right now I don't have anything like the value network or the rollout parts. Also, 3) The current engine has no search at all. Behind the scenes the network ranks all of the moves, and then I walk down the list and choose the highest ranked legal move. The top ranked move is almost always valid, but occasionally one or two need to be rejected. It's very very rare to need to search outside of the top 5. Search is definitely on the agenda, but I am pleasantly surprised at how well it plays without it. 4) Not yet :) 5) I'm using kingbase for training data (http://www.kingbase-chess.net/ http://www.kingbase-chess.net/)
- cven714 11y agoVery interesting! It played very natural, "human" positional moves and defended against most obvious threats. There was one exception, where it played a move that looked normal for the position--developing a piece in the opening--but it also hung the piece. That was the only serious blunder, every other mistake was in tactical lines more than one or two moves deep. That seems to make sense for being trained by a NN, still impressive how well it was able to spot concrete threats! Thank you for sharing. (My elo is 2150ish)
- spawkfish 11y agoThanks for your feedback! I've noticed it making quite a few errors like the one you mention. I think that a little bit of search (say just one or two ply) will help a lot with avoiding this kind of mistake, because the network seems very good at recognizing when a piece is in trouble if you show it the position.
- jicks 11y agoA very interesting project. One remark: although I'm admittedly a poor chess player, I managed easily to get a draw by threefold repetition even though Spawkfish could have avoided that easily (and still destroy me). Am I correct to assume Spawkfish don't take past moves into accounts?
- spawkfish 11y agoYes that is correct, and being tricked into draw by repetition is one of his current weaknesses :)
- binarymax 11y agoI won :) 4R2k/p5p1/7p/n4Q2/7q/2PP1P2/Pr3P1P/5RK1 b - - 6 27 EDIT - for context, I was about 1900 USCF in my prime 20 years ago - still do puzzles daily. In any case, I think this is cool. I was also surprised it managed to play efficiently given the load you must be feeling from HN. Thanks for making this and showing it!
- bainsfather 11y agoNormally against a chess computer, you try to play positionally and avoid tactical situations - i.e. you avoid its strengths and target its (relative) weakness. It is nice (and also rather uncanny) to be in the opposite situation here. Positionally it looks good, tactically, not so good. A great project!
- adamt 11y agoThat was really impressive. Other than playing very accurately, I felt it played far more human-like than most computer chess engines. I've written several chess engines, and have often wondered for some time whether or not there was a chance for a more AI/pattern-driven approach. Are you using your AI just for evaluation? E.g. do you have a traditional PVS/negascout (or similar) search? Presumably an 'extreme Type C' (no search) would fail to recognise various draws (50 move/repetition)? Good work :-)
- spawkfish 11y agoThanks! Right now I have just about as close to an "extreme type C" engine as possible. There is a neural network that maps from a board position directly to a ranked list of moves it wants to make., and a little bit of logic on top of that to reject illegal moves. The recognition of wins/draws/losses is actually done in a layer around the engine, which doesn't understand these things yet. One of "tricks" it is vulnerable to right now is being forced into a draw by repetition, because doesn't know that is a thing to avoid. Adding a more traditional search (augmented by the network, of course) is on my todo list, and I think it will improve the playing strength a lot. I am pleasantly surprised though, at how well it plays without any of that.
- zardo 11y agoIt would be interesting to see how strength and "human like play" scales with the depth of the search. There's also a really interesting possibility in training policy networks with different attributes by using games from players with certain styles of play.
- spawkfish 11y agoTraining different policies in different styles is a really interesting idea. You could then have a gating process that first chooses the "style" of move to make and then uses the style-specific network to select a move. I think getting data for this could be difficult though. I wonder how easy it would be to automatically categorize a game record by "style"?
- mathattack 11y agoVery nice! The only thing missing is a Back button to allow me to back out of mistakes. :-) I believe that chess follows the state of the art in AI. The first wave of success was based on brute force of computing better than people. Now it's harnessing insight. Keep up the interesting work!
- agarden 11y agoIn my game[0] it played well until it hit a position where it seemed to run out of ideas. At that point, it let me take its queen for a rook. The strange thing was that it felt like playing my five year old, who also plays well until he runs out of ideas and then just sacrifices a piece. It also missed the kind of tactics that my kid misses and played surprisingly human like mistakes. Note move 35... Rxf2, as if it forgot about the bishop because it had moved to the other end of the board. That's the kind of mistake a human player might make and computers never do. It strikes me that this would be a great engine for my five year old to practice against. I'd love to see it added to lichess or put into a phone app for that purpose. 0. http://en.lichess.org/beOA0Q2T#68 http://en.lichess.org/beOA0Q2T#68
- anaolykarpov 11y agoI won (hardly, after I had 3 pawns against a knight during mid game) and I don't think I'd reach 1600 elo if I were to play in tournaments. My elo is about 1620 on chesstempo, where I solve tactics quite often (daily, during the last 8 weeks or so)
- dfan 11y agoVery nice! It may be annoying, but I think at some point you really will need to keep track of castling rights and en-passant (position repetition is much harder but I don't think it is so necessary). Some evaluations depend very heavily on them.
- spawkfish 11y agoOh, absolutely. The project is still in very early stages right now, so a lot of important pieces are still missing.
- torthrw 11y ago4RR2/1p4p1/p1p5/2p3p1/2P2kP1/7P/PP1r1P1K/8 b - - 2 31 Cool project but not hard to beat.
- jhartmann 11y agoSeems very interesting, I really think these approaches will work rather well on a variety of games. Very exciting times. Btw, there is another already Open Source Neural Network Chess engine that might be worth exploring for similar ideas. That codebase already has a minmax search based on the network evaluation. Paper is at: http://arxiv.org/abs/1509.01549 http://arxiv.org/abs/1509.01549 Code is at: https://bitbucket.org/waterreaction/giraffe https://bitbucket.org/waterreaction/giraffe
- spawkfish 11y agoThanks for the tip :) I read this thesis when I started spawkfish, and it's very nice work.
- mkohlmyr 11y agoDefinitely wasn't pretty. 1k2Q3/5Q2/8/2p5/3p4/1B1P2p1/2K5/8 b - - 5 56
- sabujp 11y agoIt's pretty weak right now (I'm white) defeated it in less than 30 seconds : [Event "Spawkfish game"] [Date "2016.03.03"] [White "YOU!"] [Black "Spawkfish"] [Result "1-0"] 1. e4 e5 2. Nf3 Nc6 3. Bc4 Nf6 4. Nc3 Nxe4 5. Bxf7+ Kxf7 6. Nxe4 d5 7. Neg5+ Kg8 8. d4 exd4 9. Nxd4 Nxd4 10. Qxd4 Qe7+ 11. Be3 h6 12. Qxd5+ Qf7 13. Qxf7# 1-0 My 1 min rating on licchess is ~1550 <-> 1700, but I can sometimes defeat any players rated 1.8k - 2k at 1 min blitz.
- tvelichkov 11y agoFor a first time I'm actually having fun playing against a computer :D.