AITeky Learn

AiTeky Original Interactive Learning & Practice Advanced

Retrieval-augmented generation in depth: chunking, search, reranking and checking

Cut a handbook into chunks and measure what each cut costs, compare keyword and meaning search with real embeddings, add reranking, see where the final answer goes wrong with a real model, and decide with numbers how to handle old versions, private pages and questions with no answer.

In the Generative AI course you built a small retrieval-augmented generation (RAG) assistant over 24 FAQ entries. It worked, and it hid the hard parts. Real help content is long. It is written by different teams, it changes, some of it is private, and customers ask in their own words. This course takes the same idea to a realistic size and measures every step.

The material is a handbook of a made-up delivery company, QuickBite: 11 pages of rules about refunds, delivery, payments, coupons, accounts, quality, cancellations, riders, partner stores and privacy, with 60 facts hidden in about 4,000 words of ordinary text, an archived page that disagrees with the current one, and 205 questions with known answers, written three ways (in the handbook's own words, in other words, and in Hinglish) plus questions the handbook cannot answer. Because every fact has a known place, every step can be scored, not just admired.

You start with chunking: how a handbook is cut into pieces, and what each way of cutting loses. You build keyword search (BM25) from scratch, compare it with real embeddings from a small model, and combine and rerank them with a cross-encoder whose scores are recorded for you. Then a real small language model (Qwen2.5-1.5B-Instruct) answers from the retrieved pieces, and you separate the questions it gets wrong because search failed from those it gets wrong even with the right text. The industry lessons are a diagnosis of the whole system, with a decision about what to fix first, and a plan for the things that break in real life: old versions, pages some people must not see, and questions the handbook cannot answer.

Everything runs in the browser on the recorded data, except the model calls, which are recorded from real runs on a laptop processor; the Colab boxes hold the code that produced them. You need the Python and NLP courses; the Generative AI course is the natural companion.

  • Learn lessons explain one idea at a time and let you measure it.
  • Industry ready lessons diagnose a system and plan for change. Each ends with the interview questions that go with it.

Locked. Sign up free

Learn

Understand each idea with everyday examples. No coding background needed.

  1. 01 45 min Free sample πŸ”’ AiTeky Pass Cutting a handbook into chunks Cut a 4,000-word handbook nine ways, count how many facts survive whole, measure how often keyword search finds the right piece, and see why the best cut is the one that sends the fewest words to the model for each right answer.
  2. 02 45 min πŸ”’ AiTeky Pass Keyword search and meaning search Score two ways of finding the right paragraph, BM25 keyword search written from scratch and real embeddings from a small model, with recall at k and mean reciprocal rank, split by how the customer asked, and look at the questions each one gets wrong.
  3. 03 50 min πŸ”’ AiTeky Pass Combining searches and reranking Fuse keyword and meaning search by rank and by score, tune the weight on one half of the questions and test it on the other, then add a cross-encoder reranker with recorded scores and measure what each extra step buys and costs.
  4. 04 50 min πŸ”’ AiTeky Pass From chunks to an answer Follow 205 real questions through the whole pipeline, paste the top three paragraphs into a prompt, let a small model answer, and separate the answers that went wrong because search failed from those that went wrong even with the right text, then test the answer against the context in code.

Industry ready

Real problems from real jobs, and the questions interviewers ask about them.

  1. 05 55 min πŸ”’ AiTeky Pass On the job: diagnosing the assistant Score two versions of the answering prompt and a query-rewriting step on the same 205 questions, break the failures down by topic and by who asks, price the mistakes, and write the go or no-go decision with the launch criteria, the measured evidence and the plan.
  2. 06 55 min πŸ”’ AiTeky Pass On the job: old versions, private pages and questions with no answer Reproduce three incidents of a live assistant with real recorded runs, an archived policy that gets quoted, rider and partner pages that a customer can read, and invented answers to questions the handbook cannot answer, then fix each with metadata filters and a refusal rule chosen from a cost table, and keep the list of what you could not fix.

We use essential cookies to run the site. With your permission we also set one anonymous ID to count unique visitors, and analytics cookies to see which pages help learners. Cookie notice

Join AiTeky Learn. It's free.

Create a free account to track your progress, save items for later and get study suggestions.

Sign up free Log in