From bf55cfe978234bcd5b450e29eba27e316b1cb678 Mon Sep 17 00:00:00 2001 From: Ronald Tse Date: Mon, 23 Nov 2026 09:59:00 +0800 Subject: [PATCH] docs: the /ml quickstart (real three-runtime recipe) + the 2026-11 first baselines table MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit /ml#getting-started — "Use the models": install lines plus the real three-line recipe per runtime, all verified against each runtime's released API (npm 6.0.0 imf.resolve + PlaneModel.fromZip.transform; ruby 3.8.0 IMF.resolve + PlaneModel.from_zip; py transliterate unified dispatch). The example input/output is the frozen conformance vector for heb-vocalized-plane-3.0; the page notes the py 0.2.1 index-v12 pin (INTERSCRIPT_ML_INDEX override until the index-v16 release ships) and that the Rust runtime serves the map layer only. The crystals section's pre-rebrand secryst install/API snippet (Secryst::Model.load) is replaced with the current interscript packages, INTERSCRIPT_ML_* env names, and the esm.sh 6.0.0 pin. /benchmarks — "First baselines (frozen)": the 2026-11-21 registry cold-load / RSS / throughput table quoted from interscript-rs docs/benchmarks/BASELINES-2026-11.md, with machine context, the protocol link, per-runtime reading notes, and the same-day py refresh (#48/#49) stated as not directly comparable. --- .prettierignore | 1 + src/pages/benchmarks.astro | 133 +++++++++++++++++++++++++++++++++++++ src/pages/ml.astro | 87 ++++++++++++++++++------ 3 files changed, 199 insertions(+), 22 deletions(-) diff --git a/.prettierignore b/.prettierignore index 0908bcd..0fa672c 100644 --- a/.prettierignore +++ b/.prettierignore @@ -32,3 +32,4 @@ src/pages/api-docs.astro # hand-wrapped prose (Astro whitespace trap) — see CLAUDE.md src/pages/playground.astro src/pages/docs/isc-language.astro +src/pages/benchmarks.astro diff --git a/src/pages/benchmarks.astro b/src/pages/benchmarks.astro index bdf0c55..8cb1c5e 100644 --- a/src/pages/benchmarks.astro +++ b/src/pages/benchmarks.astro @@ -92,6 +92,56 @@ const baseline = [ perMap: 377, }, ] + +// The first runtime baselines are frozen by design: quoted verbatim from +// interscript-rs docs/benchmarks/BASELINES-2026-11.md (2026-11-21 run) — +// one-shot serial numbers, not medians; the protocol lives in the rs repo. +const firstBaselines = [ + { + runtime: "Rust (interscript-rs)", + coldLoad: "9.55", + loaded: "456/457", + rssLoad: "342.7", + docsPerSec: "145.1", + charsPerSec: "3,975", + rssThroughput: "406.2", + peakDoc: "318", + rssPeak: "16.2", + }, + { + runtime: "TypeScript (interscript-ts)", + coldLoad: "0.28", + loaded: "457/457", + rssLoad: "202.7", + docsPerSec: "1,475.3", + charsPerSec: "40,408", + rssThroughput: "613.2", + peakDoc: "22", + rssPeak: "49.6", + }, + { + runtime: "Ruby (interscript-ruby)", + coldLoad: "137.59", + loaded: "457/457", + rssLoad: "974.2", + docsPerSec: "1,976.3", + charsPerSec: "54,130", + rssThroughput: "594.3", + peakDoc: "863", + rssPeak: "33.4", + }, + { + runtime: "Python (interscript-py)", + coldLoad: "3.59", + loaded: "435/457", + rssLoad: "273.0", + docsPerSec: "52.1", + charsPerSec: "1,426", + rssThroughput: "241.3", + peakDoc: "42", + rssPeak: "19.4", + }, +] --- +
+
+

First baselines (frozen)

+

Registry cold load, RSS, and end-to-end throughput — 2026-11-21

+
+
+

+ Quoted verbatim from{" "} + + interscript-rs docs/benchmarks/BASELINES-2026-11.md + {" "} + (2026-11-21 run): the first measured baselines of the full registry path. One-shot serial + run on an otherwise idle machine (Apple M1 Max, 10 cores, 64 GB, macOS 14.1.1) — + numbers are single-run baselines, not medians. All four runtimes loaded the same maps + corpus pin (9cfbf4cf, 457 maps) and transliterated the same deterministic + 200-doc sample. Measure definitions and the runner interface: the{" "} + + full protocol. +

+
+ + + + + + + + + + + + + + + + {firstBaselines.map((row) => ( + + + + + + + + + + + + ))} + +
RuntimeCold load (s)LoadedRSS @ load (MB)Docs/secChars/secRSS @ throughput (MB)Peak doc (ms)RSS @ peak (MB)
{row.runtime}{row.coldLoad}{row.loaded}{row.rssLoad}{row.docsPerSec}{row.charsPerSec}{row.rssThroughput}{row.peakDoc}{row.rssPeak}
+
+

+ Definitions (from the protocol): cold load = a fresh process loading all + 457 maps through the runtime's standard registry path; docs/sec = warm + throughput over the 200-doc set × 5 loops; peak doc = fresh-process load + plus a single transliteration of the largest input doc; RSS = process + resident set of the whole runner, so cross-runtime deltas include each interpreter's own + baseline — per-runtime trends over time are the primary signal. +

+

