Skill 5.1.1
Optimize retrieval performance by tuning similarity thresholds, chunk sizes, and retrieval strategies
Key Concepts
Chunk size and overlap decide what a retrieved passage contains. Small chunks are precise but can lose the surrounding explanation; large chunks keep context but dilute the embedding and add tokens. A common starting point is around 512 tokens with 10 to 25 percent overlap, and structure-aware chunking that respects headings, paragraphs and tables usually beats fixed-length splits.
At query time, top-k sets how many chunks are returned, and a similarity threshold discards results below a minimum score, so weak matches do not reach the prompt. Retrieval strategies include filters on metadata such as product or date, query rewriting, multi-query or agentic retrieval that splits complex questions, and semantic reranking of a larger candidate set. Each change is measured with retrieval and groundedness metrics rather than judged by eye.