{"id":13054,"date":"2026-09-17T07:35:00","date_gmt":"2026-09-17T05:35:00","guid":{"rendered":"https:\/\/www.lukaswojcik.com\/blog\/?p=13054"},"modified":"2026-10-26T12:44:08","modified_gmt":"2026-10-26T11:44:08","slug":"tutorial-testing-chunk-size-and-overlap-against-a-retrieval-test-set","status":"publish","type":"post","link":"https:\/\/www.lukaswojcik.com\/blog\/en\/cloud-ai\/tutorials-en-cloud-ai\/tutorial-testing-chunk-size-and-overlap-against-a-retrieval-test-set\/","title":{"rendered":"Tutorial: Testing Chunk Size and Overlap Against a Retrieval Test Set"},"content":{"rendered":"<p>A chunk is a section of a source document stored as a retrieval unit. Overlap means that neighboring chunks repeat some of the same source text. Chunk size affects how much useful evidence and unrelated text reach the answer model. There is no universally best size or overlap: a comparison needs fixed source material, checked questions and a clearly defined success criterion.<\/p>\n<p>This tutorial evaluates retrieved evidence without generating answers. Embedding models, indexing and search still require compute and may incur charges. The Python example runs locally on synthetic ranked spans; it is an evaluator, not a complete embedding pipeline.<\/p>\n<figure class=\"lw-diagram\"><img decoding=\"async\" src=\"https:\/\/www.lukaswojcik.com\/blog\/wp-content\/uploads\/diagrams\/dia-13054-chunking-20261024-en.png\" width=\"1120\" height=\"580\" loading=\"lazy\" alt=\"Four stages of retrieval evaluation\"><figcaption>Four stages of retrieval evaluation<\/figcaption><\/figure>\n<h2>Fixed sources and labeled evidence<\/h2>\n<p>Each question needs an ID, its wording, an immutable document-version ID and a verified evidence span. The span uses Python character offsets: start inclusive, end exclusive. The quoted text must equal that exact slice of the frozen source. Bytes, UTF-16 positions and token positions are different coordinate systems.<\/p>\n<p>Offsets are established after extraction and normalization, before chunking. Every chunk retains its document-version ID and source interval. Searching for the quote alone can accept the same sentence in the wrong document or the wrong occurrence. Any preprocessing that changes the text requires a reliable mapping back to these coordinates.<\/p>\n<p>Synthetic questions can help populate a first test set, but generating from a whole document does not remove source-wording bias. Human review checks answerability, evidence, paraphrases and task coverage. Real queries add useful cases, subject to privacy and labeling quality. Unanswerable or multi-document questions need separate evaluation rules; the example below covers one contiguous evidence span per answerable question.<\/p>\n<h2>A metric chosen before comparing settings<\/h2>\n<p><strong>Single-span hit@k<\/strong> is the fraction of questions whose complete labeled span fits inside at least one of the first k chunks. <strong>Union hit@k<\/strong> accepts coverage across several retrieved chunks of the same document version, provided no gap remains. The second measure detects split evidence; it does not prove that the answer model can reconstruct the passage correctly.<\/p>\n<p><strong>Single-span MRR@k<\/strong> averages the reciprocal rank of the first chunk containing the whole span, with zero for a miss. A complete match at rank 1 contributes 1, at rank 2 it contributes 0.5, and at rank 4 it contributes 0.25. These are explicit measures for this labeling scheme. In general information retrieval, recall asks what fraction of all relevant units was retrieved. A hit on one relevant unit is not the same as recovering several required evidence passages.<\/p>\n<p>Thirty or fifty questions can be a pilot, not a universal sufficient sample. One changed outcome is 3.33 percentage points for 30 questions and 2 points for 50. Small differences need more evidence, per-question comparisons and an appropriate uncertainty analysis. A held-out set prevents repeated tuning from being mistaken for independent validation.<\/p>\n<h2>A small executable evaluator<\/h2>\n<p>The standard-library-only file runs with <code>python3 evaluate.py<\/code>. Rankings are supplied in retrieval order; an empty list means a completed search with no results, while a missing ranking is an error. Duplicate spans, invalid coordinates and mismatched evidence quotes are rejected.<\/p>\n<pre><code>def evaluate(questions, rankings, corpus, k=5):\n    # corpus keys identify immutable document versions.\n    if type(k) is not int or k &lt; 1 or not questions:\n        raise ValueError(&quot;positive k and nonempty questions required&quot;)\n    def valid_span(s):\n        doc, start, end = s\n        if (doc not in corpus or type(start) is not int\n                or type(end) is not int\n                or not 0 &lt;= start &lt; end &lt;= len(corpus[doc])):\n            raise ValueError(&quot;invalid source span&quot;)\n        return doc, start, end\n    hits, union_hits, reciprocal = 0, 0, 0.0\n    seen = set()\n    for q in questions:\n        if q[&quot;id&quot;] in seen:\n            raise ValueError(&quot;duplicate question id&quot;)\n        seen.add(q[&quot;id&quot;])\n        doc, start, end = valid_span(q[&quot;evidence&quot;])\n        if q[&quot;quote&quot;] != corpus[doc][start:end]:\n            raise ValueError(&quot;quote does not match the source span&quot;)\n        # A missing result is not silently treated as an empty ranking.\n        rows = rankings[q[&quot;id&quot;]]\n        if len({tuple(c) for c in rows}) != len(rows):\n            raise ValueError(&quot;duplicate retrieved span&quot;)\n        rows = [valid_span(c) for c in rows]\n        top = rows[:k]\n        rank = next((n for n, (d, a, b) in enumerate(top, 1)\n                     if d == doc and a &lt;= start and b &gt;= end), None)\n        if rank is not None:\n            hits += 1\n            reciprocal += 1 \/ rank\n        # Union coverage: adjacent intervals may cover a split sentence.\n        cursor = start\n        spans = sorted((max(a, start), min(b, end)) for d, a, b in top\n                       if d == doc and a &lt; end and b &gt; start)\n        for a, b in spans:\n            if a &gt; cursor:\n                break\n            cursor = max(cursor, b)\n        union_hits += cursor &gt;= end\n    n = len(questions)\n    return {&quot;single_hit_at_k&quot;: hits \/ n,\n            &quot;union_hit_at_k&quot;: union_hits \/ n,\n            &quot;single_mrr_at_k&quot;: reciprocal \/ n}\n\nif __name__ == &quot;__main__&quot;:\n    corpus = {&quot;manual-v1&quot;: &quot;AA BBBB CC&quot;, &quot;other-v1&quot;: &quot;AA BBBB CC&quot;}\n    questions = [{&quot;id&quot;: &quot;q1&quot;, &quot;evidence&quot;: [&quot;manual-v1&quot;, 3, 7],\n                  &quot;quote&quot;: &quot;BBBB&quot;}]\n    rankings = {&quot;q1&quot;: [(&quot;other-v1&quot;, 0, 10),\n                       (&quot;manual-v1&quot;, 0, 5),\n                       (&quot;manual-v1&quot;, 5, 10)]}\n    print(evaluate(questions, rankings, corpus, k=3))\n    # single_hit_at_k: 0.0, union_hit_at_k: 1.0, single_mrr_at_k: 0.0\n<\/code><\/pre>\n<p>The synthetic example returns single-span hit 0, union hit 1 and single-span MRR 0. The first result contains the same text in a different document; it does not count. The next two results cover the correct span together. These values test the evaluator and say nothing about embedding quality.<\/p>\n<h2>Connecting the evaluator to the actual search<\/h2>\n<p>For each configuration, the pipeline splits the same frozen corpus, embeds the chunks, builds an isolated index and retrieves ranked source spans for every question. The adapter must map each returned chunk to its original interval. The code does not supply a tokenizer, splitter, embedding client or search index.<\/p>\n<p>Four candidate sizes such as 256, 512, 1024 and 2048 tokens, each with zero or 20% overlap, give eight configurations. Candidate sizes must fit the chosen embedding model and tokenizer. Silent truncation can make an indexed vector represent less text than the stored chunk; truncation must be disabled where supported or detected and treated as a failed configuration.<\/p>\n<p>The model version, query\/document task settings, extraction, similarity function, filters and search parameters stay fixed. Query embeddings can be reused when their complete inputs and model settings are identical. Reuse of document embeddings is safe only for identical embedding inputs. Model changes require a fresh comparison.<\/p>\n<h2>Quality, context and cost<\/h2>\n<p>At fixed k, larger chunks can deliver more text. The product <code>k \u00d7 chunk_size<\/code> is only a nominal maximum for full-sized chunks. Short final chunks, wrappers, deduplication and truncation change actual prompt length. A fixed-budget comparison must count the final serialized context with the answer model&#8217;s tokenizer and use the same packing rule for every setting.<\/p>\n<p>For a long fixed-window stream with overlap fraction r, the token multiplier approaches <code>1 \/ (1 - r)<\/code>. At r = 0.20 that is 1.25: about 25% extra, not 20%. Four zero-overlap and four 20%-overlap passes over two million tokens therefore approach 18 million document-embedding tokens. Document boundaries and rounding change the exact amount; query embeddings, indexing, storage and evaluation work are additional costs.<\/p>\n<p>A useful results table records configuration, question count, both hit measures, MRR, actual context tokens, embedded tokens, index size and latency. No measured quality curve is supplied here. A recommendation for 512 tokens cannot be established without an identifiable corpus, labels and run output. Structure-aware splitting is another candidate, not an automatic winner.<\/p>\n<h2>Separate checks of the full answer pipeline<\/h2>\n<p>With reranking, evidence coverage matters both in the initial candidate set and after reranking and context packing. A high first-stage score does not guarantee that the final five chunks retain the evidence. The final answer also needs checks for correct conditions, citations and unsupported claims.<\/p>\n<p>Re-evaluation follows meaningful changes in documents, queries, models or the pipeline. Neither an annual schedule nor a fixed review time guarantees coverage. Versioned questions and per-query results make regressions easier to locate.<\/p>\n<h2>Sources<\/h2>\n<ul>\n<li><a href=\"https:\/\/www.sbert.net\/docs\/package_reference\/sentence_transformer\/evaluation.html\">Sentence Transformers: evaluation metrics<\/a><\/li>\n<li><a href=\"https:\/\/www.trychroma.com\/research\/evaluating-chunking\">Chroma: evaluating chunking strategies<\/a><\/li>\n<li><a href=\"https:\/\/arxiv.org\/abs\/2608.16586\">Caspari et al.: multi-objective chunking evaluation<\/a><\/li>\n<li><a href=\"https:\/\/docs.cloud.google.com\/vertex-ai\/generative-ai\/docs\/embeddings\/get-text-embeddings\">Google Cloud: text embeddings and truncation<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Chunk size and overlap are tested against verified source spans. An executable Python evaluator distinguishes single-chunk hits from combined coverage; the comparison also accounts for context budgets, sample uncertainty and embedding costs.<\/p>\n","protected":false},"author":1,"featured_media":28485,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[92636],"tags":[91380,91404,91219],"class_list":["post-13054","post","type-post","status-publish","format-standard","hentry","category-tutorials-en-cloud-ai","tag-artificial-intelligence","tag-llm","tag-tutorial"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.1 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Tutorial: Testing Chunk Size and Overlap Against a Retrieval Test Set | Lukas Wojcik<\/title>\n<meta name=\"description\" content=\"Building a small retrieval test set without leakage, measuring recall at k across chunk sizes and overlaps, and reading the curve that comes out.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.lukaswojcik.com\/blog\/en\/cloud-ai\/tutorials-en-cloud-ai\/tutorial-testing-chunk-size-and-overlap-against-a-retrieval-test-set\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Tutorial: Testing Chunk Size and Overlap Against a Retrieval Test Set | Lukas Wojcik\" \/>\n<meta property=\"og:description\" content=\"Building a small retrieval test set without leakage, measuring recall at k across chunk sizes and overlaps, and reading the curve that comes out.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.lukaswojcik.com\/blog\/en\/cloud-ai\/tutorials-en-cloud-ai\/tutorial-testing-chunk-size-and-overlap-against-a-retrieval-test-set\/\" \/>\n<meta property=\"og:site_name\" content=\"Lukas Wojcik - Blog\" \/>\n<meta property=\"article:published_time\" content=\"2026-09-17T05:35:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-10-26T11:44:08+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.lukaswojcik.com\/blog\/wp-content\/uploads\/2026\/10\/hero-13054-chunking-20261024-dark.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"630\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Lukas Wojcik\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Lukas Wojcik\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/cloud-ai\\\/tutorials-en-cloud-ai\\\/tutorial-testing-chunk-size-and-overlap-against-a-retrieval-test-set\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/cloud-ai\\\/tutorials-en-cloud-ai\\\/tutorial-testing-chunk-size-and-overlap-against-a-retrieval-test-set\\\/\"},\"author\":{\"name\":\"Lukas Wojcik\",\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/#\\\/schema\\\/person\\\/895f7604f9b6b71aad9bba33af28d0f9\"},\"headline\":\"Tutorial: Testing Chunk Size and Overlap Against a Retrieval Test Set\",\"datePublished\":\"2026-09-17T05:35:00+00:00\",\"dateModified\":\"2026-10-26T11:44:08+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/cloud-ai\\\/tutorials-en-cloud-ai\\\/tutorial-testing-chunk-size-and-overlap-against-a-retrieval-test-set\\\/\"},\"wordCount\":976,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/#\\\/schema\\\/person\\\/895f7604f9b6b71aad9bba33af28d0f9\"},\"image\":{\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/cloud-ai\\\/tutorials-en-cloud-ai\\\/tutorial-testing-chunk-size-and-overlap-against-a-retrieval-test-set\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/wp-content\\\/uploads\\\/lw-flux3-20261031\\\/hero-13054.png\",\"keywords\":[\"Artificial Intelligence\",\"LLM\",\"Tutorial\"],\"articleSection\":[\"Tutorials\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/cloud-ai\\\/tutorials-en-cloud-ai\\\/tutorial-testing-chunk-size-and-overlap-against-a-retrieval-test-set\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/cloud-ai\\\/tutorials-en-cloud-ai\\\/tutorial-testing-chunk-size-and-overlap-against-a-retrieval-test-set\\\/\",\"url\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/cloud-ai\\\/tutorials-en-cloud-ai\\\/tutorial-testing-chunk-size-and-overlap-against-a-retrieval-test-set\\\/\",\"name\":\"Tutorial: Testing Chunk Size and Overlap Against a Retrieval Test Set | Lukas Wojcik\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/cloud-ai\\\/tutorials-en-cloud-ai\\\/tutorial-testing-chunk-size-and-overlap-against-a-retrieval-test-set\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/cloud-ai\\\/tutorials-en-cloud-ai\\\/tutorial-testing-chunk-size-and-overlap-against-a-retrieval-test-set\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/wp-content\\\/uploads\\\/lw-flux3-20261031\\\/hero-13054.png\",\"datePublished\":\"2026-09-17T05:35:00+00:00\",\"dateModified\":\"2026-10-26T11:44:08+00:00\",\"description\":\"Building a small retrieval test set without leakage, measuring recall at k across chunk sizes and overlaps, and reading the curve that comes out.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/cloud-ai\\\/tutorials-en-cloud-ai\\\/tutorial-testing-chunk-size-and-overlap-against-a-retrieval-test-set\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/cloud-ai\\\/tutorials-en-cloud-ai\\\/tutorial-testing-chunk-size-and-overlap-against-a-retrieval-test-set\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/cloud-ai\\\/tutorials-en-cloud-ai\\\/tutorial-testing-chunk-size-and-overlap-against-a-retrieval-test-set\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/wp-content\\\/uploads\\\/lw-flux3-20261031\\\/hero-13054.png\",\"contentUrl\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/wp-content\\\/uploads\\\/lw-flux3-20261031\\\/hero-13054.png\",\"width\":1200,\"height\":630,\"caption\":\"Tutorial: Testing Chunk Size and Overlap Against a Retrieval Test Set\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/cloud-ai\\\/tutorials-en-cloud-ai\\\/tutorial-testing-chunk-size-and-overlap-against-a-retrieval-test-set\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Tutorial: Testing Chunk Size and Overlap Against a Retrieval Test Set\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/\",\"name\":\"Lukas Wojcik - Blog\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/#\\\/schema\\\/person\\\/895f7604f9b6b71aad9bba33af28d0f9\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/#\\\/schema\\\/person\\\/895f7604f9b6b71aad9bba33af28d0f9\",\"name\":\"Lukas Wojcik\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/07\\\/lw-x2.jpg\",\"url\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/07\\\/lw-x2.jpg\",\"contentUrl\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/07\\\/lw-x2.jpg\",\"width\":424,\"height\":636,\"caption\":\"Lukas Wojcik\"},\"logo\":{\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/07\\\/lw-x2.jpg\"},\"sameAs\":[\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Tutorial: Testing Chunk Size and Overlap Against a Retrieval Test Set | Lukas Wojcik","description":"Building a small retrieval test set without leakage, measuring recall at k across chunk sizes and overlaps, and reading the curve that comes out.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.lukaswojcik.com\/blog\/en\/cloud-ai\/tutorials-en-cloud-ai\/tutorial-testing-chunk-size-and-overlap-against-a-retrieval-test-set\/","og_locale":"en_US","og_type":"article","og_title":"Tutorial: Testing Chunk Size and Overlap Against a Retrieval Test Set | Lukas Wojcik","og_description":"Building a small retrieval test set without leakage, measuring recall at k across chunk sizes and overlaps, and reading the curve that comes out.","og_url":"https:\/\/www.lukaswojcik.com\/blog\/en\/cloud-ai\/tutorials-en-cloud-ai\/tutorial-testing-chunk-size-and-overlap-against-a-retrieval-test-set\/","og_site_name":"Lukas Wojcik - Blog","article_published_time":"2026-09-17T05:35:00+00:00","article_modified_time":"2026-10-26T11:44:08+00:00","og_image":[{"width":1200,"height":630,"url":"https:\/\/www.lukaswojcik.com\/blog\/wp-content\/uploads\/2026\/10\/hero-13054-chunking-20261024-dark.png","type":"image\/png"}],"author":"Lukas Wojcik","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Lukas Wojcik","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.lukaswojcik.com\/blog\/en\/cloud-ai\/tutorials-en-cloud-ai\/tutorial-testing-chunk-size-and-overlap-against-a-retrieval-test-set\/#article","isPartOf":{"@id":"https:\/\/www.lukaswojcik.com\/blog\/en\/cloud-ai\/tutorials-en-cloud-ai\/tutorial-testing-chunk-size-and-overlap-against-a-retrieval-test-set\/"},"author":{"name":"Lukas Wojcik","@id":"https:\/\/www.lukaswojcik.com\/blog\/#\/schema\/person\/895f7604f9b6b71aad9bba33af28d0f9"},"headline":"Tutorial: Testing Chunk Size and Overlap Against a Retrieval Test Set","datePublished":"2026-09-17T05:35:00+00:00","dateModified":"2026-10-26T11:44:08+00:00","mainEntityOfPage":{"@id":"https:\/\/www.lukaswojcik.com\/blog\/en\/cloud-ai\/tutorials-en-cloud-ai\/tutorial-testing-chunk-size-and-overlap-against-a-retrieval-test-set\/"},"wordCount":976,"commentCount":0,"publisher":{"@id":"https:\/\/www.lukaswojcik.com\/blog\/#\/schema\/person\/895f7604f9b6b71aad9bba33af28d0f9"},"image":{"@id":"https:\/\/www.lukaswojcik.com\/blog\/en\/cloud-ai\/tutorials-en-cloud-ai\/tutorial-testing-chunk-size-and-overlap-against-a-retrieval-test-set\/#primaryimage"},"thumbnailUrl":"https:\/\/www.lukaswojcik.com\/blog\/wp-content\/uploads\/lw-flux3-20261031\/hero-13054.png","keywords":["Artificial Intelligence","LLM","Tutorial"],"articleSection":["Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.lukaswojcik.com\/blog\/en\/cloud-ai\/tutorials-en-cloud-ai\/tutorial-testing-chunk-size-and-overlap-against-a-retrieval-test-set\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.lukaswojcik.com\/blog\/en\/cloud-ai\/tutorials-en-cloud-ai\/tutorial-testing-chunk-size-and-overlap-against-a-retrieval-test-set\/","url":"https:\/\/www.lukaswojcik.com\/blog\/en\/cloud-ai\/tutorials-en-cloud-ai\/tutorial-testing-chunk-size-and-overlap-against-a-retrieval-test-set\/","name":"Tutorial: Testing Chunk Size and Overlap Against a Retrieval Test Set | Lukas Wojcik","isPartOf":{"@id":"https:\/\/www.lukaswojcik.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.lukaswojcik.com\/blog\/en\/cloud-ai\/tutorials-en-cloud-ai\/tutorial-testing-chunk-size-and-overlap-against-a-retrieval-test-set\/#primaryimage"},"image":{"@id":"https:\/\/www.lukaswojcik.com\/blog\/en\/cloud-ai\/tutorials-en-cloud-ai\/tutorial-testing-chunk-size-and-overlap-against-a-retrieval-test-set\/#primaryimage"},"thumbnailUrl":"https:\/\/www.lukaswojcik.com\/blog\/wp-content\/uploads\/lw-flux3-20261031\/hero-13054.png","datePublished":"2026-09-17T05:35:00+00:00","dateModified":"2026-10-26T11:44:08+00:00","description":"Building a small retrieval test set without leakage, measuring recall at k across chunk sizes and overlaps, and reading the curve that comes out.","breadcrumb":{"@id":"https:\/\/www.lukaswojcik.com\/blog\/en\/cloud-ai\/tutorials-en-cloud-ai\/tutorial-testing-chunk-size-and-overlap-against-a-retrieval-test-set\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.lukaswojcik.com\/blog\/en\/cloud-ai\/tutorials-en-cloud-ai\/tutorial-testing-chunk-size-and-overlap-against-a-retrieval-test-set\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.lukaswojcik.com\/blog\/en\/cloud-ai\/tutorials-en-cloud-ai\/tutorial-testing-chunk-size-and-overlap-against-a-retrieval-test-set\/#primaryimage","url":"https:\/\/www.lukaswojcik.com\/blog\/wp-content\/uploads\/lw-flux3-20261031\/hero-13054.png","contentUrl":"https:\/\/www.lukaswojcik.com\/blog\/wp-content\/uploads\/lw-flux3-20261031\/hero-13054.png","width":1200,"height":630,"caption":"Tutorial: Testing Chunk Size and Overlap Against a Retrieval Test Set"},{"@type":"BreadcrumbList","@id":"https:\/\/www.lukaswojcik.com\/blog\/en\/cloud-ai\/tutorials-en-cloud-ai\/tutorial-testing-chunk-size-and-overlap-against-a-retrieval-test-set\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.lukaswojcik.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Tutorial: Testing Chunk Size and Overlap Against a Retrieval Test Set"}]},{"@type":"WebSite","@id":"https:\/\/www.lukaswojcik.com\/blog\/#website","url":"https:\/\/www.lukaswojcik.com\/blog\/","name":"Lukas Wojcik - Blog","description":"","publisher":{"@id":"https:\/\/www.lukaswojcik.com\/blog\/#\/schema\/person\/895f7604f9b6b71aad9bba33af28d0f9"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.lukaswojcik.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/www.lukaswojcik.com\/blog\/#\/schema\/person\/895f7604f9b6b71aad9bba33af28d0f9","name":"Lukas Wojcik","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.lukaswojcik.com\/blog\/wp-content\/uploads\/2026\/07\/lw-x2.jpg","url":"https:\/\/www.lukaswojcik.com\/blog\/wp-content\/uploads\/2026\/07\/lw-x2.jpg","contentUrl":"https:\/\/www.lukaswojcik.com\/blog\/wp-content\/uploads\/2026\/07\/lw-x2.jpg","width":424,"height":636,"caption":"Lukas Wojcik"},"logo":{"@id":"https:\/\/www.lukaswojcik.com\/blog\/wp-content\/uploads\/2026\/07\/lw-x2.jpg"},"sameAs":["https:\/\/www.lukaswojcik.com\/blog"]}]}},"_links":{"self":[{"href":"https:\/\/www.lukaswojcik.com\/blog\/wp-json\/wp\/v2\/posts\/13054","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.lukaswojcik.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.lukaswojcik.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.lukaswojcik.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.lukaswojcik.com\/blog\/wp-json\/wp\/v2\/comments?post=13054"}],"version-history":[{"count":6,"href":"https:\/\/www.lukaswojcik.com\/blog\/wp-json\/wp\/v2\/posts\/13054\/revisions"}],"predecessor-version":[{"id":27011,"href":"https:\/\/www.lukaswojcik.com\/blog\/wp-json\/wp\/v2\/posts\/13054\/revisions\/27011"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.lukaswojcik.com\/blog\/wp-json\/wp\/v2\/media\/28485"}],"wp:attachment":[{"href":"https:\/\/www.lukaswojcik.com\/blog\/wp-json\/wp\/v2\/media?parent=13054"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.lukaswojcik.com\/blog\/wp-json\/wp\/v2\/categories?post=13054"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.lukaswojcik.com\/blog\/wp-json\/wp\/v2\/tags?post=13054"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}