GameIndex uint64 | WhiteRating/16 uint8 | BlackRating/16 uint8 | InitialTime uint16 | Increment uint8 |
|---|---|---|---|---|
1 | 73 | 72 | 300 | 3 |
2 | 45 | 47 | 300 | 3 |
3 | 111 | 111 | 180 | 2 |
4 | 93 | 93 | 120 | 1 |
5 | 86 | 86 | 180 | 2 |
6 | 156 | 148 | 180 | 2 |
7 | 75 | 79 | 180 | 2 |
8 | 105 | 106 | 180 | 2 |
9 | 107 | 108 | 180 | 2 |
10 | 120 | 120 | 180 | 2 |
11 | 103 | 102 | 180 | 2 |
12 | 112 | 118 | 180 | 2 |
13 | 83 | 81 | 180 | 2 |
14 | 61 | 61 | 180 | 2 |
15 | 86 | 90 | 180 | 2 |
16 | 112 | 110 | 180 | 2 |
17 | 72 | 74 | 180 | 2 |
18 | 122 | 123 | 180 | 2 |
19 | 134 | 132 | 60 | 0 |
20 | 96 | 97 | 60 | 0 |
21 | 142 | 143 | 60 | 0 |
22 | 87 | 88 | 60 | 0 |
23 | 79 | 74 | 60 | 0 |
24 | 143 | 147 | 60 | 0 |
25 | 65 | 63 | 60 | 0 |
26 | 123 | 124 | 60 | 0 |
27 | 139 | 140 | 60 | 0 |
28 | 106 | 109 | 60 | 0 |
29 | 89 | 95 | 60 | 0 |
30 | 114 | 114 | 60 | 0 |
31 | 80 | 81 | 60 | 0 |
32 | 120 | 115 | 60 | 0 |
33 | 121 | 121 | 60 | 0 |
34 | 139 | 136 | 60 | 0 |
35 | 111 | 112 | 60 | 0 |
36 | 102 | 105 | 60 | 0 |
37 | 94 | 94 | 600 | 0 |
38 | 123 | 123 | 60 | 0 |
39 | 131 | 131 | 30 | 0 |
40 | 84 | 77 | 180 | 0 |
41 | 102 | 105 | 180 | 0 |
42 | 75 | 75 | 180 | 0 |
43 | 119 | 122 | 180 | 0 |
44 | 103 | 103 | 180 | 0 |
45 | 141 | 139 | 180 | 0 |
46 | 78 | 79 | 180 | 0 |
47 | 90 | 90 | 180 | 0 |
48 | 57 | 48 | 180 | 0 |
49 | 108 | 106 | 180 | 0 |
50 | 129 | 130 | 180 | 0 |
51 | 94 | 95 | 180 | 0 |
52 | 117 | 117 | 180 | 0 |
53 | 109 | 108 | 180 | 0 |
54 | 109 | 110 | 180 | 0 |
55 | 137 | 138 | 180 | 0 |
56 | 105 | 93 | 1,800 | 0 |
57 | 115 | 117 | 120 | 1 |
58 | 114 | 116 | 300 | 3 |
59 | 69 | 64 | 900 | 0 |
60 | 104 | 105 | 60 | 0 |
61 | 113 | 114 | 60 | 0 |
62 | 111 | 109 | 60 | 0 |
63 | 86 | 85 | 60 | 0 |
64 | 97 | 90 | 60 | 0 |
65 | 120 | 122 | 600 | 5 |
66 | 46 | 43 | 600 | 5 |
67 | 130 | 131 | 600 | 5 |
68 | 54 | 49 | 600 | 5 |
69 | 58 | 58 | 600 | 5 |
70 | 88 | 90 | 600 | 5 |
71 | 110 | 111 | 600 | 5 |
72 | 104 | 102 | 600 | 5 |
73 | 138 | 145 | 60 | 0 |
74 | 69 | 69 | 60 | 0 |
75 | 115 | 114 | 60 | 0 |
76 | 116 | 118 | 60 | 0 |
77 | 101 | 98 | 60 | 0 |
78 | 135 | 138 | 60 | 0 |
79 | 79 | 80 | 60 | 0 |
80 | 149 | 151 | 60 | 0 |
81 | 85 | 90 | 60 | 0 |
82 | 122 | 122 | 60 | 0 |
83 | 159 | 166 | 60 | 0 |
84 | 146 | 146 | 60 | 0 |
85 | 152 | 154 | 60 | 0 |
86 | 70 | 69 | 60 | 0 |
87 | 58 | 62 | 60 | 0 |
88 | 75 | 77 | 60 | 0 |
89 | 134 | 127 | 60 | 0 |
90 | 92 | 97 | 60 | 0 |
91 | 129 | 130 | 180 | 0 |
92 | 119 | 127 | 180 | 0 |
93 | 62 | 62 | 180 | 0 |
94 | 79 | 77 | 180 | 0 |
95 | 39 | 50 | 180 | 0 |
96 | 110 | 118 | 180 | 0 |
97 | 127 | 127 | 180 | 0 |
98 | 82 | 83 | 180 | 0 |
99 | 107 | 109 | 180 | 0 |
100 | 104 | 107 | 180 | 0 |
Lichess Standard Rated Games, 2024-01 → 2025-09 (binary move encoding)
A compact binary re-encoding of the Lichess monthly database for standard rated games, covering 21 consecutive months (January 2024 through September 2025). Designed for training sequence models on chess games — every move is one 16-bit token, every game is a variable-length sequence of tokens, and per-game metadata lives in Parquet alongside.
Source PGNs were processed with the encoder at https://github.com/Alfredvc/chess-autocomplete (see rust/src/move_codec.rs for the authoritative codec implementation).
File layout
Per month, three files share the prefix lichess_db_standard_rated_YYYY-MM:
| File | Format | Purpose |
|---|---|---|
*.bin |
Packed little-endian u16 tokens |
Concatenated games. One game = one variable-length run of u16 move tokens. No in-stream delimiters — use the map file to find game boundaries. |
*-map.bin |
Packed little-endian u64 |
Cumulative byte offsets, one per game. Game i occupies bytes [offsets[i-1], offsets[i]) in *.bin (with offsets[-1] = 0). Number of games = len(map) / 8. |
*-metadata.parquet |
Parquet | One row per game, in the same order as games appear in *.bin. |
All months together: 63 files, ~272 GB. The 21 Parquet files alone are ~13 GB and can be browsed directly on the Hub's Datasets viewer via the metadata config.
Metadata schema
| Column | Type | Notes |
|---|---|---|
GameIndex |
uint64 |
1-based index within the source PGN file. Skipped games (non-standard start positions, etc.) leave gaps. |
WhiteRating/16 |
uint8 |
Rating quantized to 16-pt buckets — multiply by 16 to recover. 0 = unknown. Saturates at 4080+ (255 × 16). |
BlackRating/16 |
uint8 |
Same encoding as WhiteRating. |
InitialTime |
uint16 |
Initial clock in seconds. 0 = unknown. |
Increment |
uint8 |
Increment in seconds. |
Move token encoding (16 bits per move)
Each u16, parsed in little-endian byte order, packs five fields:
bits 15-12 : op (4 bits — piece, castle, promotion, or game-end marker)
bits 11-9 : from_file (3 bits, 0=a … 7=h)
bits 8-6 : from_rank (3 bits, 0=rank 1 … 7=rank 8)
bits 5-3 : to_file (3 bits)
bits 2-0 : to_rank (3 bits)
op codes:
| Code | Meaning |
|---|---|
0b0000 |
Pawn move |
0b0001 |
Knight move |
0b0010 |
Bishop move |
0b0011 |
Rook move |
0b0100 |
Queen move |
0b0101 |
King move (non-castle) |
0b0110 |
White king-side castle |
0b0111 |
White queen-side castle |
0b1000 |
Game-end marker (see special tokens below) |
0b1001 |
Promotion to knight |
0b1010 |
Promotion to bishop |
0b1011 |
Promotion to rook |
0b1100 |
Promotion to queen |
0b1101 |
Black king-side castle |
0b1110 |
Black queen-side castle |
0b1111 |
Reserved / unused |
When op == 0b1000, the lower 12 bits encode the termination reason rather than squares:
| Token | Reason |
|---|---|
0x8000 |
Unknown |
0x8001 |
Checkmate |
0x8002 |
Stalemate |
0x8003 |
Insufficient material |
0x8004 |
Fifty-move rule |
0x8005 |
Threefold repetition |
Each game's token stream terminates with one of these markers. This representation is board-free: a parser does not need to maintain a chess position to decode any single move (unlike SAN or UCI), since the moving piece type, origin square, destination square, and promotion piece are all explicit.
Decoding example (Python)
Reading game i from a single month:
import numpy as np
import pyarrow.parquet as pq
month = "2024-01"
prefix = f"lichess_db_standard_rated_{month}"
# Per-game byte offsets into *.bin (cumulative end positions)
offsets = np.fromfile(f"{prefix}-map.bin", dtype=np.uint64)
num_games = len(offsets)
# Memory-map the moves
moves = np.memmap(f"{prefix}.bin", dtype=np.uint16, mode="r")
def get_game_tokens(i: int) -> np.ndarray:
start_byte = 0 if i == 0 else offsets[i - 1]
end_byte = offsets[i]
# offsets are byte positions; tokens are 2 bytes each
return moves[start_byte // 2 : end_byte // 2]
# Per-game metadata aligns row-for-row with the games in *.bin
meta = pq.read_table(f"{prefix}-metadata.parquet").to_pandas()
print(meta.iloc[0])
print(get_game_tokens(0))
To decode an individual move token:
def decode(token: int):
op = (token >> 12) & 0xF
if op == 0b1000:
return ("game_end", token & 0xFFF)
from_file = (token >> 9) & 0x7
from_rank = (token >> 6) & 0x7
to_file = (token >> 3) & 0x7
to_rank = token & 0x7
return (op, from_file, from_rank, to_file, to_rank)
Coverage
21 months: 2024-01, 2024-02, …, 2024-12, 2025-01, …, 2025-09.
Games per month are on the order of 10⁸ (the source Lichess dumps contain ~90–100M standard rated games per month). Games with non-standard starting positions (e.g., Chess960 mixed into the standard archive, or unusual FEN tags) are skipped during encoding, so GameIndex is not contiguous.
Filtering / partial downloads
Use huggingface_hub's filtered download to pull only the months or file types you need:
from huggingface_hub import snapshot_download
# Just the metadata Parquet files (~13 GB total)
snapshot_download(
repo_id="Alfredvc/chess-autocomplete-lichess",
repo_type="dataset",
allow_patterns="*-metadata.parquet",
local_dir="./lichess",
)
# A single month, all three files
snapshot_download(
repo_id="Alfredvc/chess-autocomplete-lichess",
repo_type="dataset",
allow_patterns="lichess_db_standard_rated_2024-01*",
local_dir="./lichess",
)
License
The underlying Lichess game data is published by Lichess under CC0 1.0 (public domain dedication). This re-encoded copy is released under the same terms. Please cite the Lichess database when using this dataset.
- Downloads last month
- 13