
Purpose of this post
This post publishes the source code used in the sudoku AI experiments. The code is loaded only when you open a file.
Models used
- Qwen3-VL-2B-Instruct: used for the first training (lora_stoku), trial-and-error training (lora_move), certain-cell finding (lora_cell), and the 2B versions of board reading and digit-1 judgement.
- Qwen3-VL-8B-Instruct: trained for board reading (lora_board_read_8b) and per-digit impossible cells (lora_digit1_illegal_8b). The solve in post 4 used the 15-cycle adapter, and photo import uses the board-reading adapter.
- LoRA: peft, r=8, alpha=16. Every adapter uses the same settings.
- Qwen2.5-1.5B-Instruct: tells whether a web chat message is a move request.
- Gemma 4 (31B, E4B, mlx 4bit): only tested on whether it could read board coordinates.
- Web moves: currently picked by code alone, without the VLM.
Folder layout
- dataset_*.py at the root: training data generation
- *_train_loop.py and train_vlm.py at the root: LoRA training and cycle loops
- sudoku_engine.py, sudoku_human_solver.py, vlm_digit_strategy.py: puzzle generation, human-style solving, finding certain moves
- human_judge_*.py: the judgement demo from post 4
- sudoku_vlm_server.py, chat_bridge_server.py: VLM server and chat server
- main.py, main_window.py, photo_board_*.py: PyQt6 app and photo import
- web: Next.js web sudoku screen, solve records (db.ts), AI chat panel
- solve.md: the document describing how people solve
Server deployment settings, monitoring and automation scripts, training data and logs, and model weights are excluded from the release. Web operation code such as ads and the list of other games, and configuration files are also left out, so some imports point to unpublished files.
Full source
75 files · 19,630 lines — open a folder and click a file to load its code.
Project root
board_read_demo.py
Loading code…
chat_bridge_server.py
Loading code…
dataset_digit_illegal.py
Loading code…
dataset_experience.py
Loading code…
dataset_human_solver.py
Loading code…
dataset_sudoku_coords.py
Loading code…
dataset_sudoku_read.py
Loading code…
dataset_sudoku.py
Loading code…
human_judge_one_game.py
Loading code…
human_judge_solve_cycle.py
Loading code…
main_window.py
Loading code…
main.py
Loading code…
make_board_snapshot.py
Loading code…
photo_board_prep.py
Loading code…
photo_board_read.py
Loading code…
README.md
Loading code…
requirements-train.txt
Loading code…
requirements-vlm.txt
Loading code…
requirements.txt
Loading code…
solve.md
Loading code…
sudoku_engine.py
Loading code…
sudoku_human_solver.py
Loading code…
sudoku_vlm_server.py
Loading code…
sudoku_vlm_solver.py
Loading code…
train_vlm.py
Loading code…
vlm_agent.py
Loading code…
vlm_board_read_sim.py
Loading code…
vlm_board_read_train_loop.py
Loading code…
vlm_board.py
Loading code…
vlm_cell_train_loop.py
Loading code…
vlm_coord_probe_gemma.py
Loading code…
vlm_coord_sim.py
Loading code…
vlm_curriculum_loop.py
Loading code…
vlm_diag.py
Loading code…
vlm_digit_illegal_sim.py
Loading code…
vlm_digit_illegal_train_loop.py
Loading code…
vlm_digit_strategy.py
Loading code…
vlm_experience.py
Loading code…
vlm_human_probe.py
Loading code…
vlm_human_train_loop.py
Loading code…
vlm_human.py
Loading code…
vlm_loader.py
Loading code…
vlm_play_sim.py
Loading code…
vlm_play_train_loop.py
Loading code…
vlm_prompt.py
Loading code…
vlm_protocol.py
Loading code…
vlm_qwen8b_base_probe.py
Loading code…
vlm_stage_sim.py
Loading code…
web/
web/next.config.mjs
Loading code…
web/package.json
Loading code…
web/postcss.config.mjs
Loading code…
web/src/app/api/chat/route.ts
Loading code…
web/src/app/api/session/move/route.ts
Loading code…
web/src/app/api/session/route.ts
Loading code…
web/src/app/globals.css
Loading code…
web/src/app/layout.tsx
Loading code…
web/src/app/page.tsx
Loading code…
web/src/components/AiChatPanel.tsx
Loading code…
web/src/components/BottomNav.tsx
Loading code…
web/src/components/GameScreen.tsx
Loading code…
web/src/components/HomeScreen.tsx
Loading code…
web/src/components/Logo.tsx
Loading code…
web/src/components/NumberPad.tsx
Loading code…
web/src/components/SettingsScreen.tsx
Loading code…
web/src/components/SudokuApp.tsx
Loading code…
web/src/components/SudokuBoard.tsx
Loading code…
web/src/lib/db.ts
Loading code…
web/src/lib/device-id.ts
Loading code…
web/src/lib/move-kinds.ts
Loading code…
web/src/lib/notes.ts
Loading code…
web/src/lib/sudoku.ts
Loading code…
web/src/lib/types.ts
Loading code…
web/src/types/node-sqlite.d.ts
Loading code…
web/tailwind.config.ts
Loading code…
web/tsconfig.json
Loading code…
COMMENTS · CHAPTER 06
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