FDEInterviews logo

latency

FDE interview questions tagged latency, across every topic.

25 questions · 2 unlocked for you

Concepts behind "latency"

The curriculum that explains the ideas these questions test.

Core
🧠 Foundations of LLMs & GenAISign in
KV CacheDuring autoregressive decoding a model would recompute attention over every prior token at each step; the KV cache stores each token's key and value vectors so each new token only attends, never recomputes, making per-token generation far cheaper. The cache grows with sequence length times batch size and becomes the memory bottleneck in serving, which is what motivates PagedAttention. FDE loops probe it because it explains why long contexts are costly to serve and why throughput, not the model, is often the constraint.
Core
⚙️ System Design for AI in ProductionSign in
Latency OptimizationMeasure p50, p95, and p99 before you touch anything, then find where the time actually goes: tokenization, retrieval, inference, or post-processing. A naive RAG pipeline that takes 1.5 seconds can usually reach sub-100ms perceived latency by caching, parallelizing retrieval, picking a smaller model, and streaming the first token, in that order of payoff.
Advanced
🖥️ ML Infrastructure & Serving🔒 Premium
Speculative DecodingDecoding is slow because each token needs a full forward pass through a huge memory-bound model. Speculative decoding has a small fast draft model propose several tokens at once, then the large target model verifies them all in a single forward pass and keeps the longest correct prefix. A careful accept rule makes the output provably identical to sampling from the target model, so you get lower latency for free, not an approximation.
Advanced
🧠 Foundations of LLMs & GenAI🔒 Premium
Model Routing and CascadesModel routing sends each request to the cheapest model that can handle it, escalating only when needed. Most production traffic is easy, so paying frontier prices for every request is usually the largest avoidable line in an AI bill. The engineering is in deciding cheaply and in knowing what to do when the router is wrong.
Advanced
🧠 Foundations of LLMs & GenAI🔒 Premium
Prompt Caching and Semantic CachingTwo different caches solve two different bills. Prompt caching reuses the model's internal computation over a stable prefix, cutting cost and time-to-first-token on every call that shares it. Semantic caching skips the model entirely when a near-identical question has been answered before, and it is the one that can serve a wrong answer confidently.
Advanced
🗄️ Data & SQL Engineering🔒 Premium
Batch vs StreamingStreaming costs more to build, more to run and far more to debug, so the question is never which is more modern but what the decision latency actually is. Most customers who ask for real-time need fresh-enough, and the useful move is converting a vague freshness request into a number tied to a decision someone makes.