Skip to content

feat(inference): the lossless run record and the lossy live tap (V3-STREAM-1) - #485

Open
chrishayuk wants to merge 2 commits into
mainfrom
v3-stream-1
Open

chrishayuk wants to merge 2 commits into
mainfrom
v3-stream-1

Conversation

@chrishayuk

Copy link
Copy Markdown
Owner

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, with Unknown for executor events it has no name for — recorded, never skipped), RecordedEvent { sequence, timestamp_ns, position }, RunRecorder (a StepObserver that also carries the stats observer and assigns sequence before fan-out), LiveTap (bounded try_send, DropLedger outside the channel), Receipt (SHA-256 over the event lines; not self-covering), RunRecord with write_jsonl / read_jsonl that verifies hash and count and fails closed.
  • serde_json float_roundtrip enabled in larql-inference: the default parser is not correctly rounded and one norm came back an ulp off.
  • Also pins the seeded projection basis's content hash across builds (the one mutant that survived on feat(vindex3): observe carrier writes on the canonical decode step (V3-OBS-1) #484).

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.

…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.
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