feat(inference): the lossless run record and the lossy live tap (V3-STREAM-1) - #485
Open
chrishayuk wants to merge 2 commits into
Open
chrishayuk wants to merge 2 commits into
chrishayuk wants to merge 2 commits into
Conversation
…TREAM-1) RunRecorder is one StepObserver that sequences every structural event and every tap-derived stats row, stamps run-relative monotonic timestamps and positions, fans out to a bounded non-blocking live tap whose loss is counted outside the channel, and seals a receipt hashing the event lines. Records write and read as JSON lines and are verified on read. Provenance from the prepared image rides on the record. Witnessed S1-S7 on the golden plan and S8 on Granite 4.2 3B (1944 events, replay equal, parity held). Freeze and results in docs/v3-stream-1-run-record.md.
The informational mutants job on #484 found that flipping the draw's offset in FixedBasis::seeded survived: nothing pinned the basis's actual values, only its orthonormality. Two runs share a coordinate system only if the generator cannot drift, so one (hidden, dims, seed) triple's content hash and first value are pinned; changing the generator is now a deliberate contract change with a pin to update.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
V3-STREAM-1, rung 2 above V3-OBS-1 (#484): one runner-side consumer turns a tokenwise VINDEX3 run into a lossless, sequenced, provenance-bearing record that replays to the same events, while a separate live tap may lose events without stalling the executor or touching the record.
crates/larql-inference/src/vindex3/record.rs:RunIdentity(caller-supplied, never executor-allocated),EventKind(the runner's own spelling, withUnknownfor executor events it has no name for — recorded, never skipped),RecordedEvent { sequence, timestamp_ns, position },RunRecorder(aStepObserverthat also carries the stats observer and assigns sequence before fan-out),LiveTap(boundedtry_send,DropLedgeroutside the channel),Receipt(SHA-256 over the event lines; not self-covering),RunRecordwithwrite_jsonl/read_jsonlthat verifies hash and count and fails closed.serde_jsonfloat_roundtripenabled in larql-inference: the default parser is not correctly rounded and one norm came back an ulp off.Evidence (
docs/v3-stream-1-run-record.md, frozen before implementation, with amendments and results)S1 lossless (F1: 15 events per position held), S2 replay identity by bits, S3 gapless sequencing, S4 bounded and counted live loss (F3: tap 8 → dropped 67, first 8, last 74), S5 parity through the recorder on both CPU backends, S6 receipt integrity (tamper, missing receipt, missing header, removed line, garbage each refused), S7 provenance on the record; S8 on real Granite 4.2 3B: 1944 events (243 per token, F2 held), 294,289-byte record, replay equal, parity held. No change to larql-vindex was needed (F5 held).
Gates
fmt, clippy (larql-inference), larql-inference lib 1542 passed, larql-vindex observe_stats 8 passed.