Skip to content

spec(port): port specs/port/trios/crates/trios-model/src/lib.t27 (Closes #9449) - #9872

Merged
gHashTag merged 1 commit into
gHashTag:masterfrom
dmitrii-f-t27:zcode-port-9449-model-lib
Oct 17, 2026
Merged

gHashTag merged 1 commit into
gHashTag:masterfrom
dmitrii-f-t27:zcode-port-9449-model-lib

Conversation

@dmitrii-f-t27

Copy link
Copy Markdown
Contributor

Summary

Port gHashTag/trios:crates/trios-model/src/lib.rs (at 8b229e9489ee, 250+ lines) as specs/port/trios/crates/trios-model/src/lib.t27 — Roadmap Stage 6 (goal #4548), target t27c gen-rust. Closes #9449.

The original is the IGLA-GF16 hybrid-precision model architecture (Φ5.1): GF16 for the critical layers and Ternary for the bulk compute layers, per the STATIC_ROUTING_TABLE.

Per the issue's rule ("Port the decision, not the plumbing"), all six listed functions are ported under their names as pure functions (no transports — the growable weight vectors are the callers' plumbing) with 7 tests (33 runtime asserts, 0 vacuous, 100% function coverage):

  • IglaModel_new — the empty five-layer start (original lines 77-85);
  • IglaModel_forward — the documented stub: the full pass has not landed, so it answers no logits (lines 106-113);
  • IglaModel_load_weights — the five counts carried (lines 142-155);
  • IglaModel_num_parameters — the sum across all five layers (lines 171-177);
  • IglaModel_size_bytes — the quantization pricing: GF16 at 2 bytes per parameter across its three layers, the Ternary pair's byte count divided by 5 (the ~1.58-bit packing) — the balanced 100×5 model prices at 640 bytes, inside the original's own 600–800 test window (lines 206-210);
  • IglaModel_default — the delegation to new (lines 213-217);
  • plus the precision routing table itself: which layer rides which precision, and the two size rates.

Verification (all run live from the worktree root, zig 0.16.0)

  • t27c parse: OK. t27c spec-status: IMPLEMENTED. t27c typecheck: 0 errors, 0 warnings.
  • t27c coverage: 13/13 tested (100%) — no transports in this port.
  • t27c test-report: 7 tests / 7 pass / 0 FAIL / 0 BLOCKED, 0 vacuous passes.
  • t27c gen | grep -c 'not yet implemented': 0; gen | wc -l: 149 (> 12).
  • grep -cE '^\s*(pub )?fn (IglaModel_new|IglaModel_forward|IglaModel_load_weights|IglaModel_num_parameters|IglaModel_size_bytes|IglaModel_default)\(': 6. grep -cE '^\s*test\s+(["|[A-Za-z_])': 7 (≥ 6).
  • Boundary: git status --short — exactly this one file. The repo's lefthook pre-commit passed.
  • dupe_scan: all 7 introduced names unique across 2040 specs, and the ModelWeights struct verified absent from the corpus type set by grep before the commit (the corpus-ratchet lesson applied); the bare body scan adds no duplicate group (752 bodies / 221 groups on base, identical with this spec present).

Dmitrii Fedorov (@dmitrii-f-t27)

 gHashTag#9449)

Port gHashTag/trios:crates/trios-model/src/lib.rs (at 8b229e9489ee,
250+ lines) as specs/port/trios/crates/trios-model/src/lib.t27 -
Roadmap Stage 6, goal gHashTag#4548, target t27c gen-rust.

The IGLA-GF16 hybrid-precision model's decisions are ported as pure
functions and tested (7 tests, 7 pass, 0 vacuous, 33 runtime
asserts, 100% function coverage), including the original's own
size-window test: the five-layer precision routing per the
STATIC_ROUTING_TABLE (GF16 for embedding, attention QKV and FFN
down; Ternary for the FFN gate and up), the empty start, the
documented forward stub answering no logits, load_weights carrying
the five counts, the parameter sum across all layers, the
quantization pricing (GF16 at 2 bytes per parameter, the Ternary
pair's bytes divided by 5 - the 1.58-bit packing; the balanced
100x5 model prices at 640 bytes, inside the original's 600-800
window), and Default delegating to new. The growable weight vectors
are the callers' plumbing.

Verified: parse OK, spec-status IMPLEMENTED, typecheck 0 errors,
coverage 13/13, test-report 7/7 pass, 0 BLOCKED, gen 149 lines with
0 'not yet implemented', boundary exactly this one file, dupe_scan:
all 7 introduced names unique across 2040 specs AND the ModelWeights
struct verified absent from the corpus type set by grep before the
commit, bare body scan adds no duplicate group (752/221 unchanged).

Dmitrii Fedorov ([@dmitrii-f-t27](https://github.com/dmitrii-f-t27))
@dmitrii-f-t27

Copy link
Copy Markdown
Contributor Author

@gHashTag Please merge this PR into master via the golden chain — rights on gHashTag/t27 are read-only for me (403), so the merge itself needs your action.

What this is: the #9449 port — crates/trios-model/src/lib.rs (gHashTag/trios, at 8b229e9489ee, 250+ lines) re-authored as specs/port/trios/crates/trios-model/src/lib.t27. One file, one commit, head 133906e71, Closes #9449.

What is verified:

  • t27c parse OK, spec-status IMPLEMENTED, typecheck 0 errors / 0 warnings, coverage 13/13 (100%) — no transports in this port, t27c test-report 7 tests / 7 pass / 0 FAIL / 0 BLOCKED, 0 vacuous — the five-layer precision routing per the STATIC_ROUTING_TABLE (GF16 for embedding, attention QKV and FFN down; Ternary for the FFN gate and up), the empty start, the documented forward stub, load_weights carrying the five counts, the parameter sum, the quantization pricing (GF16 2 bytes/param, the Ternary pair /5 — the balanced 100×5 model at 640 bytes, inside the original's own 600–800 window), and Default delegating to new.
  • gen → 149 lines, 0 not yet implemented; the 6 required names count exactly 6; 7 test blocks; boundary exactly the one file.
  • dupe_scan: all 7 introduced names unique across 2040 specs, and the ModelWeights struct verified absent from the corpus type set by grep before the commit; the bare body scan adds no duplicate group (752/221 unchanged).
  • The t27b-native-run artifact of this head (commit 133906e, run 39016185851): lib.t27 row — reference pass, t27b pass, tests 7, invariants 0, asserts 32, blockers [], detail empty, reference_disagree: [].

CI (head 133906e): required trio green — validate, check-linked-issue, parse-ratchet — Check L1 TRACEABILITY green and Corpus ratchet green; 26 checks pass overall, incl. emit-bitexact, t27b-native-linux, t27b-native-macos.

The 3 reds are the base-red trio, not this change: cli-tri (the #3324 include_str!), duplicate-bodies (only the known base names), t27b-native-ratchet (the same verdict red the Queen's port PRs carry; this spec's own row is reference pass + t27b pass — the registration debt is the UNLISTED class).

After the merge I will: verify the spec file live on the merge SHA, confirm #9449 auto-closed, and file the 14-step report.

Dmitrii Fedorov (@dmitrii-f-t27)

This was referenced Oct 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Port gHashTag/trios:crates/trios-model/src/lib.rs (Rust, 6 functions) to specs/port/trios/crates/trios-model/src/lib.t27

2 participants