# Can SLMs play chess well?

**URL:** <https://devcommunity.amd.com/t/can-slms-play-chess-well/1261>\
**Category:** Showcase\
**Tags:** ai, rocm, developer-program, help, seek-feedback\
**Created:** [October 26, 2026, 9:27pm UTC](https://devcommunity.amd.com/t/can-slms-play-chess-well/1261 "2026-10-26T21:27:42Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![WALID\_ELONOK](https://dub1.discourse-cdn.com/amd/user_avatar/devcommunity.amd.com/walid_elonok/32/2070_2.png) [@WALID\_ELONOK](https://devcommunity.amd.com/u/WALID_ELONOK)\
**Post date:** [October 26, 2026, 9:27pm UTC](https://devcommunity.amd.com/t/can-slms-play-chess-well/1261/1 "2026-10-26T21:27:42Z")

</div>

I recently tried fine-tuning qwen-3.5-4b on chess… i started by SFT on a chess dataset (202,785 high-quality chess reasoning traces (candidate captures, checks, PV analysis, and best UCI moves)) then an RL pipeline (Trained with decoupled `-25.0` hard-cliff legality rewards, unscaled Dr. GRPO advantages (`scale_rewards="none"`, `loss_type="dr_grpo"`), $G=16$ exploration ($T=1.15$, $p=0.95$), and tactical hard-mining across checks, pins, and midgames.), and the best i got was two wins against sub 200 elo bots… and a single draw (with fallback if the model does an illegal move, as even through all my training it only maxed out at 92.7% legal move rate).  
On the bright side, fine tuning it with chess alongside high quality reasoning data did mean that it didn’t lose any reasoning capability.  
But the whole goal of this project was to get an llm that could beat my friend in chess, here is the huggingface repo with more detail ([Qwen-chess repo](https://huggingface.co/maxylium/chess-qwen35-4b-rl-v3)), if anyone here could give me feedback on how to better train a model for this task, it would be very well appreciated.

---

<div class="post-metadata">

**Author:** ![Abduallah\_Shukeir](https://avatars.discourse-cdn.com/v4/letter/a/a87d85/32.png) [@Abduallah\_Shukeir](https://devcommunity.amd.com/u/Abduallah_Shukeir)\
**Post date:** [October 27, 2026, 10:20am UTC](https://devcommunity.amd.com/t/can-slms-play-chess-well/1261/2 "2026-10-27T10:20:39Z")

</div>

The 92.7% legal-move rate seems worth isolating before another training run. As an illustration, if each of 40 model moves were independently legal with probability 0.927, the probability of all 40 being legal would be only about 4.8%. Actual errors need not be independent, so that is not an estimate of your win rate.

I would compare three conditions on the same held-out positions and paired games:

1. The raw model, with illegal moves counted explicitly.
2. The model choosing from the complete legal UCI move set generated from a trusted board state. Enforce that finite set in the final output rather than relying only on the prompt. Keep the full move history available for repetition-related outcomes.
3. Your current fallback configuration, logging every fallback invocation and which side selected the actual move.

That separates move legality, move quality, and the contribution of the fallback. Split the evaluation by source game rather than randomly splitting adjacent positions, and report illegal-move rate, forfeits, and game results separately.

A concrete implementation starting point is the [legal-move and UCI parsing API](https://python-chess.readthedocs.io/en/latest/core.html#chess.Board.legal_moves). This is a proposed diagnostic experiment; I have not run it on your repository.

---

<div class="post-metadata">

**Author:** ![Hakob\_Arzumanyan](https://dub1.discourse-cdn.com/amd/user_avatar/devcommunity.amd.com/hakob_arzumanyan/32/214_2.png) [@Hakob\_Arzumanyan](https://devcommunity.amd.com/u/Hakob_Arzumanyan)\
**Post date:** [October 27, 2026, 4:50pm UTC](https://devcommunity.amd.com/t/can-slms-play-chess-well/1261/3 "2026-10-27T16:50:01Z")

</div>

> [@WALID\_ELONOK](#):
>
> I recently tried fine-tuning qwen-3.5-4b on chess… i started by SFT on a chess dataset (202,785 high-quality chess reasoning traces (candidate captures, checks, PV analysis, and best UCI moves)) then an RL pipeline (Trained with decoupled `-25.0` hard-cliff legality rewards, unscaled Dr. GRPO advantages (`scale_rewards="none"`, `loss_type="dr_grpo"`), $G=16$ exploration ($T=1.15$, $p=0.95$), and tactical hard-mining across checks, pins, and midgames.), and the best i got was two wins against sub 200 elo bots… and a single draw (with fallback if the model does an illegal move, as even through all my training it only maxed out at 92.7% legal move rate).  
> On the bright side, fine tuning it with chess alongside high quality reasoning data did mean that it didn’t lose any reasoning capability.  
> But the whole goal of this project was to get an llm that could beat my friend in chess, here is the huggingface repo with more detail ([Qwen-chess repo](https://huggingface.co/maxylium/chess-qwen35-4b-rl-v3)), if anyone here could give me feedback on how to better train a model for this task, it would be very well appreciated.

Fun project, and nice that it kept its reasoning. Your table shows the RL stages didn’t move strength yet: v3 vs the SFT base is 31.2% vs 32.2% Stockfish top-1, and about 329 centipawn loss for both. I’d make legality structural instead of learned. At play time and during rollouts, only let the model pick from python-chess’s legal moves, by masking the move tokens or by scoring each legal move after and taking the best. Illegal moves become impossible, so the reward can be all about quality, like the Stockfish eval drop of the chosen move. For more strength per parameter, DeepMind’s ChessBench paper trained transformers of up to 270M parameters on Stockfish values for legal moves and reached 2895 Lichess blitz Elo against humans, without search.
