Optimize generative AI systems and model performance Study Guide — AI-300

14% of the exam · domain 5 of 5 · Microsoft Machine Learning Operations Engineer Associate · Free Optimize generative AI systems and model performance practice questions

0 of 39 topics covered
What the exam asks here — tap to tick off0 / 7 covered
Domain 5 of 5

Optimize GenAI Systems and Model Performance

This domain accounts for 14% of the AI-300 exam and tests your ability to design, evaluate, and optimize Retrieval-Augmented Generation (RAG) pipelines and fine-tuned models on Azure. Expect scenario-based questions where you must select the correct retrieval strategy, evaluation metric, embedding model, or fine-tuning approach given specific constraints. The exam emphasizes Azure AI Search, Azure OpenAI Service, and Azure AI Foundry as the primary platforms.


Tuning Similarity Thresholds, Chunk Sizes, and Retrieval Strategies

Core Concepts

Similarity threshold controls the minimum relevance score a retrieved document must achieve before being passed to the language model. Setting it too low floods the context with noise; too high starves the model of useful context.

Chunk size determines how source documents are split before indexing. Chunk size has a direct tradeoff:

Chunk SizeAdvantageDisadvantage
Small (128–256 tokens)High precision, focused answersMay lose surrounding context
Medium (512 tokens)Balanced recall and precisionDefault starting point
Large (1024+ tokens)Retains more context per chunkDilutes relevance score, slower retrieval

Chunk overlap (typically 10–20% of chunk size) prevents information loss at boundaries. In Azure AI Search, chunking is configured in the skillset or through the integrated vectorization pipeline.

Retrieval strategies in Azure AI Search:

StrategyMechanismBest For
Vector searchcosine/dot-product similarity on embeddingsSemantic intent matching
Keyword (BM25)term frequency-inverse document frequencyExact term, product codes, IDs
Hybrid searchRRF fusion of vector + BM25 scoresMost production RAG scenarios
Semantic rankerCross-encoder reranking on top-k resultsHighest precision, adds latency

Top-k (number of retrieved chunks passed to the LLM) directly affects context window usage and cost. Azure AI Search default top-k is 50 for index queries but RAG pipelines typically use 3–5 chunks.

Reciprocal Rank Fusion (RRF) is the default fusion algorithm when hybrid search is enabled in Azure AI Search. RRF score = Σ 1/(k + rank_i) where k=60 by default.

Common Traps

  • Confusing similarity threshold (a post-retrieval filter) with top-k (a count limit)
  • Assuming larger chunks always improve answer quality—they dilute embedding specificity
  • Forgetting that semantic ranker requires Standard S1 or higher tier in Azure AI Search (not free or Basic)
  • Setting threshold too high in low-data domains causes zero results without fallback
  • Overlap does not double-count tokens; it prevents boundary truncation

Worked Scenario

Requirement: A customer support RAG system retrieves irrelevant chunks when users ask about specific product model numbers. Vector search alone is failing.

Reasoning: Product model numbers are lexical tokens that embeddings may not distinguish well. The correct fix is hybrid search (vector + BM25), which ensures exact keyword matches surface alongside semantic results. Adding a semantic ranker as a second-stage reranker further improves precision without changing the retrieval count.


Embedding Model Selection and Fine-Tuning for Domains

Core Concepts

Embedding models convert text into dense vectors. Selection depends on domain vocabulary, vector dimensionality, and latency requirements.

ModelProviderDimensionsMax TokensNotes
text-embedding-3-smallAzure OpenAI1536 (reducible)8191Cost-efficient, supports dimension reduction
text-embedding-3-largeAzure OpenAI3072 (reducible)8191Highest accuracy, higher cost
text-embedding-ada-002Azure OpenAI15368191Legacy; prefer text-embedding-3-x for new builds
E5 / BGE modelsHuggingFace (via AI Foundry)768–1024VariesFine-tunable for domain adaptation

Dimension reduction in text-embedding-3 models uses Matryoshka Representation Learning (MRL)—you can truncate vectors to smaller sizes (e.g., 256) with minimal accuracy loss, reducing storage and query cost.

Domain fine-tuning of embedding models is done when out-of-the-box models underperform on specialized vocabulary (legal, medical, financial). The process uses contrastive learning with positive/negative pairs:

  1. Create anchor–positive–negative triplets from domain data
  2. Fine-tune using Azure AI Foundry custom model training or open-source frameworks (sentence-transformers)
  3. Deploy fine-tuned embedding model to a managed endpoint
  4. Re-index all documents with the new model (index must be rebuilt)

Critical: Changing an embedding model requires re-embedding and re-indexing all documents. You cannot mix vectors from different models in the same Azure AI Search vector field.

Common Traps

  • Using ada-002 for new projects—exam will use it as a distractor; correct answer is text-embedding-3-small or text-embedding-3-large
  • Forgetting that dimension reduction is a model parameter set at query time and index time, not a post-processing filter
  • Assuming you can fine-tune text-embedding-3 models directly in Azure OpenAI Service—you cannot; only completions models support Azure OpenAI fine-tuning
  • Mixing embedding models across shards of the same index—not supported; vectors must be homogeneous

Unlock with a paid plan

8 more sections (about 2,128 words) continue below. Every paid plan unlocks all AI-300 study guides, the full question bank and mock exams, from $4.97/month.