Hashlogics
Glossary

What is chunking in RAG?

Your assistant quotes a refund window and leaves off the two conditions attached to it, because the cut landed between them.

Chunking

Text splittingDocument splitting

Chunking is the practice of splitting documents into smaller passages before storing them for retrieval. A search can then return the relevant part rather than a whole file, because each passage is stored and retrieved on its own.

Retrieval works on whole chunks. Search finds a passage, and that passage goes to the model as the evidence. Anything left outside the boundary is invisible, however relevant it was.

Size is the first decision. Small passages match a question precisely and carry little context. Large ones carry the surrounding argument and dilute the match, because one paragraph about your topic sits among five that are not.

Overlap is the second. Repeating a sentence or two at each boundary keeps a thought from being cut in half. It costs storage and it produces near-duplicate results, so most teams end up trimming it back.

Why it matters

Retrieval quality is mostly a chunking problem

Teams blame the model for wrong answers when the fault is upstream. If the passage handed over is incomplete, a strong model produces a fluent answer built on half a rule. Nothing errors, and the answer reads well.

Structure beats arithmetic here. Cutting every 500 characters ignores what the document is. Follow the headings, the clauses or the table rows instead, and each passage stays a thing that means something on its own.

The awkward material decides your approach. Tables lose their meaning when a row is separated from its header. Contracts break when a clause is split from its definitions. Scanned pages arrive with no structure at all.

  • 01Store the source and the page with every chunk, so an answer can be traced back.
  • 02Keep headings in the chunk text. A passage that names its own section retrieves better.
  • 03Re-chunking means re-embedding everything, so treat the first choice as expensive to change.
From document to answerLive
  1. ParsePDF into text and structure.
  2. SplitOn meaning, not character count.
  3. EmbedEach passage becomes numbers.
  4. RetrieveTop matches for the question.
  5. AnswerModel sees only what came back.

The fourth station gets all the attention. The second one decides what it is able to return.

Questions, answered

Common questions

01What chunk size should we start with?

Start from the document's own structure rather than a number. A section, a clause or a table is the right unit, and the size follows from that. Where the material has no structure, try a few hundred words with a sentence of overlap. Then measure it against real questions.

02Does a bigger context window remove the need for chunking?

No. A large window lets you pass more passages, but retrieval still has to choose which ones, and the choice is made on chunks. Feeding whole documents also buries the relevant line among thousands of irrelevant ones, which costs accuracy as well as money.

03How do you chunk a table or a spreadsheet?

Keep the header with the rows and keep related rows together. A row of figures separated from its column names cannot be interpreted by anything, human or model. For wide tables, repeating the header in each chunk is worth the duplication.

04How do you tell if chunking is the problem?

Log what retrieval returned alongside every answer, then read the failures. If the correct text is missing from the retrieved passages, the fault is chunking or search. If the text was there and the answer still went wrong, look at the prompt or the model.

Verified
Start

Anyone can ship the agent. We answer the pager.

We build AI agents and automation, then stay on under an agreed service level. A senior engineer reads every brief, and your call gets scheduled within 24 hours.

What happens next

  1. 01

    You send a brief or book a call

    Two minutes, whichever you prefer.

  2. 02

    A senior engineer replies within 24 hours

    Not a sales rep.

  3. 03

    Honest scoping, in writing

    And if we’re not the right fit, we say so.

Abdul Basit, CEO of Hashlogics

“I started Hashlogics because too many teams ship a demo, get paid, and disappear. We build to a standard we’d run ourselves — and we stay to keep it running.”

Abdul Basit · CEO · a direct line

Not ready to talk? Take the checklist.

12 questions to ask any AI agency before you sign. They separate a demo shop from a team that ships to production.

Get the checklist

Free · no newsletter