+ Reading the spread: TypeScript's 0.28 s cold load reads the pre-compiled JSON-IR + artifact (deserialise + link, not ISC parsing); Ruby's 137.6 s / 974 MB is + per-map parsanol compilation, after which it is the fastest runtime warm (1,976 + docs/sec); Rust parses .isc at load and cannot load one map whose{" "} + rababa funcall needs external ML engines (unsupported in that slice, by + design); the Python row is the pre-#49 engine — 22 parser-gap maps did not + load. +

+

+ Same-day refresh: after py caching (#48) and full parser coverage + (#49), py loads 457/457, cold load 7.27 s, and reaches 91.1 docs/sec + (2,496 chars/sec) with zero errors — +75% warm throughput while decoding strictly more + work (all 200 docs vs the baseline's 193); peak doc unchanged at 42 ms. Per the + baselines doc, that refresh number is not directly comparable to the baseline row — the + honest statement is more work, fewer errors, on the same machine and corpus pin. +

+
+
+

Reproduce

@@ -417,6 +547,9 @@ node scripts/benchmarks/generate.mjs font-size: 0.85rem; color: var(--color-stone); } + .table-scroll { + overflow-x: auto; + } td.fine-print { max-width: 22rem; } diff --git a/src/pages/ml.astro b/src/pages/ml.astro index 6dc21a1..c921c60 100644 --- a/src/pages/ml.astro +++ b/src/pages/ml.astro @@ -414,41 +414,84 @@ const modelCount = all.length

The crystals

Three runtimes, same bytes out.

- The neural layer is served by secryst — the same cross-runtime contract as the map - layer. Ruby, Python, and TypeScript resolve a model id against the index, fetch (or reuse the - cache), verify every checksum, and decode with the KV-cache graph. Golden sets pin the three - implementations to each other. + The neural layer is served by the runtimes themselves — the same cross-runtime contract + as the map layer. Ruby, Python, and TypeScript resolve a model id against the index, fetch + (or reuse the cache), verify every checksum, and decode locally — KV-cache streaming for + the seq2seq family, mask-predict passes for the plane family. Golden sets pin the three + implementations to each other; install lines and the three-line recipe are in{" "} + Use the models below.

-
-
# Ruby
-gem install secryst
-
-# Python
-pip install secryst
-
-# TypeScript / JavaScript
-npm install secryst
-
require "secryst"
-model = Secryst::Model.load("tha-g2p-small-1.0")
-model.translate("สวัสดี")
-# => "sa˨˩.wat̚˨˩.diː˧"
-

- Point deployments at a mirror with SECRYST_INDEX; pin the cache with SECRYST_CACHE. Both are read at call time in all three runtimes. + Point deployments at a mirror with INTERSCRIPT_ML_INDEX; pin the cache with{" "} + INTERSCRIPT_ML_CACHE (the old SECRYST_* names still work as + aliases). Both are read at call time in all three runtimes.

Without installing anything: the same models answer the REST endpoint POST https://api.interscript.org/v1/infer (open CORS, no key), and run in the browser at the demo page. In a script with no build step, the map - layer loads from esm.sh — full recipe in the + layer loads from esm.sh — full recipe in the package's docs/CDN.md.

+
+
+
+

Getting started

+

Use the models.

+

+ A model id resolves against the models.yaml index, downloads once, and is sha256-verified + on every load — then it runs locally, no server involved. Three lines per runtime. The + example restores the nikud a scribe left out; the input and output are a frozen + conformance vector, and all three runtimes are gated to produce it byte-exactly. +

+
+
+
{`# install — the neural layer ships inside the same package
+npm install interscript          # TypeScript / JavaScript
+gem install interscript          # Ruby (onnxruntime loads lazily)
+pip install "interscript[ml]"    # Python`}
+
{`// TypeScript
+import { imf, PlaneModel } from "interscript/ml"
+
+const model = await PlaneModel.fromZip((await imf.resolve("heb-vocalized-plane-3.0")).bytes)
+await model.transform("ואם הזה, כשר")
+// → "וְאִם הִזָּה, כָּשֵׁר"`}
+
{`# Ruby
+require "interscript/ml"
+
+model = Interscript::ML::PlaneModel.from_zip(
+  File.binread(Interscript::ML::IMF.resolve("heb-vocalized-plane-3.0")))
+model.translate("ואם הזה, כשר")
+# => "וְאִם הִזָּה, כָּשֵׁר"`}
+
{`# Python
+import interscript
+
+interscript.transliterate("heb-vocalized-plane-3.0", "ואם הזה, כשר")
+# → "וְאִם הִזָּה, כָּשֵׁר"`}
+
+

+ First use downloads the int8 artifact (about 416 MB for this model) and caches it — + point the cache at INTERSCRIPT_ML_CACHE (default{" "} + ~/.cache/interscript-ml); every later load re-verifies the sha256, the cache is + never trusted blindly. Other model kinds share the same three steps: seq2seq ids load + through{" "} + Interscript::ML::Translator.new(model_file:) in Ruby,{" "} + Model.load(id) in Python, imf.IMFModel.load(id) in TypeScript. +

+

+ Version note: Python 0.2.1 still pins the previous model index — until its next release + ships the index-v16 pin, set INTERSCRIPT_ML_INDEX to the index-v16{" "} + models-index.yaml URL (all three runtimes read the variable at call time). The + Rust runtime serves the map layer; neural inference ships in the TypeScript, Ruby, and + Python runtimes. +

+
+
+