{"type":"excalidraw","version":2,"source":"https://AwesomeSystemDesign.dev","elements":[{"angle":0,"strokeColor":"#6577aa","backgroundColor":"#eef1fc","fillStyle":"solid","strokeWidth":1.5,"strokeStyle":"solid","roughness":0.7,"opacity":100,"version":1,"versionNonce":1,"isDeleted":false,"groupIds":["step-1"],"frameId":null,"roundness":null,"boundElements":[{"type":"text","id":"shape-1"}],"updated":0,"link":null,"locked":false,"id":"shape-0","type":"rectangle","seed":41,"x":466,"y":32,"width":390,"height":363.6,"customData":{"revealStep":1}},{"angle":0,"strokeColor":"#394557","backgroundColor":"transparent","fillStyle":"solid","strokeWidth":1.5,"strokeStyle":"solid","roughness":0.7,"opacity":100,"version":1,"versionNonce":1,"isDeleted":false,"groupIds":["step-1"],"frameId":null,"roundness":null,"boundElements":null,"updated":0,"link":null,"locked":false,"id":"shape-1","type":"text","seed":114,"x":486,"y":50,"width":350,"height":327.6,"fontSize":18,"fontFamily":1,"text":"Option B: Recursive Text Splitting\n(LangChain default)\n\nTry to split on: \\n\\n → \\n → sentence\n→ word\nRespect natural boundaries when\npossible\nFall back to smaller separators if\nchunk too large\n\nPros: Respects paragraphs and\nsentences\nCons: Still content-unaware; heading\ncontext lost","originalText":"Option B: Recursive Text Splitting\n(LangChain default)\n\nTry to split on: \\n\\n → \\n → sentence\n→ word\nRespect natural boundaries when\npossible\nFall back to smaller separators if\nchunk too large\n\nPros: Respects paragraphs and\nsentences\nCons: Still content-unaware; heading\ncontext lost","textAlign":"center","verticalAlign":"middle","containerId":"shape-0","lineHeight":1.3,"autoResize":false,"customData":{"revealStep":1}},{"angle":0,"strokeColor":"#628572","backgroundColor":"#edf5ee","fillStyle":"solid","strokeWidth":1.5,"strokeStyle":"solid","roughness":0.7,"opacity":100,"version":1,"versionNonce":1,"isDeleted":false,"groupIds":["step-2"],"frameId":null,"roundness":null,"boundElements":[{"type":"text","id":"shape-3"}],"updated":0,"link":null,"locked":false,"id":"shape-2","type":"rectangle","seed":187,"x":36,"y":32,"width":390,"height":410.40000000000003,"customData":{"revealStep":2}},{"angle":0,"strokeColor":"#394557","backgroundColor":"transparent","fillStyle":"solid","strokeWidth":1.5,"strokeStyle":"solid","roughness":0.7,"opacity":100,"version":1,"versionNonce":1,"isDeleted":false,"groupIds":["step-2"],"frameId":null,"roundness":null,"boundElements":null,"updated":0,"link":null,"locked":false,"id":"shape-3","type":"text","seed":260,"x":56,"y":50,"width":350,"height":374.40000000000003,"fontSize":18,"fontFamily":1,"text":"Option A: Fixed-Size Chunking (Naive)\n\nSplit every 512 tokens regardless of\ncontent structure\n\n\"...end of paragraph about\nreturns.\\n\\n## Shipping Policy\\n\nOur shipping policy states...\"\n^ chunk boundary might split here —\nmid-topic!\n\nPros: Simple, predictable chunk sizes\nCons: Splits mid-sentence,\nmid-paragraph, mid-topic\nChunk may contain two unrelated\ntopics = noisy retrieval","originalText":"Option A: Fixed-Size Chunking (Naive)\n\nSplit every 512 tokens regardless of\ncontent structure\n\n\"...end of paragraph about\nreturns.\\n\\n## Shipping Policy\\n\nOur shipping policy states...\"\n^ chunk boundary might split here —\nmid-topic!\n\nPros: Simple, predictable chunk sizes\nCons: Splits mid-sentence,\nmid-paragraph, mid-topic\nChunk may contain two unrelated\ntopics = noisy retrieval","textAlign":"center","verticalAlign":"middle","containerId":"shape-2","lineHeight":1.3,"autoResize":false,"customData":{"revealStep":2}},{"angle":0,"strokeColor":"#a68a53","backgroundColor":"#fff7e6","fillStyle":"solid","strokeWidth":1.5,"strokeStyle":"solid","roughness":0.7,"opacity":100,"version":1,"versionNonce":1,"isDeleted":false,"groupIds":["step-3"],"frameId":null,"roundness":null,"boundElements":[{"type":"text","id":"shape-5"}],"updated":0,"link":null,"locked":false,"id":"shape-4","type":"rectangle","seed":333,"x":36,"y":482.4,"width":390,"height":1018.8000000000001,"customData":{"revealStep":3}},{"angle":0,"strokeColor":"#394557","backgroundColor":"transparent","fillStyle":"solid","strokeWidth":1.5,"strokeStyle":"solid","roughness":0.7,"opacity":100,"version":1,"versionNonce":1,"isDeleted":false,"groupIds":["step-3"],"frameId":null,"roundness":null,"boundElements":null,"updated":0,"link":null,"locked":false,"id":"shape-5","type":"text","seed":406,"x":56,"y":500.4,"width":350,"height":982.8000000000001,"fontSize":18,"fontFamily":1,"text":"Option C: Semantic /\nStructure-Aware Chunking\n(Recommended)\n\nParse document structure (headings,\nsections, lists, tables)\nEach section becomes a chunk (if\nwithin size limits)\nLarge sections split at paragraph\nboundaries\n\nDocument:\n# Refund Policy\n## Domestic Returns → Chunk 1 (with\ncontext:\nText about domestic... \"Refund\nPolicy > Domestic\")\n## International Returns → Chunk 2\n(with context:\nText about international... \"Refund\nPolicy > Intl\")\n## EU-Specific Rules → Chunk 3\nText about EU...\n\nEach chunk carries:\n• heading_context: \"Refund Policy >\nInternational Returns\"\n• Prepended to embedding AND to\nLLM context\n• Dramatically improves retrieval\nrelevance\n\nOverlap: 10-20% overlap between\nconsecutive chunks\n→ Handles queries that span chunk\nboundaries\n\nTable handling:\nTables → serialized as markdown\n(preserve structure)\nOr: each table row as a separate\nchunk with column headers","originalText":"Option C: Semantic /\nStructure-Aware Chunking\n(Recommended)\n\nParse document structure (headings,\nsections, lists, tables)\nEach section becomes a chunk (if\nwithin size limits)\nLarge sections split at paragraph\nboundaries\n\nDocument:\n# Refund Policy\n## Domestic Returns → Chunk 1 (with\ncontext:\nText about domestic... \"Refund\nPolicy > Domestic\")\n## International Returns → Chunk 2\n(with context:\nText about international... \"Refund\nPolicy > Intl\")\n## EU-Specific Rules → Chunk 3\nText about EU...\n\nEach chunk carries:\n• heading_context: \"Refund Policy >\nInternational Returns\"\n• Prepended to embedding AND to\nLLM context\n• Dramatically improves retrieval\nrelevance\n\nOverlap: 10-20% overlap between\nconsecutive chunks\n→ Handles queries that span chunk\nboundaries\n\nTable handling:\nTables → serialized as markdown\n(preserve structure)\nOr: each table row as a separate\nchunk with column headers","textAlign":"center","verticalAlign":"middle","containerId":"shape-4","lineHeight":1.3,"autoResize":false,"customData":{"revealStep":3}},{"angle":0,"strokeColor":"#a68a53","backgroundColor":"#fff7e6","fillStyle":"solid","strokeWidth":1.5,"strokeStyle":"solid","roughness":0.7,"opacity":100,"version":1,"versionNonce":1,"isDeleted":false,"groupIds":["step-4"],"frameId":null,"roundness":null,"boundElements":[{"type":"text","id":"shape-7"}],"updated":0,"link":null,"locked":false,"id":"shape-6","type":"rectangle","seed":479,"x":36,"y":1541.2,"width":737.4280600000001,"height":124.4,"customData":{"revealStep":4}},{"angle":0,"strokeColor":"#394557","backgroundColor":"transparent","fillStyle":"solid","strokeWidth":1.5,"strokeStyle":"solid","roughness":0.7,"opacity":100,"version":1,"versionNonce":1,"isDeleted":false,"groupIds":["step-4"],"frameId":null,"roundness":null,"boundElements":null,"updated":0,"link":null,"locked":false,"id":"shape-7","type":"text","seed":552,"x":56,"y":1559.2,"width":697.4280600000001,"height":88.4,"fontSize":17,"fontFamily":1,"text":"Recommendation: Semantic/structure-aware chunking + heading context prepend\nTarget: 256-512 tokens per chunk\nOverlap: 50 tokens between consecutive chunks\nAlways prepend heading breadcrumb to chunk text","originalText":"Recommendation: Semantic/structure-aware chunking + heading context prepend\nTarget: 256-512 tokens per chunk\nOverlap: 50 tokens between consecutive chunks\nAlways prepend heading breadcrumb to chunk text","textAlign":"left","verticalAlign":"middle","containerId":"shape-6","lineHeight":1.3,"autoResize":false,"customData":{"revealStep":4}}],"appState":{"viewBackgroundColor":"#fbfbf8","gridSize":null},"files":{}}