File size: 2,242 Bytes
b407b37
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
---
license: mit
library_name: pytorch
tags: [chess, reinforcement-learning, distilling-stockfish, tal]
---

# TalBot

A small (~7.3M parameter) chess **policy + value** network that plays in the
attacking style of **Mikhail Tal**, paired with a PUCT Monte-Carlo search so it
can actually calculate.

- Strength: **~2070 Elo** in a gauntlet against Stockfish (`UCI_LimitStrength`,
  Elo anchor 2000), 20 games, 1600 MCTS simulations/move, both colours.
- Style: predicts Tal's own move ~42% of the time on held-out games.

## Architecture

ResNet: 18 input planes → 128 channels × 10 residual blocks →
- policy head → 4096 logits (`from*64 + to`),
- value head → `tanh` in [-1, 1] from the side to move.

Search: batched PUCT MCTS (policy priors + value leaves).

## Training

1. **Distillation** from Stockfish (depth 8, MultiPV 4) on ~1.9M positions drawn
   from Lumbra's Gigabase (1950–1989) → general policy + value.
2. **Style adaption**: policy-head-only fine-tune (body and value frozen, lr 1e-4,
   8 epochs) on 123k positions where Tal was to move.

| stage | held-out policy top-1 | value MSE |
| --- | --- | --- |
| distillation | 38.0% | 0.055 |
| + Tal policy-head fine-tune | 42.1% (Tal moves) | — |

## Usage

```bash
pip install torch python-chess numpy
# net = ResNet (see src/talbot/model.py); load model.pt (state dict + channels/blocks)
# move generation via MCTS: src/talbot/mcts.py (CompactMCTS)
```

Or run it as a UCI engine (drop it into any GUI):

```bash
PYTHONPATH=src python -m talbot.engine --model model.pt --sims 1600 --batch 24
```

## Limitations

- Not a top engine. The Elo figure is anchored to Stockfish's limited-strength
  mode and measured over a small sample (20 games); treat it as ~2000 ± ~80.
- Style is a *prior bias*, not a reproduction of Tal's calculation. It prefers
  his openings and aggressive ideas, but cannot replicate his depth of sacrifice.
- The MCTS reference implementation is pure Python and is the main speed limit.

## Data & licensing

- Games: public PGN collections (Lumbra's Gigabase; a curated Tal collection).
- Labels: generated with **Stockfish** (GPLv3) used *only as an oracle*; no
  Stockfish binary is distributed here.
- Code and weights: **MIT**.