Home/Interview questions/LLM Engineering
Interview prep · 11 IT courses · 98 questions

9 LLM Engineering interview questions and answers

Questions that come up in technical interviews, with model answers. Try answering out loud first, then open the question to compare.

Q01What is a token, and why does tokenisation matter?TokensBasic

Models read text as subword tokens, usually produced by byte-pair encoding. Cost, context limits and latency are all counted in tokens.

Some languages, including Hindi, need more tokens per word than English, so the same message costs more. Tokenisation also explains quirks with spelling, counting letters and arithmetic.

Q02What do temperature, top-k and top-p do?SamplingBasic

Temperature scales the logits before softmax: low values make output more deterministic, high values more varied.

Top-k keeps only the k most likely tokens. Top-p keeps the smallest set of tokens whose probabilities add up to p. Use low temperature for extraction and classification, higher for creative writing.

Q03Explain self-attention.TransformerIntermediate

Each token is projected into a query, key and value. Attention scores are Q·Kᵀ divided by √dₖ, passed through softmax, and used to take a weighted sum of the values.

In decoder models a causal mask stops a token attending to later tokens. Multiple heads learn different relationships. Cost grows with the square of sequence length.

Q04What is the KV cache, and why does it matter?InferenceIntermediate

During generation, the keys and values for earlier tokens are stored so each new token only computes its own, instead of recomputing the whole sequence.

Its memory grows with layers × KV heads × head size × sequence length × batch size × 2, and it often limits batch size and context length. Grouped-query attention shrinks it by sharing keys and values across heads.

Q05When do you use prompting, RAG or fine-tuning?DesignIntermediate

Start with prompting. Use RAG when the model needs knowledge that changes, is private, or must be cited.

Fine-tune to change behaviour, format or style, or to get a smaller model to do a narrow task cheaply. Fine-tuning is a poor way to add fresh facts.

Q06How does LoRA work?Fine-tuningIntermediate

The base model's weights are frozen. For chosen layers, usually the attention projections, LoRA learns a low-rank update ΔW = B·A with rank r much smaller than the layer size.

This cuts trainable parameters and optimiser memory dramatically, and the update can be merged back into the weights for serving. QLoRA also stores the base model in 4-bit to fit larger models on one GPU.

Q07What is the difference between prefill and decode, and why is decode memory-bandwidth bound?ServingAdvanced

Prefill processes the whole prompt in parallel and is limited by compute. Decode produces one token at a time, and each step must read all the weights and the KV cache from memory, so it is limited by memory bandwidth.

Batching many requests shares each weight read across users. Track time to first token for prefill and time per output token for decode.

Q08How do you evaluate an LLM application?EvaluationAdvanced

Build an eval set from real user queries with expected answers or grading criteria. Use automatic checks where you can: exact match, schema validity, retrieval recall@k.

For open answers, use an LLM judge calibrated against human labels, and watch for its biases toward position, length and its own outputs. Run evals on every prompt or model change, and keep monitoring in production.

Q09What do scaling laws such as Chinchilla tell us?TrainingAdvanced

For a fixed compute budget, loss is lowest when parameters and training tokens grow together, roughly 20 tokens per parameter for compute-optimal training.

Many teams now deliberately train smaller models on far more tokens than that, because a smaller model is cheaper to serve.

TENSOR

These topics are taught in full in LLM Engineering, a live cohort starting soon (date to be announced) · ₹48,000.

View course

Get new batch dates first

One email when a cohort opens, plus free interview questions. No spam.

Chat on WhatsApp