Datasets:
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 FaceDatasetdirectories saved withdatasets.Dataset.save_to_disktokenizer/: tokenizer assets used for MahjongLM trainingREADME.md: dataset cardLICENSE: custom source-data license notice
Rows and Features
Each row is one tokenized view of one game:
game_idyearseat_countview_typeviewer_seatlengthinput_ids
Views
view_type is one of:
complete: complete public information for the game.imperfect: player-perspective information.viewer_seatidentifies the visible player's seat.omniscient: thecompleteview 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_enddelimit each hand;game_start/game_enddelimit the game log.round_endandgame_endare emitted after rank tokens and before final-score tokens at game end.seatnumbers are table-relative seats in the tokenized game.playeridentifiers, 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 matchingtake_*/pass_*resolution tokens in the same option order. - Reaction options are ordered by
(priority, seat, tiebreak, option), withronbeforepon/minkan, thenchi. - Self option priority is
tsumo > kyusyu > penuki > riichi > ankan > kakan. chi_pos_low/chi_pos_mid/chi_pos_highdescribe the position of the consumed tiles, not the called discard.red_used/red_not_usedis emitted whenever a call consumes a five tile; it records whether the consumed five was red.take_self_*_tsumois followed by the winning tile token. The winning tile is excluded from the lateropened_hand_*block.- Win result blocks begin with one or more
hule_{seat}markers. - For multiple ron wins, all
hule_{seat}markers are emitted first, sharedura_dorareveal tiles are emitted once, then each winner detail follows, and one combined score-delta block is emitted after all win details. ura_dorais 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
doratoken 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.jsontokenizer_config.jsonspecial_tokens_map.jsonvocab.txt
- Downloads last month
- 617