Skip to content
NVIDIA AI Model and Application Development Associate (NCA-AMAD) Exam Prep

Lesson 3 of 8 · 13 min

x
3/8

Inference Concepts (15%)

Video lesson: NCA-AMAD Domain 3: Inference Concepts

Official exam topics: exam-guide/nca-amad-exam-page.md ("Inference Concepts"). NVIDIA defines this area as foundational knowledge of AI inference, including inference-serving infrastructure, inference pipeline phases and modes, optimization techniques, improving throughput, latency and performance, and understanding inference costs. Expect which optimization, which metric, which serving component, why is it slow, what drives cost scenarios. The reading list: NIM for LLMs API reference and the NIM LLM benchmarking guide (overview, metrics, parameters), Triton batchers, NIM Operator model caching, TensorRT-LLM docs (overview, paged attention and in-flight batching, sparse attention), Mastering LLM Techniques: Inference Optimization, LLM Inference Benchmarking: Fundamental Concepts, KV cache reuse, post-training quantization, and NIM out-of-memory troubleshooting.

Exam topics in this domain 1. 3.1 Inference-serving infrastructure: model servers, gateways and routing, provider abstraction, NVIDIA Dynamo, autoscaling, queuing, cold starts 2. 3.2 Pipeline phases and modes: prefill and decode; real-time, batch and streaming 3. 3.3 Optimization techniques: quantization, KV and prefix caching, batching, speculative decoding, parallelism, disaggregated serving, context length and GPU memory 4. 3.4 Performance measures and load testing; latency vs throughput trade-offs 5. 3.5 Inference cost drivers

Checked against NVIDIA documentation (November 2026). - NVIDIA Dynamo is an open-source, inference-engine-agnostic framework for distributed LLM serving: it runs above engines such as TensorRT-LLM, vLLM and SGLang and adds disaggregated prefill/decode, KV-cache-aware routing, KV cache offloading and GPU planning. Triton Inference Server is part of the Dynamo platform (also called Dynamo-Triton). - NIM for LLMs exposes an OpenAI-compatible API (/v1/chat/completions, /v1/completions, /v1/models) and picks an optimized engine profile for the GPUs it finds. - NIM Operator deploys and manages NIM on Kubernetes, including model caching (download model weights once to persistent storage) to cut start-up time, and autoscaling.

3.1 Serving Infrastructure

ComponentRole
Inference engineRuns the model efficiently on GPUs: TensorRT-LLM, vLLM, SGLang
Model serverWraps engines with APIs, batching, model management and metrics: Triton (Dynamo-Triton), NIM, vLLM's server
NIM microservicePackaged model + optimized engine + server + standard API in one container (D6)
Gateway / routerSingle entry point: authentication, rate limits, quotas, logging, routing across models or replicas (by cost, load, capability, KV-cache hits)
Provider abstractionOne API (often OpenAI-compatible) in front of several model providers, so applications can switch models without code changes
OrchestratorKubernetes schedules replicas; NIM Operator, Run:ai (D8)
DynamoDistributed serving across many GPUs and nodes: disaggregated serving, KV-aware routing, planner that reallocates GPUs

Scaling, queuing and cold starts - Request queuing: when all slots are busy, requests wait; queue depth and wait time are key health signals. - Autoscaling: add or remove replicas based on load. For LLMs, scale on queue length, request concurrency, GPU KV-cache utilization or tokens per second, not just CPU usage (Kubernetes Horizontal Pod Autoscaler with custom metrics). - Cold start: a new replica must pull the container, load tens of GBs of weights and warm up, which can take minutes. Mitigations: model caching (NIM Operator caches weights on persistent volumes), pre-pulled images, keeping a minimum number of warm replicas, scaling ahead of predicted demand. - Scaling strategies: horizontal (more replicas), vertical (bigger GPUs or more GPUs per replica via tensor parallelism), scheduled scaling for known peaks, scale-to-zero for rarely used models (with cold-start cost).

3.2 Phases and Modes

Prefill and decode | Phase | What happens | Bound by | Drives | |---|---|---|---| | Prefill | The whole prompt is processed in parallel; the KV cache is built; the first token is produced | Compute | Time to first token (TTFT) | | Decode | One token at a time, each reading all weights and the growing KV cache | Memory bandwidth | Inter-token latency (ITL) and total generation time |

Long prompts make prefill expensive; long outputs make decode expensive. Disaggregated serving puts prefill and decode on different GPU pools so each can be sized and optimized separately and long prefills don't stall other users' decoding (Dynamo transfers the KV cache between them).

Modes | Mode | Use | Optimization target | |---|---|---| | Real-time (online) | Chat, agents, APIs with a user waiting | Low TTFT and ITL at acceptable cost | | Streaming | Return tokens as they are generated (server-sent events, stream: true) | Perceived latency: users see text immediately | | Batch (offline) | Summarize a million documents overnight, score a dataset | Maximum throughput and lowest cost per token; latency doesn't matter |

3.3 Optimization Techniques

