glossary

Context and retrieval

Chunking

Chunking is how documents are split before they are embedded and indexed, and the size of each piece plus any overlap decides whether a later query can retrieve a rule together with the exception that qualifies it.

Abracadabra Team Glossary

How it works

The index does not store the file as the author laid it out. It stores pieces. A fixed token size, a split on headings, or a split on sentences each produces a different set of vectors and a different set of things a query can hit. The piece is the unit of retrieval. If the exception lives in the next piece, a query that hits the rule returns the rule alone. The model then states the rule as if it were complete. Overlap repeats some tokens across the boundary so a sentence cut in half can still appear whole in one of the pieces.

Size is a trade. A tiny piece is specific and can lose the condition that makes it true. A large piece keeps the condition and mixes unrelated topics into one vector, then spends more of the context window when it is pasted into the call. Overlap reduces broken sentences and also indexes the same sentence twice, so the retriever can return near-duplicates and crowd out a third page. A split still fails when a binding exception sits in a different section and nobody retrieves both.

A worked example

An overtime rule split from the managers' exception

An employee handbook is split every few hundred tokens with no overlap and no attention to headings. One chunk ends with "overtime is paid at time and a half after the contracted weekly hours". The next chunk begins "This does not apply to salaried managers". A payroll chatbot is asked whether a salaried manager is paid overtime. Retrieval returns the first chunk, which looks complete, and does not return the second. The bot says yes and states the rate. The exception was indexed. It was indexed as a different piece, and the question's wording matched the rule rather than the exception. A later edit adds overlap so the exception's first sentence also sits at the end of the rule's chunk, and the same question returns both lines together.

Illustrative example, not a production trace and not a measured result.

What goes wrong

  • A fixed split cuts a rule from its exception, the query matches the rule chunk, and the answer states the rule with the qualification missing. The next piece holds the qualification, and this hit never includes it.
  • Chunks are so large that the vector averages a whole chapter, and a specific question never ranks that chapter above shorter, looser pages.
  • Heavy overlap returns three near-copies of the same paragraph, the window fills with duplicates, and a second relevant section is never fetched.

How to measure it

Take questions whose correct answer needs two neighbouring sentences, and record whether a single hit contains both. Where it does not, record whether the missing sentence is the next chunk and whether overlap would have carried it across.

After you change size, overlap or the split rule, reindex and compare task success for that task and cohort. Read answers that quote a rule the handbook qualifies in the following lines.

How Abracadabra helps

A person who quotes the exception the agent skipped is pointing at a boundary in the index. After the split or the overlap changes, compare task success for that task and cohort.

When context is lost, people restate a fact or repeat the request. Abracadabra pins those corrections and repeated intents to the turn. After a change to what the agent keeps, compare task success for that task and cohort with the previous period.

Request access to read this on your own agent.

See it in your own agent's conversations.

Each task, the step where it stops, and the conversations behind every count. Free during early access.