Normative. Key words MUST / MUST NOT / SHALL / SHOULD / MAY are to be interpreted as described in RFC 2119. This file is the canonical text; the crystals' documentation site renders the same content for users.
An implementation conforms to interscript-ml v1 when it:
- C1 — MUST resolve model ids against a
models.yamlindex ofversion: 1, honoringSECRYST_INDEX. - C2 — MUST verify the whole-artifact sha256 before installation and re-verify every cache hit; a mismatch MUST fail loudly.
- C3 — MUST verify every
.onnxmember against the manifest sha256 map on load; members not covered by the manifest MUST NOT load. - C4 — MUST implement the byte tokenizer exactly (§4); id sequences MUST NOT be treated as raw bytes.
- C5 — MUST produce byte-identical outputs to the reference crystal on the shared golden sets.
- C6 — SHOULD install artifacts atomically (temp file + rename).
version: 1
models:
<id>:
filename: string # artifact file name
url: string # single-file channel (http(s):// or file://)
sha256: string # whole-artifact digest
size: int
precision: fp32 | fp16 # default fp32
task: string
parts: # OPTIONAL: split artifacts
- url: string
sha256: string # per-part digest, verified as it lands
size: int
The parts mechanism exists for artifacts exceeding GitHub's 2 GiB
per-asset cap: parts stream into one file in index order, each verified
on arrival; the assembled file is then checked against the entry-level
sha256 exactly as a single-file model — the cache contract is
identical.
- Resolve
<id>inmodels.models. Unknown ids MUST raise an error enumerating known ids. - If a cached copy exists at
<cache>/models/<id>/<filename>whose whole-file sha256 matches, use it — cache hits are re-verified, never trusted blindly. - Otherwise download (single URL, or parts in order) to a temporary file in the target directory, verifying digests as data lands.
- Verify the assembled artifact against the index sha256.
- Atomically rename into place, then load.
A zip containing at minimum metadata.yaml, encoder.onnx, and
decoder.onnx. Zips MUST NOT rely on zip-level integrity; integrity
is the manifest's job.
format: imf-v1
tokenizer: bytes
id: <model id>
task: string
decoder: plain | kv # kv iff decoder-kv.onnx is present
precision: fp32
opset: 14
sha256: # every .onnx member MUST be covered
encoder.onnx: <hex>
decoder.onnx: <hex>
A conforming loader MUST reject: any other format, any tokenizer
other than bytes, missing required members, and uncovered or
mismatched member digests.
| concept | rule |
|---|---|
| encoding a string | UTF-8 bytes b → ids b + 3, then one trailing eos |
| decoding ids | stop at eos; skip pad/unk; (id − 3) mod 256 per byte; reassemble as UTF-8 |
| special ids | pad = 0, eos = 1, unk = 2 |
Warning — the classic silent-garbage bug: ids are offset by 3 and carry
a trailing EOS. Feeding text.bytes directly, or forgetting the EOS,
produces plausible-but-wrong outputs that pass shape checks. Interop
tests MUST cover both encode and decode round-trips, including
multi-byte scripts.
| variable | meaning | default |
|---|---|---|
SECRYST_INDEX |
index URL or local path | models.yaml on this repo's main |
SECRYST_CACHE |
artifact cache directory | ~/.cache/secryst |
- Golden parity kit (deterministic decode-loop fixture + reference goldens): secryst-py/parity.
- Export gate (parity written into released artifacts): this repo's
release pipeline (
src/imf/, WO03).