Qwen-3.5-2B Chess RL (GRPO)

Overview

This is a fine-tuned version of Qwen-3.5-2B on chess move prediction using Group Relative Policy Optimization (GRPO) with Stockfish as the reward signal. This is an RL fine-tuned model that builds upon the SFT checkpoint.

Model Details

  • Base Model: Qwen/Qwen3.5-2B (SFT checkpoint: checkpoint-5940)
  • RL Method: Group Relative Policy Optimization (GRPO)
  • Reward Signal: Stockfish (depth=10, 1 thread)
  • Sequence Length: 1024 tokens
  • Precision: bfloat16

GRPO Hyperparameters

Parameter Value
Beta (KL control) 0.1
Epsilon (clip range) 0.2
Learning Rate 1e-6
Samples per prompt 4
Epochs 1

Training Configuration

SFT Pre-training

  • Learning Rate: 1e-5
  • Batch Size: 4 (per device)
  • Epochs: 3
  • Scheduler: Cosine with 100 warmup steps

RL Fine-tuning (GRPO)

  • Learning Rate: 1e-6
  • Batch Size: 2 (per device)
  • Gradient Accumulation: 2
  • Max Steps: 2500
  • Logging Steps: 10
  • Save Steps: 500

Dataset

The RL training was performed on a split of the ChessInstruct dataset with the following task categories:

  • FIND_NEXT_BEST_MOVE
  • FIND_ADVANTAGED_PLAYER
  • FIND_FINAL_SCORE
  • MLM_ON_MOVES
  • FIND_LAST_MOVE
  • SORT_FENS

Usage

from transformers import AutoTokenizer, AutoModelForCausalLM
import torch

model_name = "GL3MON/Qwen3.5-2B-chess-rl-grpo"

tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(
    model_name,
    torch_dtype=torch.bfloat16,
    device_map="auto"
)

# Example: Generate chess moves
messages = [
    {"role": "system", "content": "You are a chess assistant. Provide the best move in SAN format."},
    {"role": "user", "content": "What is the best move for white in the position: rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1?"}
]

input_ids = tokenizer.apply_chat_template(messages, return_tensors="pt").to(model.device)
outputs = model.generate(input_ids, max_new_tokens=50, temperature=0.7, do_sample=True)
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(response)

Training Pipeline

  1. Step 1: SFT - First trained on ChessInstruct using Supervised Fine-Tuning
  2. Step 2: RL - Further fine-tuned using GRPO with Stockfish reward

License

MIT License

Citation

@software{ChessLM2026,
  title = {ChessLM - Qwen-3.5-2B Chess Assistant (RL GRPO)},
  author = {GL3MON},
  year = {2026},
  url = {https://huggingface.co/GL3MON/Qwen3.5-2B-chess-rl-grpo}
}

References

Downloads last month
12
Safetensors
Model size
2B params
Tensor type
BF16
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for GL3MON/Qwen3.5-2B-chess-rl-grpo

Finetuned
Qwen/Qwen3.5-2B
Finetuned
(307)
this model

Collection including GL3MON/Qwen3.5-2B-chess-rl-grpo

Paper for GL3MON/Qwen3.5-2B-chess-rl-grpo