Inference architecture and tradeoffs
Balance latency, throughput, quality and reliability.
Define workload assumptions and measure tail latency before choosing an architecture.
Interview questions
Choose a question to reveal its answer.
01EasyCoreHow do you define inference latency?
Answer
How do you define inference latency?
Elapsed time from a request to a defined response milestone.
Measure time to first token for a streaming assistant.
import asyncio
async def request():
await asyncio.sleep(0.1)
return 'ok'
async def main():
return await asyncio.wait_for(request(), timeout=1)
print(asyncio.run(main()))A timeout bounds waiting for a cooperative async operation.
02EasyCoreHow does throughput differ from latency?
Answer
How does throughput differ from latency?
Amount of completed work per unit time.
Measure requests processed per second.
03EasyCoreWhat is the tradeoff of batching requests?
Answer
What is the tradeoff of batching requests?
Combines multiple items in one inference operation to improve utilization.
Group compatible requests on a GPU.
04MediumHigh priorityWhat does a load balancer do?
Answer
What does a load balancer do?
Distributes traffic across service instances.
Spread prediction requests across healthy replicas.
05MediumHigh priorityWhat signals can drive autoscaling?
Answer
What signals can drive autoscaling?
Adjusts resource capacity according to measured demand.
Add workers as request queue length increases.
06MediumHow does backpressure protect a serving system?
Answer
How does backpressure protect a serving system?
Limits upstream production when downstream capacity is saturated.
Reject or defer work rather than growing an unbounded queue.
07MediumWhy use circuit breakers for model dependencies?
Answer
Why use circuit breakers for model dependencies?
Temporarily stops calls to a failing dependency to allow recovery.
Avoid repeatedly invoking an unavailable vector service.
08MediumWhen is a fallback response appropriate?
Answer
When is a fallback response appropriate?
Alternative behavior when a primary component is unavailable or insufficient.
Return a clearly labeled cached result when allowed.
09HardHow do you define a service-level objective?
Answer
How do you define a service-level objective?
Target level of a defined service metric over a specified interval.
Set a target for the percentage of requests under a latency threshold.
10HardHow would you protect user data in an AI system?
Answer
How would you protect user data in an AI system?
Minimizes and protects personal information throughout system architecture.
Avoid logging raw prompts containing secrets.
11MediumHigh priorityHow can queue delay affect inference latency?
Answer
How can queue delay affect inference latency?
Time a request spends waiting before a worker begins processing it.
Detect high p95 latency caused by a saturated GPU queue.
12MediumHigh priorityHow does horizontal scaling differ from vertical scaling?
Answer
How does horizontal scaling differ from vertical scaling?
Adds service instances rather than only increasing one instance's capacity.
Replicate stateless inference workers behind a load balancer.
13MediumHigh priorityWhen should an AI response cache be invalidated?
Answer
When should an AI response cache be invalidated?
Removes or changes cache entries when their underlying dependencies become stale.
Invalidate generated results after a model or document version changes.
14MediumHigh priorityWhat consumes GPU memory during LLM inference?
Answer
What consumes GPU memory during LLM inference?
Available device memory allocated among weights, activations, KV cache and runtime overhead.
Choose batch and context sizes that avoid out-of-memory errors.
15MediumHigh priorityHow would you design graceful degradation in an AI service?
Answer
How would you design graceful degradation in an AI service?
Maintains a reduced but explicit service level when components fail.
Offer lexical retrieval if the dense retriever is unavailable, when suitable.
Priority and difficulty are editorial study recommendations.
Technical reference: Documentation / paper ↗
Try a few practice questions
Explore the questions before creating a free account.
1. Which metric captures the latency below which 95% of requests finish?
2. What is a common batching tradeoff?
3. Which mechanism prevents a failing dependency from receiving endless calls?
RAG system design interviews
Continue to the next set of interview questions.