Repository navigation
fix: ground small mixed corpora and warm embeddings after listen - #69
Merged
Merged
Conversation
Function words and a title stored off the body were keeping English and title-shaped questions at weak when the margin is skipped. On that small corpus, drop source cards far below the best match. After listen, load the model and embed one dummy query so the first search does not pay startup. Co-authored-by: Nick Kosarev <nick@kosarev.space>
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.
Function words and a title stored outside the body were keeping English questions and title-shaped questions at
weakon a corpus below the margin floor. This keeps the public tools assearch,remember,read, andtimeline.Done
sinbot's) are left out of the uncommon-share numerator and denominator. They are not removed from FTS, so retrieval on a large corpus is unchanged.CONTEXT_GROUNDING_MARGIN_MIN_CORPUS(default 6), source cards belowCONTEXT_SEARCH_CARD_FLOOR(default0.5,0disables) times the best source card are omitted. The compared score is the hybrid rank score plus the number of matched query terms, because reciprocal-rank scores on a few notes sit within a couple of percent of each other. A larger corpus does not use the floor. Knowledge cards are unchanged.{"event":"embeddings_ready"}on stderr, never on stdout./healthreportsembeddingsaswarming,ready, oroff.docs/search.md,docs/curated-instance.md,docs/architecture.md, README settings.Tests
pnpm run check— lint, typecheck, and 287 tests passed.node dist/test/evaluate-grounding.js(lexical, no model files present):New coverage: a 3-note RU/EN fixture. An English paraphrase of the English paragraph is
strongand returns only that note. «Как устроена память бота?» and «О чём отвечает AI Бот?» arestrong. «Where is the cobalt lantern?» isnonewith no cards. At 6 notes the same English question staysstrongand the one-word neighbours come back, so the floor does not apply to the public eval size.Skipped
questionTermsare unchanged, so function words can still match a row. Only the share math ignores them.curated semantic: unavailable).Friction
questionTermsalready drops how/what/как/о, so the first reading of the stop list looked like the bug was already fixed. The remaining misses were words outside that list (чём,can,you,explain, the possessives) and titles that live in metadata, not in the passage. A pure relative rank floor also does not drop the extra notes: on three hits the reciprocal-rank scores differ by about 2%. Confirming that needed a small script, and Node cannot import these sources directly because they use.jsspecifiers (Cannot find module .../package-query.jsfromsearch-lexical.ts). Onetscwas required first. After that,pnpm run checkwas 28s and the lexical grounding eval was 1.5s. No flake loop and no model download./healthtests that used todeepEqualthe whole body now acceptembeddingsofwarming,ready, oroff. The warmup task races the first health read, so a single expected state would be flaky. The card floor adds matched term count to the rank score because rank alone cannot see the irrelevant neighbour. That is the comparison the small corpus needs, and it is documented, but it is not the hybrid score by itself.src/package-query.tscalls its stop list "small" and it omitsчём,where,can,you, andexplain, which is exactly the gap.docs/search.mddid not say function words still count in the share.src/embedding-index.tsstart()already calledload()before listen and the comment said that removed the first-query cost; the first inference was still cold, which is the ~1s the website client cannot spend. Health assertions intest/backup-cli.test.ts,test/restart.test.ts,test/processor-status.test.ts, andtest/server.test.tssnapshot the entire JSON object, so an added field touches all of them.context grounding explainto print the terms dropped as function words and whether the title was outside the matched window. That would have shown the cause without a custom script. A Node loader that resolves the repo's.jsimports to.ts(or apnpm exec tsxpath that works here) would skip thetscdetour. Health tests should assertstatusandprocessorfields, not the whole object.