TechniqueWhat it doesTrade-off
Quantization (FP8, INT8, INT4 weight-only such as AWQ, NVFP4 on Blackwell)Fewer bytes per weight (and activation, KV cache): less memory, more throughputPossible accuracy loss; post-training quantization with calibration (TensorRT Model Optimizer) usually keeps accuracy close; always re-evaluate
KV cacheStore keys and values of past tokens so they aren't recomputedUses GPU memory that grows with batch × sequence length
Paged attentionKV cache in fixed-size blocks allocated on demandLess fragmentation → more concurrent requests
In-flight (continuous) batchingNew requests join and finished ones leave the batch at every stepMuch higher throughput than static batching
KV cache reuse / prefix cachingReuse cached keys and values for shared prompt prefixes (system prompts, few-shot examples, multi-turn history)Big TTFT savings for repeated prefixes; needs memory; TensorRT-LLM adds priority-based eviction and KV-cache event APIs for cache-aware routing
Speculative decodingA small draft model (or extra heads such as Medusa/EAGLE) proposes several tokens; the large model verifies them in one passLower latency with identical output distribution; gains depend on how often drafts are accepted
Tensor parallelismSplit each layer's matrices across GPUs (fast NVLink needed)Fits bigger models, lowers latency; communication overhead
Pipeline parallelismSplit layers across GPUs or nodesFits very large models; pipeline bubbles
Disaggregated servingSeparate prefill and decode poolsBetter utilization at scale; more moving parts
Sparse attention (TensorRT-LLM)Attend to a subset of tokens for long contextsFaster long-context inference; may affect accuracy
Guided decodingConstrain output to a JSON schema, regex or grammarValid structured output; slight overhead
Triton batchersDynamic batcher (groups individual requests within a short delay) for stateless models; sequence batcher for stateful modelsThroughput vs added wait

Context length and GPU memory GPU memory ≈ model weights + KV cache + activations/overhead. - Weights ≈ parameters × bytes per parameter (FP16 = 2, FP8 = 1, INT4 = 0.5): a 70B model in FP16 ≈ 140 GB. - KV cache per token = 2 (keys and values) × layers × KV heads × head dimension × bytes; total grows with concurrent requests × sequence length. Long contexts and many users can need as much memory as the weights. - Out-of-memory fixes (NIM troubleshooting): lower the maximum sequence length or max batch size, use a quantized profile, add GPUs (tensor parallelism), reduce the KV-cache memory fraction, or choose a smaller model.

3.4 Performance Measures and Load Testing

MetricDefinition
Time to first token (TTFT)From sending the request to receiving the first token (includes queuing and prefill)
Inter-token latency (ITL) / time per output token (TPOT)Average gap between tokens after the first
End-to-end request latencyTTFT + generation time for all output tokens
ThroughputOutput tokens per second (system-wide) and requests per second
Tokens per second per userGeneration speed one user experiences (≈ 1 / ITL)
ConcurrencyNumber of requests in flight
GoodputThroughput of requests that meet the latency SLA

Latency vs throughput Bigger batches and more concurrency raise throughput (GPU busier) but raise latency per request. The right operating point is the highest throughput that still meets the latency SLA. Plot latency against throughput at increasing concurrency to find it.

Load testing (LLM Inference Benchmarking, NIM benchmarking guide) - Use a benchmarking tool (GenAI-Perf, now succeeded by AIPerf) against the endpoint with realistic input and output lengths and concurrency levels (or request rates). - Sweep concurrency (for example 1, 8, 32, 128) and record TTFT, ITL, throughput and errors. - Warm up first; run long enough; keep the same settings when comparing; report percentiles (p50, p95, p99), not just averages. - Parameters that change results: input/output token lengths, concurrency, streaming on/off, model profile (precision, tensor parallelism), max batch size.

3.5 Inference Cost Drivers

DriverWhy it mattersLever
Model sizeMore parameters → more GPUs and memory per requestSmaller or distilled model, MoE, quantization
Tokens (input and output)Cost scales with tokens processed; output tokens are slowerShorter prompts, prefix caching, concise outputs, limits on reasoning tokens
Traffic (volume and peaks)Determines replicas neededAutoscaling, batching, caching answers
HardwareGPU type and price per hour; utilizationRight-size GPUs, fractional GPUs for small models (Run:ai), newer GPUs with FP8/FP4
Latency targetsTight SLAs force small batches and spare capacityRelax SLAs for batch work; separate real-time and batch fleets
Agentic workflowsMany calls per task multiply tokensFewer steps, model routing, smaller models for simple steps

Cost per million tokens = GPU cost per hour ÷ millions of tokens generated per hour (for example, 2,000 tokens/s × 3,600 s = 7.2 M tokens per hour; at an illustrative $3.60 per GPU-hour that is $3.60 ÷ 7.2 = $0.50 per million tokens), so raising throughput (at the required latency) lowers cost.

Exam Tips - Prefill = compute-bound, sets TTFT; decode = memory-bandwidth-bound, sets ITL. - In-flight batching + paged KV cache = high throughput; prefix caching = lower TTFT for shared prompts. - Speculative decoding: draft proposes, target verifies; same output quality, lower latency. - Disaggregated serving separates prefill and decode pools (Dynamo). - Quantize with PTQ and re-check accuracy; FP8 on Ada/Hopper+, FP4 on Blackwell. - OOM: lower max sequence length or batch size, quantize, or add GPUs. - Report TTFT, ITL, throughput and percentiles at realistic concurrency. - Cold starts: cache models (NIM Operator), keep warm replicas. - Throughput up at fixed latency → cost per token down.

References

  1. NVIDIA NCA-AMAD certification exam page — checked Nov 11, 2026

Check your understanding

  • Token generation is slow. Will faster tensor cores fix it?Show answer

    Answer

    Usually not. Decode is memory-bandwidth-bound; batching, KV-cache efficiency and quantization help more.
  • Does speculative decoding lower output quality?Show answer

    Answer

    No. A draft model proposes tokens and the target model verifies them, so the output matches the target model while latency drops.
  • Is average latency enough to judge whether you meet an SLA?Show answer

    Answer

    No. Report percentiles such as p95 and p99, and time to first token and inter-token latency, at realistic concurrency.
  • Does a longer context window cost extra memory?Show answer

    Answer

    Yes. The KV cache grows with batch size times sequence length, so longer contexts allow fewer concurrent requests.
Previous

Progress is saved in this browser.

Next Lesson