Repository navigation
A trimmed description is not stale - #673
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Signed-off-by: WaylandYang <wayland0916@gmail.com>
Contributor
Author
|
End to end on the recall bench (
42/52 is within one σ (≈ 2.7) of the 09-11 |
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.
Fixes #672.
What was wrong
Whether an ontology row's vector is stale is decided by comparing the text it was embedded from (
embedded_text) with the text it would be embedded from now. The stored side comes fromembed_text, which uses Ruststr::trim. The comparison side was rebuilt in SQL withbtrim(label)/btrim(description), which without a character argument strips only ASCII spaces.Descriptions that begin or end with a newline or tab, which is how schema.org descriptions come in (
"...\n "), therefore never matched. Those rows stayed stale forever:embed_ontologyre-embedded them on every refresh, and since #640 the extraction gate (gate_required) deferred everyextract_documentuntilDEFER_WINDOW_SECSran out and the document failed. On the recall bench (recall-bench schema-org) that was 59 rows, and 0 of 64 chunks extracted in 15 minutes.What changed
types_needing_embeddingandrelations_needing_embeddingload each row's label, description and storedembedded/embedded_model/embedded_text(plus the label-vector equivalents for entity types) and decide staleness in Rust with the sameembed_textthat produces the text. This is the approachmappings::needing_embeddingalready takes, for the same reason.Verification
New DB-backed test
a_trimmed_description_is_not_stale. An entity type with a label wrapped in tabs and a description ending in"\n ", and a relation whose description starts and ends with newlines:set_type_embeddings, nothing is stale;Against the previous code the test fails with all three rows reported stale right after being embedded. End-to-end results from the recall bench follow in a comment.
🤖 Generated with Claude Code