Mirage Academy · RAG

RAG course: learn when you do not need RAG first, then choose the tool

RAG stands for retrieval-augmented generation: a model gets passages from a collection that fit a question and answers with reference to them. An Academy example lab first asks whether you need that at all: four fixed rules decide between SQL, long context, fine-tuning and RAG. You start free, with no payment details.

Start your first courseBrowse courses

The choice

Four rules in a fixed order decide whether you need RAG

You go through them in order and stop at the first that fits. The rules come from an Academy example lab, a sample file. The course page shows whether and in which course it appears. The company in its story is made up.

Tool chooser: send a request through the four rules

Pick a request and change the facts. The request stops at the first rule that fits.

Request
Facts
  1. Rule 1: SQL

    does not fit

    If it is a count or a value from a table, use SQL.

  2. Rule 2: long context

    The request stops here: Long context

    If it is a lookup that fits the window, gets up to 5,000 questions a day and has no reason to retrieve, use long context. A reason would be: the facts change, answers need citations, or access is set per person.

  3. Rule 3: fine-tuning

    not reached

    If it is about behavior, such as tone or format, fine-tune.

  4. Rule 4: RAG

    not reached

    For everything else, use RAG.

    Everything else lands here

Four rules in the order the example lab checks them: a count or table value, a lookup inside the window, behavior, everything else.

Tokens

The example lab counts tokens before anything is built

The numbers come from the example lab: a handbook of 25,000 tokens and 2,000 questions a day, in a made-up company.

Numbers from the lab

One RAG prompt2,000 tokensInput tokens a dayLong context50,000,000RAG4,000,000Ratio 12.5 to 1
  1. 01

    One RAG prompt

    400 tokens of system text, five excerpts of 300 tokens each and the question at 100 tokens: 2,000 tokens in all.

  2. 02

    Long context

    Every question carries the whole handbook: 25,000 times 2,000 questions is 50,000,000 input tokens a day.

  3. 03

    RAG

    2,000 tokens per question times 2,000 questions is 4,000,000 input tokens a day.

The example lab's arithmetic in three cards: one RAG prompt, the daily load without selection, the daily load with RAG.
  • The ratio is 12.5 to 1. Why the example still picks long context is in the decision record.

Decision

The decision record has four entries, and one of them says SQL

The example ends with which tool fits which request and why.

  1. 2

    Handbook questions

    Long context

    Rule 2. The example asks for a switch to RAG once more than 5,000 questions a day arrive, the content starts to change or sources become necessary.

  2. 1

    Count of parental-leave policies

    SQL

    Rule 1. According to the example record, RAG cannot count across all policies.

  3. 4

    Monthly freight rate sheet

    RAG

    Rule 4. According to the example record, the rates change monthly, and a clause has to be cited as the source.

  4. 3

    Replies in the company tone

    Fine-tuning

    Rule 3. According to the example record, it is about behavior.

Four entries of the decision record: handbook, parental-leave count, freight rates, company tone, each with tool and rule.

Pipeline

RAG in four steps: chunk, embed, retrieve, answer with a source

This is how RAG works in principle. Step through it below on a made-up example. It does not describe Academy's own systems.

Pipeline stepper: one question through four steps

Pick a question and walk through the steps.

Made up, not a description of the Academy's systems.

Question
  • Handbook
    • Piece 1
    • Piece 2
  • Freight rate sheet
    • Piece 1
    • Piece 2
  • Parental-leave policies
    • Piece 1
    • Piece 2

Step 1 / 4: Chunk

The answer names a source only if the retrieve step returned a piece. If it returns none, the answer says "No source".

  1. 01

    Chunk

    The documents are cut into pieces called chunks. The app shows this in a sample session: “512-token chunks, with some overlap between them.”

  2. 02

    Embed

    Each piece is turned into a row of numbers, an embedding, so that similarity can be computed.

  3. 03

    Retrieve

    The question is turned into numbers the same way, and the most similar pieces go into the prompt.

  4. 04

    Answer with a source

    The model answers with reference to the pieces. In Academy's retrieval labs a rule checks whether the answer names its source and points to the expected document.

Four steps of a RAG pipeline on a made-up example: split documents, embed the pieces, retrieve the matching pieces, answer with a source.
  • As in other labs, you enter a text of at most 800 characters, and rules in program code check the answer. If your course's live answers are used up, you get a recorded example answer.
  • Academy uses retrieval itself, too. By the instruction to the coach, source texts count as data. That is meant to keep a planted text from steering the coach.

AI coach

The AI coach asks about your decisions, one question at a time

You explain by voice what you chose, and the coach is an AI.

AI coachAIby voice
  1. Knows your progress

    If you save your notes, the app says the next session picks up from them.

  2. Challenges your thinking

    According to the app it asks follow-up questions and tests your understanding.

Two traits of the AI coach according to the app: it knows your progress, and it challenges your thinking.
  • An example from the app (Context Engineering, chapter 3): the coach asks “Why the overlap? What breaks without it?”, you answer “An answer that spans two chunks gets cut in half.”, and it goes on: “Exactly. Now, how would you test that?”

Certificate

The certificate documents your course

You get a certificate with a check code when you meet the rule. Courses that enable it add a confirmation of participation.

Content
Course, type and date. Only for a Masterclass with a capstone are the competency levels you reached added, a scale of its own next to the course level. The competency levels follow fixed rules from your assessed work, not from the talk with the coach.
Checking by others
Whoever has the check code of a certificate or confirmation opens the public check page. It says whether the code is genuine and names no one.
Limits
According to the page “Get certified”, it is not a state-recognized qualification.
Three facts: content, checking by others, limits.

All rules for the certificate →

Start and price

The Free plan costs nothing, and you start without payment details

Each course states its level and language before you start. Most courses are in English today, and the first German ones are in preparation.

Mirage AcademyBefore you pay for anything you see the full price, VAT included.

See prices
The pricing page shows every plan and the current amount.
  • Do you want someone to build RAG for your company?

RAG for your company: knowledge search at Mirage Digital →Production RAG course →

Questions about the RAG course

  • Do I need to know how to code?

    The example lab on choosing the tool works with rules and counting. According to the app many labs need no code, and where a lab uses code it runs in your browser. A course's page says what that course asks for.

  • What do I build in the course?

    The course page says. This page describes an example lab on choosing the tool and the check rules of the retrieval labs.

  • What is the difference between RAG and fine-tuning?

    By the example lab's rules, fine-tuning is for behavior, such as tone or format, and RAG is for knowledge that sits in documents and may change.

  • When do I not need RAG?

    By the example lab's rules, for counts and table values (SQL) and for a lookup that fits the context window, gets up to 5,000 questions a day and gives no reason to retrieve (long context).

  • What does the AI coach do?

    You talk to it by voice. It asks you to explain what you learned and asks again where it is unclear. It does not decide on your certificate.

  • Do I get a certificate, and is it recognized?

    You get a certificate as a PDF with a check code when you meet the rule. Courses that enable it add a confirmation of participation. According to the page “Get certified” the certificate is not state recognized.

  • Is the course available in English and German?

    The site and the coach work in English and German. Most courses are in English today, and the first German ones are in preparation.

  • What does it cost?

    The Free plan costs nothing, and you start without payment details. The pricing page shows every plan.