Moka 是一个超小型的 9×9 围棋 AI,仅 10.4 万个参数、112KB INT8 权重,从 KataGo 蒸馏而来,可在浏览器中以约 9ms 推理时间运行,总加载量仅 103KB。

Stars

8

7 天增长

暂无数据

Fork 数

0

开放 Issue

0

开源协议

MIT

最近更新

2026-07-28

AI 仓库情报摘要
FR-AI / ANALYSIS

为什么值得关注

它将一个可学习的围棋棋手压缩到教师模型大小的 1% 以下,同时仍能在 9×9 棋盘上具备一定竞争力,且无需服务器或 GPU,可嵌入普通网页,展示了模型蒸馏和量化技术的实际应用。

适合谁使用

  • 希望在不依赖服务器或大型模型的情况下为网站添加围棋 AI 的 Web 开发者
  • 对轻量级、基于浏览器的棋局对手或分析工具感兴趣的围棋爱好者
  • 研究模型蒸馏、量化或高效神经网络的人工智能研究员

典型使用场景

  • 在静态网站中嵌入围棋 AI 用于交互对弈或教学
  • 在浏览器中提供轻量级的 9×9 围棋对局分析引擎
  • 作为在消费级硬件上部署蒸馏模型进行实时推理的示例

项目优势

  • 极小的加载量(总计 103KB)和浏览器中平均 9ms 的推理速度
  • 通过简单 JavaScript API 即可集成,无需框架或打包工具
  • 从 KataGo b6c96 蒸馏,在 64 次搜索下以 117/300 胜场击败教师模型
  • 采用 MIT 开源许可,可自由使用和修改

使用前须知

  • 仅支持 9×9 棋盘,无法处理 19×19 或更大尺寸
  • 棋力有限(仅略优于之前版本),不能替代完整 KataGo
  • 训练需要外部 KataGo 权重和特定流程,对其他人复现有一定门槛

README 快速开始

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

项目描述

A very cute Go-playing model

相关仓库与替代方案

根据分类、Topic 和编程语言匹配的相似项目。

lopopolo
精选
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 与机器学习AI 智能体
2,390
slvDev
精选
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 与机器学习大语言模型
1,960
littledivy
精选
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 与机器学习
1,482