Skip to content

LLM Engineer interview questions

100 real questions with model answers and explanations for Middle candidates.

See a LLM Engineer resume example

Practice with flashcards

Spaced repetition · Hunter Pass

Questions

ragqueriesarchitecture

Ingestion prepares a searchable knowledge representation, while query-time components retrieve and assemble evidence for one request.

  • Ingestion parses sources, normalizes metadata, chunks content, creates embeddings, and updates indexes with stable document identities.
  • Query-time work transforms the question, applies access filters, retrieves and reranks candidates, then packs context for generation.
  • Versioning the source, chunker, and embedding model makes index contents reproducible and supports controlled reindexing.

Why interviewers ask this: The interviewer checks whether the candidate understands RAG as two coordinated pipelines with different lifecycles.

chunking

Fixed-size chunking follows token or character counts, while structure-aware chunking preserves document units such as headings, paragraphs, tables, or code blocks.

  • Fixed windows are simple and predictable but may cut a semantic unit at an arbitrary point.
  • Structure-aware chunks often improve interpretability and citation quality when the source has meaningful boundaries.
  • Both approaches still need size limits because one section can exceed the embedding or generation budget.

Why interviewers ask this: A strong answer compares operational simplicity with preservation of document meaning.

chunking

Semantic chunking places boundaries where the topic or meaning changes rather than at only fixed lengths.

  • It may compare adjacent sentence embeddings or use a model to identify coherent sections.
  • Better coherence can improve retrieval, but the method costs more and may produce uneven chunk sizes.
  • Thresholds and resulting chunks must be evaluated on domain questions instead of assumed superior to simpler splitting.

Why interviewers ask this: The interviewer evaluates whether the candidate understands both the goal and added variability of semantic chunking.

ragretrieval

Parent-child retrieval indexes small child chunks for precise matching but returns a larger parent section for generation context.

  • Small children improve the chance that a focused query matches the relevant passage.
  • The parent restores surrounding definitions and references that a tiny chunk may omit.
  • Parent identifiers and offsets must remain stable so retrieved children map to the correct source section.

Why interviewers ask this: A strong answer explains how retrieval granularity can differ from context granularity.

retrieval

Multi-vector retrieval stores several representations for one source item so different aspects of it can match a query.

  • Vectors may represent the original text, summaries, headings, extracted questions, or separate fields.
  • Any matching representation can retrieve the same source, improving recall for varied query phrasing.
  • More vectors increase index size and duplicate matches, so results need grouping and source-level scoring.

Why interviewers ask this: The interviewer checks whether the candidate understands richer representations and their indexing cost.

rag

Overlap should preserve information crossing chunk boundaries without filling the index and prompt with near-duplicates.

  • Narrative prose may need sentence-level continuity, while code and tables need boundaries based on their own structure.
  • Excess overlap inflates storage, biases ranking toward repeated text, and wastes context tokens.
  • The setting should be selected with retrieval and answer evaluations across representative document types.

Why interviewers ask this: A strong answer treats overlap as a domain-dependent parameter with measurable redundancy costs.

ragretrievalsystem-design

Dense retrieval embeds queries and passages into a compatible vector space and ranks passages by vector similarity.

  • Dual-encoder models compute query and passage vectors separately, enabling document embeddings to be indexed in advance.
  • Dense retrieval captures semantic similarity and paraphrases but may miss exact identifiers or rare terms.
  • Retrieval quality depends on the embedding model, input formatting, corpus, metric, and index configuration.

Why interviewers ask this: The interviewer evaluates whether the candidate understands both the efficiency and limits of dual-encoder retrieval.

nlpretrievalembeddings

Sparse retrieval remains strong when exact lexical evidence is more informative than semantic similarity.

  • It handles product codes, names, error strings, legal phrases, and rare domain terms well.
  • BM25 weights term frequency and rarity without requiring an embedding model or vector index.
  • Its misses on paraphrases complement dense retrieval, which is why the two are often combined.

Why interviewers ask this: A strong answer explains the lexical signal instead of treating sparse search as obsolete.

