r/ComputerChess • u/Any_Illustrator3875 • 7h ago
Can you find examples of a tactic in a pile of PGNs just by naming it? I tried it on 150 of Magnus's blitz games.
Say you want a few knight forks from your own games to study. You remember the idea, but you have no idea which games to open. I wanted to see if I could type “knight fork” and get a shortlist of boards worth looking at.
I tested that on 13,338 positions from 150 of Magnus's Lichess blitz games. I embedded each position and each search phrase as a 512-dimensional vector and ranked the positions by how close they were to the phrase. Then I checked the top 30 for each query with python-chess rules over the next 8 plies of the game and with Stockfish.
• “back rank mate” returned all 3 mates played along the king's own back rank at ranks 2, 8 and 10. Six of the other seven hits were mates too, including 43...Ra3# down the a-file. I counted rook or queen mates along the back rank. None had the classic pawn wall.
• “knight fork” found 3 forks that win material, at ranks 3, 7 and 21.
• “queen sacrifice” put a bishop sac first (16.Bxg6 fxg6 17.Qxg6+). The only queen sac I verified in the top 30 was at rank 25 (18...Qxd4! 19.cxd4 Nf3+). My guess is that a sacrifice is harder to pick up from a single position because the payoff comes later.
I also tried using Knight, our chess-tuned language model, as a yes/no judge. It answered 66 of 90 requests. Only 4 of its 14 yeses checked out, and it said no to 18...Qxd4. I'd use embeddings to get the shortlist, then verify it with python-chess and Stockfish.
Embedding all 13,338 positions cost 53 cents, once. Stockfish ran locally.
I work on ChessDrive, which makes both the embedding model and Knight. Happy to share the rule checker in a comment.