An extraction reply cites sentences by number - #705
WaylandYang wants to merge 3 commits into
Conversation
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Signed-off-by: WaylandYang <wayland0916@gmail.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Signed-off-by: WaylandYang <wayland0916@gmail.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Signed-off-by: WaylandYang <wayland0916@gmail.com>
|
Back to draft. The lease bench (Blackbaud HQ lease chain, 18 as-of questions) drops with this change. Every build below carries #696, #699 with its lock fix, #697 and #706; the only difference is this PR (the base's ontology is small and inlined, so #704 does not apply):
The partials are old values left open next to new ones: the lease stays split across 4–5 entities with this PR against 2 without it. The recall bench (NVIDIA filings) did not show it (48/52). Next: find which half does it — sentence numbers in place of quotes, or facts that name their sides by handle only. |
|
Closing. The two halves were measured apart on the lease bench, each as a build on top of the control (the same build as the table above without this PR):
The per-chunk budget (#704) stays: it carries most of the saving on large ontologies (19.5k → 8.3k prompt tokens per call) without touching the output contract. |
Related to #701, which has the measurement that started this.
Problem
An extraction reply spends most of its output restating what the server already has. One ai-timeline chunk (1,318 characters) came back as 13,620 characters, 2,965 tokens, for 13 entities and 19 facts:
subject,subject_refandsubject_span, and the same for the object. 24 of 38 spans equalled the name.Output tokens are the slow part of a call.
Change
[S1] …, UAX Fix GLIBC mismatch, and make the release prove the container boots #29 bounds). The text is otherwise untouched: line breaks and table rows are kept, and a table row is its own sentence."sentence": 3, or a list for adjacent sentences. It names its sides by handle only, gives a span only when the sentence names the entity differently, and leaves out null fields. Names cite a sentence the same way.utopia_extract::groundruns right after parsing. It fillsquotefrom the cited sentences (min to max, always a substring of the chunk) and fillssubject/objectfrom the handles. Everything downstream still readsquoteand the names, so span checks, same-sentence edges, the opening check, evidence rows and the queue agent's stale-quote check are unchanged. A reply that still writes quotes or names keeps them. A fact whose handle points nowhere is dropped and counted inskipped_facts.Measured
Recall bench (NVIDIA filings, 52 items), measured together with #704 on the same run:
On
google-deepmind.txtfrom ai-timeline (41 chunks, both PRs), output per call went 1,605 → 965 tokens and prompt 19,473 → 8,300.Seconds depend on the provider's load at the time of day, so read them as direction only. 60 of 76 replies cited sentences, and the rest had no facts. None repeated names or quotes. All 566 evidence rows got a quote back, averaging 110 characters.
Tests
every_sentence_gets_a_number_and_the_text_is_otherwise_untoucheda_reply_by_sentence_and_handle_is_filled_in_from_the_texta_sentence_number_outside_the_text_cites_nothingcargo test -p utopia-extract -p utopia-server, clippy and fmt clean🤖 Generated with Claude Code