Hybrid search retrieves from both systems and fuses their rankings or calibrated scores into one candidate list.

  • Reciprocal Rank Fusion combines rank positions without assuming BM25 and vector scores share a scale.
  • Weighted score fusion requires normalization and validation because raw scores have different meanings.
  • Fusion weights and candidate depths should be tuned against relevance labels for the target query distribution.

Why interviewers ask this: The interviewer checks whether the candidate understands rank fusion and the danger of adding incomparable scores directly.

retrievalci-cd

Metadata filtering should restrict candidates as early as the retrieval system can enforce required access and domain constraints correctly.

  • Pre-filtering avoids retrieving unauthorized tenants, languages, dates, or document classes.
  • Post-filtering can leave too few results because forbidden candidates already occupied the nearest-neighbor slots.
  • Filter selectivity and index support affect recall and latency, so the chosen vector store behavior must be verified.

Why interviewers ask this: A strong answer connects filter placement to security, recall, and index execution.

reranking

A cross-encoder scores a query and candidate together, allowing token-level interaction that separate embeddings cannot model.

  • It is usually more accurate for fine relevance distinctions than a dual encoder.
  • Joint encoding is too expensive for the full corpus, so it reranks a limited first-stage candidate set.
  • The first retriever must still have high recall because a reranker cannot recover a missing document.

Why interviewers ask this: The interviewer evaluates whether the candidate understands the recall-first and precision-second retrieval design.

nlpretrievalembeddings

Late-interaction models keep multiple token-level vectors and compare them at query time instead of compressing all meaning into one vector.

  • This preserves finer-grained matching signals for terms and passages.
  • It can offer a quality and cost point between dual encoders and full cross-encoders.
  • The trade-off is larger indexes and more expensive scoring than single-vector retrieval.

Why interviewers ask this: A strong answer identifies the representation and cost difference without requiring implementation trivia.

ragqueries

Query rewriting converts the user's input into a clearer retrieval query while preserving the original information need.

  • It can resolve conversational references, expand abbreviations, normalize terminology, or remove irrelevant phrasing.
  • The original question should remain available for generation because a rewrite may lose intent or constraints.
  • Rewrite quality needs evaluation since a fluent but incorrect rewrite can make every later stage fail.

Why interviewers ask this: The interviewer checks whether transformation is treated as a fallible retrieval aid rather than a replacement for user intent.

retrievalqueries

Multi-query retrieval generates several alternative searches for one information need and merges their candidates.

  • Variants can cover synonyms, different aspects, or lexical and semantic formulations.
  • The method can raise recall when one query formulation misses relevant evidence.
  • It adds model and retrieval cost and may introduce topic drift, so deduplication and evaluation are required.

Why interviewers ask this: A strong answer explains recall improvement together with cost and drift.

retrieval

HyDE asks a model to generate a hypothetical relevant document and uses its embedding to retrieve real documents.

  • The hypothetical text can resemble the language and detail of an answer more closely than a short question.
  • Retrieval uses the generated representation, not the hypothetical claims as factual evidence.
  • HyDE can help difficult queries but can also steer retrieval toward a model's unsupported assumptions.

Why interviewers ask this: The interviewer evaluates whether the candidate understands both the embedding trick and its hallucination risk.

ragqueries

Query decomposition is useful when one question contains several facts or reasoning steps that require different evidence.

  • Each subquery retrieves a focused set of passages instead of forcing one embedding to represent the whole request.
  • Results must be joined under the original question so relationships and constraints are not lost.
  • Unnecessary decomposition increases latency and can compound errors across generated subquestions.

Why interviewers ask this: A strong answer chooses decomposition for multi-part information needs and recognizes error propagation.

retrievalci-cd

Contextual compression extracts or selects the parts of retrieved content most relevant to the current query before generation.

  • It reduces token use and distraction when source chunks contain substantial irrelevant material.
  • Compression may use rules, sentence selection, or another model.
  • The compressor can remove qualifiers or evidence, so faithfulness must be evaluated against the original source.

Why interviewers ask this: The interviewer checks whether the candidate sees compression as a lossy stage with its own quality risk.

nlpretrievalembeddings

Retrieval embeddings are commonly trained with contrastive objectives that pull relevant pairs together and push irrelevant pairs apart.

  • Positive pairs may be query-document, title-passage, duplicate, or semantically equivalent examples.
  • Hard negatives teach the model to separate plausible but wrong candidates from true matches.
  • The training pair distribution determines which notion of similarity the model learns.

