instibrain
instibrain  /  guides  /  rag  /  lesson 3
lesson 3 of 8 · rag

Chunking by structure.

Cut on headings and paragraphs, never every N characters. Each chunk carries its section's title and makes sense alone.

new words

Section
A heading and the paragraphs under it. The natural chunk.
Title path
The headings above a chunk, carried into it: "Travel policy › Hotels". A chunk found alone then still says what it is about.
Overlap
The last sentence of a chunk repeated at the start of the next, when one section had to be cut in two. AI basics, lesson 6.

the lesson

A chunk is what the model sees, alone, with no page around it. So it must say whose, when and what by itself. A cut every 500 characters breaks a sentence in half and strands "the limit is 180" from "a night, in Europe". A cut on structure keeps a rule whole.

RuleWhy
A heading starts a new chunkA section is one topic
Paragraphs fill a chunk up to the sizeA paragraph is one point; it is never cut inside
The title path goes into every chunk"Hotels" alone says nothing; "Travel policy › Hotels" does
A section too long continues, with one sentence of overlapA fact on the border is whole in one of the two
200 to 800 tokens a chunkSmaller loses the context; bigger pastes noise into the prompt

Tokens are counted from words: about four tokens for three words, as AI basics, lesson 1 says. A chunk of 150 to 600 words lands in the range. Tables, lists and code are cut on their own borders, never inside a row.

An example page of three sections, cut at 60 words: one chunk a section, each with its title path.

try it

An example page, cut by its structure at the size you set. Lower the size to 30 words and watch a section split in two, with its overlap. Change the page itself; the cuts follow.

  1. 1 · Travel policy › Flights49 words, about 65 tokens

    Book flights through the travel desk at least two weeks ahead. Economy class on flights under six hours, premium economy over six. A change fee is paid by the company when the trip changes for a work reason. A change for a private reason is paid by the traveller.

  2. 2 · Travel policy › Hotels50 words, about 67 tokens

    Book a hotel from the approved list on the travel desk's page. The limit is 180 a night in Europe and 220 elsewhere, breakfast included. A stay over the limit needs the lead's yes before booking. The yes goes in the booking's note, so finance sees it with the invoice.

  3. 3 · Travel policy › Expenses40 words, about 53 tokens

    Keep every receipt. Claim within thirty days of the trip's end, in the expense tool, one claim per trip. A claim without a receipt is paid only for amounts under 20. A claim after thirty days needs the lead's yes.

you should see

  • At 60 words: three chunks, one a section, each named "Travel policy › …".
  • At 30: six chunks; each second one starts with the last sentence of the first, marked as overlap, and both still say which section they are from.