Skip to content

Commit 5553784

Browse files
authored
Merge pull request #176 from interscript/docs-libraries-measure
docs: Libraries + How-we-measure
2 parents dd9e100 + fc8bb2c commit 5553784

2 files changed

Lines changed: 180 additions & 0 deletions

File tree

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
= How we measure
2+
3+
Every quality number we publish is measured, recorded, and can be
4+
re-derived by anyone. This page explains how.
5+
6+
== Where numbers come from
7+
8+
Each model's accuracy figure comes from a fixed evaluation protocol,
9+
run on the complete test set, and is recorded in a public results log:
10+
https://github.com/interscript/interscript-ml/blob/main/docs/RESULTS.md[docs/RESULTS.md].
11+
The log records the number, a confidence interval where the protocol
12+
supports one, and a checksum of the exact training labels used.
13+
14+
When a number turned out to be wrong, we corrected it in public. One
15+
example: the Arabic model ara-diac-small-2.0 was first published with a
16+
score of 4.82. Two independent re-measurements of the released files
17+
agreed on a different value, 5.08, and the original number was
18+
withdrawn (the correction entry in the results log explains what
19+
changed and what it affected).
20+
21+
== Re-deriving our results
22+
23+
The pieces are public:
24+
25+
* The benchmark: https://huggingface.co/datasets/Misraj/SadeedDiac-25[SadeedDiac-25]
26+
* The scoring tool: `pip install interscript-ml-tools[sadeed]`
27+
* Our raw predictions for every published run: the
28+
https://github.com/interscript/interscript-ml/releases/tag/frontier-predictions-v1[frontier-predictions-v1]
29+
release
30+
* The teacher checkpoints behind the training results: the
31+
https://github.com/interscript/interscript-ml/releases/tag/teachers-arabic-v1[teachers-arabic-v1]
32+
release
33+
34+
To re-score one of our runs:
35+
36+
```
37+
pip install interscript-ml-tools[sadeed]
38+
interscript-sadeed-eval score \
39+
--preds <predictions file> \
40+
--data Misraj/SadeedDiac-25
41+
```
42+
43+
The tool reproduces the published numbers exactly; that is how the
44+
incorrect 4.82 above was found.
45+
46+
== Cross-runtime correctness
47+
48+
The same model file must produce the same output in TypeScript,
49+
Python, and Ruby. We check this with a shared corpus of reference
50+
inputs and outputs (the
51+
https://github.com/interscript/interscript-ml/releases/tag/golden-v1[golden-v1]
52+
release), generated from the released artifacts themselves.
53+
54+
The guarantee has a measured boundary. Models stored at full precision
55+
(fp32, fp16) produce byte-identical output on every machine we tested.
56+
Quantized models (int8, int4) run faster and smaller, but on different
57+
CPU types their outputs can differ slightly: tiny numerical
58+
differences flip decisions that the model is nearly undecided on. For
59+
those models the guarantee is quality-level, not byte-level, and each
60+
artifact carries its measured quality difference from the full
61+
precision version in its metadata.
62+
63+
== Negative results
64+
65+
Not every approach worked. Attempts to close the quality gap between
66+
the small student models and their teachers by adding more classical
67+
training text, changing the text mixture, or training on the model's
68+
own mistakes all failed, with measurements recorded in the results
69+
log. We publish these alongside the successes because they define what
70+
the current models are and are not.

src/content/docs/Libraries.adoc

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
= Libraries
2+
3+
Interscript ships as libraries for three languages, a command-line
4+
tool, and a web API. All of them run the same transliteration systems
5+
and the same neural models, and all model artifacts are
6+
checksum-verified when they load.
7+
8+
== TypeScript (Node and browsers)
9+
10+
Install:
11+
12+
```
13+
npm install interscript
14+
```
15+
16+
Transliterate with one of the 289 authority systems:
17+
18+
```ts
19+
import { transliterateAsync } from "interscript"
20+
21+
const out = await transliterateAsync(
22+
"bgnpcgn-ukr-Cyrl-Latn-2019",
23+
"Антон",
24+
)
25+
```
26+
27+
Use a neural model (for example, Arabic diacritization). The model
28+
downloads once, is verified against its checksum, and is cached:
29+
30+
```ts
31+
import { imf } from "interscript/ml"
32+
33+
const resolved = await imf.resolve("ara-diac-layerdrop-1.0-int4")
34+
const model = await imf.IMFModel.fromZipBytes(resolved.bytes)
35+
const vocalized = await model.translate("السلام عليكم")
36+
```
37+
38+
== Python
39+
40+
Install:
41+
42+
```
43+
pip install interscript-ml
44+
```
45+
46+
Load a model and run it:
47+
48+
```python
49+
from interscript_ml import Model
50+
51+
model = Model.load("ara-diac-small-2.1-int8")
52+
print(model.translate("قوله فحكمها في الوفاة"))
53+
```
54+
55+
== Ruby
56+
57+
Install:
58+
59+
```
60+
gem install secryst
61+
```
62+
63+
Load and translate:
64+
65+
```ruby
66+
require "secryst"
67+
68+
model = Secryst::Model.load("ara-diac-small-2.1-int8")
69+
model.translate("قوله فحكمها في الوفاة")
70+
```
71+
72+
== Command line
73+
74+
The deterministic systems:
75+
76+
```
77+
echo "Антон" | npx interscript t bgnpcgn-ukr-Cyrl-Latn-2019
78+
```
79+
80+
The neural layer:
81+
82+
```
83+
echo "السلام عليكم" | npx interscript m ara-diac-layerdrop-1.0-int4
84+
```
85+
86+
Run `npx interscript --help` for the full command list, including bulk
87+
processing and script detection.
88+
89+
== Web API
90+
91+
A hosted REST API serves both layers:
92+
https://api.interscript.org[api.interscript.org]. Its documentation,
93+
including batch endpoints and asset serving, lives at
94+
https://api.interscript.org/docs[/docs].
95+
96+
== Try it in the browser
97+
98+
The link:/playground[playground] runs the full stack in your browser:
99+
pick any system, optionally vocalize Arabic text first, and copy the
100+
exact code for the configuration you selected. Nothing is sent to a
101+
server.
102+
103+
== Which models exist
104+
105+
The model catalog with measured quality numbers for every artifact is
106+
on the link:/ml[neural layer page]. The machine-readable index that the
107+
libraries resolve against is
108+
https://github.com/interscript/interscript-ml/blob/main/models.yaml[models.yaml]
109+
in the https://github.com/interscript/interscript-ml[interscript-ml]
110+
repository.

0 commit comments

Comments
 (0)