Artoria Zero

Grandmaster-Level Chess Without Search โ€” A decoder-only transformer trained via behavioral cloning to predict chess moves directly from board state, with no search algorithm (no MCTS, no Alpha-Beta).

Based on the approach from arXiv:2402.04494.

Model Variants

Variant d_model Layers Heads Parameters Checkpoint
Small 256 8 8 ~19M small/checkpoint.pt
Mid 512 16 8 ~100M mid/checkpoint.pt
Large 1024 40 32 ~500M large/checkpoint.pt

Architecture

  • Type: Decoder-only Transformer (LLaMA-style)
  • Normalization: RMSNorm (pre-norm)
  • FFN: SwiGLU
  • Attention: Bidirectional (no causal mask)
  • Input: FEN string tokenized to 79 ASCII tokens
  • Output: Dual-head โ€” Policy (move classification, ~4544 classes) + Value (position evaluation, tanh [-1, 1])
  • Pooling: Mean pooling over sequence

Usage

import torch
from artoria import ChessTokenizer, GrandmasterChessModel, ChessModelConfig
import json

# Load config
with open("small/config.json") as f:
    config = ChessModelConfig(**json.load(f))

tokenizer = ChessTokenizer()
config.num_classes = tokenizer.num_actions

model = GrandmasterChessModel(config)
checkpoint = torch.load("small/checkpoint.pt", map_location="cpu")
model.load_state_dict(checkpoint["model_state_dict"])
model.eval()

# Predict move from FEN
fen = "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1"
tokens = tokenizer.tokenize(fen).unsqueeze(0)

with torch.no_grad():
    logits, value = model(tokens)

# Get best legal move
import chess
board = chess.Board(fen)
best_move, best_prob = None, -1
probs = torch.softmax(logits[0], dim=0)
for m in board.legal_moves:
    idx = tokenizer.action_to_class(m.uci())
    if idx != -1 and probs[idx].item() > best_prob:
        best_move, best_prob = m.uci(), probs[idx].item()

print(f"Best move: {best_move} (confidence: {best_prob:.4f}, eval: {value.item():.4f})")

Training

Trained on Lichess standard chess games via behavioral cloning (imitation learning). The model learns to predict the next move played by strong players given a board position.

Source Code

github.com/ShinapriLN/artoria

License

MIT

Downloads last month
27
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Space using Shinapri/artoria-zero 1

Paper for Shinapri/artoria-zero