
Purpose of this post
This post publishes the full MariaGO source code that implements what posts 1–7 explained step by step. There are many files, so they are folded by folder, and the code is loaded only when you open a file.
Models used
- Production model: Qwen3-VL-8B-Instruct + LoRA adapter lora_mix_qwen_r5 (rank 16, alpha 32)
- Input: text-only mode that feeds a two-digit aligned text board instead of a board image
- Training and inference: LoRA training and serving with MLX (mlx-vlm) on a Mac Studio (Apple Silicon)
- Training data: KGS 4-dan-and-above SGF records from u-go.net, focusing on the winner's moves with extra weight on atari and capture positions, mixed with coordinate-reading data
- Training order: starting from the coordinate-only adapter, five rounds from r1 to r5 while changing the ratio of coordinate and move data. Only adapters that passed 90% or more on the coordinate test moved on to the next round
The first model we tried
At first we attached LoRA (rank 8, later 16) to Gemma 4 E4B-it 4bit (mlx-community). We observed the model reading coordinates skewed to one side, so we unified the board format for training and serving to aligned and switched the base model to Qwen3-VL-8B.
Supporting pieces
- KataGo (b18c384nbt): position analysis, and an ensemble-judging experiment that picks one of the candidates proposed by several adapters
- NumPy two-layer MLP policy: a REINFORCE self-play experiment with a legal-move mask (rl_env)
- C++ heuristic AI: a safety net for answering atari, and a fallback move when the model fails to respond
Folder layout
- src, tests: Qt6/C++ Go client, rule engine (goboard), scoring (gamejudge), heuristic AI
- vlm_server: SGF parsing, training data generation, LoRA training, coordinate tests, move recommendation server
- rl_env: NumPy reinforcement learning experiments
- mariago-web: Next.js web game screen and game record API
Server deployment settings, remote access and monitoring scripts, training automation and experiment scripts, and the training data and model weights (hundreds of GB) are excluded from the release. Web operation code and configuration such as ads, login and rankings, debugging tools and the old Gemma model download script are also left out, so some imports point to unpublished files. Paths in the code such as /Volumes/MY_WORK/... refer to the author's Mac, so replace them with your own paths when running.
Full source
76 files · 18,629 lines — open a folder and click a file to load its code.
Project root
CMakeLists.txt
Loading code…
README.md
Loading code…
mariago-web/
mariago-web/app/api/analyze/route.ts
Loading code…
mariago-web/app/api/game/[code]/route.ts
Loading code…
mariago-web/app/api/game/list/route.ts
Loading code…
mariago-web/app/api/game/route.ts
Loading code…
mariago-web/app/api/player/route.ts
Loading code…
mariago-web/app/globals.css
Loading code…
mariago-web/app/kibo/kibo.module.css
Loading code…
mariago-web/app/kibo/page.tsx
Loading code…
mariago-web/app/layout.tsx
Loading code…
mariago-web/app/page.tsx
Loading code…
mariago-web/app/play/page.tsx
Loading code…
mariago-web/app/play/play.module.css
Loading code…
mariago-web/components/GoBoard.module.css
Loading code…
mariago-web/components/GoBoard.tsx
Loading code…
mariago-web/components/ModelSelector.module.css
Loading code…
mariago-web/components/ModelSelector.tsx
Loading code…
mariago-web/lib/board.ts
Loading code…
mariago-web/lib/db.ts
Loading code…
mariago-web/lib/gameTypes.ts
Loading code…
mariago-web/lib/guest.ts
Loading code…
mariago-web/lib/katagoTypes.ts
Loading code…
mariago-web/lib/vlmClient.ts
Loading code…
mariago-web/lib/vlmModels.ts
Loading code…
mariago-web/package.json
Loading code…
mariago-web/README.md
Loading code…
rl_env/
rl_env/__init__.py
Loading code…
rl_env/board.py
Loading code…
rl_env/env.py
Loading code…
rl_env/eval_policy.py
Loading code…
rl_env/policy_numpy.py
Loading code…
rl_env/requirements-train.txt
Loading code…
rl_env/test_legal.py
Loading code…
rl_env/test_phase2.py
Loading code…
rl_env/test_phase3.py
Loading code…
rl_env/train_reinforce.py
Loading code…
rl_env/train_selfplay.py
Loading code…
src/
src/aiplayer.cpp
Loading code…
src/aiplayer.h
Loading code…
src/boardwidget.cpp
Loading code…
src/boardwidget.h
Loading code…
src/gamejudge.cpp
Loading code…
src/gamejudge.h
Loading code…
src/goboard.cpp
Loading code…
src/goboard.h
Loading code…
src/main.cpp
Loading code…
src/mainwindow.cpp
Loading code…
src/mainwindow.h
Loading code…
src/tcpvlmclient.cpp
Loading code…
src/tcpvlmclient.h
Loading code…
tests/
tests/atari_smoketest.cpp
Loading code…
tests/test_cross_lessons.py
Loading code…
tests/test_monitor_heuristic.py
Loading code…
tests/test_pass_guard.py
Loading code…
vlm_server/
vlm_server/__init__.py
Loading code…
vlm_server/__main__.py
Loading code…
vlm_server/cross_lessons.py
Loading code…
vlm_server/dataset_baduk.py
Loading code…
vlm_server/dataset_coords.py
Loading code…
vlm_server/dataset_hogu.py
Loading code…
vlm_server/dataset_ladder.py
Loading code…
vlm_server/dataset_opening.py
Loading code…
vlm_server/eval_vlm_vs_vlm.py
Loading code…
vlm_server/ladder.py
Loading code…
vlm_server/policy_backend.py
Loading code…
vlm_server/README.md
Loading code…
vlm_server/requirements.txt
Loading code…
vlm_server/server.py
Loading code…
vlm_server/sgf_download.py
Loading code…
vlm_server/sgf_parser.py
Loading code…
vlm_server/shapes.py
Loading code…
vlm_server/train_lora.py
Loading code…
vlm_server/TRAINING.md
Loading code…
vlm_server/verify_board.py
Loading code…
vlm_server/verify_coords.py
Loading code…
COMMENTS · CHAPTER 08
The full source code and the models used 0 comments
No comments yet. Leave a question or anything you would like to add.
To post a comment, continue with Google and register a nickname and email address.
Continue with Google