Moka is a tiny (104k parameter, 112KB INT8) 9×9 Go AI distilled from KataGo that runs entirely in the browser with ~9ms inference and a 103KB total payload.

Stars

8

7-day growth

No data

Forks

0

Open issues

0

License

MIT

Last updated

2026-07-28

Why it is worth attention

It demonstrates how a learned Go player can be compressed to under 1% of its teacher's size while still performing competitively on the 9×9 board, making it embeddable in any ordinary webpage without heavy downloads or GPU requirements.

Who it is for

  • Web developers who want to add a Go AI to a site without a server or large model
  • Go players interested in a lightweight, browser-based opponent or analysis tool
  • AI researchers studying model distillation, quantization, or efficient neural networks

Use cases

  • Embedding a Go AI in a static website for interactive play or teaching
  • Providing a lightweight analysis engine for 9×9 Go games in a browser
  • Serving as a demonstration of deploying a distilled model for real-time inference on consumer hardware

Strengths

  • Extremely small payload (103KB total) and fast mean inference of 9ms in the browser
  • Easy to integrate via a simple JavaScript API without frameworks or bundlers
  • Distilled from KataGo b6c96, achieving 117/300 wins against it with 64-visit search
  • Open-source under MIT license, allowing free use and modification

Considerations

  • Supports only 9×9 boards; no 19×19 or larger board support
  • Strength is limited (only marginally better than previous artifact) and not a replacement for full KataGo
  • Training requires external KataGo weights and a specific pipeline, limiting reproducibility for others

README quick start

Moka

A cute Go-playing model.

Moka v1 is a 104,129-parameter policy and value network for 9×9 Go. Its 112 KB INT8 weights run entirely in the browser. With 64-visit search, this artifact won 117 of 300 fresh games against KataGo b6c96, compared with 113 for the previous artifact on the same openings.

Moka was distilled from KataGo b6c96 using teacher games and positions reached by Moka’s own rollouts.

Browser payload

PathWeightsRuntimeTotal load
Moka v1 · INT8100 KB4 KB103 KB
KataGo b6c96 · ONNX4.1 MB12.8 MB17.0 MB

Moka’s browser path is about 165× smaller than the teacher path. The point is not to replace KataGo. It is to put a learned Go player inside an ordinary webpage.

Browser performance

Moka runs inference in a Web Worker, which keeps model execution off the main thread.

MetricLatency
Initialization10.1 ms
Mean inference9.0 ms
p50 inference8.8 ms
p95 inference9.6 ms

These are the medians of five Chromium runs on Apple Silicon. Each run measured 100 positions after 10 warmups. Latency includes Worker messaging; inference stays off the main thread.

Embed Moka on a site

Embed Moka by serving its browser client, worker, manifest, and weights with your site. The example below runs without a framework or bundler.

Build and copy the browser assets

Build Moka from this repository, then copy its four runtime files into your site’s public directory.

ni
nr build
mkdir -p ../your_site/public/moka
cp dist/index.js ../your_site/public/moka/index.js
cp dist/worker.js ../your_site/public/moka/worker.js
cp model/go-model.json ../your_site/public/moka/go-model.json
cp model/go-model.bin ../your_site/public/moka/go-model.bin

The deployed site should serve these files from /moka. Use different URLs in the initialization options if you choose another directory.

Initialize Moka in the browser

Run this code from a JavaScript module, such as an app.js file loaded with type="module".

import {
  GoModelWorkerClient,
  createGameState,
  encodeStudentFeatures,
  playMove,
  selectHighestLegalMove,
} from "/moka/index.js";

const mokaWorker = new Worker("/moka/worker.js", {
  type: "module",
});
const moka = new GoMode

Description

A very cute Go-playing model

Related repositories

Similar projects matched by category, topics, and programming language.

lopopolo
Featured
lopopolo GitHub avatar

harness-engineering

Harness Engineering is a methodology for improving coding agent outputs by carefully crafting the environment around them—providing curated context, tools, and executable constraints that encode an organization’s nonfunctional requirements and cumulative lessons.

AI & Machine LearningAI Agents
2,390
slvDev
Featured
slvDev GitHub avatar

esp32-ai

A 28.9 million parameter language model runs on an $8 ESP32-S3 microcontroller entirely on-device, generating simple stories at about 9.5 tokens per second.

AI & Machine LearningLarge Language Models
1,960
littledivy
Featured
littledivy GitHub avatar

mimic

mimic captures traffic from any iOS or web app and automatically generates a Python client library that lets you call the app's API like a regular library.

AI & Machine Learning
1,482