chess-qwen2.5-1.5b-legal-sft
chess move selection adapter
2 min readupdated
chess-qwen2.5-1.5b-legal-sft is a LoRA (a small add-on layer for a base model) built on Qwen2.5-1.5B-Instruct, trained to select the optimal chess move in UCI notation (for example, e2e4). The model takes the current board position in FEN notation and a sorted list of legal moves as input, and outputs exactly one best move with no extra text. This model is useful for chess bot developers and researchers studying the application of compact language models in tabletop games.
Key features
- Base model: compact LLM Qwen2.5-1.5B-Instruct fine-tuned using SFT (supervised fine-tuning).
- Output format: outputs strictly one move in UCI notation without additional explanations or formatting.
- Context: takes into account the current board layout and the list of permitted moves passed in the prompt.
- Efficiency: the small parameter count (1.5B) allows running the adapter on consumer GPUs.
What you can do
- Integrate the adapter into a custom chess bot to automatically select moves during a game.
- Conduct experiments to evaluate the playing strength of small language models in combination with the python-chess library.
- Test various chess positions and study the behavior of the model when generating moves.
Example
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
base_id = "Qwen/Qwen2.5-1.5B-Instruct"
adapter_id = "OscarSantosMu/chess-qwen2.5-1.5b-legal-sft"
tokenizer = AutoTokenizer.from_pretrained(base_id)
base_model = AutoModelForCausalLM.from_pretrained(base_id, device_map="auto")
model = PeftModel.from_pretrained(base_model, adapter_id)
model.eval()Read more
Details• Training method: SFT with LoRA (experiment e001_q25_1p5b_legal_20k_sft_s42)
• Dependencies: transformers, peft, torch, python-chess
• Limitations: intended for experiments, playing strength has not been validated by standard chess engine benchmarks










Comments