Dataset Viewer
Auto-converted to Parquet Duplicate
Search is not available for this dataset
file_count
int64
total_samples
int64
15
1,619,475

Reversi-Transformer Self-Play Dataset (m1)

This dataset contains self-play game records generated by Reversi-Transformer-1 playing against itself using MCTS, with C++ bitboard acceleration and multi-process shared-memory batched inference.

It provides 1.8 million board states formatted as TFRecords for training policy and value networks in Reversi AI.

Dataset Summary

  • Total Samples: ~1,796,729 board positions
    • Train: 15 TFRecord shards (1,619,475 samples)
    • Validation: 15 TFRecord shards (177,254 samples)
  • Format: TFRecord (serialized tf.train.Example)
  • Game Engine: C++ Bitboard engine with MCTS (reversi_bitboard_cpp, reversi_mcts_cpp)

Data Generation

The dataset was generated using train.py with the following configuration:

  • Generator model: Reversi-Transformer-1
  • Opponent: Same model (self-play)
  • MCTS simulations per move: 600
  • MCTS batch size: 100
  • PUCT constant: 2.3
  • Total games: 10,000

Self-Play Pipeline

  1. Parallel Self-Play

    • Multi-process workers run concurrent games.
    • A centralized GPU prediction server performs batched neural network inference through POSIX shared memory.
  2. Move Selection

    • First 12 turns: MCTS root exploration noise is enabled and moves are sampled from visit-count probabilities.
    • After 12 turns: The move with the highest MCTS visit count is selected.
  3. Target Generation

    • The MCTS visit-count distribution is stored as the policy target.
    • After the game ends, the final game outcome and stone difference are used to generate value targets.

Data Structure

Each sample in the TFRecord dataset represents a single turn and is serialized using tf.train.Example with tensor bytes:

Field TFRecord Type Decoded Tensor Type Shape Description
input_planes tf.string (bytes) tf.float32 [8, 8, 3] 3-channel board state:
• Ch 0: Own stones (1.0 or 0.0)
• Ch 1: Opponent stones (1.0 or 0.0)
• Ch 2: Legal moves (1.0 or 0.0)
policy tf.string (bytes) tf.float32 [64] Target policy distribution computed from MCTS visit counts ($\sum = 1.0$)
value tf.float32 (float list) tf.float32 [2] Dual value targets:
value[0]: Game outcome (+1.0: Win, -1.0: Loss, 0.0: Draw)
value[1]: Final stone difference ratio ($\pm |\text{Black} - \text{White}| / 64.0$)

How to Load and Use

Reading with TensorFlow (tf.data)

import glob
import tensorflow as tf
from huggingface_hub import snapshot_download

dataset_path = snapshot_download(repo_id="rsu/Reversi-Transformer-1-Selfplay", repo_type="dataset", revision="main", local_dir="dataset", local_dir_use_symlinks=False)

feature_description = {
    'input_planes': tf.io.FixedLenFeature([], tf.string),
    'policy': tf.io.FixedLenFeature([], tf.string),
    'value': tf.io.FixedLenFeature([2], tf.float32),
}

def parse_example(serialized_example):
    features = tf.io.parse_single_example(serialized_example, feature_description)
    
    input_planes = tf.io.parse_tensor(features['input_planes'], out_type=tf.float32)
    policy = tf.io.parse_tensor(features['policy'], out_type=tf.float32)
    value = features['value']
    
    input_planes = tf.ensure_shape(input_planes, (8, 8, 3))
    policy = tf.ensure_shape(policy, (64,))
    value = tf.ensure_shape(value, (2,))
    
    return input_planes, {
        'policy': policy,
        'value': value
    }

# Create tf.data.Dataset
files = sorted(glob.glob(f"{dataset_path}/train/*.tfrecord"))
dataset = tf.data.TFRecordDataset(files)
dataset = dataset.map(parse_example, num_parallel_calls=tf.data.AUTOTUNE)
dataset = dataset.shuffle(10000).batch(256).prefetch(tf.data.AUTOTUNE)

for batch_x, batch_y in dataset.take(1):
    print("Input batch shape:", batch_x.shape)             # (256, 8, 8, 3)
    print("Policy target shape:", batch_y['policy'].shape) # (256, 64)
    print("Value target shape:", batch_y['value'].shape)   # (256, 2)

Intended Use

  • Training and evaluating policy/value networks for Reversi.
  • Research into Mixture-of-Experts (MoE) architectures, self-play learning dynamics, and MCTS-guided policy improvement.

Source Code & Reference

License

MIT License

Downloads last month
-