Skip to content

Commit f74c7a0

Browse files
authored
Update chunking.md
1 parent d523693 commit f74c7a0

File tree

1 file changed

+20
-4
lines changed

1 file changed

+20
-4
lines changed
Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,27 @@
11
---
22
title: Text Chunking
3-
description: A guide in my new Starlight docs site.
3+
description: Guide on Document Chunking
44
---
55

6-
Guides lead a user through a specific task they want to accomplish, often with a sequence of steps.
7-
Writing a good guide requires thinking about what your users are trying to do.
6+
# Text Chunking
7+
8+
Text documents can be short (a social sedia post or comment) or very long (a book).
9+
10+
As longer text documents cover many different topics in sequential order (sometimes with references), it is desireable to structure them into smaller pieces that are semantically coherent and focus on one topic.
11+
12+
This process of splitting up documents into smaller pieces is called *Chunking*.
13+
14+
There are a number of different chunking strategies, listed below.
15+
16+
* Splitting: Split a document into equal sized sections (by character or token-count), with an optional overlap (typical sizes are 250-500 tokens with 50-100 tokens overlap)
17+
* Hierarchical Document Chunking: Split a document alongside lexical boundaries - chapters, sections, paragraphs
18+
* Sentence Chunking: Split a document into individual sentences
19+
* Semantic Chunking: Split documents into sentences, generate embeddings and split on boundaries where the embedding vector distance exceeds a certain threshold
820

921
## Further reading
1022

11-
- Read [about how-to guides](https://diataxis.fr/how-to-guides/) in the Diátaxis framework
23+
- [StackOverflow: Breaking up is hard to do: Chunking in RAG applications](https://stackoverflow.blog/2024/06/06/breaking-up-is-hard-to-do-chunking-in-rag-applications/)
24+
- [Unstructured: Chunking for RAG: best practices](https://unstructured.io/blog/chunking-for-rag-best-practices)
25+
- [LangChain: Chunking Strategies](https://js.langchain.com/docs/concepts/text_splitters/)
26+
- [LlamaIndex: Chunking Strategies](https://docs.llamaindex.ai/en/stable/optimizing/basic_strategies/basic_strategies/)
27+
- [MachineLearning Code: Optimizing RAG with Document Chunking Techniques Using Python](https://github.com/xbeat/Machine-Learning/blob/main/Optimizing%20RAG%20with%20Document%20Chunking%20Techniques%20Using%20Python.md)

0 commit comments

Comments
 (0)