LFM2.5-230M-Chess

A 230M chess engine with a language model interface, fine-tuned from LFM2.5-230M-Base using Stockfish distillation.

Every possible chess move is a single token in the vocabulary. The model reads a position as a fixed 80-token prompt, predicts its own win probability, then predicts one move token. The host masks the move logits to the legal moves, so the model can never play an illegal move.

It plays at roughly 2004 Elo with a shallow depth-3 search on top, and roughly 1500 with the raw one-pass policy.

Demo: Play it in your browser with the ChessLFM Space.

Demo game

Usage

import json
from transformers import AutoModelForCausalLM

model = AutoModelForCausalLM.from_pretrained("mlabonne/LFM2.5-230M-Chess")
token_ids = json.load(open("token_ids.json"))

Each move takes two short forward passes:

  1. Build the 80-token prompt from the FEN. It encodes the 64 squares, side to move, castling rights, en passant file, halfmove clock, repetition count, and the last 8 plies.
  2. Argmax over the 64 value tokens gives the model evaluation, where <v:k> means a win probability in [k/64, (k+1)/64).
  3. Append that value token and <|bestmove|>, mask the move logits to the legal moves, and take the argmax.

You can find the 2,106 added token IDs in token_ids.json (it starts at 64402).

Downloads last month
-
Safetensors
Model size
0.2B params
Tensor type
BF16
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for mlabonne/LFM2.5-230M-Chess

Finetuned
(11)
this model
Quantizations
1 model