Skip to content

AI Systems

Retrieval-augmented generation: permissions before similarity

A model knows a lot in general and nothing about your business. Retrieval gives it the relevant passages from your own sources at the moment it answers, so the answer reflects your policies, with citations. The order matters: what the reader may see is decided before anything is ranked. In practice: an assistant that answers your team's questions from your own documents, and never shows anyone a passage they couldn't open themselves.
T4 · field technician, EastsideWhat do we charge for a call-out after 6 pm?filtering by permissionranking what's leftanswered from 3 sourcesFinance · marginsAfter-hours margin by…0.91Finance · marginsno access · 0.91Pricing · §4 v6After 18:00: $1490.881HR · overtimePay rates after 18:000.86HR · overtimeno access · 0.86Membership · §2Members: $99 after hours0.832Procedures · nightConfirm the fee first0.793Pricing · §2 v608:00–18:00: $890.74Customer FAQWe answer 24/70.71Scheduling · rotaOn-call after 18:000.69Fleet · vansWeekly van checklist0.21After 6 pm the call-out fee is $149 [1], or $99 for members [2].Confirm the fee with the customer before dispatch [3].[1] Pricing policy §4 · v6[2] Membership terms §2[3] Night call-out procedure

General knowledge, your specifics

Language models know a lot in general and nothing about your business in particular. Retrieval-augmented generation gives a model the relevant passages from your own approved sources when it answers, so responses reflect your policies, documents and records, with citations a person can check.

Most of the quality is decided before the model writes a word: how documents were split, what each passage records about itself, and whether the reader was allowed to see it. A semantically perfect passage from someone else's private source is still the wrong answer.

Chunk by structure, not by size

The same section of a pricing policy, split two ways. Retrieval can only return what the split preserved.

Pricing policy v6 · §4 After-hours pricing

Split every 500 characters

  1. chunk 1

    §4 After-hours pricing

    Work started after 18:00 or on Sundays is charged at after-hours rates. Members keep their discount.

    ServiceStandardAfter 18:00

  2. chunk 2

    Call-out$89$149

    Hourly labour$130$165

  3. chunk 3

    Members' call-out$69$99

    Retrieved alone, this row has no heading and no column names.

Split by structure

  1. chunk 1 · §4 · text · v6 · all staff

    §4 After-hours pricing

    Work started after 18:00 or on Sundays is charged at after-hours rates. Members keep their discount.

  2. chunk 2 · §4 · table · v6 · all staff

    §4 After-hours pricing › rates

    ServiceStandardAfter 18:00

    Call-out$89$149

    Hourly labour$130$165

    Members' call-out$69$99

Two pipelines, one index

Ingestion prepares your sources once and keeps them current. Answering runs for every question. Each stage can be tested and improved on its own.

Ingestion · when sources change

  1. 01

    Sources

    documents, wikis, tickets

  2. 02

    Extract

    text, headings, tables

  3. 03

    Chunk

    by structure

  4. 04

    Tag

    source, version, access

  5. 05

    Embed

    meaning as vectors

Index

passages + metadata

Answering · every question

  1. 01

    Question

    plain language

  2. 02

    Filter

    by permission, first

  3. 03

    Retrieve

    closest passages

  4. 04

    Rerank

    when tests show it helps

  5. 05

    Assemble

    passages + instructions

  6. 06

    Answer

    with citations

What every passage carries

Without these, retrieval can't filter, prefer the current version, or cite anything.
  1. Source and position

    Where it came from

    The document, section and place in it, so a citation lands on the right paragraph.

  2. Type

    What kind of content

    Policy, procedure, table, ticket. A procedure answers “how”; a policy answers “may I”.

  3. Version

    Which edition

    So the current policy outranks last year's, and superseded passages can be excluded.

  4. Access scope

    Who may see it

    Mapped from the source's own permissions and applied before ranking.

What retrieval hands off

In

Approved sources
documents, wikis, tickets
Who's asking
role and groups
Question
in their own words
Retrieve, then write
permission → similarity → answer

Out

Answer
with citations
Not in the sources
said plainly
Trace
passages and versions used

Worth building when the answers are in documents

Good fit

  • The answers live in a body of documents that changes over time.
  • There's too much to read or paste in full.
  • People need to check where an answer came from.

Not the right fit

  • The answer is a calculation over structured data, such as orders or account balances. A query does that better.
  • The sources are unreliable. Retrieval will faithfully surface bad content.

Questions about retrieval-augmented generation

Is our data used to train the model?

RAG doesn't train anything. Passages are sent to the model as context when a question is asked. Whether a provider may keep or train on inputs depends on its terms and your agreement, and we choose and configure providers with that in mind.

What happens when two documents disagree?

Retrieval may surface both. Version and status on each passage let the system prefer the current one, and conflicts are flagged to the document's owner to resolve at the source.

Do we need a vector database?

Usually not a separate one. PostgreSQL with pgvector handles most business knowledge bases next to your other data. A dedicated store such as Qdrant comes in when scale or advanced hybrid retrieval justifies it.

How do you know it finds the right passages?

We test retrieval on its own, with real questions and the passages that should answer them, before judging the written answers. A good answer from the wrong passage is luck.