chess-pgn-2400plus-rl

chess-pgn-2400plus, a character-level PGN transformer trained only on Lichess games of 2400+ players, fine-tuned to play the moves that won while staying on human lines. Same architecture, same files, same usage as the starting model; only the weights differ.

Method

Offline, outcome-weighted imitation on the band's own human games: no self-play, no engine, no rollouts.

  • Games: the starting model's own 2400+ training games, the ones that ended normally (not on time, abandoned or by a rules infraction); 6,169,600 games, one pass.
  • In each decisive game the model is the winner, and only the winner's moves get a loss: the ordinary next-character cross-entropy on each move's characters. The loser's moves and the move numbers are context only. In a drawn game the model is a random side, at weight 0.5.
  • Plus 0.01 x KL(policy || starting model) at the same characters, so it stays close to the human distribution it started from. AdamW, learning rate 1e-05, 256 games per step.

Every gradient step moves probability onto a move a human actually played, so the model cannot learn moves no human would play; it shifts toward the human moves that won. The reward is the game result alone.

Results

This model and the starting model, evaluated with the same code: chess_beyond/transcend/pgn/eval.py in AriSpiesberger/Memorize, which also has the training script (rl_pgn_games.py).

Games against Lichess's Stockfish levels 1, 3, 5, 7 and 8 (Fairy-Stockfish), 100 games per level from 50 openings; Glicko-2 rating over the calibrated levels 1, 3 and 5 (95% interval: about +/-74 each).

temperature chess-pgn-2400plus this model change
0.001 1790 1885 +95
0.01 1778 1969 +190
0.1 1735 1861 +126
1 1278 1405 +127

Puzzles (Lichess puzzles with their game history; 2,000 each at ratings 1050, 2400, 2600, 2800), puzzle rating:

temperature chess-pgn-2400plus this model
0.001 1192 1271
0.01 1189 1269
0.1 1186 1270
1 1021 1074

Human-likeness: held-out positions from games of this band, temperature 0.001; how often the model's top 1 / 3 / 5 moves contain the move the human played, and the expected score lost against Stockfish's best move (depth 12):

top-1 top-3 top-5 lost vs best
chess-pgn-2400plus 53.6% 79.1% 89.7% 5.94%
this model 53.9% 80.4% 88.3% 6.11%

Usage

As for chess-pgn-2400plus, with this repository's id:

import json, chess, torch
from huggingface_hub import snapshot_download
from safetensors.torch import load_file
import sys

path = snapshot_download("Arisp/chess-pgn-2400plus-rl")
sys.path.insert(0, path)
from pgn_model import PGNTransformer, generate_moves

cfg = json.load(open(f"{path}/config.json"))["architecture"]
model = PGNTransformer(**cfg)
model.load_state_dict(load_file(f"{path}/model.safetensors"))
model.eval()

board = chess.Board()
board.push_san("e4")
move = generate_moves(model, [board], temperature=0.0, dev="cpu")[0]   # None if 5 attempts were illegal
print(board.san(move))

Limitations

The starting model's: it knows the position only from the move history and occasionally writes an illegal move; past roughly move 80-100 the game no longer fits its 1,024-character context. It plays like a strong player of its band, blunders included; it is not an engine.

Downloads last month
45
Safetensors
Model size
51M params
Tensor type
F32
ยท
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Model tree for Arisp/chess-pgn-2400plus-rl

Finetuned
(1)
this model