Personal Japanese riichi mahjong AI project.
Important
lisjong is an independent personal Japanese mahjong AI project developed by lisbun. It is not affiliated with any other project using the LisJong or lisjong name.
lisjong は、日本式立直麻雀AIの decision core を開発するrepositoryです。
初期段階で重視していた、
Policy contract
↓
RiichiEnv / RiichiLabへ安全に接続
↓
局・半荘を再現可能に完走
という接続・実行基盤は、現在はecosystem内で独立した責務へ整理されています。
RiichiEnv / RiichiLabへのexternal execution / observationは
lisjong-arena がcanonical ownerです。
現在の中心は、再現可能な研究ループの中でPolicyを実際に強くするresearch phaseです。
主な研究方向は次の2本柱です。
A. General Policy Strength
Learned Policy / structural efficiency / value / defense / long-horizon utility
B. Explicit HandBelief Research
hidden informationを明示的に推定し、decision valueへ接続する
総合strengthのNorth Starはfixed-protocolの半荘performanceとしつつ、 日常のcandidate iterationでは、より安いdiagnostic / round-level evidenceを先に使って 明らかな退化を早期にrejectします。
cheap diagnostic
↓
low-complexity opponent evaluation
↓
interactive single-round evaluation
↓
hanchan evaluation / North Star
cheap metric は最終optimization targetではなく、reject / triage / prioritizationのための
signalとして扱います。
lisjong ecosystem全体のrepository責務、依存方向、長期ロードマップは
lisjong-project を正本とします。
- Project architecture
- Project roadmap
- Policy current status
- 研究ロードマップの現在地・Issue一覧
- kobalab 0004 tile-efficiency reference
- kobalab 0004 profile / optimization / Belief paijia
- lisjong architecture
- Rustへの段階移行(確定方針・現在地)
Learned Policyは、hand-crafted Policyとは別世界のruntimeを作らず、既存の Policy contract / action semantics / execution / evaluationを再利用して研究します。
現在までに、model-facing action vocabulary、player-safe feature representation、 dataset / training / servingのbounded vertical slice、Behavior Cloning、Offline Q系の controlled experimentまで成立しています。
一方、technical servingの成立とgame strengthは別問題として扱います。 Behavior Cloningやsimple Offline Qの実験では、teacher agreementや学習の成立だけでは strengthを保証できないことが確認されています。特にOffline Qのfailure diagnosisでは、 Qによるaction selectionがhand progressionを悪化させるmechanism-level evidenceが得られました。
そのため、現在の研究方針は次です。
strong existing AI / literature
↓
mechanism-level design principle
↓
existing lisjong evidence
↓
one-axis bounded experiment
↓
cheap diagnostic first
↓
higher-fidelity strength evaluation only when warranted
強い既存AIで使われているarchitectureやalgorithmをそのままcanonical designとはせず、
representation、objective、data scale、offline support、auxiliary supervision等へ
分解し、原則1軸ずつlisjong自身のevidenceで検証します。
初期Learned Policyでは、最初から麻雀の全能力を同時に獲得できることを前提にせず、
hand progression
↓
tenpai
↓
riichi / win
↓
calling / hand value
↓
defense / push-fold
↓
opponent belief / placement / long-horizon utility
のように基礎能力を診断できるcurriculumも重視します。
lisjongは、不完全情報ゲームであるリーチ麻雀において、観測可能な情報から hidden stateに対するbeliefを構築し、その不確実性を意思決定へ利用することを 独自の重要な研究軸とします。
特に、各他家のconcealed handに各牌種が何枚存在するかの期待値を推定する
HandBelief を中心に、heuristic / learned estimator、history-aware representation、
data scale、decision-value integrationを段階的に検証します。
ただし、次の3つは別のquality claimです。
belief prediction quality
!=
Policy decision quality
!=
overall game strength
estimatorのaccuracy / calibrationが改善しても、それだけでPolicy strength improvementとは みなしません。Policyへ利用する段階では、controlled Arena evaluationでdecision valueと 実際のgame performanceを別途確認します。
| Repository | 主な責務 |
|---|---|
lisjong |
AI decision core、Policy / AI-side contract、action semantics、牌効率・belief・value / risk、canonical Learning(feature / dataset / teacher / training / artifact / inference) |
lisjong-engine |
日本式立直麻雀のルール、状態遷移、合法手、round / hanchan progression |
lisjong-arena |
external / local execution、objective observation、reusable source record、Policy strength evaluation |
lisjong-play |
Human Play / GUI / presentation consumer |
lisjong はstableなAI-side semanticsとcanonical Learning capabilityを所有します。
feature・dataset・teacher / label・training objective・artifact・inferenceの意味はlisjong、
source生成・客観的観測・正式な棋力評価はArenaの責務です(project ADR 0008)。
Arenaのhistorical Learning実装はreferenceとして保持し、lisjongからruntime依存を作りません。
実験の成功を、そのままproduction / stable contractへ昇格させません。
lisjongの中心的な境界は、観測可能な情報から合法Actionを選択することです。
DecisionContext
|
v
Policy
|
v
InternalAction
- 外部environment固有型をPolicy contractへ漏らさない
- seat-visibleな情報だけをdecisionへ利用する
- Policyはlegal actionから選択する
- semantic identityと外部表現上のindexを分離する
- privileged observer dataをruntime Policy inputへ逆流させない
詳細は Architecture と Policy contract を参照してください。
lisjong.action_vocabulary は、Learned Policyが固定長のmodel outputを扱うための
versioned action vocabularyとlegal mask contractを提供します。
semantic identity
= InternalAction dataclass value equality
model action index
= versioned adapter representation
model action indexは麻雀上の新しいAction identityでも、合法性の根拠でもありません。 合法性のauthorityは常にcurrent decisionのlegal actionsです。
詳細は Model-facing action vocabulary を参照してください。
公開Policyのcurrent role、current strength baseline、training coverage source等の 現在の解釈は Policy current status を正本とします。
historicalな評価値やpromotion / rejectionの全履歴をREADMEへ複製しません。
Policy strength comparisonのmeasurement source of truthはlisjong-arena側の
artifact / evaluation policyです。
- correctness / information boundary / reproducibilityをstrength claimより先に守る
- strong-AI referenceを採用理由ではなくresearch evidenceとして扱う
- 原則 one bounded experiment = one primary research question
- negative / inconclusive / invalid resultも次の判断に使えるevidenceとして保持する
- cheap proxyを最終目的化しない
- fixed-protocol hanchan performanceを総合strengthのNorth Starとして維持する
- resultを見てseedやthresholdを都合よく追加しない
- large model / large data / native backend / cloud scaleはmeasured need後に導入する
- 高頻度のsmall loopはLLMに依存させず、LLM / coding agentは低頻度のresearch decisionに利用できる形を優先する
- Rust等のnative backendは、profilingで対象を特定した計算の試作・学習としては許容する。本採用(default化)は、既存Python実装との同値性と、変換込みの実測効果・導入保守負担で判断する(#213の試作記録)
初期基準は通常版CPython 3.14です。
python -m venv .venv
.venv\Scripts\Activate.ps1
python -m pip install -e ".[dev]"macOS / Linuxでは:
source .venv/bin/activate品質確認:
python -m ruff format --check .
python -m ruff check .
LISJONG_REQUIRE_NATIVE=1 python -m unittest discover -s tests -v
testはnative拡張が導入された環境で実行します(LISJONG_REQUIRE_NATIVE=1でnative不在をskipではなく失敗にします)。
向聴数・打牌候補の一括評価・R5探索はnative拡張_lisjong_native(native/のRust crate)で
計算します。Issue #346でPython計算実装を削除したため、Policyを使うにはlisjongと
同じrevisionのnative拡張が必要です。対応環境はLinux x86_64 / CPython 3.14通常版で、
WindowsではWSLを使います(Windows native wheelは提供しません)。
# 推奨: 同revisionのsourceとmain CI wheelの組を新規venvへ導入・検証する
python3.14 tools/native_bundle.py install <bundle> <new-venv>
# Rust toolchain(native/rust-toolchain.toml)がある環境でのsource build
python -m pip install ./nativeLISJONG_SHANTEN_BACKENDは未設定(またはrust)にします。旧値pythonや未知の値、
native拡張の不在・API_VERSION不一致は、lisjong.hand_evaluation.shantenのimport時に
ShantenBackendErrorで失敗します(Pythonへのfallbackはありません)。lisjong、
lisjong.hand_evaluation.scoring、artifact供給moduleとoffline generatorのimportは
native拡張なしでも成功します。Python backendで行った過去の実行は、記録済みrevisionと環境で再現します。
導入・配布は Rust backend wheel配布記録、
経緯は Rust backend試作記録 と
Python計算backendの段階的廃止 を参照してください。
lisjong 自体はRiichiEnv / RiichiLab execution runtimeを所有しません。
external/local integration testや実対局の実行方法は
lisjong-arena を参照してください。
このrepositoryには、次をcommitまたは再配布しません。
- RiichiLabのBot token、API key、その他の秘密情報
- 利用条件を確認していない牌譜・学習データ
- Mortalなど外部プロジェクトのmodel weight
- 大容量の生成model、raw data、実験artifact
外部データやmodelを利用する場合は、提供元、license、version、取得方法、hash等を確認し、 repository本体とは分離して管理します。
project-wideな長期方向は
lisjong-project/docs/roadmap.md
を正本とします。
個別の実験、実装、acceptance criteria、current next actionは各repositoryのGitHub Issues / PRsを 正本とし、READMEを短期進捗表として使いません。
lisjong自身のsource codeはMIT Licenseで公開します。外部library、model、牌譜、 学習データには、それぞれの提供元のlicenseと利用条件が適用されます。