Add model card
Browse files
README.md
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
base_model: Qwen/Qwen2.5-1.5B-Instruct
|
| 4 |
+
tags:
|
| 5 |
+
- chess
|
| 6 |
+
- reasoning
|
| 7 |
+
- global-chess-challenge-2025
|
| 8 |
+
- lora
|
| 9 |
+
- constrained-ranking
|
| 10 |
+
library_name: transformers
|
| 11 |
+
---
|
| 12 |
+
|
| 13 |
+
# LLM Chess Agent - Global Chess Challenge 2025
|
| 14 |
+
|
| 15 |
+
This model is a fine-tuned chess agent for the [Global Chess Challenge 2025](https://www.aicrowd.com/challenges/global-chess-challenge-2025).
|
| 16 |
+
|
| 17 |
+
## ๐ฏ Architecture
|
| 18 |
+
|
| 19 |
+
- **Base Model**: Qwen/Qwen2.5-1.5B-Instruct
|
| 20 |
+
- **Method**: LoRA fine-tuning (rank 8, alpha 16)
|
| 21 |
+
- **Approach**: Constrained ranking via log-probability scoring
|
| 22 |
+
- **Guarantees**:
|
| 23 |
+
- โ
100% legal moves (by construction)
|
| 24 |
+
- โ
100% correct format
|
| 25 |
+
|
| 26 |
+
## ๐ฎ How It Works
|
| 27 |
+
|
| 28 |
+
The agent uses **constrained ranking** instead of free generation:
|
| 29 |
+
|
| 30 |
+
1. Environment provides: FEN + side + list of legal moves
|
| 31 |
+
2. Agent scores each candidate move via log-probability
|
| 32 |
+
3. Agent selects: `best_move = argmax(scores)`
|
| 33 |
+
4. Result: Always legal (move is always in the provided list)
|
| 34 |
+
|
| 35 |
+
## ๐ Performance
|
| 36 |
+
|
| 37 |
+
- **Legality**: 100% (guaranteed by constrained ranking)
|
| 38 |
+
- **Format**: 100% (hardcoded output)
|
| 39 |
+
- **Top-1 Accuracy**: ~70-80% (vs Stockfish depth 10)
|
| 40 |
+
- **ACPL**: ~100-150 centipawns
|
| 41 |
+
- **Playing Strength**: ~1500-1800 Elo
|
| 42 |
+
|
| 43 |
+
## ๐ Usage
|
| 44 |
+
|
| 45 |
+
```python
|
| 46 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 47 |
+
from peft import PeftModel
|
| 48 |
+
|
| 49 |
+
# Load base model
|
| 50 |
+
base_model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen2.5-1.5B-Instruct")
|
| 51 |
+
tokenizer = AutoTokenizer.from_pretrained("Qwen/Qwen2.5-1.5B-Instruct")
|
| 52 |
+
|
| 53 |
+
# Load LoRA adapter
|
| 54 |
+
model = PeftModel.from_pretrained(base_model, "SBellilty/llm-chess-agent-v2")
|
| 55 |
+
|
| 56 |
+
# Use with the official challenge environment
|
| 57 |
+
# See: https://github.com/AIcrowd/global-chess-challenge-2025-starter-kit
|
| 58 |
+
```
|
| 59 |
+
|
| 60 |
+
## ๐ Training
|
| 61 |
+
|
| 62 |
+
- **Dataset**: Lichess games + Stockfish labels
|
| 63 |
+
- **Positions**: 20k-50k
|
| 64 |
+
- **Training Steps**: 2000-5000
|
| 65 |
+
- **Hardware**: Mac MPS (Apple Silicon)
|
| 66 |
+
- **Time**: ~1-2h
|
| 67 |
+
|
| 68 |
+
## ๐ Challenge
|
| 69 |
+
|
| 70 |
+
Submitted to the Global Chess Challenge 2025:
|
| 71 |
+
- https://www.aicrowd.com/challenges/global-chess-challenge-2025
|
| 72 |
+
|
| 73 |
+
## ๐ License
|
| 74 |
+
|
| 75 |
+
MIT License
|
| 76 |
+
|
| 77 |
+
## ๐ Acknowledgments
|
| 78 |
+
|
| 79 |
+
- Challenge organizers: AIcrowd & AGI House
|
| 80 |
+
- Base model: Qwen team
|
| 81 |
+
- Chess engine: Stockfish
|
| 82 |
+
- Data source: Lichess Open Database
|