| --- |
| tags: |
| - chess |
| - embeddings |
| - puzzles |
| - computer-vision |
| - pytorch |
| - tabular |
| license: other |
| language: |
| - en |
| - zxx |
| pretty_name: "Lichess Puzzle Embeddings (ChessLM Encoder v4)" |
| dataset_info: |
| features: |
| - name: FEN |
| dtype: string |
| - name: Moves |
| dtype: string |
| - name: Themes |
| dtype: string |
| - name: Embedding |
| dtype: sequence |
| |
| |
| |
| |
| |
| --- |
| |
| # Lichess Puzzle Embeddings (ChessLM Encoder v4) |
|
|
| ## Dataset Description |
|
|
| This dataset contains pre-computed vector embeddings for chess puzzle positions sourced from the Lichess Open Puzzle Database. The embeddings were generated using the odestorm1/chesslm (https://huggingface.co/datasets/odestorm1/chesslm_puzzles) Encoder Transformer model. |
| |
| Each row corresponds to a unique chess puzzle, providing its initial FEN (Forsyth–Edwards Notation) string, the sequence of moves in the puzzle solution, associated themes, and the generated embedding vector for the starting position. |
| |
| The dataset was created by sampling up to 1,000,000 puzzles from the Lichess Database (https://database.lichess.org/) and processing the starting FEN position of each puzzle through the pre-trained encoder model. The embedding represents the state of the board *before* the first puzzle move is made. |
| |
| More details about the model can be found at https://github.com/bluehood/Encoder-ChessLM and the technical writeup https://bluehood.github.io/research/benh_Beyond_Evaluation__Learning_Contextual_Chess_Position_Representations_2025.pdf. |
| |
| ## Supported Tasks and Leaderboards |
| |
| This dataset can be used for various tasks related to chess puzzle analysis and understanding, including: |
| |
| * **Puzzle Similarity Search:** Find puzzles with similar starting positions based on embedding distance. |
| * **Theme Prediction/Clustering:** Analyze if embeddings cluster according to puzzle themes. |
| * **Difficulty Prediction:** Use embeddings as features to predict puzzle ratings or solve rates. |
| * **Downstream Model Training:** Use embeddings as input features for models tackling other chess-related tasks. |
| |
| ## Languages |
| |
| The data primarily uses: |
| * **English (`en`)**: For the `Themes` column. |
| * **No linguistic content (`zxx`)**: For `FEN`, `Moves`, and `Embedding` columns, which represent chess notation or numerical data. |
| |
| ## Dataset Structure |
| |
| ### Data Instances |
| |
| A typical row in the dataset looks like this (embedding truncated for brevity): |
| |
| ```json |
| { |
| "FEN": "r1b1k2r/1p1n1ppp/pq2p3/3pP3/1P1N4/P1N5/2PQ1PPP/R3K2R w KQkq - 0 14", |
| "Moves": "f2f4 b6d4 d2d4 f8c5", |
| "Themes": "crushing deflection middlegame short", |
| "Embedding": [-0.0123, 0.4567, -0.7890, ..., 0.1122] |
| } |
| ``` |
| |
| ### Data Fields |
| |
| * `FEN` (string): The Forsyth–Edwards Notation string representing the starting position of the puzzle. |
| * `Moves` (string): A space-separated string of moves representing the puzzle's solution (player moves and opponent responses). |
| * `Themes` (string): A space-separated string of themes associated with the puzzle (e.g., "mateIn2", "fork", "endgame"). |
| * `Embedding` (sequence/list of float32): The vector embedding generated by the `ChessLM Encoder v4` for the starting FEN position. The dimension corresponds to the `d_model` of the encoder (e.g., 256). |
| |
| |
| ## Dataset Creation |
| |
| The primary source data is the Lichess Open Puzzle Database. This file contains information about millions of chess puzzles generated from Lichess games. |
| |
| ### Annotations |
| |
| The `FEN`, `Moves`, and `Themes` columns are taken directly from the source Lichess Database. The `Embedding` column is generated by processing the `FEN` string through the ChessLM model. |
| |
| ### Citation Information |
| |
| If you use this dataset or the underlying model methodology, please cite: |
| |
| ```bibtex |
| @misc{hull2025beyond, |
| title={Beyond Evaluation: Learning Contextual Chess Position Representations}, |
| author={Ben Hull}, |
| year={2025}, |
| howpublished={Accessed via \url{[https://bluehood.github.io/](https://bluehood.github.io/)}}, |
| note={Technical report} |
| } |
| ``` |
| |
| ### Contributions |
| |
| Thanks to the Lichess team for providing the open puzzle database. |
| |
| ## How to Use |
| |
| You can load the dataset using the Hugging Face `datasets` library or `pandas`. |
| |
| **Using `datasets`:** |
| |
| ```python |
| from datasets import load_dataset |
| |
| # Load from Hugging Face Hub |
| dataset = load_dataset("odestorm1/chesslm_puzzles") |
| |
| # Load local parquet file |
| dataset = load_dataset("parquet", data_files="puzzle_embeddings.parquet") |
| ``` |
| |
| **Using `pandas`:** |
| |
| ```python |
| import pandas as pd |
| |
| df = pd.read_parquet("puzzle_embeddings.parquet") |
| print(df.head()) |
| |
| # Access the embedding (list of floats) for the first puzzle |
| first_embedding = df.iloc[0]['Embedding'] |
| print(f"Embedding dimension: {len(first_embedding)}") |
| ``` |