AI: RAG and chunking - how the assistant finds what to read

What RAG is, why text must be cut into chunks, the main ways to cut it with a worked example of each, how pieces are scored, and how {{brand}} applies them - step by step, with pictures.

In short

A language model knows nothing about your workspace. To answer a question about your cards or test runs, {{brand}} first finds the facts, then hands them to the model together with the question. This pattern is called RAG - retrieval-augmented generation. The facts travel as small pieces of text called chunks; in {{brand}} they are called snippets.

After this lesson you can Explain RAG in one minute, choose a chunking strategy for any kind of text, explain why {{brand}} uses full-text search instead of a vector database, and build a tiny RAG pipeline yourself.

Words you need

How RAG works, step by step

Most RAG systems follow these five stages, sometimes with extra steps such as re-ranking. Learn them and you can read almost any RAG design.

Why text must be cut at all

The ways to cut text - with an example of each

Take one Help guide as the example: a title, an In short section of two paragraphs, a Steps section with five numbered steps, and a Good to know section with a table. Here is what each chunking strategy does to it, and what a chunk ends up holding.

A length limit is fixed-size cutting applied to only the opening of one long text. {{brand}} therefore uses four cuts: by structure, one record per piece, a summary and a length limit.

How big should a chunk be? A common starting point is 200-500 tokens per chunk and 10-20% overlap for plain prose. Always test on your own questions: too small loses context, too large adds noise and cost.

The options in the market

What {{brand}} chose, and why

{{brand}} cuts text by material and finds the pieces with full-text search rather than embeddings. The reasons, the price paid and the cases where you should choose differently are below.

The four ways {{brand}} uses, and where

The same four techniques apply to any product: documents, rows, groups of rows and long text.

Why labelled lines matter A model reading Due: 2026-10-24 knows it is a date the card is due. The same date with no label could be a creation date or a deadline. Labels make chunks unambiguous, and the number in front lets the answer cite the piece it used.

How the pieces are scored and chosen

The | sign means any word may match, and the where line drops pieces that match nothing. In a real index you store the tsvector in a column and add a GIN index so this stays fast. BM25 is the best-known classic word-scoring formula; PostgreSQL's ranking is a related idea. {{brand}} applies this pattern.

Nothing is indexed in advance {{brand}} builds pieces at question time, as the person asking, inside their organization, and does not keep a separate searchable copy of their data. So there is nothing to keep in step with permissions.

Reusing answers safely

Asking a model costs money, so identical questions should not be paid for twice. The safe way is to key a stored answer on the pieces that were sent, not on the question text alone. Answers can be reused only when the person's own retrieval returns exactly the same pieces, so a reused answer never crosses a permission.

Embeddings explained - and why they are not used today

An embedding model turns text into a list of numbers - often 768 to 3,072 of them - so that texts with similar meaning sit close together. The question is turned into numbers too, and a vector database returns the closest pieces. It finds meaning even when words differ: money owed finds unpaid invoices.

Hybrid search runs both searches and merges the two ranked lists, for example with reciprocal rank fusion. It gets the best recall, with the most moving parts.

Most questions people ask {{brand}} are about rows: which runs failed, which cards are overdue, which endpoint is slowest. An exact query answers those better than similarity. A meaning-based retriever could be added next to the word-based one, but the ranking step would also have to merge the two result lists, for example by rank fusion.

How to know it works

A RAG system that looks right can still miss the right chunk half the time. You find out with a golden set: questions whose right answers you already know.

Try it yourself: a mini RAG in six steps

You can build the core of RAG in an afternoon, with free tools only: SQLite, any language, and a local model such as Ollama or any API free tier. This is the exercise interviewers love to see you understand.

Common mistakes

Interview questions

Related