Downloads · 30 days
8
8% of all-time downloads
dbest-isi/searchless-chess-9M-dpo
searchless-chess-9M-dpo is a reinforcement learning model from dbest-isi. Use it for the reinforcement learning task on the model card, and read the license before you ship it in a product. It is set up for jax. The card lists the license as apache-2.0.
This is a 9 million parameter transformer-based chess engine trained using Direct Preference Optimization (DPO) with mistake-focused self-play and Stockfish supervision.
Downloads · 30 days
8
8% of all-time downloads
All-time downloads
99
Public
Repo size
35.8 MB
Likes
1
Public
Click a slice to open those files.
.npz35.8 MB · 100%
From the Hugging Face model README
This is a 9 million parameter transformer-based chess engine trained using Direct Preference Optimization (DPO) with mistake-focused self-play and Stockfish supervision.
After just 1 iteration of DPO training:
Puzzle Solving:
Head-to-Head Games (50 games):
from searchless_chess.src import hf_model
from huggingface_hub import snapshot_download
# Download model
model_path = snapshot_download(
repo_id="dbest-isi/searchless-chess-9M-dpo",
local_dir="./chess_model"
)
# Load model
model = hf_model.SearchlessChessModel.from_pretrained("./chess_model")
# Predict move from starting position
fen = "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1"
result = model.predict(fen)
print(f"Best move: {result['best_move']}")
print(f"Q-value: {result['q_value']:.4f}")
Required dependencies:
pip install jax jaxlib dm-haiku orbax-checkpoint numpy huggingface-hub python-chess
Direct Preference Optimization (DPO) is a preference-based learning algorithm that directly optimizes the policy without requiring a separate reward model. The training process:
The DPO loss for action-value models:
log π(a|s) = Q(s,a) / τ - log(Σ exp(Q(s,a') / τ))
Loss = -log sigmoid(β * (log π_θ(chosen|s) - log π_ref(chosen|s)
- log π_θ(rejected|s) + log π_ref(rejected|s)))
Where:
The model was trained using mistake-focused self-play:
Strengths:
Current Limitations:
Future Work:
| Metric | Base 9M | DPO-trained | Improvement |
|---|---|---|---|
| Puzzle Accuracy | 87% | 88% | +1% |
| Head-to-Head Win Rate | 43% | 57% | +14% |
| Elo Rating | Baseline | +25 | +25 Elo |
Based on the Searchless Chess work by DeepMind Technologies Limited:
@article{ruoss2024grandmaster,
title={Grandmaster-Level Chess Without Search},
author={Ruoss, Anian and others},
journal={arXiv preprint arXiv:2402.04494},
year={2024}
}
DPO algorithm from:
@article{rafailov2023direct,
title={Direct Preference Optimization: Your Language Model is Secretly a Reward Model},
author={Rafailov, Rafael and Sharma, Archit and Mitchell, Eric and Ermon, Stefano and Manning, Christopher D and Finn, Chelsea},
journal={arXiv preprint arXiv:2305.18290},
year={2023}
}
Apache 2.0