Why interviewers ask this: A strong answer connects the objective and negative sampling to the resulting retrieval behavior.

nlpembeddingsqueries

Asymmetric embedding models use different instructions, prefixes, or encoders because queries and documents play different retrieval roles.

  • A query is often short and expresses an information need, while a passage contains the answer in a different style.
  • Correct prefixes align both inputs with the training objective and shared vector space.
  • Using the document format for queries can reduce quality even when vector dimensions still match.

Why interviewers ask this: The interviewer evaluates whether the candidate follows model-specific encoding contracts.

normalizationmonitoring

Normalization changes vector magnitude and determines when cosine similarity, dot product, or Euclidean distance produce equivalent rankings.

  • For unit-normalized vectors, cosine similarity equals dot product, and Euclidean distance is monotonically related.
  • Without normalization, dot product also reflects vector magnitude.
  • The index metric must match the embedding model's recommendation and the way vectors were stored.

Why interviewers ask this: A strong answer understands that metric choice and preprocessing form one compatibility decision.

Locked questions

  • 21

    What matters when choosing a multilingual embedding model?

    nlpembeddings
  • 22

    How should embedding models be compared for a domain corpus?

    nlpembeddings
  • 23

    How does an HNSW vector index trade accuracy for speed and memory?

    indexesmemory
  • 24

    When is exact search in pgvector preferable to an approximate index?

    indexes
  • 25

    How should retrieved chunks be packed into an LLM context?

    llm
  • 26

    What is the lost-in-the-middle effect?

  • 27

    How should a token budget be divided in a multi-step LLM workflow?

    tokensllm
  • 28

    What are the trade-offs of summarizing conversation history?

  • 29

    When is retrieval preferable to placing an entire corpus in a long context window?

    retrievalcontext
  • 30

    How does speculative decoding accelerate generation?

    decoding
  • 31

    How should prompt optimization be evaluated?

    promptingoptimizationdecision-making
  • 32

    How should few-shot examples be selected for a prompt?

    prompting
  • 33

    How should instruction hierarchy and untrusted context be represented in a prompt?

    prompting
  • 34

    When is constrained decoding preferable to asking for JSON in a prompt?

    promptingdecoding
  • 35

    How should a schema for structured LLM output be designed?

    llmschemadesign
  • 36

    How do grammar-based and JSON Schema constrained decoding differ?

    decodingschema
  • 37

    What should happen after a structured LLM response fails validation?

    llmvalidation
  • 38

    What is function or tool calling in an LLM?

    llm
  • 39

    What makes a good tool definition for an LLM?

    llm
  • 40

    What are the main stages of a tool-using agent loop?

    agents
  • 41

    When is a deterministic workflow preferable to an LLM agent?

    agentsllm
  • 42

    What is supervised fine-tuning for an instruction model?

    supervisedfine-tuning
  • 43

    How does LoRA provide parameter-efficient fine-tuning?

    fine-tuning
  • 44

    How does QLoRA differ from ordinary LoRA?

    fine-tuning
  • 45

    What role do Axolotl, Unsloth, LLaMA-Factory, and TRL play in fine-tuning?

    fine-tuning
  • 46

    What are the main stages of RLHF?

    alignment
  • 47

    How does DPO differ from reward-model-based RLHF?

    alignment
  • 48

    How do FP16, FP8, INT4, and AWQ affect model inference?

    inference
  • 49

    What does RAGAS evaluate in a RAG system?

    ragsystem-designdecision-making
  • 50

    How should LLM-as-judge evaluation be made trustworthy?

    llmllm-eval
  • 51

    A RAG assistant gives poor answers. How would you determine whether retrieval or generation is failing?

    ragretrieval
  • 52

    Relevant documents rarely appear in the top retrieval results. How would you improve recall?

    retrieval
  • 53

    Retrieval returns many related but unusable chunks. How would you improve precision?

    retrieval
  • 54

    How would you diagnose whether RAG chunking is causing answer failures?

    ragchunking
  • 55

    A tenant occasionally sees another tenant's RAG sources. How would you fix the retrieval design?

    ragretrievaldesign
  • 56

    Search quality dropped after changing the embedding model. How would you diagnose the migration?

    nlpembeddingsmigrations
  • 57

    How would you tune hybrid lexical and vector retrieval?

    retrieval
  • 58

    How would you decide whether a reranker is worth adding to production RAG?

    ragreranking
  • 59

    How would you tune a pgvector approximate index without hiding recall loss?

    indexes
  • 60

    How would you improve retrieval for user queries that use vocabulary absent from the documents?

    retrievalqueries
  • 61

    How would you build retrieval for questions that require evidence from multiple documents?

    retrieval
  • 62

    How would you assemble retrieved chunks into context when the token budget is tight?

    tokens
  • 63

    Generated citations often point to irrelevant passages. How would you fix them?

    citations
  • 64

    A grounded prompt still produces hallucinations. How would you investigate?

    hallucinationgroundednessprompting
  • 65

    How would you enforce grounded answers without blocking useful responses too often?

    groundedness
  • 66

    How would you repair a RAG corpus that serves stale or duplicate content?

    rag
  • 67

    How would you design an automated eval pipeline for an LLM application?

    llmdesignci-cd
  • 68

    How would you turn production traces into an evaluation dataset safely?

    llm-eval
  • 69

    How would you use Braintrust or Inspect AI for a team eval suite?

  • 70

    How would you calibrate an LLM-as-judge scorer?

    llm
  • 71

    How would you detect and reduce position bias in an LLM judge?

    llm
  • 72

    How would you run an online experiment for a new RAG pipeline?

    ragci-cdexperiments
  • 73

    Offline eval improved, but users report worse answers. How would you investigate the disagreement?

    conflict
  • 74

    How would you decide whether an eval score change is meaningful?

  • 75

    How would you monitor quality drift in an LLM application?

    monitoringiacllm
  • 76

    How would you version prompts so a production regression is reproducible?

    reproducibilityprompting
  • 77

    A prompt change causes failures only for some users. How would you debug it?

    prompting
  • 78

    How would you design a structured-output gateway for multiple LLM providers?

    designgatewayllm
  • 79

    How would you make LLM tool execution safe and retryable?

    llmresilience
  • 80

    How would you implement layered prompt-injection guardrails?

    injectionllm-safetyguardrails
  • 81

    An LLM feature is too slow. How would you break down and reduce its latency?

    latencyplanningllm
  • 82

    How would you implement semantic caching without serving the wrong answer?

    caching
  • 83

    Where would batching help in an LLM pipeline, and what trade-offs would you measure?

    llmbatchci-cd
  • 84

    How would you build model routing to reduce cost while preserving quality?

  • 85

    How would you evaluate speculative decoding for a self-hosted model?

    decodingdecision-makingllm-eval
  • 86

    How would you choose between fp16, fp8, and INT4 or AWQ quantization?

  • 87

    How would you capacity-plan a vLLM deployment on Kubernetes?

    kubernetesdeploymentcapacity
  • 88

    A vLLM cluster has high throughput but poor tail latency. How would you improve it?

    latencythroughput
  • 89

    How would you implement per-million-token cost governance?

    tokens
  • 90

    How would you reduce context cost without lowering RAG quality?

    rag
  • 91

    How would you keep an LLM feature available during a provider outage?

    llm
  • 92

    How would you handle rate limits across multiple LLM providers?

    llmrate-limiting
  • 93

    How would you prevent duplicate side effects when an LLM workflow retries?

    llm
  • 94

    How would you handle a provider failure after part of a streamed response was shown?

  • 95

    What would you include in an LLM application monitoring dashboard?

    llmmonitoring
  • 96

    How would you define SLOs for an LLM-powered feature?

    llmslo
  • 97

    How would you implement guardrails for PII and unsafe content without excessive false positives?

    piillm-safetyguardrails
  • 98

    How would you roll out a new model or prompt version safely?

    prompting
  • 99

    How would you decide between prompt changes, RAG, SFT, and DPO for a quality problem?

    ragprompting
  • 100

    A production LLM feature's quality is declining. What recovery plan would you follow?

    llmrecovery