datafreak commited on
Commit
9269e61
路
verified 路
1 Parent(s): 226e1db

Model card: links, results, local setup

Browse files
Files changed (1) hide show
  1. README.md +46 -8
README.md CHANGED
@@ -3,13 +3,51 @@ license: apache-2.0
3
  base_model: convaiinnovations/laya
4
  tags: [chess, laya, decision-model]
5
  ---
6
- # Laya fine-tuned for chess
7
 
8
- [Laya](https://huggingface.co/convaiinnovations/laya) fine-tuned on DeepMind ChessBench action-values:
9
- for each legal move, a Laya `score` question predicts the side to move's win chance over 10 levels.
10
- The engine plays the move with the highest expected win chance (no search).
 
 
11
 
12
- - checkpoint: `final` (step 32000, 2,048,000 training examples)
13
- - latest eval: `{'val_loss': 1.3315, 'val_wp_mae': 0.082, 'top_move_acc': 0.26666666666666666, 'step': 32000}`
14
- - encoding / levels / prompt template: see `chess_meta.json`
15
- - code: github.com/devroopsaha744/LayaChess
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  base_model: convaiinnovations/laya
4
  tags: [chess, laya, decision-model]
5
  ---
6
+ # LayaChess: Laya fine-tuned for chess
7
 
8
+ [Laya](https://huggingface.co/convaiinnovations/laya) (Convai Innovations, ModernBERT-large, 421M) is a System 1
9
+ decision model that had never seen a chessboard. This checkpoint fine-tunes it on 2 million Stockfish-rated moves from
10
+ DeepMind's [ChessBench](https://github.com/google-deepmind/searchless_chess). For each legal move, a Laya `score`
11
+ question predicts the win chance of the side to move over 10 levels. The
12
+ [LayaChess engine](https://github.com/devroopsaha744/LayaChess) wraps it in a Monte Carlo tree search.
13
 
14
+ - **Play it online:** [huggingface.co/spaces/datafreak/laya-chess](https://huggingface.co/spaces/datafreak/laya-chess)
15
+ - **Write-up:** [LayaChess: teaching a System 1 decision model to play chess](https://devroopsaha744.github.io/portfolio/blog/laya-chess/)
16
+ - **Demo video:** [youtube.com/watch?v=bPpAlWArs7E](https://www.youtube.com/watch?v=bPpAlWArs7E)
17
+ - **Code:** [github.com/devroopsaha744/LayaChess](https://github.com/devroopsaha744/LayaChess)
18
+
19
+ ## Results
20
+ | | Base Laya | This checkpoint |
21
+ |---|---|---|
22
+ | Picks Stockfish's best move (300 held-out positions) | 6% | **27%** |
23
+ | Win-chance error (percentage points) | 28.6 | **8.2** |
24
+
25
+ Checkpoint `final`: step 32,000, 2,048,000 training examples. Encoding, levels and the question template are in
26
+ `chess_meta.json`. `train_state.pt` is the optimizer state for resuming training; inference doesn't need it.
27
+
28
+ ## Run it on your own machine
29
+ ```bash
30
+ git clone https://github.com/devroopsaha744/LayaChess.git
31
+ cd LayaChess/engine
32
+ python3 -m venv .venv && source .venv/bin/activate
33
+ pip install -r requirements.txt
34
+ python -m laya_chess.play # browser board at http://localhost:8000
35
+ ```
36
+ The engine downloads this checkpoint on first start. Optional: install Stockfish (`brew install stockfish` or
37
+ `sudo apt install stockfish`) to see its preferred move next to Laya's. Full steps are in the
38
+ [GitHub README](https://github.com/devroopsaha744/LayaChess#run-it-on-your-own-machine).
39
+
40
+ ## Use it from Python
41
+ ```python
42
+ import chess
43
+ from laya_chess import LayaChessModel
44
+
45
+ model = LayaChessModel("datafreak/laya-chess")
46
+ for move, win in model.score_moves(chess.Board())[:5]:
47
+ print(move, f"{win:.0%}")
48
+ ```
49
+
50
+ ## Credits
51
+ [Laya](https://github.com/NandhaKishorM/laya) by Convai Innovations (Apache 2.0) 路
52
+ [ChessBench](https://github.com/google-deepmind/searchless_chess) by Google DeepMind 路
53
+ [Stockfish](https://stockfishchess.org) 路 [python-chess](https://python-chess.readthedocs.io)