Skip to content

feat(ml): windowed long-input translate (1400-byte protocol, client-side) - #83

Merged
ronaldtse merged 1 commit into
mainfrom
feat/windowed-translate
Sep 17, 2026
Merged

ronaldtse merged 1 commit into
mainfrom
feat/windowed-translate

Conversation

@ronaldtse

Copy link
Copy Markdown
Contributor

Client-side windowing for long inputs — the runtime half of the 1400-byte protocol.

Models train on ≤1400-byte windows; the runtime previously fed whole inputs regardless, so long texts reached them out-of-distribution and degraded. Now:

  • splitWindows reproduces the published Python harness split exactly (word-boundary, byte-budget). The parity fixture is generated from the reference implementation and caught the one semantic difference (Python str.split() drops empty tokens on whitespace runs; JS split(" ") does not).
  • translateWindowed routes both IMFModel.translate and SpeculativeModel.translate: single-window inputs — every golden-set size — pass straight through untouched, so cross-runtime byte parity is unaffected; long inputs decode as the join of their window decodes. translateDirect is the former decode body.
  • Unbreakable single words exceed the budget in the Python reference too; the split cannot cut inside a word (documented in the invariant test).

10 new specs; full suite 286 passed. This also future-proofs the speculative path: its windows are now protocol windows, never raw long inputs.

…nt-side)

Models train on <=1400-byte windows; longer inputs were reaching them
out-of-distribution and degrading. splitWindows reproduces the
published Python harness split exactly (word-boundary, byte-budget,
Python split semantics - the fixture is generated from the reference
and caught the empty-token difference). translateWindowed routes both
IMFModel.translate and SpeculativeModel.translate: single-window
inputs (every golden-set size) pass straight through, so cross-
runtime byte parity is untouched; long inputs decode as the join of
their window decodes. translateDirect is the former body.

7 split-parity specs + 3 behavior specs; full suite 286.
@ronaldtse
ronaldtse merged commit 19e74f3 into main Sep 17, 2026
6 of 8 checks passed
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.

1 participant