Prepstellar
Get it on Google Play

AI-103 · Choosing Foundry Models and Services

24 cards

Retrieval and Indexing Methods

Swipe, scroll or use ← →
  1. Why retrieval comes before generation

    A model only knows what it saw in training. LLMs are trained on public data available at training time, so they can't answer from your private documents or from information that changes often.

    Retrieval augmented generation (RAG) is the pattern that fixes this. It combines search with LLMs so that responses are grounded in your data. It follows a three-step flow:

    1. Retrieve: when a user asks a question, your application queries an index or data store to find relevant content.
    2. Augment: the app combines the user's question and the retrieved content, the grounding data, into a prompt.
    3. Generate: the model receives the augmented prompt and generates a response grounded in the retrieved content, which reduces inaccuracies and enables citations.
    1 / 24
  2. Why retrieval comes before generation

    In RAG the app retrieves passages from an index, adds them to the prompt as grounding data, and only then asks the model to generate.passagesgrounding dataaugmented promptUser questionRetrievequery the indexIndexyour dataAugmentquestion and passagesGenerateanswer with citations
    The index is the only part that knows your data. The model answers from what retrieval hands it, which is why weak retrieval still produces weak answers.

    Two terms recur through this lesson. Grounding data is retrieved content you give the model to reduce guessing. Embeddings are numeric representations of content, used for vector similarity search.

    2 / 24
  3. Quick check

    In a RAG request, what happens in the augment step?

    1. AThe model writes the answer and its citations

      Writing the answer is the generate step, which comes after the prompt is augmented.

    2. BThe app adds retrieved passages to the user's question

      Right. Augment combines the user's question with the grounding data, so the model answers from that content.

    3. CThe app queries the index for relevant passages

      Querying the index is the retrieve step, the first of the three.

    3 / 24

  4. What an index is for

    RAG works best when you can retrieve relevant content quickly and consistently. An index is a data structure optimized for retrieval, and it organizes your content for efficient retrieval.

    Many RAG solutions use an index that supports one or more retrieval modes: keyword search, semantic search, vector search, and hybrid search, which is keyword plus vector, sometimes with semantic ranking. An index can also store fields that improve citation quality, such as document titles, URLs, or file names.

    Azure AI Search is a recommended index store for RAG scenarios. It supports retrieval over vector and textual data in search indexes, and it can query other targets when you use agentic retrieval. Foundry connects your project to an Azure AI Search service and index; depending on the feature and API, that connection appears as a project connection or an index asset ID.

    4 / 24
  5. Quick check

    Users complain that answers cite passages without saying which document they came from. What can the index add?

    1. AA second embedding model for each passage

      A second embedding model changes how passages are matched, not how they're cited.

    2. BFields such as titles, URLs, or file names

      Right. An index can store fields that improve citation quality, such as titles, URLs, or file names.

    3. CA larger token budget for the generate step

      More tokens let the model read more, but they don't tell it where a passage came from.

    5 / 24

  6. Query types in Azure AI Search

    All queries in Azure AI Search run over a search index that stores searchable content. The query form decides what part of the index is searched.

    Query form What it searches
    Full-text search Inverted indexes of tokenized terms
    Vector search Vector fields of embeddings
    Hybrid search Text and vector search in a single request
    Agentic retrieval All of the above, with optional LLM query planning (preview), for agent consumption
    Others Verbatim content for filters, geospatial, fuzzy, and fielded search

    In words: full-text queries iterate over inverted indexes of tokenized terms. Vector queries iterate over vector fields. Hybrid search combines text and vector search in a single query request. Agentic retrieval is an alternative path whose response is designed for agent consumption.

    6 / 24
  7. Query types in Azure AI Search

    The classic query forms still matter, but some don't belong in RAG.

    • Filters use OData syntax in a filter parameter on filterable fields. Filter text isn't analyzed: it's a verbatim, case-sensitive pattern that either matches or fails.
    • Autocomplete and suggestions fire on partial input in a search-as-you-type box. They're intended for human interaction and you can skip them in a RAG pattern. Facets and order-by might be useful, but they're uncommon in RAG.
    • Document look-up retrieves one document by its ID, with no index scan.
    7 / 24
  8. Quick check

    A team designs a RAG pipeline on Azure AI Search. Which features are meant for human interaction and can be skipped?

    1. ASemantic ranking and scoring profiles

      Semantic ranking and scoring profiles improve relevance, which is exactly what RAG grounding needs.

    2. BHybrid queries and vector weighting

      Hybrid queries and vector weighting tune recall and relevance, so they're useful in RAG.

    3. CAutocomplete and suggestions

      Right. Autocomplete and suggestions serve search-as-you-type users and aren't useful in a RAG pattern.

    8 / 24

  9. Keep your progress in the app

    That’s 3 of 10 quick checks. In the app they stay answered, and every lesson remembers where you left off.

    Get it on Google Play Keep reading here
  10. Classic RAG

    Classic RAG uses the original query architecture. Your application sends a single query to Azure AI Search and orchestrates the handoff to an LLM itself. Your deployed LLM then formulates an answer from the flattened result set. It's simpler, with fewer components, and faster, because no LLM takes part in query planning.

    To get the most relevant grounding data from classic RAG:

    • Use hybrid queries, which combine keyword and vector search for maximum recall. A text string and its vector equivalent run as parallel queries, and the best matches from each return in one unified result set.
    • Add semantic ranking, which re-scores results by meaning and identifies the top 50 most relevant results. It's optional in classic RAG.
    • Apply scoring profiles to boost critical fields, and tune vector weighting, minimum thresholds, and result limits such as top-k for vectors and top-n for text.

    During indexing, chunking subdivides large documents so that portions can be matched independently, and a vectorization step creates the embeddings used by vector queries.

    9 / 24
  11. Quick check

    Users search with words that differ from the wording in the documents. Which classic RAG query gives the most recall?

    1. AA filter on the category field

      Filters match verbatim, case-sensitive text, so they narrow results rather than catching different wording.

    2. BA full-text query with fuzzy search

      Fuzzy search matches similar spellings of the same term, not different words with the same meaning.

    3. CA hybrid query of keyword and vector search

      Right. Hybrid queries combine keyword and vector search for maximum recall, and vectors match concepts, not exact terms.

    10 / 24

  12. Agentic retrieval

    Classic RAG uses one query. Agentic retrieval, also called agentic RAG, uses a model to break a complex input into multiple focused subqueries, run them in parallel, and return structured grounding data that works well with chat completion models.

    Its advantages over classic RAG:

    • Context-aware query planning uses conversation history, so follow-up questions keep the context of earlier exchanges.
    • Parallel execution of subqueries gives better coverage and reduces latency.
    • Structured responses return grounding data, citations, and execution metadata.
    • Built-in semantic ranking filters noise.
    • Optional answer synthesis can include an LLM-formulated answer, or you can return raw passages.
    11 / 24
  13. Agentic retrieval

    Agentic retrieval plans several focused subqueries from one question, runs them in parallel, ranks the results, and returns a structured response.Question and historyQuery planningLLM, previewSubquerySubquerySubquerySemantic rankingStructured responsegrounding data, citations
    Classic RAG sends one query and leaves the rest to your app. Agentic retrieval adds the planning step, which is also the part in preview.

    The pipeline needs three new objects: one or more knowledge sources, each pointing to searchable content such as a search index or a remote SharePoint site; a knowledge base, the queryable object that unifies those sources; and the retrieve action that you call from application code, for example as a tool for your agent. The knowledge base also sets the retrieval reasoning effort: minimal, low, or medium.

    12 / 24
  14. Quick check

    In agentic retrieval, which object unifies several knowledge sources and is what your code queries?

    1. AA knowledge base

      Right. The knowledge base is the queryable object that unifies one or more knowledge sources.

    2. BA single search index

      A search index is one kind of content a knowledge source can point to. It doesn't unify several sources.

    3. CA knowledge source

      A knowledge source points to one piece of searchable content. The knowledge base is what brings them together.

    13 / 24

  15. Agentic or classic: making the call

    Azure AI Search offers both approaches, and the choice follows a short list of signals.

    Use agentic retrieval when:

    • Your client is an agent or chatbot.
    • You need the highest possible relevance and accuracy.
    • Your queries are complex or conversational.
    • You want structured responses with citations and query details.
    • You're building a new RAG implementation.

    Use classic RAG when:

    • You need generally available (GA) features only, because LLM query planning in agentic retrieval is in preview.
    • Simplicity and speed are priorities over advanced relevance.
    • You have existing orchestration code you want to preserve.
    • You need fine-grained control over the query pipeline.

    For new RAG implementations, the recommendation is to start with agentic retrieval. And a RAG solution with agents can use Foundry IQ as the agent's single endpoint to a knowledge layer; Foundry IQ uses agentic retrieval.

    14 / 24
  16. Quick check

    A company policy allows only generally available features, and the team must keep its existing orchestration code. Which approach fits?

    1. AClassic RAG with hybrid queries and semantic ranking

      Right. Classic RAG suits GA-only requirements and preserves existing orchestration code.

    2. BAgentic retrieval with minimal effort

      Lower reasoning effort makes agentic retrieval faster, but its LLM query planning is still preview.

    3. CAgentic retrieval with answer synthesis

      Answer synthesis changes the output of agentic retrieval. It doesn't solve the GA-only rule or keep the existing code.

    15 / 24

  17. Preparing content for the index

    RAG quality depends on how you prepare content. A RAG implementation in Foundry typically covers five stages: prepare your data (organize and chunk it), set up an index, connect your Foundry project to the index, build the RAG application with the Foundry SDK or REST APIs, and test and evaluate retrieval quality and citations.

    Azure AI Search helps with the hard parts of preparation:

    Content challenge How it helps
    Large documents Automatic chunking
    Many languages More than 50 language analyzers, multilingual vectors
    Images and PDFs OCR, image analysis, image verbalization
    Similarity search Integrated vectorization
    Terminology mismatches Synonym maps, semantic ranking
    16 / 24
  18. Preparing content for the index

    In words: large documents are chunked automatically, images and PDFs go through OCR and image verbalization, and integrated vectorization creates embeddings without a separate pipeline.

    The two approaches build that pipeline differently. For classic RAG, you use indexers and skillsets to build custom pipelines, or you push pre-processed content through the push API. Indexers pull from more than 10 Azure data sources, and incremental indexing keeps content fresh. For agentic retrieval, knowledge sources auto-generate the chunking and vectorization pipelines.

    17 / 24
  19. Quick check

    For classic RAG, how do you build a custom indexing pipeline in Azure AI Search?

    1. AIndexers and skillsets, or the push API

      Right. Classic RAG builds custom pipelines with indexers and skillsets, or pushes pre-processed content through the push API.

    2. BA knowledge base with reasoning effort

      A knowledge base belongs to agentic retrieval, where knowledge sources generate the pipeline for you.

    3. CAutocomplete with a suggester on each field

      Autocomplete serves search-as-you-type users. It has no role in building an indexing pipeline.

    18 / 24

  20. RAG, fine-tuning, or an agent tool

    Foundry supports several patterns for private data, and they solve different problems.

    • Use RAG when you need answers grounded in private or frequently changing data.
    • Use fine-tuning when you need to change model behavior, style, or task performance, rather than add fresh knowledge.
    • Use agent tools when you're building an agent that needs retrieval as a tool, such as the file search tool. To build a full RAG app with complete control instead, use the Foundry SDK.

    The tell is the word "fresh". Knowledge that changes weekly goes into an index, not into model weights.

    19 / 24
  21. Quick check

    A model must answer from a price list that changes every week. Which pattern fits?

    1. AFine-tuning on the current price list

      Fine-tuning changes behavior, style, or task performance. It isn't the way to add knowledge that changes weekly.

    2. BRAG over an up-to-date price list index

      Right. RAG grounds answers in private or frequently changing data, so updating the index updates the answers.

    3. CA system message that lists the prices

      Prompts guide how the model uses retrieved content. A weekly price list belongs in an index that retrieval can query.

    20 / 24

  22. Security, cost, and latency

    RAG can expose sensitive content if access and prompting aren't designed carefully.

    • Apply access control at retrieval time. With Azure AI Search as a data source, use document-level access control with security filters, so users only retrieve authorized content.
    • Prefer Microsoft Entra ID over API keys for production. API keys are convenient in development but aren't recommended for production.
    • Treat retrieved content as untrusted input. System messages and app logic should reduce the risk of prompt injection from retrieved passages.

    RAG also adds work compared with a model-only request: retrieval round trips, embeddings at indexing time and often at query time, and more input tokens from retrieved passages. When the token budget runs out, filter, rank, or summarize passages. When retrieval quality is poor, review chunking, the embedding model, and the search configuration.

    21 / 24
  23. Quick check

    Finance documents sit in the same index as general documents. How do you keep them away from other staff?

    1. ATell the model in the system message to hide finance content

      The model only sees what retrieval returns, and retrieved content is untrusted input. Access has to be enforced before the model sees anything.

    2. BGive each team its own API key for the search service

      API keys aren't recommended for production and don't trim individual documents per user.

    3. CApply document-level access control with security filters

      Right. Access control applied at retrieval time, through security filters, returns only content the user is authorized to see.

    22 / 24

  24. Key takeaways

    • RAG retrieves, augments, and generates, so answers are grounded in your data and can cite it.
    • Full-text queries search inverted indexes, vector queries search vector fields, and hybrid queries combine both in one request for maximum recall.
    • Classic RAG sends a single query and leaves orchestration to your app; it fits GA-only, simple, existing pipelines.
    • Agentic retrieval plans parallel subqueries over a knowledge base and returns structured responses; start new RAG implementations there.
    • Use RAG for fresh or private knowledge and fine-tuning for behavior or style.
    • Enforce access control at retrieval time, and skip autocomplete and suggestions in RAG.
    23 / 24
  25. Quick check

    Which pairing of need and retrieval method is correct?

    1. AGA-only policy and existing code: agentic retrieval

      GA-only requirements and existing orchestration code point to classic RAG, since agentic query planning is preview.

    2. BMaximum recall from one request: a hybrid query

      Right. A hybrid query combines keyword and vector search in one request for maximum recall.

    3. CWeekly changing facts: fine-tuning the model

      Fresh or frequently changing knowledge belongs in RAG; fine-tuning changes behavior, style, or task performance.

    24 / 24

  26. 10 quick checks · then the test

    In the app, finishing the quick checks opens this lesson’s 10-question test, and the ones you miss come back exactly when you’re about to forget them.

← Previous Get it on Google Play Next card →

The whole course, on your phone

Lessons you can read, audio you can listen to on the way to work, and practice that remembers what you got wrong.

Get it on Google Play

“This app is the ‘One Lake’ for preparing the certification exams. Really worth it.”

Abdelhak Y. Google Play review