Skip to content

/train: fit long examples to the window from the front ("fit": "left") - #29

Merged
joelteply merged 6 commits into
feat/props-weight-residencyfrom
feat/train-fits-examples-to-the-window
Sep 28, 2026
Merged

joelteply merged 6 commits into
feat/props-weight-residencyfrom
feat/train-fits-examples-to-the-window

Conversation

@joelteply

Copy link
Copy Markdown

Continuum's first in-engine dream was refused because a lived example (a whole served conversation with system, tools and history) ran 14,519 tokens against a 1,025-token window. Only the reply carries loss.

The option:

  • With "fit": "left", an example longer than the window keeps the window+1 tokens that end its last trained turn. The leading BOS is kept when the vocab adds one.
  • A trained turn cut at its front is masked: a reply learned without its opening would teach the wrong thing.
  • An example whose last trained turn alone cannot fit is skipped.
  • Status gains examples (kept), examples_truncated and examples_skipped. A run where nothing fits is refused.
  • Without "fit", behavior is unchanged: a long example is refused.

Test: test_train_fit_left in test-chat. It covers keeping the tail, keeping BOS, masking a reply cut at its front, and skipping a reply longer than the window.

The pure function train_fit_left is declared in server-train.h so the unit test can reach it.

…("fit": "left")

A served conversation (system, tool block, history) is far longer than a training window,
and only the assistant reply carries loss (continuum: Kimi's first dream refused, example
of 14,519 tokens against a 1,025-token window). With "fit": "left" an example keeps the
window+1 tokens ending its last trained turn (BOS kept when the vocab adds one); a trained
turn cut at its front is masked; an example whose last trained turn alone cannot fit is
skipped. Status reports examples, examples_truncated and examples_skipped; a run with
nothing that fits is refused. Without "fit" a long example is refused as before.
…her reply, dropping the oldest history; "left" stays for a window too small for the head (Cormac on #29)
…xt, not a fixed 8192 (training sees what inference sees)
…user), keeping strict role alternation (Codex on #29)
…-lora's usage comment has no line continuations (-Werror; lets the full build and its CTest, test-chat included, run)
@joelteply

Copy link
Copy Markdown
Author

APPROVED fork #29 at c059725. ubuntu (x64, ubuntu-22.04) concluded success, and its CTest shows 'Test #24: test-chat ... Passed' with '[chat] All tests passed!'. test_train_fit_left and train_fit_droppable run in that binary's main and throw on failure, so both ran green. The finetune.cpp initializer and the finetune-lora comment fixes unblocked the CTest jobs. Middle fit keeps the system head, never drops her last exchange, and drops whole exchanges; left is unchanged; the window is bounded by n_ctx_train.

@joelteply
joelteply merged commit 4a1b319 into feat/props-weight-residency Sep 28, 2026
9 of 25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant