Skip to content

Kyojin: open-source engine that runs 100 GB-class open models (GLM-5.3, Qwen3.8, DeepSeek V4.1) on one desktop machine. AMD Strix Halo, NVIDIA RTX and Apple Mac. OpenAI API, built on ExLlamaV3.

feat(nix): add kyojin-bench app for benchmark reports

Tristin Stagg12e3ea09b9a5
diff --git a/doc/nix.md b/doc/nix.md
index 6ba9256..38a1260 100644
--- a/doc/nix.md
+++ b/doc/nix.md
@@ -118,6 +118,22 @@ Context size is the memory lever: 262144 was verified on all three packs on
an otherwise empty 128 GB box (Qwen kept 13.9 GiB free, GLM 10.4, MiMo 6.6).
Lower it when the machine is shared.
+## Benchmark
+
+`tools/bench.py` runs unmodified against any running server (stdlib only).
+From a checkout the default corpus is the repo's own Markdown, so plain
+`nix develop --command python3 tools/bench.py` just works when the server
+is local. Against a remote box, tunnel it and bring a corpus:
+
+```bash
+ssh -L 8000:localhost:8000 <server> # keep this open in another shell
+nix run .#kyojin-bench -- --base http://localhost:8000/v1 \
+ --corpus <any 8000+ word text file> --json
+```
+
+It prints a Markdown block ready to paste into a benchmark report issue,
+plus a fenced JSON block with `--json` for collecting tables.
+
## Test notes
`checks.kyojin-tests` runs `tests/test_*_cpu.py` (95 green). Three tests in
diff --git a/flake.nix b/flake.nix
index 6306697..74a8a27 100644
--- a/flake.nix
+++ b/flake.nix
@@ -573,8 +573,32 @@
};
};
- # NOTE: pythonSet.torch IS the ROCm torch (swapped in myOverrides
- # above); packages.torch-rocm aliases it for a stable address.
+ # NOTE: pythonSet.torch IS the ROCm torch (lock resolution);
+ # packages.torch-rocm aliases it for a stable address.
+
+ # 9b. kyojin benchmark runner (house pattern 3: stdenv + makeWrapper).
+ # bench.py is stdlib-only, so plain python3 suffices (no engine
+ # venv), and it runs unmodified: default corpus is the repo's own
+ # Markdown (run it from a checkout, e.g. nix develop), or pass
+ # --corpus explicitly anywhere else.
+ kyojinBench = pkgs.stdenv.mkDerivation {
+ pname = "kyojin-bench";
+ version = "1.5.0";
+ src = ./.;
+ nativeBuildInputs = [ pkgs.makeWrapper ];
+ installPhase = ''
+ runHook preInstall
+ mkdir -p $out/share/kyojin $out/bin
+ cp $src/tools/bench.py $out/share/kyojin/
+ makeWrapper ${pkgs.python312}/bin/python3 $out/bin/kyojin-bench \
+ --add-flags "$out/share/kyojin/bench.py"
+ runHook postInstall
+ '';
+ meta = {
+ description = "kyojin benchmark runner (issue #1 reports)";
+ mainProgram = "kyojin-bench";
+ };
+ };
# 10. Container image + entrypoint. Ships the full SDK + toolchain
# because serve builds GPU kernels on first use (install.md) with
@@ -770,6 +794,7 @@
hip-sysroot = hipSysroot;
kyojin = kyojinServe;
docker = kyojinImage;
+ bench = kyojinBench;
};
apps =
@@ -783,6 +808,10 @@
kyojin-serve-qwen = serveApp "qwen";
kyojin-serve-glm = serveApp "glm";
kyojin-serve-mimo = serveApp "mimo";
+ kyojin-bench = {
+ type = "app";
+ program = "${kyojinBench}/bin/kyojin-bench";
+ };
default = serveApp "glm";
};
};