LLM Learning Hub

workspace/llm-course/home

Text Chunking

Text chunking splits long documents into smaller, semantically coherent pieces so that embeddings capture focused meaning and retrieval returns precise passages rather than entire documents.

What is Text Chunking?

Text chunking splits long documents into smaller, semantically coherent pieces so that embeddings capture focused meaning and retrieval returns precise passages rather than entire documents.

Text chunking splits long documents into smaller, semantically coherent pieces so that embeddings capture focused meaning and retrieval returns precise passages rather than entire documents.

Where is it used?

LangChain `RecursiveCharacterTextSplitter` and LlamaIndex `SentenceSplitter` are standard; the chunk strategy directly impacts RAG answer quality and is tuned per use case.

How to build it

Use `RecursiveCharacterTextSplitter(chunk_size=500, chunk_overlap=50).split_documents(docs)` and print the first few chunks to inspect boundaries; adjust separators for Markdown or code.