dopamineaddict's picture
Create README.md
e7e311f verified
|
Raw History Blame Contribute Delete
3.3 kB
metadata
language:
  - en
license: apache-2.0
tags:
  - chess
  - reinforcement-learning
  - supervised-fine-tuning
  - lora
  - trl
  - transformers
  - qwen
pipeline_tag: text-generation
base_model: Qwen/Qwen3-0.6B
datasets:
  - Lichess/chess-puzzles

dopamineaddict/qwen3-0.6b-chess-sft-v1

This model is a LoRA fine-tuned variant of Qwen/Qwen3-0.6B, trained to output chess moves in UCI format wrapped in <uci_move>...</uci_move> along with a short <rationale>...</rationale> explanation.
It was created as a baseline submission model for the AIcrowd Global Chess Challenge 2025.

Intended use

  • Intended for chess move selection in settings where the input includes:
    • A FEN position.
    • The side to move.
    • A list of legal moves in UCI.
  • Intended output format:
    • <uci_move>{legal_uci_move}</uci_move>
    • <rationale>{one-sentence explanation}</rationale>

How to use

Example (Transformers):

from transformers import AutoTokenizer, AutoModelForCausalLM
import torch, re

MODEL_ID = "dopamineaddict/qwen3-0.6b-chess-sft-v1"
tok = AutoTokenizer.from_pretrained(MODEL_ID, use_fast=True)
model = AutoModelForCausalLM.from_pretrained(MODEL_ID, torch_dtype=torch.float16, device_map="auto")
model.eval()

prompt = """Position (FEN): <YOUR_FEN>
Side to move: White
Legal moves: e2e4, g1f3, ...

Return exactly:
<uci_move>...</uci_move>
<rationale>...</rationale>
"""

inputs = tok(prompt, return_tensors="pt").to(model.device)
with torch.no_grad():
out = model.generate(**inputs, max_new_tokens=64, do_sample=False, temperature=0.0)

text = tok.decode(out, skip_special_tokens=False)
m = re.search(r"<uci_move>\s*([^<\s]+)\s*</uci_move>", text)
print("model_output:", text)
print("uci_move:", m.group(1) if m else None)

Training data

  • Primary dataset: Lichess/chess-puzzles.
  • Construction approach:
    • The puzzle FEN was converted into a “player-to-move” position by applying the first UCI move from the puzzle move list.
    • The supervised label was the next UCI move in the puzzle solution sequence.
  • Additional fields stored during data prep (varies by run): legal moves list, puzzle metadata, and optional Stockfish annotations.

Training procedure

  • Method: supervised fine-tuning (SFT) with LoRA adapters.
  • Trainer: TRL SFTTrainer.
  • Objective: maximize format compliance and legality (always emit a legal UCI move wrapped in <uci_move> tags).
  • Hardware: single NVIDIA T4 GPU (typical for initial iteration).

Evaluation

This model was primarily validated via:

  • Format compliance checks (presence of <uci_move> and parsable UCI).
  • Legality checks (output move exists in the provided legal moves list for that position).
  • Quick qualitative checks on held-out puzzle positions.

No Elo or engine-match benchmark is reported for this baseline version.

Limitations and biases

  • The model is trained mostly on tactical puzzle positions and may be weaker in quiet/opening positions.
  • The <rationale> field may be repetitive or generic in this version; it is not optimized for explanation quality.
  • This is not a substitute for a full chess engine and can still choose suboptimal moves.

License and attribution

  • Base model: Qwen/Qwen3-0.6B (see upstream license and terms).
  • Puzzle data: derived from the Lichess puzzles dataset.