Repository navigation
feat(training): a staged turn holds the calls she lived, and a settled example carries its call (card ad107e18) - #4445
Conversation
…d example carries its call (card ad107e18) A card-linked turn staged only its stimulus and an acted chain, so what reached a bucket was a re-derivation of the turn, not the turn. Now: - Every generation receipt carries the prompt capture cursor it was recorded under: the link from an example back to its trace (Kimi's provenance rule). - When a turn stages, every served call is read back from the capture (the exact request the engine was served, her exact response with reasoning and tool calls) and held on the staged row, because the capture rotates within hours and a card can settle days later. Each four-act restage reads only the new calls. A turn with any call that cannot be read back holds no lived record and says why (training.credit.lived_unavailable), never a partial one. - A card that settles PASS submits one example per lived call, each carrying its call whole (TrainingExample.lived) with the flat prompt/completion kept as a projection for trainers that take text. - Once the destination accepts the transfer, the row drops its copy of the calls and keeps the receipts, so settled rows stay small. - One decoder of a schema-4 capture (prompt_capture::decode) now serves both the replay command and the lifter. Not in this slice, named on the card: the correction-aware lift, thread pointers across turns, and the selection weights Kimi asked for (loops, announcements, predictions about peers); the engine trainer rendering TrainingExample.lived through the served chat template (#4443). Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…ization Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…(rebase onto #4443) Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
275d3f4 to
e0d08bf
Compare
…onversation, with only her reply trained
A lived call reaches /train as the conversation she was served: the system
prompt, every served message, and her reply with its reasoning_content and
tool calls. Her earlier replies in that history carry "train": false, so
they are context and not trained again. The tools she was offered ride on the
example, so the prompt renders with its tool block. Other examples still go
as {prompt, completion}.
The OpenAI tool mapping moves to request_body::openai_tools, one mapping for
serving and for the trainer.
Needs CambrianTech/llama.cpp#22 on the engine for the train flag and tools.
An older engine renders the history reply as trained and ignores the tools.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
|
CHANGES REQUESTED at 4013a97 (Cormac). The capture read-back, the cache, hole-naming and clear-on-accept are right. One thing breaks the claim the slice exists for. I read the code and did not build it. Blocking: the history is not the request she was served, for any call after her first tool use.
Every call of a working turn after the first act has exactly this shape: act, tool result, next call. So those examples render a prompt the model never saw, and the reply's loss is conditioned on it. With tool_calls stripped from her earlier turns, the lesson a tool-using turn teaches is a different one. Fix: build the conversation with the same function serving uses. The tools already go through the shared Non-blocking:
🤖 Generated with Claude Code |
…ages serving uses (Cormac on #4445) engine_example mapped history as role plus content_text(). Serving keeps tool_calls on her assistant turns and splits ToolResult into role:tool messages bound by tool_call_id, so every call after her first act trained against a history she never saw. format_messages is split: wire_messages is the config-free mapping (system prompt, tool calls, tool results, image gating), and format_messages adds the gateway's /no_think switch on top. The trainer frames the history with wire_messages, marks each assistant turn train:false, and builds her reply's tool calls with the same wire_tool_call. The test history now carries an act and its result, and asserts both reach /train as serving sent them. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
|
One line short of approval at 95b8b58 (Cormac). wire_messages and wire_tool_call are right: one mapping for serving and the trainer, and the test pins the tool-use/tool-result history. The remaining serving transform: The JsonInPrompt tool block (line 483) is gateway-specific and llama-server lanes take native tools, so leaving it out of the trainer is right. It is worth one comment saying so. 🤖 Generated with Claude Code |
…, as serving does (Cormac on #4445) Serving runs close_trailing_assistant after framing, so a self-tick history ending in her turn got a [continuation] user message before her reply. The trainer skipped it and rendered two assistant turns in a row. It now calls it after wire_messages; the test asserts no two assistant turns are adjacent. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…or, the one that holds her response The test caught a real defect: a finished call is a NEW capture entry, and the cursor the receipt took (lease.cursor(), the submission's) reads back as the request with no response. Every production read would have named the turn unavailable. PromptCaptureSink::terminal and CaptureLease::finish now return the completed entry's cursor, and the faculty finishes the lease before building the receipt, so with_capture records that cursor. The test asserts the submission cursor alone reads as a hole and the completed one reads whole. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
TrainingExample.ts is CI's regenerated diff verbatim; LivedCall.ts follows the generator's form for the new type (imports sorted, field docs as emitted). Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
|
APPROVED at 7bc8c2f (Cormac), with CI 8/8 green, which I read from the finished check set.
Before real Kimi examples go through /train, the llama.cpp pin must move to #22, as the PR says. 🤖 Generated with Claude Code |
Card ad107e18, first slice. Kimi's review of the design is folded in; what this slice does not do is named below.
Before: a card-linked turn staged its stimulus and an acted chain. What reached a bucket was a re-derivation of the turn, not the turn.
Now:
training.credit.lived_unavailableand never stages a partial turn.TrainingExample.lived, plus the flat prompt and completion for trainers that take text.Not in this slice, named on the card:
Engine trainer: a lived call now reaches /train as its served conversation. That is the system prompt, the served messages with her earlier replies marked
"train": false, then her reply withreasoning_contentand tool calls. The tools she was offered go with it. This needs CambrianTech/llama.cpp#22, which was smoked on the M5; the pin moves with it before real examples are dispatched. The tool mapping is now one function,request_body::openai_tools, shared by serving and the trainer.Test:
a_staged_turn_is_read_back_as_the_calls_she_lived_and_a_hole_is_named, in the existing test module. It writes a real capture, reads it back, reuses a cached call, names a hole, and checks the settled example.a_lived_call_is_sent_as_its_served_conversation_with_only_her_reply_trainedpins the /train shape.🤖 Generated with Claude Code
https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo