LLM AI Infra Interview Questions: A Systematic Problem-Solving Framework
As Large Language Model (LLM) context windows expand to hundreds of thousands of tokens, AI Infrastructure roles have evolved far beyond simple model deployment. They now encompass compute graph optimization, distributed systems, storage, networking, and cost control. This article outlines a systematic framework for tackling high-frequency AI Infra interview questions, covering model architecture, training systems, inference serving, performance analysis, and engineering governance. It provides candidates with a structured approach to articulate design rationales, identify bottlenecks, and build reliable production systems.
As LLM context lengths expand from a few thousand tokens to 100K or even hundreds of thousands, AI Infrastructure (AI Infra) is no longer just about “deploying a model.” It now involves compute graph optimization, distributed systems, storage, networking, compilers, hardware resource scheduling, online service governance, and cost control.
Consequently, interviews for large model infrastructure roles typically do not focus solely on the API usage of a specific framework. Instead, they assess whether a candidate can answer the following questions:
- Why is the model designed this way?
- What are the respective bottlenecks in training and inference?
- How do we scale under limited VRAM and network bandwidth?
- How do we troubleshoot throughput drops, latency spikes, and service instability?
- How do we build an experimental model into a reliable online system?
Below is a structured breakdown along the most common knowledge tracks found in these interviews.
1. Understanding the Core Problem: What Does an AI Infra Role Solve?
AI Infra typically sits between model algorithms and underlying compute resources. The work can be divided into four layers.
The first layer is compute resource management, encompassing accelerators (GPUs/ASICs), CPUs, memory, local disks, high-speed networking, and cluster scheduling. The goal is to maximize hardware utilization while avoiding resource fragmentation, task interference, and fault propagation.
The second layer is training infrastructure, including data preprocessing, distributed training, fault-tolerant resume, checkpointing, experiment management, and performance monitoring.
The third layer is inference infrastructure, covering model loading, request scheduling, batching, KV Cache management, parallel inference, streaming output, rate limiting, and elastic auto-scaling.
The fourth layer is platform engineering, which involves images, deployment, permissions, logging, monitoring, alerting, cost accounting, and unified service interfaces for algorithm and business teams.
Interviewers will typically drill down into these layers based on a candidate’s experience. For instance, if a candidate claims to have “optimized inference throughput,” the interviewer might follow up with:
- What were the bottlenecks before and after the optimization?
- What metrics were used to identify the bottleneck?
- Was it compute-bound, memory-bound, or communication-bound?
- Did the optimization affect Time To First Token (TTFT) and output stability?
- Does the solution remain effective as concurrency increases?
- Did you account for different request types, such as long-input/short-output?
Therefore, answering questions should not stop at “I used a specific technology.” You must explain the problem, analysis method, solution, trade-offs, and final metrics.
2. High-Frequency Model Architecture Questions
What is the core computation process of a Transformer?
This is the most fundamental yet frequently probed question. A typical Transformer decoder layer usually contains:
- Token embedding or input representation;
- Multi-head self-attention;
- Residual connection and normalization;
- Feed-forward network;
- A second residual connection and normalization;
- Stacking multiple layers to produce the final output.
The basic form of self-attention is:
Q = XWqK = XWkV = XWvAttention(Q, K, V)= Softmax(QKᵀ / √d) V
Where Q, K, and V represent Query, Key, and Value, respectively, and d is the dimension of the attention head.
In an interview, you shouldn’t just recite the formula; you must explain the engineering implications. Attention computation involves matrix multiplication and massive intermediate tensors. As sequence length increases, the compute and VRAM consumption of standard full attention grow rapidly. During training, the complete attention matrix can become a memory bottleneck. During inference, historical Keys and Values must be cached, causing the KV Cache to grow linearly with context length and concurrent requests.
Why does long context incur massive costs?
For a sequence of length L, the core computation of standard self-attention is typically proportional to L². This means scaling context from 8K to 128K isn’t just a tenfold cost increase; attention-related computation can face an order-of-magnitude explosion.
Inference also requires accounting for the KV Cache. A rough estimate of cache size can be represented as:
KV Cache ≈ Layers × 2 × Sequence Length × KV Heads × Dimension per Head × Bytes per Data Type
The “2” corresponds to K and V. In practice, this must be multiplied by the number of concurrent requests, while also factoring in cache chunking, alignment, and management metadata.
Therefore, long-context optimization rarely relies solely on adding more VRAM. It typically involves a combination of:
- More efficient attention implementations;
- Reducing the number of KV heads;
- Low-precision caching;
- Chunked caching;
- Prefix reuse;
- Sliding window or local attention;
- Tiered storage and cache eviction;
- Request-level context pruning;
- Compute and communication overlap.
When answering, it’s best to explicitly distinguish between “model architecture-level optimizations” and “serving system-level optimizations.” The former affects model capability and training, while the latter impacts resource utilization and online performance.
What are the differences between MHA, GQA, and MQA?
In standard Multi-Head Attention (MHA), each query head typically has independent K and V heads, offering strong representational capacity but resulting in a large KV Cache.
Multi-Query Attention (MQA) allows multiple query heads to share a single set of K and V, significantly reducing cache size and memory access pressure, but potentially sacrificing some representational capacity.
Grouped-Query Attention (GQA) sits in between: multiple query heads share K and V in groups, achieving a compromise between effectiveness and inference efficiency.
This is a common architecture question. You can compare them across three dimensions:
- Parameter volume: Are the K and V projection matrices reduced?
- Inference VRAM: Are the number of heads in the KV Cache reduced?
- Computation and capacity: The higher the sharing degree, the lower the cache and bandwidth pressure, but model representational capacity might be impacted.
3. High-Frequency Training System Questions
How to choose between Data, Tensor, and Pipeline Parallelism?
Data Parallelism (DP) distributes different data batches across multiple devices. Each device holds a complete model replica and synchronizes gradients at the end. It is simple to implement and suitable for models that fit within a single device or node’s VRAM.
Tensor Parallelism (TP) splits the weights or computation results of a single operator across multiple devices. For example, a large matrix multiplication can be split along the input or output dimension. It supports larger models but typically requires inter-device communication for every layer, demanding high-speed interconnects.
Pipeline Parallelism (PP) places different model layers on different devices or device groups, flowing micro-batches sequentially through the pipeline. It reduces per-device VRAM pressure but introduces pipeline bubbles and scheduling complexity.
Real-world systems often use hybrid parallelism:
Total Device Count= Data Parallel Size× Tensor Parallel Size× Pipeline Parallel Size
When choosing a parallelism strategy, consider:
- Whether model parameters and optimizer states fit on a single device;
- Intra-node vs. inter-node network bandwidth;
- Target throughput and per-step latency;
- Gradient synchronization volume;
- Pipeline bubble ratio;
- Fault recovery and scheduling complexity.
If asked, “Why not use a larger tensor parallel size?” you can answer: As TP size increases, communication frequency and synchronization costs rise. If it spans nodes with weaker network conditions, communication becomes the primary bottleneck. Therefore, TP is usually prioritized within high-speed interconnect domains (like NVLink within a node), while DP is used to scale overall throughput across nodes.
How to estimate training VRAM?
Training VRAM includes more than just model parameters. It also encompasses gradients, optimizer states, activations, temporary workspaces, and communication buffers.
In low-precision training, common VRAM components include:
- Low-precision model parameters;
- Possibly retained high-precision master parameters;
- Low-precision gradients;
- Optimizer first and second-order states;
- Activations;
- Gradient communication buffers;
- Operator temporary space.
Thus, “parameter count × bytes per data type” only estimates model weights, not the complete training VRAM.
Common optimization methods include:
- Mixed precision training;
- Gradient accumulation;
- Activation recomputation (rematerialization);
- Optimizer state partitioning;
- Parameter, gradient, and state sharding (e.g., ZeRO optimization);
- Reducing temporary tensor lifetimes;
- Using more memory-efficient optimizers;
- Tuning micro-batch sizes.
Activation recomputation is a classic time-for-space trade-off: during the forward pass, intermediate activations are not fully saved. During the backward pass, they are recomputed, reducing VRAM usage but increasing computation.
How to handle faults in distributed training?
Large-scale training runs for long periods, and single devices, processes, nodes, or networks can all fail. A reliable training system requires:
- Periodic checkpointing;
- Checkpoint integrity validation;
- Multi-replica or reliable storage;
- Consistency between training state and data reading position;
- Automatic task restart on failure;
- Cluster-level health checks;
- Random state management upon resume;
- Exception logs and fault localization data.
In an interview, you can elaborate: checkpoints must not only save model parameters but also attempt to save optimizer states, learning rate scheduler states, data iteration positions, and RNG states. Otherwise, resuming might cause learning rate jumps, data repetition, or training trajectory shifts.
4. High-Frequency Inference Serving Questions
What is the difference between TTFT and TPOT?
LLM inference is generally divided into two phases:
- Prefill phase: Processing the user’s entire input context;
- Decode phase: Generating subsequent tokens step-by-step.
Time To First Token (TTFT) is primarily affected by prefill computation, queue time, model loading, and scheduling. Time Per Output Token (TPOT) is more heavily influenced by sequential decoding, KV Cache reads, memory bandwidth, and concurrent scheduling.
Therefore, optimizing TTFT and optimizing continuous generation speed require different approaches:
TTFT optimizations include:
- Input chunking;
- More efficient prefill computation;
- Request priority scheduling;
- Prefix caching;
- Reducing queue time;
- Appropriate parallelism strategies.
TPOT optimizations include:
- Lowering KV Cache access cost;
- Optimizing decode operators;
- Using continuous batching;
- Reducing scheduling overhead;
- Improving device utilization;
- Appropriately controlling concurrency.
A common pitfall is looking only at average latency. Online services must also monitor P95 and P99 latencies, as long inputs, cache misses, device jitter, and request congestion typically manifest first in tail latencies.
What is Continuous Batching?
Traditional batching requires waiting for all requests in a batch to finish before returning results collectively, easily causing device idle time. Continuous batching allows completed requests to exit while adding new requests to the running batch, thereby maximizing device utilization.
However, continuous batching introduces scheduling complexity. The system must dynamically manage:
- Request lifecycles;
- Current generation length for each request;
- KV Cache blocks;
- Maximum lengths for different requests;
- Cancellation and timeouts;
- Priority and fairness;
- VRAM fragmentation.
If asked how to design a scheduler, frame your answer around “request orchestration under resource constraints” rather than simple FIFO. A reasonable scheduler must simultaneously consider input length, estimated output length, priority, remaining cache space, and target latency.
How is KV Cache managed?
KV Cache management is a core issue in inference systems. Simply allocating large contiguous VRAM blocks per request causes internal fragmentation and scaling difficulties. A more common approach is to slice the cache into fixed-size blocks and manage the mapping between logical sequences and physical cache.
A cache system typically needs to solve:
- How to allocate cache for new requests;
- How to append cache as requests grow;
- How to reclaim cache when requests end;
- Whether multiple requests can share identical prefixes;
- Who to evict when VRAM is insufficient;
- Whether cache blocks support cross-device migration;
- How to quickly release cache upon request cancellation.
Prefix caching can reduce redundant input computation, but it must consider cache hit conditions, content consistency, tenant isolation, lifecycle, and security. For dynamically changing contexts, you cannot simply reuse based on string similarity; you must ensure the corresponding model states and positional encoding conditions are compatible.
5. Performance Analysis and Troubleshooting
How to determine where the system bottleneck is?
A complete performance analysis workflow usually goes:
Step 1: Define target metrics, such as throughput, TTFT, TPOT, VRAM utilization, device utilization, and request success rate.
Step 2: Establish an end-to-end breakdown:
Total Latency= Queue Time+ Scheduling Time+ Input Processing Time+ Model Compute Time+ Communication Time+ Output Transfer Time
Step 3: Use monitoring and profiling tools to determine:
- Whether compute units are consistently saturated;
- Whether memory bandwidth is near its limit;
- Whether there is idle time between devices;
- Whether communication is blocking computation;
- Whether memory is frequently allocated and reclaimed;
- Whether requests are queuing due to insufficient cache;
- Whether host-side scheduling is the bottleneck.
Step 4: Conduct single-variable experiments. For example, fix the model and input while only changing the batch size; or fix concurrency while only changing the context length. This helps isolate which factor is causing the performance shift.
How to distinguish between compute-bound, memory-bound, and communication-bound?
Compute-bound typically manifests as high compute unit utilization and dense arithmetic operations. Increasing parallelism or optimizing matrix multiplications may be effective.
Memory-bound usually presents as low compute unit utilization but memory bandwidth near its limit. Adding more compute resources is futile here. Instead, reduce data movement, optimize memory layout, use lower data precision, or increase cache reuse.
Communication-bound is characterized by noticeable device-to-device waiting, a high proportion of communication time, and difficulty overlapping communication with computation. This requires optimizing partitioning methods, reducing synchronization frequency, compressing communication volume, or restricting communication to faster network domains.
An excellent interview answer should avoid equating “low device utilization” directly with “insufficient compute resources.” Low utilization might be caused by slow data preparation, synchronization waits, memory fragmentation, poor scheduling, or communication blocking.
6. Stability, Cost, and Engineering Governance
AI Infra is not just about speed; it also prioritizes reliability and cost.
For stability, systems need:
- Request timeouts and cancellation mechanisms;
- Rate limiting, circuit breaking, and graceful degradation;
- Device health checks;
- Model version rollback;
- Resource isolation;
- Anomalous request protection;
- Multi-level monitoring and alerting;
- Chaos engineering and disaster recovery plans.
For cost, focus on:
- Accelerator utilization;
- Idle resource ratio;
- Cost per request across different models;
- Input and output length distributions;
- Cache hit rates;
- Resource reservation and elastic scheduling;
- Resource waste from training failures.
If asked “How to reduce inference costs,” answer from four directions:
- Model side: Quantization, distillation, structural optimization.
- System side: Batching, cache reuse, operator fusion.
- Scheduling side: Elastic auto-scaling, workload mixing, priority scheduling.
- Business side: Context pruning, output length control, request routing.
It is important to emphasize that every optimization involves trade-offs. For example, quantization might affect accuracy, batching might increase per-request wait time, cache reuse introduces isolation requirements, and aggressive auto-scaling might cause cold-start latency.
7. A Universal Method for Interview Answers
When facing open-ended questions, use the “Define - Bottleneck - Solution - Trade-off - Verify” structure.
For example, answering “How to optimize long-context inference”:
- Define the problem: Long context primarily increases prefill computation and KV Cache footprint.
- Analyze the bottleneck: Measure computation, VRAM, bandwidth, communication, and queueing separately.
- Propose a solution: Adopt chunked processing, cache reuse, low-precision cache, and dynamic batching.
- Explain the trade-offs: Lowering cache precision might affect numerical stability; cache reuse requires strict consistency validation.
- Verify the effect: Observe TTFT, continuous generation speed, P99 latency, VRAM usage, and request success rate.
Additionally, prepare a complete project case study where you can clearly articulate:
- What the original problem was;
- Why you identified it as the core problem;
- What experiments you conducted;
- How the solution was implemented;
- How the metrics changed;
- What side effects you encountered;
- How it could be further improved.
Conclusion
The essence of an LLM AI Infra interview is assessing whether a candidate can connect model principles, hardware characteristics, distributed systems, and online engineering. Improving long-context capabilities is not just about adding parameters or VRAM; it relies on the joint evolution of attention architecture, cache management, parallel computation, communication optimization, scheduling strategies, and reliability governance.
When preparing for these interviews, avoid merely memorizing concepts. Instead, build a mental framework around “how resources flow, how bottlenecks are located, how solutions are weighed, and how metrics are verified.” Only by being able to articulate ideas from the model layer down to the system layer, and from theory down to troubleshooting, can you truly demonstrate the engineering depth required for an AI Infrastructure role.
