1. Fixed-size chunking — cắt theo số ký tự/token cố định (ví dụ 500 token, overlap 50). Đơn giản, nhanh; nhược: cắt giữa câu/ý làm mất ngữ nghĩa.
2. Recursive character chunking (LangChain RecursiveCharacterTextSplitter) — chia theo danh sách separator ưu tiên ["\n\n", "\n", ". ", " "] → giữ được cấu trúc tự nhiên. Mặc định tốt cho văn bản thuần.
3. Semantic chunking — dùng embedding model tính độ tương đồng giữa các câu liền kề; cắt ở nơi độ tương đồng thấp (chủ đề đổi). Chất lượng cao hơn, đắt hơn.
4. Document-structure chunking — chunk theo heading/section (Markdown H1/H2, HTML) hoặc layout (trang PDF, ô Excel). Tốt cho tài liệu có cấu trúc.
5. Parent-child (small-to-big) — embed các chunk nhỏ (chính xác cho retrieval) nhưng generation dùng chunk cha lớn hơn (đủ ngữ cảnh). Giảm "lost in the middle".
6. Agentic chunking — LLM tự đọc và chia theo ý nghĩa. Đắt nhất, dùng cho tài liệu quan trọng.
Chọn chunk size: quá nhỏ (< 100 token) → mất ngữ cảnh, retrieval kém; quá lớn (> 1000) → nhiễu, dùng context lãng phí, recall giảm. Baseline tốt: 256-512 token, overlap 10-20%. Nên tune bằng eval set thực tế (chunk size × top-K × reranker). Tài liệu kỹ thuật code/API có xu hướng cần chunk nhỏ; văn bản dài có thể chunk lớn hơn.
1. Fixed-size chunking — cut by fixed character/token count (e.g. 500 tokens, 50 overlap). Simple, fast; may cut through sentences/ideas.
2. Recursive character chunking (LangChain RecursiveCharacterTextSplitter) — splits using a priority list of separators ["\n\n", "\n", ". ", " "] → preserves natural structure. Sensible default for plain text.
3. Semantic chunking — use an embedding model to measure similarity between adjacent sentences; split where similarity drops (topic change). Higher quality, more expensive.
4. Document-structure chunking — chunk by heading/section (Markdown H1/H2, HTML) or layout (PDF pages, Excel cells). Great for structured docs.
5. Parent-child (small-to-big) — embed small chunks (precise retrieval) but generate with larger parent chunks (enough context). Reduces "lost in the middle".
6. Agentic chunking — let an LLM split by meaning. Most expensive, for high-value documents.
Choosing chunk size: too small (< 100 tokens) → lost context, poor retrieval; too large (> 1000) → noise, wasted context, lower recall. Good baseline: 256–512 tokens, 10–20% overlap. Tune on your eval set (sweep chunk size × top-K × reranker). Code/API docs often need smaller chunks; long prose can go larger.