feat: short-chunk coalescing, rerank truncation, query vector cache - #5
Merged
Merged
Conversation
Verdenroz
force-pushed
the
feat/chunk-coalesce-rerank-cache
branch
from
September 5, 2026 21:24
3c0ab28 to
63e2fa2
Compare
- Gap lines between definitions (doc comments, attributes, one-line mod declarations) embedded on their own and ranked on their path header alone; a fifth of finance-query's chunks were one or two lines. - recall@10 on eval/finance-query.toml goes from 0.717 to 0.817.
- Files are only re-chunked when their content hash changes, so a chunker change never reaches an existing index without this.
- The answer route took the fused top eight while search reranked a pool of twenty, so answers saw worse sources than search showed. - The prompt now asks for what is missing rather than a guess.
- On eval/finance-query.toml with BGE v2-m3: 1200 chars 0.783 recall, 2000 0.817, 3000 0.833 at p50 2.3s, full length 0.817 at p50 3.2s.
- A repeated natural-language query skips HyDE and embedding: 3.6s to 2.1s with the reranker, 0.69s to 0.04s without.
Verdenroz
force-pushed
the
feat/chunk-coalesce-rerank-cache
branch
from
September 5, 2026 21:29
63e2fa2 to
5262100
Compare
- main only accepts pull requests now, so the workflow opens one and lets auto-merge land it once the required checks pass. - The token is minted from the same GitHub App soothfast and finance-query use; a PR made with the workflow token triggers no CI.
Verdenroz
force-pushed
the
feat/chunk-coalesce-rerank-cache
branch
from
September 5, 2026 21:47
5262100 to
ceb8801
Compare
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.
Description
A fifth of finance-query's 16k chunks were one or two lines. The gap between two definitions, a doc comment, a
#[cfg]line, apub mod x;, got windowed into its own chunk and embedded on little more than its path header, and those chunks were the top sources for-aquestions, which the answer route never reranked anyway. Leading comments and attributes now belong to their definition, spans under four lines merge into a neighbour,@generatedfiles are skipped, and answers go through the same rerank as search. The reranker also reads at most 3000 chars per document, which measured better than full length and not merely faster, and the server keeps the last 256 query vectors so a repeated query skips HyDE and embedding.Changes
chunker/coalesce.rs: spans shorter than four lines merge forward into the next span, or back into the previous one at the end of a file. Sibling symbols merge under their common parent path.@generatedin their first five lines.scry index --full, which re-uploads every file regardless of the manifest. A chunker change does not reach existing files otherwise.reranktoAnswerRequest. The prompt asks the model to say what is missing instead of guessing.max_charsto[rerank](default 3000);RerankClient::documentcuts each embedding input there on a char boundary.scry-server/src/query_cache.rs, a 256-entry FIFO of query vectors used by the search and answer routes.changelog.ymlto open an auto-merging PR frombot/changelog-updateinstead of committing to main, minting its token from the same GitHub App soothfast and finance-query use (CHANGELOG_APP_CLIENT_IDvariable,CHANGELOG_APP_PRIVATE_KEYsecret).docs/search.mdand the re-chunk requirement inCLAUDE.md.Testing
cargo test --workspace: 57 core unit tests plus the integration suites pass;cargo clippy --workspace --all-targets -- -D warningsclean. New tests cover trivia attachment, detached comments, one-linemodruns, coalescing rules,@generatedskipping, rerank document truncation, and cache eviction.scry index --full: 16,331 to 10,438; chunks of one or two lines 3,267 to 33.scry eval eval/finance-query.toml, 60 cases, HyDE on, bge-reranker-v2-m3 top 20, each configuration run alone on the iGPU: start of branch 0.717 recall@10 / 0.577 MRR / p50 1804ms; chunker only 0.817 / 0.570 / 3232ms; with 3000-char truncation 0.833 / 0.572 / 2336ms, reproduced twice; second run with the cache warm 0.833 / 0.572 / 1459ms.CHANGELOG_APP_PRIVATE_KEYsecret, and auto-merge enabled in the repo settings.cargo soothfast gate -p scry-core --against-ref origin/main --filter chunk:bench_chunk_rustinstructions +1.7% after replacing the per-definitionprev_named_siblingwalk, which had pushed it to +9.6%.