Skip to content

Widen retrieved passages with neighboring chunks#550

Closed
tobocop2 wants to merge 1 commit into
mainfrom
feat/context-window-expansion
Closed

Widen retrieved passages with neighboring chunks#550
tobocop2 wants to merge 1 commit into
mainfrom
feat/context-window-expansion

Conversation

@tobocop2

Copy link
Copy Markdown
Owner

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_expansion set (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.

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

Copy link
Copy Markdown
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.

@tobocop2

Copy link
Copy Markdown
Owner Author

Superseded by the consolidated retrieval PR #557, which contains this change. Closing; the branch stays intact for reference.

@tobocop2 tobocop2 closed this Jul 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant