Sentence Window Retrieval

Sentence window retrieval finds relevant sentences then expands to surrounding context for generation. Mechanism: Index individual sentences, retrieve matching sentences, expand each to include N sentences before/after, provide expanded windows to LLM. Why sentences?: Maximum retrieval precision - no irrelevant content in retrieved unit. But single sentences often lack context for understanding. Window expansion: Retrieved sentence + K previous + K following sentences. Typical K = 2-5 depending on document type. Implementation: Store sentence index with document position, retrieve top-k sentences, fetch surrounding context from position, merge overlapping windows. Comparison to parent document: More flexible window size, adapts to local context needs, but requires position tracking. Best for: Documents where key information is localized, QA over factual content, precise citation needs. Trade-offs: Index size (many more vectors), position metadata storage, merge complexity. Variations: Variable window based on paragraph boundaries, semantic window (expand to related sentences via embedding similarity). Clean separation of retrieval precision and context completeness.

Take sentence window retrieval further

Ask the copilot about this term, or have our engineers assess it against your process.