Derkerekes aicrowd commited on
Commit
fac6914
·
verified ·
0 Parent(s):

Duplicate from aicrowd/ChessExplained

Browse files

Co-authored-by: AIcrowd SA <aicrowd@users.noreply.huggingface.co>

.gitattributes ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
5
+ *.ckpt filter=lfs diff=lfs merge=lfs -text
6
+ *.ftz filter=lfs diff=lfs merge=lfs -text
7
+ *.gz filter=lfs diff=lfs merge=lfs -text
8
+ *.h5 filter=lfs diff=lfs merge=lfs -text
9
+ *.joblib filter=lfs diff=lfs merge=lfs -text
10
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
+ *.lz4 filter=lfs diff=lfs merge=lfs -text
12
+ *.mds filter=lfs diff=lfs merge=lfs -text
13
+ *.mlmodel filter=lfs diff=lfs merge=lfs -text
14
+ *.model filter=lfs diff=lfs merge=lfs -text
15
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
16
+ *.npy filter=lfs diff=lfs merge=lfs -text
17
+ *.npz filter=lfs diff=lfs merge=lfs -text
18
+ *.onnx filter=lfs diff=lfs merge=lfs -text
19
+ *.ot filter=lfs diff=lfs merge=lfs -text
20
+ *.parquet filter=lfs diff=lfs merge=lfs -text
21
+ *.pb filter=lfs diff=lfs merge=lfs -text
22
+ *.pickle filter=lfs diff=lfs merge=lfs -text
23
+ *.pkl filter=lfs diff=lfs merge=lfs -text
24
+ *.pt filter=lfs diff=lfs merge=lfs -text
25
+ *.pth filter=lfs diff=lfs merge=lfs -text
26
+ *.rar filter=lfs diff=lfs merge=lfs -text
27
+ *.safetensors filter=lfs diff=lfs merge=lfs -text
28
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
29
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
30
+ *.tar filter=lfs diff=lfs merge=lfs -text
31
+ *.tflite filter=lfs diff=lfs merge=lfs -text
32
+ *.tgz filter=lfs diff=lfs merge=lfs -text
33
+ *.wasm filter=lfs diff=lfs merge=lfs -text
34
+ *.xz filter=lfs diff=lfs merge=lfs -text
35
+ *.zip filter=lfs diff=lfs merge=lfs -text
36
+ *.zst filter=lfs diff=lfs merge=lfs -text
37
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
38
+ # Audio files - uncompressed
39
+ *.pcm filter=lfs diff=lfs merge=lfs -text
40
+ *.sam filter=lfs diff=lfs merge=lfs -text
41
+ *.raw filter=lfs diff=lfs merge=lfs -text
42
+ # Audio files - compressed
43
+ *.aac filter=lfs diff=lfs merge=lfs -text
44
+ *.flac filter=lfs diff=lfs merge=lfs -text
45
+ *.mp3 filter=lfs diff=lfs merge=lfs -text
46
+ *.ogg filter=lfs diff=lfs merge=lfs -text
47
+ *.wav filter=lfs diff=lfs merge=lfs -text
48
+ # Image files - uncompressed
49
+ *.bmp filter=lfs diff=lfs merge=lfs -text
50
+ *.gif filter=lfs diff=lfs merge=lfs -text
51
+ *.png filter=lfs diff=lfs merge=lfs -text
52
+ *.tiff filter=lfs diff=lfs merge=lfs -text
53
+ # Image files - compressed
54
+ *.jpg filter=lfs diff=lfs merge=lfs -text
55
+ *.jpeg filter=lfs diff=lfs merge=lfs -text
56
+ *.webp filter=lfs diff=lfs merge=lfs -text
57
+ # Video files - compressed
58
+ *.mp4 filter=lfs diff=lfs merge=lfs -text
59
+ *.webm filter=lfs diff=lfs merge=lfs -text
60
+ sft_v0/ChessExplained_500k_nothink_v0.jsonl filter=lfs diff=lfs merge=lfs -text
61
+ sft_v0/ChessExplained_500k_v0.jsonl filter=lfs diff=lfs merge=lfs -text
62
+ ChessExplained_SFT_v0/ChessExplained_500k_v0.jsonl filter=lfs diff=lfs merge=lfs -text
ChessExplained_2500k_qwen3.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:18c294f2e0a891871523a3130623a79c6d30453a3769ea70c4ecc749764c692a
3
+ size 1036230583
ChessExplained_SFT_v0/ChessExplained_500k_v0.jsonl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c3289155245038e55191d00ae1aa3360729908824f11a2c0249b13eac2f6284c
3
+ size 1179694434
ChessExplained_SFT_v0/README.md ADDED
@@ -0,0 +1,108 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ChessExplained_500k_v0 Dataset
2
+
3
+ ## Overview
4
+ This dataset contains approximately 500,000 chess positions with explanations for optimal moves, prepared for Supervised Fine-Tuning (SFT). The data is tokenized using **Qwen/Qwen3-8B** tokenizer.
5
+
6
+ ## Format
7
+ - **File**: JSONL format (one JSON object per line)
8
+ - **Fields**:
9
+ - `text`: Full conversation in Qwen chat format with special tokens
10
+ - `fen`: Position in FEN notation
11
+ - `move`: Best move in UCI notation
12
+ - `explanation`: Natural language explanation for the move
13
+
14
+ ## Explanation Generation Process
15
+
16
+ Each explanation is generated through the following pipeline:
17
+
18
+ 1. **Position Analysis**: Extract current position features from the FEN
19
+ 2. **Best Move Calculation**: Determine optimal move using Stockfish engine
20
+ 3. **Move Application**: Apply the move and extract new position features
21
+ 4. **Position Evaluation**: Use Stockfish evaluation to classify the position:
22
+ - Winning (|eval| > 2)
23
+ - Drawish (|eval| ≤ 2)
24
+ 5. **Feature Extraction**: Identify key tactical/strategic elements by comparing position features:
25
+ - Attacking new pieces
26
+ - Escaping attacks
27
+ - Forced checkmates
28
+ - Captures
29
+ - Pawn promotions
30
+ - Checks
31
+ - Center control
32
+ - Pins
33
+ - King safety improvements
34
+ - Rooks on 7th rank
35
+
36
+ ## Explanation Template
37
+
38
+ Explanations are generated by comparing position features before and after the best move. The system detects tactical/strategic changes and constructs natural language explanations.
39
+
40
+ **Standard format:**
41
+ ```
42
+ After {piece} {action} {square}, this causes {color} to {reason(s)}.
43
+ So {move_SAN} is the most logical. {evaluation}.
44
+ ```
45
+
46
+ **Detected features include:**
47
+ - Checkmate delivery
48
+ - Castling (kingside/queenside)
49
+ - Giving check
50
+ - Captures
51
+ - Pawn promotions
52
+ - Escaping attacks
53
+ - Attacking new pieces
54
+ - Gaining center control
55
+ - Creating pins
56
+ - Placing rook on 7th/2nd rank
57
+
58
+ **Fallback:** When no specific tactical features are detected, the explanation describes piece development (early game) or repositioning (mid/late game).
59
+
60
+ ## Example Entry
61
+
62
+ ```json
63
+ {
64
+ "text": "<|im_start|>user\nYou are an expert chess player...",
65
+ "fen": "rnbq1rk1/ppp1bpp1/4pn1p/3p4/2PP4/2N1PN2/PP1B1PPP/R2QKB1R b KQ - 0 7",
66
+ "move": "c7c5",
67
+ "explanation": "After Pawn moves to c5, this causes Black to attacks the pawn on d4. So c5 is the most logical. Position is drawish."
68
+ }
69
+ ```
70
+
71
+ ```
72
+ <|im_start|>user
73
+ You are an expert chess player looking at the following position in FEN format:
74
+ r3kb1N/pp2p2p/n5p1/2p5/2BP2q1/7b/PPP2P2/R1BQK3 b q - 3 16
75
+ Briefly, FEN describes chess pieces by single letters [PNBRKQ] for white and [pnbrkq] for black. The pieces found in each rank are specified, starting at the top of the board (a8..h8) and describing all eight ranks. Within each rank, all 8 positions must be specified, with one or more empty squares noted with a digit [1..8]. For example, /8/ is an empty rank (no pieces), while /4P3/ specifies four empty squares, a white pawn, and three more empty squares.
76
+
77
+ Here is an additional visualization of the board (♔♕♖♗♘♙ = White pieces, ♚♛♜♝♞♟ = Black pieces):
78
+
79
+ a b c d e f g h
80
+ +---------------+
81
+ 8 | ♜ · · · ♚ ♝ · ♘ | 8
82
+ 7 | ♟ ♟ · · ♟ · · ♟ | 7
83
+ 6 | ♞ · · · · · ♟ · | 6
84
+ 5 | · · ♟ · · · · · | 5
85
+ 4 | · · ♗ ♙ · · ♛ · | 4
86
+ 3 | · · · · · · · ♝ | 3
87
+ 2 | ♙ ♙ ♙ · · ♙ · · | 2
88
+ 1 | ♖ · ♗ ♕ ♔ · · · | 1
89
+ +---------------+
90
+ a b c d e f g h
91
+
92
+ The current side to move is black.
93
+ The possible legal moves for the side to move are: ['f8g7', 'f8h6', 'e8d8', 'e8d7', 'a8d8', 'a8c8', 'a8b8', 'a6b8', 'a6c7', 'a6b4', 'g4c8', 'g4d7', 'g4e6', 'g4h5', 'g4g5', 'g4f5', 'g4h4', 'g4f4', 'g4e4', 'g4d4', 'g4g3', 'g4f3', 'g4g2', 'g4e2', 'g4g1', 'g4d1', 'h3g2', 'h3f1', 'e8c8', 'c5d4', 'h7h6', 'e7e6', 'b7b6', 'g6g5', 'h7h5', 'e7e5', 'b7b5'].
94
+
95
+ Your task is to select the best move for the side to move. Please choose a move from this list, and output it in the following format:
96
+ <uci_move>one_move_from_the_list</uci_move>.
97
+ An example of a valid move for this position is <uci_move>f8g7</uci_move>.
98
+ Think about the move and output it in the following format:
99
+ <think>your_thinking</think>
100
+ <uci_move>one_move_from_the_list</uci_move>.
101
+ <|im_end|>
102
+ <|im_start|>assistant
103
+ <think>
104
+ After Queen moves to g1, this causes Black to give check, moves away from attack, attacks the pawn on f2, creates a pin. So Qg1+ is the most logical. Black has a huge advantage.
105
+ </think>
106
+
107
+ <uci_move>g4g1</uci_move><|im_end|>
108
+ ```
README.md ADDED
@@ -0,0 +1,115 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ tags:
4
+ - chess
5
+ task_categories:
6
+ - reinforcement-learning
7
+ ---
8
+ # ChessExplained_500k_v0 Dataset
9
+
10
+ ## Overview
11
+ This dataset contains approximately 500,000 chess positions with explanations for optimal moves, prepared for Supervised Fine-Tuning (SFT). The data is tokenized using **Qwen/Qwen3-8B** tokenizer.
12
+
13
+ ## Format
14
+ - **File**: JSONL format (one JSON object per line)
15
+ - **Fields**:
16
+ - `text`: Full conversation in Qwen chat format with special tokens
17
+ - `fen`: Position in FEN notation
18
+ - `move`: Best move in UCI notation
19
+ - `explanation`: Natural language explanation for the move
20
+
21
+ ## Explanation Generation Process
22
+
23
+ Each explanation is generated through the following pipeline:
24
+
25
+ 1. **Position Analysis**: Extract current position features from the FEN
26
+ 2. **Best Move Calculation**: Determine optimal move using Stockfish engine
27
+ 3. **Move Application**: Apply the move and extract new position features
28
+ 4. **Position Evaluation**: Use Stockfish evaluation to classify the position:
29
+ - Winning (|eval| > 2)
30
+ - Drawish (|eval| ≤ 2)
31
+ 5. **Feature Extraction**: Identify key tactical/strategic elements by comparing position features:
32
+ - Attacking new pieces
33
+ - Escaping attacks
34
+ - Forced checkmates
35
+ - Captures
36
+ - Pawn promotions
37
+ - Checks
38
+ - Center control
39
+ - Pins
40
+ - King safety improvements
41
+ - Rooks on 7th rank
42
+
43
+ ## Explanation Template
44
+
45
+ Explanations are generated by comparing position features before and after the best move. The system detects tactical/strategic changes and constructs natural language explanations.
46
+
47
+ **Standard format:**
48
+ ```
49
+ After {piece} {action} {square}, this causes {color} to {reason(s)}.
50
+ So {move_SAN} is the most logical. {evaluation}.
51
+ ```
52
+
53
+ **Detected features include:**
54
+ - Checkmate delivery
55
+ - Castling (kingside/queenside)
56
+ - Giving check
57
+ - Captures
58
+ - Pawn promotions
59
+ - Escaping attacks
60
+ - Attacking new pieces
61
+ - Gaining center control
62
+ - Creating pins
63
+ - Placing rook on 7th/2nd rank
64
+
65
+ **Fallback:** When no specific tactical features are detected, the explanation describes piece development (early game) or repositioning (mid/late game).
66
+
67
+ ## Example Entry
68
+
69
+ ```json
70
+ {
71
+ "text": "<|im_start|>user\nYou are an expert chess player...",
72
+ "fen": "rnbq1rk1/ppp1bpp1/4pn1p/3p4/2PP4/2N1PN2/PP1B1PPP/R2QKB1R b KQ - 0 7",
73
+ "move": "c7c5",
74
+ "explanation": "After Pawn moves to c5, this causes Black to attacks the pawn on d4. So c5 is the most logical. Position is drawish."
75
+ }
76
+ ```
77
+
78
+ ```
79
+ <|im_start|>user
80
+ You are an expert chess player looking at the following position in FEN format:
81
+ r3kb1N/pp2p2p/n5p1/2p5/2BP2q1/7b/PPP2P2/R1BQK3 b q - 3 16
82
+ Briefly, FEN describes chess pieces by single letters [PNBRKQ] for white and [pnbrkq] for black. The pieces found in each rank are specified, starting at the top of the board (a8..h8) and describing all eight ranks. Within each rank, all 8 positions must be specified, with one or more empty squares noted with a digit [1..8]. For example, /8/ is an empty rank (no pieces), while /4P3/ specifies four empty squares, a white pawn, and three more empty squares.
83
+
84
+ Here is an additional visualization of the board (♔♕♖♗♘♙ = White pieces, ♚♛♜♝♞♟ = Black pieces):
85
+
86
+ a b c d e f g h
87
+ +---------------+
88
+ 8 | ♜ · · · ♚ ♝ · ♘ | 8
89
+ 7 | ♟ ♟ · · ♟ · · ♟ | 7
90
+ 6 | ♞ · · · · · ♟ · | 6
91
+ 5 | · · ♟ · · · · · | 5
92
+ 4 | · · ♗ ♙ · · ♛ · | 4
93
+ 3 | · · · · · · · ♝ | 3
94
+ 2 | ♙ ♙ ♙ · · ♙ · · | 2
95
+ 1 | ♖ · ♗ ♕ ♔ · · · | 1
96
+ +---------------+
97
+ a b c d e f g h
98
+
99
+ The current side to move is black.
100
+ The possible legal moves for the side to move are: ['f8g7', 'f8h6', 'e8d8', 'e8d7', 'a8d8', 'a8c8', 'a8b8', 'a6b8', 'a6c7', 'a6b4', 'g4c8', 'g4d7', 'g4e6', 'g4h5', 'g4g5', 'g4f5', 'g4h4', 'g4f4', 'g4e4', 'g4d4', 'g4g3', 'g4f3', 'g4g2', 'g4e2', 'g4g1', 'g4d1', 'h3g2', 'h3f1', 'e8c8', 'c5d4', 'h7h6', 'e7e6', 'b7b6', 'g6g5', 'h7h5', 'e7e5', 'b7b5'].
101
+
102
+ Your task is to select the best move for the side to move. Please choose a move from this list, and output it in the following format:
103
+ <uci_move>one_move_from_the_list</uci_move>.
104
+ An example of a valid move for this position is <uci_move>f8g7</uci_move>.
105
+ Think about the move and output it in the following format:
106
+ <think>your_thinking</think>
107
+ <uci_move>one_move_from_the_list</uci_move>.
108
+ <|im_end|>
109
+ <|im_start|>assistant
110
+ <think>
111
+ After Queen moves to g1, this causes Black to give check, moves away from attack, attacks the pawn on f2, creates a pin. So Qg1+ is the most logical. Black has a huge advantage.
112
+ </think>
113
+
114
+ <uci_move>g4g1</uci_move><|im_end|>
115
+ ```