L3: Chunking

L3: Chunking

23:37

ChatGPT Image Jan 23, 2026, 03_48_31 PM.png

What is Chunking?

Chunking means breaking large text into smaller pieces before giving it to an AI system.

Think of it like this 👇
Instead of asking someone to remember an entire book at once, you give them one paragraph or one page at a time. That’s exactly what chunking does for AI.

Large Language Models (LLMs) cannot handle very large documents at once , so we split the content into smaller, meaningful chunks.


Why Do We Need Chunking?

Chunking is very important in RAG (Retrieval-Augmented Generation) systems.

Without chunking:

  • AI gets confused

  • Important information gets missed

  • Answers become inaccurate or irrelevant

With chunking:

  • AI retrieves only the most relevant part

  • Responses become accurate and focused

  • Search becomes faster and smarter

👉 Chunking helps AI find the right answer, not just any answer.


Where is Chunking Used?

Chunking is commonly used in:

  • 🔍 AI Search systems

  • 🤖 Chatbots

  • 📄 Document Q &A

  • 🧠 Enterprise knowledge bases

  • 📚 PDF, Word, and website data processing

Example:
If you upload a 100-page PDF, chunking breaks it into small sections so AI can search and answer questions correctly.


How Chunking Works (Step by Step)

  1. Take a large document (PDF, text, website)

  2. Split it into smaller chunks
    (for example: 300 - 500 words each)

  3. Convert each chunk into embeddings

  4. Store them in a vector database

  5. During a user query:

    • Relevant chunks are retrieved

    • AI generates an answer using only those chunks


Types of Chunking (Beginner Level)

Here are the most common chunking methods:

1. Fixed-Size Chunking

  • Text is split by a fixed number of words or characters

  • Example: every 500 words

✅ Simple
❌ May cut sentences in the middle


2. Sentence-Based Chunking

  • Text is split by sentences or paragraphs

✅ More natural
✅ Better meaning preservation


3. Overlapping Chunking

  • Some words are shared between chunks

Example:
Chunk 1: words 1 - 500
Chunk 2: words 450 - 950

✅ Helps maintain context
✅ Very common in RAG systems


What Happens If Chunking Is Done Poorly?

❌ Too small chunks → Loss of context
❌ Too large chunks → Slow search & poor answers
❌ Random splitting → Confusing responses

Good chunking = balanced size + clear meaning


Chunking in a Simple Real-World Example

Imagine a library 📚

  • Without chunking → All books mixed together

  • With chunking → Books → Chapters → Pages

When you ask a question, the librarian gives you the exact page , not the whole book.

That’s chunking in AI.


Key Takeaways

  • Chunking = breaking large data into smaller, meaningful pieces

  • Essential for RAG systems

  • Improves accuracy, speed, and relevance

  • Works closely with embeddings & vector databases

  • Bad chunking = bad AI answers