Widen retrieved passages with neighboring chunks#550
Closed
tobocop2 wants to merge 1 commit into
Closed
Conversation
A hit that lands mid-argument loses the text before and after it. With neighbor_expansion set, each selected chunk pulls up to N adjacent chunks per side from its own source and merges them into one contiguous passage, deduplicating the chunker overlap. Expansion runs after the budget fit and spends only leftover tokens, so originals are never dropped for neighbors; citation numbering is untouched and page/line spans are recomputed truthfully. Off by default (neighbor_expansion=0) pending eval evidence. bb-m3mo
tobocop2
marked this pull request as draft
July 18, 2026 04:55
Owner
Author
|
Superseded by the consolidated retrieval PR #557 — review and merge there. Converted to draft to keep it off the review queue; the branch and history stay intact for reference. |
Owner
Author
|
Superseded by the consolidated retrieval PR #557, which contains this change. Closing; the branch stays intact for reference. |
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.
Problem
Retrieved chunks are prompted exactly as stored, so a hit landing mid-argument loses the sentences before and after it and the model answers from a fragment.
Solution
With
neighbor_expansionset (off by default), each selected chunk pulls up to N adjacent chunks per side from its own source and merges them into one contiguous passage, deduplicating the chunker overlap. Expansion runs after the token-budget fit and spends only leftover budget, so an original chunk is never dropped for a neighbor; citation numbering is untouched and page/line spans are recomputed truthfully. Indices claimed by a higher-ranked passage are never pulled twice, so no text repeats across passages.