mlabonne releases LFM2.5-230M-Chess, a 230M-parameter chess engine language model
A new open‑weight model, LFM2.5-230M-Chess, has been added to Hugging Face by the mlabonne community. The 230‑million‑parameter causal LM is distilled from Stockfish and treats every legal chess move as a distinct token. It reads an 80‑token board representation, predicts a win probability, then selects a move token, achieving roughly 2004 Elo with a shallow depth‑3 search and about 1500 Elo in…
Key points
- LFM2.5-230M-Chess is a 230M‑parameter LM fine‑tuned via Stockfish distillation, playing ~2004 Elo with depth‑3 search.
- Every legal chess move is a separate token; the model reads an 80‑token FEN prompt and outputs win probability then move.
- Full integration guides are provided for Transformers, vLLM, SGLang, and Docker, with OpenAI‑compatible API examples.
The post provides step‑by‑step usage guides for popular inference stacks: Transformers pipelines, direct AutoModel loading, vLLM, SGLang, and Docker Model Runner. Sample curl commands illustrate OpenAI‑compatible API calls, and a browser demo is available via ChessLFM Space. Token‑level details, such as the 2,106 added token IDs for move encoding, are also shared.
By exposing a compact, legally‑constrained chess engine through standard AI serving tools, the model lowers the barrier for developers to embed strong chess play into applications, research, or educational tools without needing heavyweight search engines.
mlabonne/LFM2.5-230M-Chess · Hugging Face
huggingface.co · 16 September 2026
Instructions to use mlabonne/LFM2.5-230M-Chess with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers How to use mlabonne/LFM2.5-230M-Chess with Transformers: ```
Use a pipeline as a high-level helper
from transformers import pipeline pipe = pipeline("text-generation", model="mlabonne/LFM2.5-230M-Chess") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)
Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("mlabonne/LFM2.5-230M-Chess") model = AutoModelForCausalLM.from_pretrained("mlabonne/LFM2.5-230M-Chess", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:]))
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM How to use mlabonne/LFM2.5-230M-Chess with vLLM: ##### Install from pip and serve model```
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "mlabonne/LFM2.5-230M-Chess"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "mlabonne/LFM2.5-230M-Chess",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'
Use Dockerdocker model run hf.co/mlabonne/LFM2.5-230M-Chess
- SGLang How to use mlabonne/LFM2.5-230M-Chess with SGLang: ##### Install from pip and serve model```
Install SGLang from pip:
pip install sglang
Start the SGLang server:
python3 -m sglang.launch_server
--model-path "mlabonne/LFM2.5-230M-Chess"
--host 0.0.0.0
--port 30000
Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:30000/v1/chat/completions"
-H "Content-Type: application/json"
--data '{
"model": "mlabonne/LFM2.5-230M-Chess",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'
##### Use Docker images```
docker run --gpus all \
--shm-size 32g \
-p 30000:30000 \
-v ~/.cache/huggingface:/root/.cache/huggingface \
--env "HF_TOKEN=<secret>" \
--ipc=host \
lmsysorg/sglang:latest \
python3 -m sglang.launch_server \
--model-path "mlabonne/LFM2.5-230M-Chess" \
--host 0.0.0.0 \
--port 30000
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:30000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "mlabonne/LFM2.5-230M-Chess",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'
- Docker Model Runner How to use mlabonne/LFM2.5-230M-Chess with Docker Model Runner: docker model run hf.co/mlabonne/LFM2.5-230M-Chess
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.
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:
- 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.
- Argmax over the 64 value tokens gives the model evaluation, where
<v:k>means a win probability in[k/64, (k+1)/64). - 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
This text was published by huggingface.co . It is reproduced here with attribution so you can read it in full; the rights remain with the publisher. Read it at the source ↗
Coverage and discussion
1 source- Reddit discussion reddit.com
The headline, key points and digest above were generated by Digest AI's editorial model from the linked sources. Automated summaries can contain errors: the sources are the record. Spotted a mistake? Tell us.
More in Generative AI & Models
All →- TypeSafe AI unveils Jev, a frontier model up to 400× cheaper and 200× faster · 2 src
- Nums AI launches Causilo, a tabular foundation model that tops TabArena benchmarks · 1 src
- Google DeepMind launches Gemini 3.8 Live and 3.8 Live Extended Thinking models · 5 src
- Salesforce launches Koa, its first CRM reasoning model built on NVIDIA Nemotron 3 Super · 4 src
- NVIDIA cuDNN Graph API Tutorial: Fusion & Autotuning · 1 src
Comments
via GitHub Discussions