Introduction to Performance Optimization for GenAI
Reducing latency with pre-computation, latency-optimized inference, parallelism and streaming, optimising retrieval, maximising FM throughput, tuning FM configurations with A/B tests and profiling system performance.
- 5 lessons
- Module quiz
Generative AI applications are slower than most software: a model may take several seconds to produce a long answer, and RAG and agent workflows add retrieval and tool calls to every request. Responsive applications balance three measures: latency, how long each request takes; throughput, how many requests the available capacity serves; and cost, which often rises when the other two are improved.
This module covers techniques for each part of the request path. Latency is reduced with smaller or latency-optimized models, streaming, parallel execution of independent steps and pre-computation of predictable results. Retrieval is made faster and more relevant by tuning indexes, filtering and query processing. Throughput, which is limited by tokens per minute, rises when each request uses fewer tokens and bulk work moves to batch inference. Inference parameters are tuned per model with A/B tests, and profiling finds the remaining bottlenecks.
What the exam expects
Questions test choosing the technique for a stated bottleneck. Output length is one of the largest drivers of latency, independent sub-tasks should run in parallel, latency-optimized inference is enabled with performanceConfig for supported models, and parameter settings must be tuned and validated for each model separately.
How this module is organised
Reducing Time to First Token and Total Latency explains how latency is measured and reduced. Optimizing Retrieval Speed and Relevance explains index, query and scoring optimisations. Maximizing Foundation Model Throughput explains how more requests are served with the same capacity. Tuning Model Configurations with Offline Comparison and A/B Testing explains how parameters are tuned, and Profiling Generative AI Requests End to End explains how bottlenecks are found and removed.
- Reducing Time to First Token and Total Latency Lesson 1
- Optimizing Retrieval Speed and Relevance Lesson 2
- Maximizing Foundation Model Throughput Lesson 3
- Tuning Model Configurations with Offline Comparison and A/B Testing Lesson 4
- Profiling Generative AI Requests End to End Lesson 5
- Practise and review
- Checkpoint Practice activities across the module
- Test your knowledge 3 questions