{"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":16,"y":16,"width":288,"height":608,"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":36,"y":34,"width":248,"height":572,"fontSize":22,"fontFamily":1,"text":"Option B: Recursive\nText Splitting\n(LangChain default)\n\nTry to split on: \\n\\n\n→ \\n → sentence →\nword\nRespect natural\nboundaries when\npossible\nFall back to smaller\nseparators if chunk\ntoo large\n\nPros: Respects\nparagraphs and\nsentences\nCons: Still\ncontent-unaware;\nheading context lost","originalText":"Option B: Recursive\nText Splitting\n(LangChain default)\n\nTry to split on: \\n\\n\n→ \\n → sentence →\nword\nRespect natural\nboundaries when\npossible\nFall back to smaller\nseparators if chunk\ntoo large\n\nPros: Respects\nparagraphs and\nsentences\nCons: Still\ncontent-unaware;\nheading context lost","textAlign":"left","verticalAlign":"middle","containerId":"shape-0","lineHeight":1.3,"autoResize":false,"customData":{"revealStep":1}},{"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-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":16,"y":668,"width":288,"height":808.2,"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":36,"y":686,"width":248,"height":772.2,"fontSize":22,"fontFamily":1,"text":"Option A: Fixed-Size\nChunking (Naive)\n\nSplit every 512\ntokens regardless of\ncontent structure\n\n\"...end of paragraph\nabout\nreturns.\\n\\n##\nShipping Policy\\n\nOur shipping policy\nstates...\"\n^ chunk boundary\nmight split here —\nmid-topic!\n\nPros: Simple,\npredictable chunk\nsizes\nCons: Splits\nmid-sentence,\nmid-paragraph,\nmid-topic\nChunk may contain\ntwo unrelated topics\n= noisy retrieval","originalText":"Option A: Fixed-Size\nChunking (Naive)\n\nSplit every 512\ntokens regardless of\ncontent structure\n\n\"...end of paragraph\nabout\nreturns.\\n\\n##\nShipping Policy\\n\nOur shipping policy\nstates...\"\n^ chunk boundary\nmight split here —\nmid-topic!\n\nPros: Simple,\npredictable chunk\nsizes\nCons: Splits\nmid-sentence,\nmid-paragraph,\nmid-topic\nChunk may contain\ntwo unrelated topics\n= noisy retrieval","textAlign":"left","verticalAlign":"middle","containerId":"shape-2","lineHeight":1.3,"autoResize":false,"customData":{"revealStep":2}},{"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-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":16,"y":1520.2,"width":288,"height":1780.6000000000001,"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":36,"y":1538.2,"width":248,"height":1744.6000000000001,"fontSize":22,"fontFamily":1,"text":"Option C: Semantic /\nStructure-Aware\nChunking\n(Recommended)\n\nParse document\nstructure (headings,\nsections, lists,\ntables)\nEach section becomes\na chunk (if within\nsize limits)\nLarge sections split\nat paragraph\nboundaries\n\nDocument:\n# Refund Policy\n## Domestic\nReturns → Chunk 1\n(with context:\nText about\ndomestic... \"Refund\nPolicy > Domestic\")\n## International\nReturns → Chunk 2\n(with context:\nText about\ninternational...\n\"Refund Policy >\nIntl\")\n## EU-Specific Rules\n→ Chunk 3\nText about EU...\n\nEach chunk carries:\n• heading_context:\n\"Refund Policy >\nInternational\nReturns\"\n• Prepended to\nembedding AND to\nLLM context\n• Dramatically\nimproves retrieval\nrelevance\n\nOverlap: 10-20%\noverlap between\nconsecutive chunks\n→ Handles queries\nthat span chunk\nboundaries\n\nTable handling:\nTables → serialized\nas markdown\n(preserve structure)\nOr: each table row\nas a separate chunk\nwith column headers","originalText":"Option C: Semantic /\nStructure-Aware\nChunking\n(Recommended)\n\nParse document\nstructure (headings,\nsections, lists,\ntables)\nEach section becomes\na chunk (if within\nsize limits)\nLarge sections split\nat paragraph\nboundaries\n\nDocument:\n# Refund Policy\n## Domestic\nReturns → Chunk 1\n(with context:\nText about\ndomestic... \"Refund\nPolicy > Domestic\")\n## International\nReturns → Chunk 2\n(with context:\nText about\ninternational...\n\"Refund Policy >\nIntl\")\n## EU-Specific Rules\n→ Chunk 3\nText about EU...\n\nEach chunk carries:\n• heading_context:\n\"Refund Policy >\nInternational\nReturns\"\n• Prepended to\nembedding AND to\nLLM context\n• Dramatically\nimproves retrieval\nrelevance\n\nOverlap: 10-20%\noverlap between\nconsecutive chunks\n→ Handles queries\nthat span chunk\nboundaries\n\nTable handling:\nTables → serialized\nas markdown\n(preserve structure)\nOr: each table row\nas a separate chunk\nwith column headers","textAlign":"left","verticalAlign":"middle","containerId":"shape-4","lineHeight":1.3,"autoResize":false,"customData":{"revealStep":3}},{"angle":0,"strokeColor":"#9180ac","backgroundColor":"#f4effb","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":16,"y":3344.8,"width":288,"height":407.8,"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":36,"y":3362.8,"width":248,"height":371.8,"fontSize":22,"fontFamily":1,"text":"Recommendation:\nSemantic/structure-a\nware chunking +\nheading context\nprepend\nTarget: 256-512\ntokens per chunk\nOverlap: 50 tokens\nbetween consecutive\nchunks\nAlways prepend\nheading breadcrumb\nto chunk text","originalText":"Recommendation:\nSemantic/structure-a\nware chunking +\nheading context\nprepend\nTarget: 256-512\ntokens per chunk\nOverlap: 50 tokens\nbetween consecutive\nchunks\nAlways prepend\nheading breadcrumb\nto chunk text","textAlign":"left","verticalAlign":"middle","containerId":"shape-6","lineHeight":1.3,"autoResize":false,"customData":{"revealStep":4}}],"appState":{"viewBackgroundColor":"#fbfbf8","gridSize":null},"files":{}}