The developer of the chess analysis tool 'Dumay Khodom' encountered significant issues with LLMs, including Yandex GPT and DeepSeek, generating illegal chess moves. Despite prompt engineering, models frequently hallucinated moves that were not possible in the given board positions.
To address this, the developer implemented a validator using chess.js. The system extracts move tokens using regular expressions and verifies them against the board state. If a move is invalid, the model is prompted to rewrite the response; otherwise, a fallback rule-based comment is used.
The project includes 161 catalogs of chess tactics and openings. Initial manual review failed to catch errors, but a custom validation script identified issues such as impossible mechanics and mismatched explanations. Now, all generated data must pass an automated validation process.
The analysis engine was moved from serverless functions to the browser using a WASM-compiled Stockfish engine. This shift resolved server-side deployment issues and latency constraints, allowing the application to run directly on the user's device.
The developer also implemented a cleanup script to handle React hydration errors caused by hosting provider-injected HTML comments. Additionally, the platform uses IP-based rate limiting and a daily budget of 2000 AI requests to manage costs and prevent abuse.





