Lesson 06
Free for every learner
11 min read

AirborneOps Learning Labs · LLMs for IT professionals

Retrieval-augmented generation

Ground answers in approved, current sources and preserve the access, provenance, and verification checks that retrieval requires.

Learning objective

Describe an authorized retrieval flow and review a generated answer against the retrieved source passages.

Retrieve evidence before generation

Retrieval-augmented generation (RAG) searches a data collection for material relevant to a request and provides selected passages to a model. A typical flow authenticates the user, filters sources by that user’s permissions, retrieves a small set of passages, supplies them with source identifiers, and asks the model to answer only from that evidence or say when it is missing.

Documents are often split into chunks and represented with search terms, embeddings, or both. Chunk size, overlap, metadata, ranking, and query expansion affect what comes back. Measure retrieval quality on real task queries; a fluent model answer cannot compensate for a passage that was missing, stale, or unauthorized.

Preserve permission and provenance

Apply access controls before content reaches the model. Include tenant, classification, ownership, and freshness metadata where the source requires it. Never retrieve broadly and rely on the prompt to prevent the model from revealing a passage. Keep each citation tied to the exact record and version that produced it.

Retrieved text remains untrusted. It may be outdated, incorrect, or contain prompt injection. Keep it clearly separated as quoted evidence, do not let it redefine permissions, and do not give it authority to call tools. Check important claims against the original document and show users when the evidence is missing or conflicting.

Evaluate retrieval and answers separately

Test whether the right source is found before scoring the final answer. Track measures such as relevant-source recall, rank of the supporting passage, citation correctness, answer completeness, and correct abstention. Add stale documents, duplicate policies, conflicting versions, cross-group content, and injection attempts to the test set.

Set a re-indexing and removal process for updated or deleted documents. Treat embeddings and indexes as sensitive derived data, apply retention and deletion rules, and verify that a changed permission is reflected before another user can retrieve the material.

Worked example

Review the request and response

SAMPLE scenario: an operator asks when a fictional system’s last approved maintenance window occurred. The search returns two versioned records, one superseded.

Sample prompt

Answer from the supplied approved records only. Cite the record identifier and version for each statement. If the records conflict, identify the conflict and do not choose a date without evidence.

Possible response

The current approved record lists the maintenance window as 14:00 UTC on the sample date. Record CHG-SAMPLE-042, version 3 supports this statement. The older version is marked superseded.

What to verify

A reviewer opens version 3, checks its approval and status, confirms that the user was authorized to retrieve it, and verifies that the citation refers to the exact source used.

Practice

Exercise

Design a retrieval test set with one current source, one superseded source, one conflicting source, one restricted source, and one source containing embedded hostile instructions. State which sources should be returned to a learner and why.

Review guide

The system filters unauthorized material before prompt assembly, favors the current approved record, exposes unresolved conflicts, treats embedded instructions as untrusted, and supports deletion or re-indexing.

Knowledge check with feedback

Check your understanding

A user is not allowed to read a document, but the document would answer their question. Should the application retrieve it and tell the model to keep it secret?

Answer: No.

Authorization must filter retrieval before context assembly. A prompt cannot enforce access control. If an allowed source cannot support an answer, the system should say that the evidence is unavailable.

Take this to your next review

Practical checklist

  • Authorize the user and filter sources before retrieval and prompt assembly.
  • Retain source identifiers, version, access metadata, and freshness information.
  • Treat retrieved passages as evidence, not instructions or permission grants.
  • Measure retrieval quality separately from answer quality; test conflicts, stale data, injection, and abstention.
  • Check citations against original sources and manage index updates, deletions, and sensitive embeddings.

References for further reading