LLM Engineer interview questions
100 real questions with model answers and explanations for Senior candidates.
See a LLM Engineer resume example →Practice with flashcards
Spaced repetition · Hunter Pass
Questions
I would separate a policy-aware gateway, token-based scheduler, model pools, and versioned capability registry so routing and capacity remain explicit.
- The gateway enforces trust tier, region, context limit, tools, schema, quotas, and deadlines before selecting any hosted or self-hosted route.
- Hot models get resident vLLM or TGI pools sized from prompt and output distributions, while cold variants use isolated pools with declared cold-start behavior.
- Load tests at 26,000 requests per minute verify 30% headroom, p99 TTFT, output tokens per second, quality, and cost for every route.
Why interviewers ask this: The interviewer is checking whether the candidate turns a multi-model platform into measurable routing, isolation, capacity, and trust contracts.
I would route by data eligibility and measured task quality first, then optimize cost inside each eligible pool.
- Regulated prompts stay on an approved private deployment with pinned weights, regional storage, and audited retention; nonregulated traffic may use hosted models.
- A common request contract preserves messages, tools, schemas, deadlines, and usage, while provider-specific adapters expose features without claiming model equivalence.
- Shadow evaluation compares quality, p95, effective cost per successful task, and capacity before any portion of the 200 million daily tokens changes route.
Why interviewers ask this: A strong answer combines data-boundary constraints with measured model capability and economics instead of choosing one deployment model universally.
I would use constrained decoding against a versioned JSON Schema and keep semantic validation outside the model.
- Outlines, Guidance, or a provider-native grammar limits token choices for syntax, while enums, ranges, and cross-field rules run in deterministic code.
- Repair retries are capped and receive exact validation failures; truncated, contradictory, or policy-invalid outputs take a separate fallback path.
- The release gate covers exact schema validity above 99.95%, field accuracy, retry rate, p99, and tokens on production-shaped payloads.
Why interviewers ask this: The interviewer is evaluating whether structured generation is enforced by decoding and validation rather than prompt wording alone.
I would operate it as a resumable token-aware pipeline and prove required throughput and cost from a representative pilot.
- Immutable manifests and deterministic record IDs support stage checkpoints, idempotent writes, classified retries, and resume without duplicate charges.
- Queues group records by model, prompt length, and output bound, applying provider batch APIs or self-hosted continuous batching under quota and GPU backpressure.
- Hourly forecasts track accepted records per second, quality-pass rate, remaining tokens, completion probability, and projected spend against 18 hours and $120,000.
Why interviewers ask this: A strong answer treats massive LLM batch inference as a deadline, quality, idempotency, and unit-economics system.
I would keep shared base replicas resident and dynamically load versioned adapters through a bounded cache keyed by tenant and base revision.
- The registry verifies tokenizer, target modules, rank, base hash, evaluation, and tenant authorization before an adapter can load.
- Hot adapters are replicated from measured demand, while cold adapters accept a declared load delay and eviction uses memory pressure plus recent frequency.
- Requests with different adapters batch only when the engine preserves adapter isolation, and no KV or adapter state may cross tenant boundaries.
Why interviewers ask this: The interviewer is checking whether multi-LoRA density preserves compatibility, isolation, batching, and predictable cold behavior.
I would make hard eligibility deterministic and use a calibrated difficulty policy to select the cheapest model meeting each task's quality floor.
- Context, language, modality, tools, data policy, and latency exclude incapable routes before a learned router considers cost.
- Randomized holdouts and shadow labels estimate false cheap-route acceptance, escalation, p99, and total success without router selection bias.
- The full routed policy, not each model alone, must meet quality and cost targets under the production task mixture.
Why interviewers ask this: A strong answer frames model routing as constrained optimization with unbiased end-to-end evaluation.
I would start with LoRA because the dataset and 36-hour budget do not justify optimizer states and gradients for all 70B parameters without evidence of a quality ceiling.
- A pilot sweeps rank 16, 32, and 64 plus attention-only versus attention-and-MLP targets on a fixed held-out set.
- BF16 base weights remain frozen, while adapter checkpoints, optimizer state, tokenizer, data manifest, and exact base revision are versioned.
- Full fine-tuning is considered only if LoRA materially misses the task floor and a measured throughput and memory plan fits eight H100s.
Why interviewers ask this: The interviewer is evaluating whether adaptation scope follows dataset size, quality evidence, memory, and schedule rather than prestige.
I would load the frozen base in 4-bit NF4 with double quantization, train BF16 LoRA adapters, and spend memory on activations and sequence throughput.
- Start with rank 32, alpha 64, dropout near 0.05, and target attention plus selected MLP projections, then ablate narrower targets.
- Gradient checkpointing, packed sequences, gradient accumulation, and a distributed sampler keep four GPUs productive without exceeding memory.
- Compare QLoRA with BF16 LoRA on held-out quality, training tokens per second, peak memory, and merge or serving compatibility before accepting its savings.
Why interviewers ask this: A strong answer connects QLoRA's weight compression to concrete adapter, precision, activation, and evaluation choices.
I would choose rank 16 unless the 1.1-point gain at rank 64 clears a predefined critical-slice requirement.
- Adapter parameters and memory scale roughly with rank, so rank 64 makes storage, network loading, and resident adapter cache about four times heavier.
- Compare the ranks by task slice, forgetting, latency, batch density, and cold-load time rather than aggregate success alone.
- If one high-value task needs rank 64, I would keep that adapter exceptional instead of charging all 100 tenants the same cost.
Why interviewers ask this: The interviewer is checking whether LoRA rank is selected from marginal quality and fleet economics rather than maximized automatically.
I would choose mixture weights from target product importance and gradient value, not copy the raw 70:20:10 collection ratio.
- Deduplicate first, cap repeated support templates, and build per-domain validation sets with rare and high-risk cases.
- Run short mixture pilots such as 50:30:20 and temperature-smoothed sampling, measuring task gains and interference after equal training tokens.
- The final manifest records source counts, sampling weights, licenses, consent, and effective examples seen so the run is reproducible.
Why interviewers ask this: A strong answer treats data mixture as an experimentally measured optimization rather than a reflection of collection volume.
I would remove exact and semantic duplicates and quarantine benchmark contamination before any train-validation split.
- Normalize stable fields, hash exact records, and use MinHash or embedding clusters with source-aware thresholds for near-duplicate groups.
- Match benchmark prompts, references, and paraphrases against all sources, retaining provenance so suspected contamination can be excluded and audited.
- Split by document, customer, conversation, and time boundary after grouping, then report removed counts and contamination rates by source.
Why interviewers ask this: The interviewer is evaluating whether deduplication and contamination controls prevent inflated evaluation and repeated-gradient waste.
I would pack multiple examples into each sequence while preserving loss and boundary semantics.
- Insert the correct EOS or separator, mask padding and any prompt tokens excluded from loss, and ensure one example cannot leak into another through labels.
- Bucket by length before packing so long examples do not create new padding, and keep deterministic packing in the dataset manifest.
- Measure nonpadding-token ratio, examples per step, tokens per second, convergence, and held-out quality rather than GPU utilization alone.
Why interviewers ask this: A strong answer improves training efficiency without corrupting causal labels or example boundaries.
I would calibrate the schedule with a short range-finding run and define it in tokens rather than examples or wall-clock time.
- Start conservatively for LoRA, compare candidate peak rates such as 1e-4 and 2e-4, and warm up roughly 1% to 3% of planned training tokens.
- Track train and validation loss by domain, gradient norm, update norm, throughput, and task evals every fixed token interval.
- Stop from held-out task saturation or regression, not merely completion of an arbitrary epoch over duplicated data.
Why interviewers ask this: The interviewer is checking whether optimization schedules account for effective token batch and task evidence.
I would clean and slice the pairs, pin a reference model, and tune DPO strength against preference gain and capability regression.
- Agreement analysis separates ambiguous pairs, systematic reviewer differences, and label errors; uncertain pairs are excluded or weighted deliberately.
- Start with a small beta sweep such as 0.05, 0.1, and 0.2 plus length controls, then inspect chosen-rejected margins by task.
- Release evaluation covers blinded pairwise win rate, factuality, safety, verbosity, KL movement, and base benchmarks on a sealed holdout.
Why interviewers ask this: A strong answer treats DPO as controlled preference optimization with label-quality and regression checks.
I would pilot PPO only if the simulator reward is robust and online policy exploration can address failures that static pairs do not cover.
- Validate reward precision on adversarial trajectories, partial success, invalid tools, and shortcut behavior before letting the policy optimize against it.
- The PPO stack needs rollout workers, reference and value models, advantage estimation, KL control, and monitoring for reward growth without task improvement.
- Continue only if held-out task success rises materially above 58% and the gain repays rollout GPU-hours and operational complexity.
Why interviewers ask this: The interviewer is evaluating whether online RL is justified by verifiable interactive feedback and a measured limit of offline tuning.
I would train a pairwise scorer with domain-balanced sampling and validate calibration and ranking beyond the annotators and prompts seen in training.
- Split by prompt family, time, and annotator group to prevent paraphrase or reviewer leakage, while retaining disagreement and provenance.
- Report pairwise accuracy, calibration, domain and language slices, length bias, position bias, and adversarial reward-hacking cases.
- Before RL use, compare reward rankings with blinded human judgments on fresh policy outputs rather than only the original 500,000 pairs.
Why interviewers ask this: A strong answer treats the reward model as a potentially biased learned metric that must generalize to changing policy outputs.
I would mix targeted long-context examples and evaluate position-sensitive tasks instead of assuming short SFT preserves 128,000-token behavior.
- Include retrieval, aggregation, and needle tasks across lengths and positions, with a controlled fraction of 16,000 to 128,000-token sequences.
- Use packing and length curriculum carefully because long batches dominate token count and memory even when examples are few.
- Gate on short-task quality, long-context retrieval, lost-in-the-middle slices, throughput, and memory before accepting the tuned model.
Why interviewers ask this: The interviewer is checking whether fine-tuning data length matches the context capability that the product intends to retain.
I would extend it only if compression and task gains outweigh embedding changes and compatibility cost.
- Train candidate tokens on domain text, require meaningful frequency and nonoverlap, and compare average length, truncation, and inference tokens against the current tokenizer.
- New embeddings need careful initialization and enough supervised or continued-pretraining exposure, while old-token behavior must remain stable.
- The new tokenizer creates a distinct model and serving artifact, so adapters, caches, quantized engines, and clients cannot silently mix versions.
Why interviewers ask this: A strong answer connects domain tokenization gains to retraining requirements and strict runtime compatibility.
The run needs about 30.3 wall-clock hours and roughly 243 H100 GPU-hours including the 20% allowance.
- Two hundred million divided by 2,200 is about 90,909 seconds, or 25.3 hours of measured compute time.
- Multiplying by 1.2 covers evaluation, checkpoints, stragglers, and expected interruptions, giving about 30.3 hours.
- Eight GPUs for 30.3 hours yield about 243 GPU-hours, which I would price with storage and failed-run reserve separately.
Why interviewers ask this: The interviewer is checking whether the candidate can turn measured token throughput into a defensible schedule and GPU-hour budget.
I would checkpoint at most every 20 minutes of progress and benchmark asynchronous save time against training throughput.
- A faithful checkpoint includes model or adapter, optimizer, scheduler, scaler, random states, dataloader position, and global step under one manifest.
- Sharded checkpoints avoid gathering a huge full state on rank zero, while periodic consolidated weights support evaluation and serving.
- Resume tests deliberately kill workers and verify matching loss and sample order, because a written checkpoint is not proof of recoverability.
Why interviewers ask this: A strong answer connects recovery-point objective to exact distributed state and tested resume behavior.
Locked questions
- 21
Train a 70B model with Adam on 16 H100 GPUs. How would you choose between PyTorch FSDP and DeepSpeed ZeRO-3?
- 22
A 140B model cannot fit one node, and you have four nodes with eight H100 GPUs connected by fast intra-node NVLink and slower inter-node fabric. How would you place parallelism?
- 23
A 32,000-token fine-tune exceeds GPU memory by 28%. Would you use activation checkpointing, CPU offload, or smaller batches?
fine-tuningtokensbatch - 24
Sequence length grows from 8,000 to 64,000 tokens and attention memory becomes the training bottleneck. What parallelism would you add?
tokensmemorytracking - 25
H100 training supports BF16 and FP8. When would you use FP8 for a 70B continued-pretraining run?
- 26
How much memory do 70B model weights require in BF16, INT8, and INT4 before runtime overhead?
memory - 27
Estimate BF16 KV-cache memory for a 70B GQA model with 80 layers, 8 KV heads, head dimension 128, and one 32,000-token sequence.
cachingmemoryestimation - 28
A vLLM endpoint must deliver 8,000 output tokens per second while keeping p99 TTFT below 900 ms. How would you tune continuous batching?
tokensendpointsbatch - 29
Choose between vLLM and TGI for serving a 34B model with streaming, continuous batching, LoRA adapters, and 16,000-token contexts.
fine-tuningtokensstreaming - 30
A 70B BF16 model must serve on four 80 GB H100 GPUs in one node. How would you choose tensor parallelism and memory headroom?
memory - 31
A 180B model spans two eight-GPU nodes, but inter-node bandwidth is one fifth of NVLink bandwidth. Would you add pipeline parallelism?
ci-cd - 32
INT8 preserves 98.8% task quality and INT4 AWQ preserves 95.6%, while INT4 doubles batch capacity. Which precision would you deploy?
capacitybatchdeployment - 33
A 70B target model uses a 1.5B draft model with a 72% token acceptance rate. How would you decide whether speculative decoding is worthwhile?
tokensdecoding - 34
Eighty percent of requests share an identical 4,000-token system and tool prefix. How would you exploit prefix caching?
cachingsystem-designtokens - 35
A serving engine uses paged KV cache with 16-token blocks. What trade-off would make you test 8-token or 32-token blocks?
tokenscaching - 36
Grammar-constrained decoding raises JSON validity from 94% to 99.98% but lowers throughput by 17%. Would you keep it?
throughputdecoding - 37
An inference fleet has 12-minute cold starts and traffic can triple within 5 minutes. Which autoscaling signals and capacity policy would you use?
capacityscalinginference - 38
A server hosts 80 LoRA adapters, and loading a cold adapter takes 1.8 seconds. How would you size and schedule the adapter cache?
fine-tuningcaching - 39
How would you benchmark a new inference engine for prompts from 200 to 32,000 tokens and outputs from 20 to 2,000 tokens?
promptingtokensbenchmarking - 40
GPU utilization is 55%, but CPU tokenization consumes 22 ms per request at 10,000 requests per second. How would you size the front end?
tokens - 41
A model supports 128,000 tokens, but the request must reserve 4,000 output tokens and includes 70,000 tokens of conversation. How would you allocate context?
tokens - 42
Retrieved and conversational context totals 60,000 tokens, but the latency budget permits only 16,000 input tokens. How would you compress it?
latencytokens - 43
A support prompt has grown to 9,000 tokens through 40 examples, but removing examples hurts rare intents. How would you reduce it?
promptingtokens - 44
Set decoding for a deterministic invoice extractor and a creative marketing assistant using the same model. What would differ?
decoding - 45
A 32B model was trained for 8,000 tokens, but product asks for 64,000 through RoPE scaling. What evidence would you require?
tokensscaling - 46
Build a release harness for a model serving 12 tasks, six languages, and three risk tiers with 10,000 labeled examples. How would you structure it?
mlops - 47
An LLM judge agrees with human reviewers 86% overall but only 64% on code answers. Can it gate a model release?
llm - 48
A fine-tuned model gains 8 points on MMLU, but 6% of benchmark prompts were found in training. How do you report the result?
promptingfine-tuningbenchmarking - 49
A candidate improves average task success from 87% to 89%, but structured-output validity falls from 99.9% to 98.7%. Would you release it?
- 50
A new model leads MMLU and HumanEval but your customer-support task has only 74% success. Which benchmark decides deployment?
benchmarkingdeployment - 51
A LoRA release improves support style by 12 points but drops the core reasoning benchmark from 78% to 69%. How do you respond?
fine-tuningbenchmarking - 52
A DPO model wins 64% of style comparisons but factual accuracy falls from 91% to 83%. What do you investigate?
- 53
A support fine-tune raises ticket resolution by 8 points but cuts code-generation pass@1 from 62% to 41%. How do you handle catastrophic forgetting?
fine-tuningsoft-skills - 54
After SFT on mostly 2,000-token examples, needle retrieval at 96,000 tokens falls from 76% to 38%. What do you do?
retrievaltokens - 55
A PPO agent's reward rises 40%, but verified tool-task success stays at 57% and trajectories become longer. What is happening?
agents - 56
Loss becomes NaN at step 18,400 of a 70B FP8 run after 600 H100 GPU-hours. How do you recover?
- 57
Training throughput falls from 2,400 to 1,350 tokens per second after scaling from 8 to 32 H100 GPUs. How do you investigate?
throughputscalingtokens - 58
A resumed ZeRO-3 run matches loss for 200 steps, then diverges by 17%. What state do you verify?
- 59
One week before release, you discover that 7% of evaluation prompts have near-duplicates in SFT data. What do you report and redo?
promptingdedupllm-eval - 60
A fine-tuned checkpoint is served with the base tokenizer, causing 4.6% malformed outputs and a 13-point quality loss. How do you recover?
fine-tuningtokens - 61
The hosted inference bill rises 92% from $310,000 while request volume grows only 4%. What do you inspect first?
inference - 62
A self-hosted fleet consumes 38,000 H100 GPU-hours per month, up 61%, while useful output tokens rise 9%. How do you reduce waste?
tokens - 63
Speculative decoding increases total GPU cost by 24% after acceptance falls from 74% to 39% on new traffic. What do you decide?
decoding - 64
Cold LoRA loads rise from 3% to 31%, adding 1.7 seconds p99 and 14,000 GPU-hours per month. How do you fix adapter-cache thrashing?
fine-tuningcaching - 65
An INT4 rollout cuts memory 46% but drops Arabic task success from 81% to 59%. Product wants the capacity savings. What do you do?
capacitymemory - 66
At four times normal load, p99 TTFT jumps from 680 ms to 3,400 ms while decode speed is stable. How do you stabilize it?
- 67
After increasing maximum batched tokens, throughput improves 22% but p99 inter-token latency rises from 55 to 170 ms. Keep the change?
latencythroughputbatch - 68
A priority scheduler preempts batch work, but 28% of batch requests now miss a six-hour deadline. How do you rebalance it?
estimationbatch - 69
Server traces show TTFT of 480 ms, but 35% of browsers receive the first token after 2.6 seconds following a gateway upgrade. Where do you look?
tokensgateway - 70
A new model takes 14 minutes to load, and a traffic spike triples demand in 6 minutes. How do you avoid repeated cold-start saturation?
- 71
vLLM workers OOM when ten users submit 128,000-token prompts, although average context is 7,500 tokens. How do you recover?
promptingtokens - 72
Loading the 41st LoRA adapter causes CUDA OOM even though estimated adapter weights fit with 9 GB free. What do you inspect?
fine-tuningestimation - 73
KV-cache occupancy stays at 96% after requests finish, and concurrency falls 40% over six hours. How do you diagnose it?
cachingconcurrency - 74
In a four-way tensor-parallel replica, one H100 reaches 78 GB while the others stay near 61 GB and the worker OOMs. What do you check?
replication - 75
An autoscaler alternates between 12 and 40 replicas every 20 minutes, wasting 6,000 GPU-hours monthly and destabilizing p99. How do you stop it?
replicationscaling - 76
A release candidate passes the judge suite, but 180 of 1,000 generated programs fail in the sandbox because of missing imports. What decides rollout?
- 77
Your LLM judge reports a 7-point gain after its provider silently updates the judge model, but human preference is unchanged. What do you do?
llm - 78
After a provider migration, 14% of requests return empty completions and 27,000 daily workflows cannot continue. How do you recover?
migrations - 79
An eval suite passes overall, but 11 of 240 safety cases regress after a prompt change. Product calls the sample too small. What do you decide?
prompting - 80
Offline task success remains 88%, but production complaint rate doubles from 0.7% to 1.4% after release. How do you reconcile it?
- 81
A jailbreak causes a public assistant to produce prohibited weapon instructions in 2.3% of red-team attempts. How do you respond?
llm-safety - 82
An employee pastes 6,000 lines of proprietary code into a consumer LLM account with 30-day retention. What do you do?
llmretention - 83
A retrieved document injects instructions that make an agent send customer data to an external URL. How do you contain it?
agents - 84
Email addresses and API tokens appear in 1.8% of traces sent to a vendor with 45-day retention. How do you respond?
tokensapiretention - 85
A model checkpoint loaded on four hosts executes an unexpected pickle payload and opens a network connection. What do you do?
- 86
Responses for tenant B occasionally use tenant A's LoRA style and phrases after adapter swaps. How do you investigate the 19 confirmed cases?
fine-tuning - 87
A legal assistant invents five citations, and two customers have already submitted the generated briefs. What is your response?
citations - 88
A medical assistant gives an unsupported dosage to 73 users despite a moderation pass. How do you lead the response?
- 89
A model confidently states a tax rule that expired 14 months ago, and 4,200 users saw it. How do you contain the hallucination?
hallucination - 90
An agent invents a nonexistent `transfer_funds` argument and moves $18,000 to the wrong account after coercion by the tool wrapper. What failed?
agentsfundamentals - 91
A provider will retire the model serving 42 million monthly requests across 17 workflows in 45 days. How do you migrate?
mlops - 92
A hosted model alias changes behavior overnight: refusal rate rises from 6% to 19% with no release notice. What do you do?
- 93
The primary provider is unavailable, but the fallback fails 16% of tool-selection tests. Do you fail over all traffic?
testing - 94
A provider cuts the usable context from 128,000 to 64,000 tokens and raises output price 35% with two weeks' notice. How do you decide the route?
tokens - 95
A middle engineer changes a prompt without the eval harness, causing JSON validity to fall from 99.8% to 94%. How do you mentor them?
promptingmentoring - 96
A researcher claims a 6-point gain, but the checkpoint cannot be reproduced and 900 GPU-hours are already spent. How do you coach them?
- 97
A junior engineer 'fixes' recurring KV-cache OOM by restarting pods every hour. How do you redirect the work?
caching - 98
Two senior engineers disagree on a $90,000 monthly overrun: one wants INT4, the other wants fewer warm replicas. How do you decide?
conflictreplication - 99
Product wants a Friday launch, but red-team jailbreak success is still 6.5% for an agent with customer-write tools. What do you recommend?
agentsllm-safety - 100
A prompt and scheduler release causes retry amplification, cache misses, and a $620,000 incident across four teams. How do you run the postmortem?
incidentscachingresilience