You need to agree to share your contact information to access this dataset

This repository is publicly accessible, but you have to accept the conditions to access its files and content.

Log in or Sign Up to review the conditions and access this dataset content.

MahjongLM Dataset

MahjongLM Dataset is a processed, pre-tokenized riichi mahjong game-log corpus for causal language modeling. It is built from Tenhou game logs and is intended for training MahjongLM-family models to predict long structured mahjong token streams.

The dataset is distributed as token IDs, not as raw Tenhou XML. The corresponding tokenizer assets are included in this repository.

Dataset Structure

  • 2011/ ... 2024/: yearly Hugging Face Dataset directories saved with datasets.Dataset.save_to_disk
  • tokenizer/: tokenizer assets used for MahjongLM training
  • README.md: dataset card
  • LICENSE: custom source-data license notice

Rows and Features

Each row is one tokenized view of one game:

  • game_id
  • year
  • seat_count
  • view_type
  • viewer_seat
  • length
  • input_ids

Views

view_type is one of:

  • complete: complete public information for the game.
  • imperfect: player-perspective information. viewer_seat identifies the visible player's seat.
  • omniscient: the complete view plus a reconstructed full wall block for each hand.

The omniscient view inserts:

round_start wall <wall tile tokens> ...

For four-player games, the wall block contains 136 physical tiles including red fives (m0, p0, s0). For three-player games, the wall block contains the 108 tiles used by Tenhou sanma: m1, m9, all pinzu, all souzu, and honors, with red fives for pinzu and souzu. Wall tokens are stored in actual consumption order, so the beginning of the block corresponds to the initial deal and subsequent live-wall draws. Omniscient rows are emitted only when the Tenhou shuffle seed is available and the reconstructed wall order is consistent with the observed initial hands, live-wall draws, replacement draws, dora indicators, ura-dora indicators, and result data.

Splits

This repository stores the full yearly training corpora only. Train/validation splits are created deterministically by the training pipeline and are not stored in the public dataset repository.

Token Stream Outline

Sequences are stored without <bos> and <eos> in input_ids; MahjongLM training code adds those boundary tokens at training time.

A game begins with rule and view tokens, then game_start, then one or more hand blocks:

rule_* view_* game_start round_start ... round_end ... game_end

Important conventions:

  • round_start / round_end delimit each hand; game_start / game_end delimit the game log.
  • round_end and game_end are emitted after rank tokens and before final-score tokens at game end.
  • seat numbers are table-relative seats in the tokenized game. player identifiers, when present in token names, are original player indices from the source game.
  • Self decisions and reaction decisions are emitted as opt_* option tokens followed by matching take_* / pass_* resolution tokens in the same option order.
  • Reaction options are ordered by (priority, seat, tiebreak, option), with ron before pon/minkan, then chi.
  • Self option priority is tsumo > kyusyu > penuki > riichi > ankan > kakan.
  • chi_pos_low / chi_pos_mid / chi_pos_high describe the position of the consumed tiles, not the called discard.
  • red_used / red_not_used is emitted whenever a call consumes a five tile; it records whether the consumed five was red.
  • take_self_*_tsumo is followed by the winning tile token. The winning tile is excluded from the later opened_hand_* block.
  • Win result blocks begin with one or more hule_{seat} markers.
  • For multiple ron wins, all hule_{seat} markers are emitted first, shared ura_dora reveal tiles are emitted once, then each winner detail follows, and one combined score-delta block is emitted after all win details.
  • ura_dora is emitted only when relevant to a riichi win.
  • Kan dora timing follows Tenhou behavior: closed kan reveals immediately before the replacement draw; open kan / added kan reveal after the following discard or before a chained replacement draw. If multiple dora indicators are revealed together, they are emitted as one dora token followed by all revealed tile tokens.
  • Kyushukyuhai result opened_hand_* contains exactly 14 tiles including the draw tile. North extraction (penuki) is treated like a call for first-turn kyushukyuhai suppression.

Vocabulary Summary

The vocabulary contains:

  • special tokens: <pad>, <bos>, <eos>, <unk>
  • view and rule tokens
  • game and hand boundary tokens
  • physical tile tokens, including red fives
  • draw, discard, call, decision, and pass/take tokens
  • dora and ura-dora reveal tokens
  • opened-hand, hule, yaku, fu, han, score, score-delta, rank, and final-score tokens
  • point-stick tokens from 100-point through 10,000-point units

Intended Use

  • Pretraining and evaluating MahjongLM-family models
  • Sequence modeling research on Japanese mahjong game logs
  • Reproducible training runs across yearly subsets or the full 2011-2024 corpus

Source Code

The dataset construction code is maintained at:

https://github.com/MitsuhiroTaniguchi/MahjongLM

License

source-data-terms-apply

This dataset is a processed derivative of third-party Tenhou game log data. Use of this dataset is subject to Tenhou's source-data terms and restrictions. See LICENSE for the repository notice used for this release.

Tokenizer

Tokenizer assets are included in tokenizer/:

  • tokenizer.json
  • tokenizer_config.json
  • special_tokens_map.json
  • vocab.txt
Downloads last month
617