Generative AI interview questions

65 generative AI interview questions and answers

Questions for AI engineer, ML engineer and applied scientist interviews, grouped into 16 topics: from tokens and transformers to retrieval-augmented generation, agents, fine-tuning, evaluation and running LLM systems in production. Each one has a 30-second answer you can say out loud, a deeper explanation and the follow-ups you should expect.

65 questions with a 30-second answer, a deeper explanation and the follow-ups interviewers usually ask.

How to use these questions

Generative AI interviews tend to test four things in this order: whether you understand the fundamentals (how a model reads and generates text), whether you can build with it (prompting, retrieval, tools, agents), whether you can tell if it works (evaluation) and whether you can run it safely and affordably (cost, latency, security). The topics below follow that order, so you can work through them from the top.

For each question:

  1. Read the question and try to answer it aloud before looking at anything.
  2. Compare with the 30-second answer. That is the version to give when an interviewer wants a quick, clear reply.
  3. Read the full answer for the reasoning and trade-offs behind it.
  4. Ask yourself the listed follow-ups. A good answer survives two rounds of "why?".

Questions marked Often asked come up most in interviews. If you are short on time, start with those. To rehearse under pressure, run an AI mock interview and pick the technical category, or study the same questions interactively in Tech Learn.

AI & GenAI Landscape

Models, paradigms and licensing

Q1EasyFresherOften asked

How do Symbolic AI, Machine Learning, Deep Learning and Generative AI differ?

30-second answer: Symbolic = hand-written rules. ML learns from data. DL learns representations with neural nets. GenAI synthesizes new content from learned distributions.

Symbolic AI encodes rules and logic by hand. Machine Learning learns patterns from data with engineered features. Deep Learning uses multi-layer neural nets to learn representations automatically. Generative AI is a subset that models data distributions to synthesize new text, images, audio or code rather than only classifying or scoring inputs.

Follow-up questions interviewers ask next

  • What is a foundation model?
  • When is classical ML still better than GenAI?
Q2Medium2–5 years

Discriminative vs generative models - what is the difference?

30-second answer: Discriminative models learn P(y|x) for decisions. Generative models learn the data distribution so they can sample new content.

Discriminative models learn P(y|x) to classify or regress (e.g. logistic regression, BERT for classification). Generative models learn P(x) or P(x,y) so they can sample new data (e.g. GPT next-token prediction, diffusion models). Generative models can often do discriminative tasks via prompting, but they are trained to model distributions, not just decision boundaries.

Follow-up questions interviewers ask next

  • Is a classifier ever generative?
  • Why does next-token prediction count as generative?
Q3EasyFresher

Explain tensors, weights, activation, loss, gradient descent and backpropagation.

30-second answer: Tensors hold data and params. Activations add non-linearity. Loss scores error. Backprop + gradient descent update weights to reduce that error.

Tensors are multi-dimensional arrays of activations and parameters. Weights are the learnable parameters. Activations (ReLU, GELU, sigmoid) add non-linearity. A loss measures prediction error. Gradient descent updates weights to reduce loss. Backpropagation applies the chain rule to compute gradients of the loss w.r.t. every weight efficiently.

Follow-up questions interviewers ask next

  • What is vanishing gradient?
  • Why GELU in Transformers?
Q4Medium2–5 yearsOften asked

Proprietary frontier models vs open-weights models - how do you choose?

30-second answer: APIs win on quality and speed. Open-weights win on privacy, fine-tuning and unit economics at scale. Choose from constraints, not hype.

Frontier APIs (GPT, Claude, Gemini) give strongest quality, managed infra, and safety tooling, but cost money, send data off-box, and limit customization. Open-weights (Llama, Mistral, Qwen, DeepSeek, Gemma) let you self-host, fine-tune, and control data, at the cost of ops, GPUs, and often a quality gap on hard tasks. Pick APIs for speed-to-value; open-weights for privacy, cost at scale, or deep customization.

Follow-up questions interviewers ask next

  • What does open-weights actually mean?
  • When is a small open model enough?
Q5MediumSenior

Apache 2.0 / MIT vs custom community licenses vs proprietary API terms?

30-second answer: MIT/Apache are commercially friendly. Community licenses add use restrictions. API terms cover hosted use only - you do not own the weights.

Apache 2.0 and MIT are permissive commercial-friendly open-source licenses. Some open-weights models use custom community licenses with use restrictions (e.g. acceptable-use clauses, size thresholds). Proprietary API terms govern hosted models: rate limits, data retention, prohibited uses, and no model-weight ownership. Always check license before commercial deployment or redistribution.

Follow-up questions interviewers ask next

  • Can you fine-tune and sell a Llama-based product?
  • What should legal review before shipping GenAI?

Go deeper: Open vs Closed Models · Token Pricing · Hallucinations · Transformer Architecture

Python for AI Engineering

Tooling, data I/O and async APIs

Q6EasyFresher

Which Python skills matter most for GenAI engineering?

30-second answer: Focus on clean modules, file I/O, regex parsing, and type hints/Pydantic. GenAI apps break at integration boundaries, not clever algorithms.

Solid data structures and OOP for clean modules, file I/O for prompts and datasets, regex for parsing model output, and type hints (and Pydantic) for schema-safe pipelines. Prefer readable, typed code over clever one-liners - LLM apps fail at integration boundaries more than algorithms.

Follow-up questions interviewers ask next

  • Why type hints for LLM pipelines?
  • When do you use dataclasses vs Pydantic?
Q7EasyFresher

How do you work with JSON, YAML, CSV, NumPy and Pandas in GenAI apps?

30-second answer: JSON/YAML for configs and tool schemas, Pandas/CSV for eval sets, NumPy for embeddings. Validate schemas at model boundaries.

JSON/YAML hold configs, tool schemas and structured LLM outputs. CSV and Pandas handle evaluation sets and analytics. NumPy arrays back embeddings and local vector math. Keep schemas validated on the way in and out of the model so malformed generations fail fast.

Follow-up questions interviewers ask next

  • How do you repair invalid JSON from an LLM?
  • When prefer Polars over Pandas?
Q8EasyFresherOften asked

uv, poetry, venv and .env - what is modern Python tooling for AI projects?

30-second answer: One venv per project, prefer uv or poetry for locks, put keys in .env, and never commit secrets.

Use a virtual environment per project. uv is a fast installer/resolver; poetry manages deps and lockfiles; venv is the stdlib baseline. Keep secrets and model keys in .env (never commit them) and load with python-dotenv or your platform's secret store. Pin versions so training and inference environments reproduce.

Follow-up questions interviewers ask next

  • uv vs pip - why switch?
  • How do you manage CUDA-specific wheels?
Q9Medium2–5 years

Why asyncio, aiohttp and SSE matter for LLM apps?

30-second answer: LLM calls are I/O-bound. Use asyncio for concurrency and SSE to stream tokens to the UI without blocking.

LLM calls are I/O-bound and often streamed. asyncio + aiohttp (or httpx AsyncClient) let you fire concurrent API calls without blocking. Server-Sent Events (SSE) deliver token streams; you accumulate deltas, handle disconnects, and surface partial output to the UI. Blocking sync clients under concurrency waste latency and connection budgets.

Follow-up questions interviewers ask next

  • SSE vs WebSockets for chat?
  • How do you cancel an in-flight stream?
Q10Medium2–5 years

REST APIs for LLMs: auth, rate limits, retries and SDKs?

30-second answer: Auth headers, exponential backoff on 429/5xx, prefer SDKs but know the raw REST/SSE contract for debugging.

Call providers over HTTPS with auth headers (Bearer/API key). Respect rate limits with exponential backoff and jitter on 429/5xx. Prefer official SDKs for retries, streaming helpers and typed params, but understand the raw REST/SSE contract for debugging. Never retry non-idempotent side effects blindly.

Follow-up questions interviewers ask next

  • What is idempotency for chat completions?
  • How do you budget tokens across retries?

Go deeper: Async and Await · Input Validation with Pydantic · Streaming Responses · Retries with Backoff

NLP & Transformers

Tokenization, attention and foundation model lifecycle

Q11EasyFresher

How did text representation evolve from BoW to contextual embeddings?

30-second answer: BoW/TF-IDF count words. Word2Vec is static. Contextual models give different vectors based on surrounding context.

Bag-of-Words and TF-IDF count tokens and ignore order. Word2Vec/GloVe learn static word vectors - one vector per word type. Contextual embeddings (ELMo, BERT, GPT) produce vectors that depend on surrounding tokens, so 'bank' differs in river vs finance contexts. Modern LLMs use contextual subword embeddings plus attention.

Follow-up questions interviewers ask next

  • Why did TF-IDF lose to embeddings?
  • What problem do static embeddings have?
Q12Medium2–5 yearsOften asked

Explain BPE, WordPiece and SentencePiece tokenization.

30-second answer: Subword tokenizers split rare words. BPE merges pairs, WordPiece is likelihood-based, SentencePiece handles raw text and multilingual scripts.

All three build subword vocabularies so rare words split into pieces. BPE merges frequent character pairs (GPT-style). WordPiece picks merges that maximize likelihood (BERT). SentencePiece trains on raw bytes/chars and handles languages without whitespace. Watch token-to-word ratios - some languages burn far more tokens, hurting context and cost.

Follow-up questions interviewers ask next

  • Why do some languages cost more tokens?
  • What is a tokenizer fertility ratio?
Q13HardSeniorOften asked

Walk through the Transformer: embeddings, attention, residuals and FFN.

30-second answer: Embeddings + positions → multi-head attention (Q/K/V) → residuals/norm → FFN. GPT is decoder-only; BERT encoder-only; T5 encoder-decoder.

Input tokens become embeddings plus positional encodings (sinusoidal or RoPE). Self-attention mixes information via Queries, Keys and Values with scaled dot-product; multi-head attention runs this in parallel subspaces. Residual connections and layer norm stabilize deep stacks. Feed-forward networks expand and project each position independently. Variants: encoder-only (BERT), decoder-only (GPT/Llama), encoder-decoder (T5).

Follow-up questions interviewers ask next

  • What problem does RoPE solve?
  • Why scale the dot product by sqrt(d_k)?
Q14HardSenior

What are MoE, GQA, sliding-window attention and the KV-cache?

30-second answer: MoE scales params via routing. GQA shrinks KV heads. Sliding windows limit attention span. KV-cache avoids recomputing past attention.

Mixture-of-Experts routes tokens to specialist FFNs so parameters scale without proportional FLOPs. Grouped-Query Attention shares KV heads across query heads to shrink the KV cache. Sliding-window attention limits each token to a local window for long contexts. The KV-cache stores past keys/values during decoding so you do not recompute attention over the full history every token.

Follow-up questions interviewers ask next

  • Why does KV-cache dominate decode memory?
  • MoE vs dense models for serving cost?
Q15Medium2–5 years

Describe pre-training, SFT and preference alignment (RLHF / DPO / GRPO).

30-second answer: Pre-train for language, SFT for instructions, then align with preferences via RLHF or DPO/GRPO.

Pre-training learns next-token prediction on massive corpora - general language and world knowledge. Supervised Fine-Tuning (SFT) teaches instruction following on curated prompt-response pairs. Preference alignment steers toward human-preferred answers: RLHF trains a reward model then optimizes with RL; DPO/GRPO optimize preferences more directly without a full RL loop. Production chat models usually need all three stages.

Follow-up questions interviewers ask next

  • When is SFT enough without RLHF?
  • DPO vs RLHF trade-offs?

Go deeper: Tokenization · Self-Attention · Context Windows · KV Cache

Prompt Engineering

Sampling, roles, CoT and context design

Q16EasyFresherOften asked

What do temperature, top_p, top_k, penalties and stop sequences control?

30-second answer: Temperature and top_p/top_k control randomness. Penalties cut repetition. max_tokens and stop sequences bound length and delimiters.

Temperature scales logits before sampling - higher = more random. top_p (nucleus) samples from the smallest set whose cumulative probability exceeds p. top_k limits to the k best tokens. Frequency/presence penalties reduce repetition. max_tokens caps length. Stop sequences halt generation at delimiters. For factual tasks prefer low temperature; for brainstorming raise it carefully.

Follow-up questions interviewers ask next

  • Temperature 0 vs greedy decoding?
  • Why combine temperature with top_p?
Q17EasyFresher

System/Developer vs User vs Assistant roles - how should you structure messages?

30-second answer: System = durable policy. User = task. Assistant = model output. Keep invariants in system; put task data in user turns.

System (or developer) messages set durable policy, tools and style. User turns carry the task. Assistant turns are model outputs (and can include tool calls). Put invariants in the system prompt, variable task data in the user turn, and keep few-shot examples as alternating user/assistant pairs. Do not bury critical constraints only in the latest user message.

Follow-up questions interviewers ask next

  • What belongs in system vs user?
  • How do tool-call messages fit the hierarchy?
Q18Medium2–5 years

Zero-shot, one-shot and few-shot prompting - when does each win?

30-second answer: Zero-shot = instructions only. Few-shot adds examples for format/style. Retrieve dynamic examples when tasks vary.

Zero-shot relies on instructions alone. One/few-shot add worked examples so the model matches format and reasoning style. Use dynamic example selection (retrieve similar cases) when tasks vary. Prefer few-shot for brittle formats; prefer zero-shot plus schema constraints when examples burn too much context.

Follow-up questions interviewers ask next

  • How many shots is too many?
  • What is dynamic few-shot selection?
Q19HardSeniorOften asked

Explain CoT, least-to-most, step-back, ToT and self-consistency.

30-second answer: CoT reasons step-by-step; decompose hard tasks; ToT explores branches; self-consistency votes across samples. Reasoning models spend extra inference compute.

Chain-of-Thought asks the model to reason step-by-step (including zero-shot 'think step by step'). Least-to-most / explicit decomposition break hard problems into subproblems. Step-back prompting asks a higher-level question first. Tree-of-Thoughts explores multiple reasoning branches. Self-consistency samples several CoT paths and majority-votes. Reasoning models also use inference-time compute and thinking budgets with hidden or exposed traces.

Follow-up questions interviewers ask next

  • When does CoT hurt accuracy?
  • Hidden vs exposed reasoning traces?
Q20Medium2–5 years

What is context engineering and the 'lost in the middle' problem?

30-second answer: Budget the window carefully. Critical content at the edges - models underuse the middle. Cache stable prefixes to save cost.

Context engineering budgets the window: system rules, retrieved docs, history and the user ask. Models often attend more to the start and end of long contexts ('lost in the middle'), so put critical instructions and the question at the edges and compress or rank middle content. Prompt caching reuses stable prefixes to cut latency and cost on repeated system/tool schemas.

Follow-up questions interviewers ask next

  • How do you structure a long RAG prompt?
  • What should you put in the cacheable prefix?

Go deeper: System Prompts · Few-shot Prompting · Chain of Thought · Temperature and Top-p

Structured Outputs & Tool Calling

JSON schema, tools and sandboxed code

Q21Medium2–5 yearsOften asked

How do you enforce deterministic JSON from LLMs?

30-second answer: Prefer JSON Schema / constrained decoding over prompt-only JSON. Validate client-side and retry on failure.

Use provider JSON mode or JSON Schema / constrained decoding (grammar/FSM guided generation) so every token must keep the output valid. Prefer schema-constrained decoding over 'please return JSON' prompts. Validate on the client and retry with the error when the model still drifts.

Follow-up questions interviewers ask next

  • JSON mode vs JSON Schema?
  • What is constrained decoding?
Q22EasyFresher

Pydantic vs Zod for LLM output validation?

30-second answer: Parse LLM output with Pydantic or Zod, then auto-retry with the validation error. Tight schemas prevent bad tool calls.

Pydantic (Python) and Zod (TypeScript) parse and type-check model output against a schema. On failure, feed the validation error back for an auto-retry loop. Keep schemas tight (enums, bounds) so invalid tool args fail before side effects.

from pydantic import BaseModel, ValidationError

class Ticket(BaseModel):
    priority: str
    summary: str

try:
    Ticket.model_validate_json(raw)
except ValidationError as e:
    # feed e into a retry prompt
    ...

Follow-up questions interviewers ask next

  • How many retries before failing?
  • Where should validation live in an agent loop?
Q23Medium2–5 yearsOften asked

How does function calling / tool use work?

30-second answer: Declare tool schemas, execute returned calls, send results back as tool messages. Handle errors and parallel calls cleanly.

You declare tools with JSON schemas (name, description, parameters). The model returns a structured tool call instead of (or before) a final answer. Execute the tool, return the result as a tool message, and let the model continue. Support parallel tool calls when independent, and handle execution errors with clear tool-error messages rather than crashing the loop.

Follow-up questions interviewers ask next

  • How do you prevent hallucinated tool names?
  • When should tools run in parallel?
Q24MediumSenior

Why use a code interpreter sandbox (E2B, Docker) with LLMs?

30-second answer: Sandboxed code execution improves math and analysis. Isolate with containers, limits and no secrets - treat LLM code as untrusted.

Letting the model write and run Python/SQL solves math, data analysis and plotting better than pure token prediction. Isolation (containers, network egress controls, time/memory limits) prevents prompt-injected code from harming the host. Treat the sandbox as an untrusted tool: limit secrets, validate outputs, and log every execution.

Follow-up questions interviewers ask next

  • What limits belong on a sandbox?
  • When is SQL execution safer than Python?

Go deeper: Structured Outputs · Tool Calling · Output Validation · Tool Call Accuracy

Embeddings & Vector Databases

Similarity, ANN indexes and vector stores

Q25Medium2–5 yearsOften asked

Dense vs sparse vs late-interaction embeddings?

30-second answer: Dense = semantic vectors. Sparse = keywords. ColBERT = late interaction. MRL lets you truncate dimensions cheaply.

Dense embeddings map text to fixed vectors for semantic similarity. Sparse methods (BM25, SPLADE) excel at exact keyword matching. Late-interaction models like ColBERT compare token-level vectors for finer relevance. Matryoshka Representation Learning (MRL) trains nested dimensions so you can truncate vectors for cheaper search with graceful quality loss.

Follow-up questions interviewers ask next

  • When is BM25 better than dense?
  • What is Matryoshka embedding truncation?
Q26Medium2–5 years

Cosine, dot product, Euclidean - and what are HNSW / IVF / PQ?

30-second answer: Cosine/dot for similarity; ANN indexes (HNSW, IVF, PQ) approximate nearest neighbors for speed at scale.

Cosine compares angle (normalized semantic similarity). Dot product is similar when vectors are normalized and is common in ANN engines. Euclidean measures distance. Exact search is too slow at scale, so Approximate Nearest Neighbor indexes trade a little recall for speed: HNSW (graph), IVF (inverted lists of clusters), PQ (product quantization compression).

Follow-up questions interviewers ask next

  • When prefer HNSW vs IVF?
  • How does PQ reduce memory?
Q27Medium2–5 years

What matters when choosing a vector database?

30-second answer: Pick by filtering, tenancy, hybrid search and ops. Store metadata/ACLs with vectors or you will leak or miss docs.

Evaluate metadata filtering, namespaces/tenancy, hybrid search, scaling, latency SLOs and ops burden. Chroma/FAISS suit local/dev; Qdrant, Pinecone, Weaviate and pgvector cover production with different managed vs self-host trade-offs. Always store source IDs and filters (tenant, ACL, time) alongside vectors or retrieval will leak or miss documents.

Follow-up questions interviewers ask next

  • pgvector vs dedicated vector DB?
  • How do you enforce tenant isolation?

Go deeper: Embeddings · Cosine Similarity · Vector Databases · HNSW Indexes

RAG Architectures

Ingestion, chunking, retrieval and advanced patterns

Q28Medium2–5 yearsOften asked

How do you ingest complex PDFs, DOCX and HTML for RAG?

30-second answer: Parse for layout and tables, keep structure, drop boilerplate. Bad parsing beats any embedding upgrade as a failure mode.

Use parsers that preserve layout, tables and reading order (Unstructured, Docling, LlamaParse, Marker). Extract clean text plus structure; keep table markdown or HTML when numbers matter. Drop boilerplate nav/headers. Bad parsing is the #1 silent RAG failure - garbage chunks cannot be rescued by a better embedding model.

Follow-up questions interviewers ask next

  • How do you handle scanned PDFs?
  • When keep tables as markdown vs images?
Q29Medium2–5 years

Compare chunking strategies for RAG.

30-second answer: Prefer structure-aware or semantic chunking over naive fixed splits. Contextual retrieval prepends summaries for better embeddings.

Fixed-size with overlap is simple but splits mid-thought. Recursive character / markdown-aware splitters respect structure. Semantic chunking groups by meaning. Contextual retrieval prepends a short document summary to each chunk so embeddings carry global context. Match chunk size to the embedding model's sweet spot and your citation UX.

Follow-up questions interviewers ask next

  • How much overlap is enough?
  • What is contextual retrieval?
Q30Medium2–5 years

Query transformation: multi-query, rewrite, step-back and HyDE?

30-second answer: Expand, rewrite or step back when user wording mismatches docs. HyDE embeds a hypothetical answer to improve recall.

Multi-query expands one ask into several search queries. Rewriting clarifies ambiguous user text. Step-back asks a broader question for better recall. HyDE generates a hypothetical answer document and embeds that for retrieval. Use transformations when raw user queries mismatch document wording.

Follow-up questions interviewers ask next

  • When does HyDE hurt?
  • Multi-query vs HyDE?
Q31Medium2–5 yearsOften asked

Hybrid search and reranking - why both?

30-second answer: Hybrid = dense + BM25. Rerank the shortlist with a cross-encoder before building the prompt context.

Hybrid search blends dense vectors with BM25 keywords (often via Reciprocal Rank Fusion) so you catch semantic and exact matches. Cross-encoder rerankers (Cohere Rerank, BGE) score query-document pairs more accurately on a shortlist. Retrieve broadly, then rerank for precision before stuffing the context window.

Follow-up questions interviewers ask next

  • What is Reciprocal Rank Fusion?
  • Rerank top-k of what size?
Q32HardSenior

Explain Parent-Document, Self-RAG, CRAG, GraphRAG and multimodal RAG.

30-second answer: Small-to-big retrieval, graded Self/CRAG loops, knowledge graphs, and vision embeddings each fix different RAG failure modes.

Parent-Document retrieves small chunks but returns larger parents for context. Self-RAG / Corrective RAG grade relevance and may rewrite or fall back to web search. GraphRAG extracts entities/relations (Neo4j/NetworkX) and combines graph traversal with vectors. Multimodal RAG retrieves images/slides/tables via vision embeddings (e.g. ColPali). Pick patterns based on failure modes you observe in evals.

Follow-up questions interviewers ask next

  • When is GraphRAG worth the cost?
  • What does relevance grading check?

Go deeper: Chunking Strategies · Hybrid Search · Reranking · Query Rewriting

Orchestration & Memory

Frameworks, short/long-term memory and workflows

Q33Medium2–5 yearsOften asked

When should you use raw SDKs vs LangChain, LlamaIndex, PydanticAI or the Vercel AI SDK?

30-second answer: Start with raw SDKs. Add a framework when you keep rebuilding orchestration. Match stack to language and UI needs.

Raw SDKs maximize control and debuggability for simple call → tool → respond loops. LangChain/LlamaIndex accelerate RAG and agent graphs but can hide complexity. PydanticAI emphasizes typed, schema-first Python agents. Vercel AI SDK shines for streaming UIs in TypeScript. Start thin; adopt a framework when you repeatedly rebuild the same orchestration primitives.

Follow-up questions interviewers ask next

  • What is the risk of heavy frameworks?
  • LlamaIndex vs LangChain for RAG?
Q34Medium2–5 years

Short-term vs long-term memory for LLM apps?

30-second answer: Short-term fits the window (trim/summary). Long-term stores durable user facts carefully - noisy memory causes lasting errors.

Short-term memory is the conversation: sliding window, token trimming, or a rolling summary that fits the context limit. Long-term memory persists across sessions - episodic events, semantic user profiles, or stores like Mem0/Zep. Write only high-signal facts; bad memory compounds hallucinations.

Follow-up questions interviewers ask next

  • Sliding window vs summary memory?
  • What should never be written to long-term memory?
Q35EasyFresher

Where do n8n, Make or Dify fit in GenAI systems?

30-second answer: Low-code tools are great for SaaS automations and prototypes. Keep core product agents in code for reliability.

No/low-code tools connect LLMs to SaaS apps quickly for internal automations. They are great for ops workflows and prototypes, weaker for complex agent state, eval gates and custom UX. Use them at the edges; keep core product orchestration in code when reliability and testability matter.

Follow-up questions interviewers ask next

  • When promote an n8n flow into code?
  • Dify vs custom RAG service?

Go deeper: LangGraph · Short-term Memory · Long-term Memory · State and Checkpoints

Agents & Multi-Agent Systems

ReAct, LangGraph, MCP and HITL

Q36Medium2–5 yearsOften asked

Explain ReAct, Plan-and-Execute, Reflection and LATS.

30-second answer: ReAct loops reason+act; plan-and-execute separates planning; reflection revises; LATS searches action trees. Start simple.

ReAct interleaves reasoning with tool actions in a loop. Plan-and-Execute drafts a plan then runs steps. Reflection/self-critique reviews outputs and revises. LATS (Language Agent Tree Search) searches over action trees. Prefer the simplest loop that meets reliability needs - agents fail when tools, state and stop conditions are vague.

Follow-up questions interviewers ask next

  • When does ReAct thrash?
  • Plan-and-Execute vs ReAct?
Q37MediumSenior

What does LangGraph-style stateful orchestration buy you?

30-second answer: Graphs give cycles, durable state, checkpoints and HITL pauses. Use them for stateful agents, not one-shot calls.

Graph runtimes model cyclic workflows with explicit state, conditional edges, persistence and checkpointing. You can pause for human approval, resume after failures, and time-travel debug. Use them when agents need durable state machines - not for a single LLM call.

Follow-up questions interviewers ask next

  • What should live in graph state?
  • How do checkpoints help retries?
Q38Medium2–5 years

Multi-agent patterns: supervisor, hierarchy, handoffs and debate?

30-second answer: Routers, hierarchies, handoffs and debate specialize work. Multi-agent helps quality but costs latency and complexity.

A supervisor/router delegates to specialists. Hierarchies nest teams. Sequential handoffs pass work down a pipeline. Debate/consensus has agents critique each other. Frameworks like CrewAI, AutoGen and the OpenAI Agents SDK implement these patterns. Multi-agent helps specialization and review - but adds latency, cost and failure surfaces.

Follow-up questions interviewers ask next

  • When is one agent with tools enough?
  • How do you prevent agent ping-pong?
Q39Medium2–5 yearsOften asked

What is the Model Context Protocol (MCP)?

30-second answer: MCP is a standard client/server protocol for tools and resources - reusable integrations across agents and IDEs.

MCP standardizes how hosts (clients) connect to servers that expose tools, resources and prompts. You build MCP servers for internal APIs/docs and plug them into compatible agents/IDEs instead of one-off tool adapters. Think of it as USB-C for tool/context integrations.

Follow-up questions interviewers ask next

  • MCP tools vs resources?
  • When build a custom MCP server?
Q40MediumSenior

Human-in-the-loop and agentic coding workflows?

30-second answer: Approve risky actions, escalate on low confidence, and configure IDE agent rules so coding agents follow your architecture.

HITL adds approval interrupts, confidence thresholds and escalation before risky actions. Time-travel debugging replays checkpoints. Agentic coding tools (Cursor, Claude Code, Windsurf) index repos and follow rules/skills - configure project rules so agents respect architecture and security constraints.

Follow-up questions interviewers ask next

  • What actions always need HITL?
  • What belongs in repo agent rules?

Go deeper: The Agent Loop · ReAct Pattern · Planning · Multi-agent Handoffs

Multimodal GenAI

Vision, image gen, audio, video and 3D

Q41EasyFresher

What can vision-language models (VLMs) do well?

30-second answer: VLMs do VQA, UI-to-code and OCR extraction. Verify critical numbers - they can hallucinate text in images.

VLMs understand images with text: visual Q&A, UI-to-code, chart reading, and structured OCR/invoice extraction. They still hallucinate text in images - verify critical fields. Prefer models with strong grounded OCR when numbers and IDs matter.

Follow-up questions interviewers ask next

  • How do you extract invoices reliably?
  • VLM vs dedicated OCR?
Q42HardSenior

Diffusion models vs DiT - how does image generation work?

30-second answer: Diffusion denoises toward images. DiT swaps UNets for transformers. ControlNet/IP-Adapter/LoRA steer structure and style.

Diffusion models learn to denoise (DDPM, latent diffusion, flow matching). UNet backbones dominated early Stable Diffusion; Diffusion Transformers (DiT) replace UNets with transformers (Flux-style systems). Controllability comes from ControlNet (canny/depth/pose), IP-Adapter, in/outpainting and style LoRAs.

Follow-up questions interviewers ask next

  • What is latent diffusion?
  • ControlNet vs IP-Adapter?
Q43Medium2–5 years

Audio and speech GenAI building blocks?

30-second answer: STT transcribes, TTS speaks, cloning needs consent. Real-time agents stream STT→LLM→TTS over WebRTC with barge-in.

Speech-to-text (Whisper-class models) transcribes. Expressive TTS synthesizes speech; voice cloning copies a speaker with consent/legal constraints. Real-time voice agents use low-latency STT → LLM → TTS pipelines, often over WebRTC, with interruption handling and endpointing.

Follow-up questions interviewers ask next

  • What dominates voice-agent latency?
  • How do you handle interruptions?
Q44Medium2–5 years

What are the basics of video and 3D generation?

30-second answer: Video needs temporal consistency; 3D generation is emerging. Expect higher cost and check flicker/identity drift.

Video models need temporal consistency across frames for text-to-video and image-to-video. 3D asset generation is emerging for meshes/scenes from text or images. Expect higher cost/latency than still images and evaluate flicker, identity drift and physics plausibility.

Follow-up questions interviewers ask next

  • Image-to-video vs text-to-video?
  • What fails first in generated video?

Go deeper: Multimodal Inputs · Document Parsing

Fine-Tuning & Post-Training

PEFT, datasets and alignment

Q45Medium2–5 yearsOften asked

Prompting vs RAG vs fine-tuning vs continued pre-training - how do you choose?

30-second answer: Prompt for behavior, RAG for knowledge, fine-tune for stable style/format, continued pre-train for domain language. Prefer the lightest fix.

Prompting is cheapest for behavior tweaks. RAG supplies changing or private knowledge without weight updates. Fine-tuning teaches style, format, tool patterns or domain language when examples are stable. Continued pre-training adapts to a domain corpus before SFT. Prefer the lightest option that hits quality - fine-tuning is not a substitute for retrieval of fresh facts.

Follow-up questions interviewers ask next

  • Can fine-tuning replace RAG?
  • When is continued pre-training worth it?
Q46Medium2–5 years

What does good fine-tuning dataset engineering look like?

30-second answer: Clean, dedupe, format consistently. Synthetic teacher data helps if filtered. Prefer fewer clean examples over noisy volume.

Curate, clean, dedupe and convert to ChatML/Alpaca-style formats. Cover edge cases and refusal behavior. Synthetic data from a teacher model (distillation) scales volume but needs filtering for errors and license compliance. Quality beats quantity - a few thousand clean examples often outperform noisy millions.

Follow-up questions interviewers ask next

  • How do you detect duplicate near-copies?
  • Risks of synthetic data?
Q47MediumSeniorOften asked

Explain LoRA, QLoRA and DoRA.

30-second answer: LoRA trains small adapters; QLoRA adds 4-bit base weights; DoRA improves adaptation. Choose targets/rank via evals.

LoRA freezes base weights and trains low-rank adapters on chosen modules (often attention projections). QLoRA loads the base in 4-bit and trains LoRA adapters to cut VRAM. DoRA decomposes weights into magnitude and direction for stronger adaptation. Pick target modules and rank based on evals, not defaults alone.

Follow-up questions interviewers ask next

  • Which modules should LoRA target?
  • LoRA rank too high - what happens?
Q48HardSenior

DPO, ORPO and RLVR/GRPO for alignment?

30-second answer: DPO/ORPO learn from preferences. GRPO/RLVR reinforce when you have automatic verifiers like tests or math checkers.

DPO optimizes directly on preferred vs rejected responses without a separate RL loop. ORPO combines odds-ratio preference with SFT-style training. RLVR/GRPO use verifiable rewards (unit tests, math checkers) to reinforce reasoning. Use preference methods for style/safety; verifiable RL when you have automatic graders.

Follow-up questions interviewers ask next

  • DPO vs RLHF?
  • What makes a good verifiable reward?
Q49Easy2–5 years

Which training tools are common for LLM fine-tuning?

30-second answer: HF transformers/PEFT/TRL are the baseline; Unsloth/Axolotl speed iteration; rent GPUs as needed and track reproducibility.

Hugging Face transformers + PEFT + TRL cover standard SFT/DPO loops. Unsloth and Axolotl speed up and simplify configs. GPU clouds (RunPod, Lambda, Modal) provide burst capacity. Track datasets, hyperparams and eval harness versions so runs are reproducible.

Follow-up questions interviewers ask next

  • When use Unsloth?
  • How do you reproduce a fine-tune?

Go deeper: Fine-tuning with LoRA · QLoRA · Distillation · RAG vs Fine-tuning

Quantization & Inference Optimization

Compression, serving engines and on-device

Q50Medium2–5 yearsOften asked

PTQ vs QAT and common quantization formats?

30-second answer: PTQ quantizes after training; QAT trains aware of low precision. GGUF/AWQ/GPTQ/EXL2 are common packaging formats.

Post-Training Quantization compresses a trained model (FP16/BF16 → INT8/INT4) without full retraining. Quantization-Aware Training simulates low precision during training for better accuracy. Formats like GGUF, AWQ, GPTQ and EXL2 package quantized weights for different runtimes. Lower bits save memory/bandwidth with some quality loss - measure on your evals.

Follow-up questions interviewers ask next

  • INT4 vs INT8 quality?
  • When is BF16 enough?
Q51HardSenior

What makes high-throughput LLM serving fast?

30-second answer: PagedAttention, continuous batching and speculative decoding drive throughput in engines like vLLM and TensorRT-LLM.

PagedAttention manages KV cache memory efficiently. Continuous batching fills GPU utilization as requests arrive. Speculative decoding uses a small draft model to propose tokens verified by the large model. Engines like vLLM, SGLang, TensorRT-LLM and TGI implement these ideas. Optimize for tokens/sec and tail latency, not just single-stream speed.

Follow-up questions interviewers ask next

  • What is continuous batching?
  • When does speculative decoding help?
Q52EasyFresher

How do you run models locally or on-device?

30-second answer: Ollama/llama.cpp/LM Studio for local desktops; MLX/WebLLM/ExecuTorch for edge. Quantize and shrink context for devices.

Ollama, llama.cpp and LM Studio make local chat easy. Mobile/browser runtimes (ExecuTorch, MLX, WebLLM) target edge constraints. Quantize aggressively, shrink context, and accept weaker models when privacy or offline is the goal.

Follow-up questions interviewers ask next

  • llama.cpp vs Ollama?
  • When is on-device preferable to API?

Go deeper: Quantization · PagedAttention · Speculative Decoding · Inference Serving with vLLM

Evaluation & Observability

Metrics, RAGAS, golden sets and tracing

Q53Medium2–5 yearsOften asked

How should you evaluate LLM outputs?

30-second answer: Mix assertions, reference metrics and LLM-as-a-Judge rubrics. Tie the suite to real product failure modes.

Combine deterministic assertions (schema, regex, unit tests) with statistical NLP metrics (BLEU, ROUGE, BERTScore) where references exist, and LLM-as-a-Judge for open-ended quality (pairwise or rubric scoring). No single metric is enough - build a small suite tied to product failures.

Follow-up questions interviewers ask next

  • When is BLEU misleading?
  • How do you calibrate an LLM judge?
Q54Medium2–5 years

What metrics matter for RAG and agents?

30-second answer: RAG: faithfulness and context precision/recall. Agents: tool-call and trajectory accuracy. Split retrieval vs generation evals.

RAG cares about faithfulness, answer relevance, context precision/recall (RAGAS, DeepEval). Agents need trajectory quality and tool-call accuracy - right tool, right args, recovery from errors. Evaluate retrieval and generation separately so you know which stage broke.

Follow-up questions interviewers ask next

  • Faithfulness vs answer relevance?
  • How do you score tool-call accuracy?
Q55MediumSenior

Golden datasets and CI evaluation gates?

30-second answer: Keep golden + adversarial sets and block merges when eval scores regress past a threshold.

Maintain a golden set of prompts with expected behaviors, plus adversarial/synthetic cases. Run them in CI on model or prompt changes and fail the build when regressions exceed a threshold. Refresh goldens as the product evolves so tests stay meaningful.

Follow-up questions interviewers ask next

  • How large should a golden set be?
  • What belongs in CI vs nightly evals?
Q56Easy2–5 years

Tracing and observability for LLM apps?

30-second answer: Trace prompts, retrieval and tools. Measure latency, tokens and cost with LangSmith/Langfuse/Phoenix/Helicone.

Use span-level traces for each prompt, retrieval, tool call and model response. Track latency breakdowns, token usage and cost attribution with LangSmith, Langfuse, Arize Phoenix or Helicone. Observability is how you debug flaky agents and control spend.

Follow-up questions interviewers ask next

  • What spans should you always record?
  • How do you attribute cost per feature?

Go deeper: LLM as a Judge · Golden Datasets · Tracing · Regression Evals in CI

Production LLMOps

Backends, cloud platforms and cost control

Q57Medium2–5 years

What does a solid GenAI application backend look like?

30-second answer: Async FastAPI + queues for heavy work + Docker. Separate streaming request path from long-running workers.

Use an async API (FastAPI) for streaming responses, task queues (Celery/Redis) for long jobs, and Docker for reproducible deploys. Separate the request path from heavy retrieval/fine-tune workers. Design for cancellation, timeouts and idempotent side effects.

Follow-up questions interviewers ask next

  • When put LLM calls on a queue?
  • How do you stream from FastAPI?
Q58Easy2–5 years

AWS Bedrock, Vertex AI and Azure AI Foundry - when use them?

30-second answer: Managed cloud platforms help with IAM/compliance. Abstract providers so you can route across Bedrock, Vertex, Azure or APIs.

Cloud GenAI platforms give managed model access, networking, IAM and compliance integrations inside your cloud. Use them when enterprise controls matter; use frontier APIs or self-host when you need models or pricing those platforms lack. Abstract the provider behind an interface so you can route later.

Follow-up questions interviewers ask next

  • Bedrock vs direct OpenAI?
  • What should a model router abstract?
Q59MediumSeniorOften asked

How do you cut latency and cost in production?

30-second answer: Cache similar prompts, compress context, route easy work to small models, and use Batch APIs for offline jobs.

Semantic caching (Redis/GPTCache) reuses answers for similar prompts. Prompt compression shrinks context. Cascading/model routing sends easy queries to small/cheap models and hard ones to frontier models. Batch APIs discount offline workloads. Measure cost per successful task, not only per token.

Follow-up questions interviewers ask next

  • When is semantic cache unsafe?
  • How do you define routing features?

Go deeper: Model Routing · Model Fallbacks · Cost Optimization · Canary Releases

AI Security & Governance

OWASP LLM Top 10, guardrails and compliance

Q60Medium2–5 yearsOften asked

What are key OWASP Top 10 risks for LLMs?

30-second answer: Watch prompt injection, jailbreaks, prompt leakage, unsafe output execution and data poisoning. Treat model output as untrusted.

Direct/indirect prompt injection, jailbreaks, system prompt leakage, insecure output handling (executing model output unsafely), and training data poisoning are headline risks. Treat model output as untrusted, isolate tools, and never let retrieved content silently override system policy.

Follow-up questions interviewers ask next

  • What is indirect prompt injection?
  • How do you harden tool use?
Q61Medium2–5 years

Guardrails and moderation patterns?

30-second answer: Filter inputs/outputs for topic, toxicity and PII. Combine rails, least-privilege tools and HITL for high risk.

Apply input/output rails: topic boundaries, toxicity filters, PII detection/redaction (Presidio) and policy models (Llama Guard, NeMo Guardrails, Guardrails AI). Defense in depth - filters plus least-privilege tools plus human review for high risk.

Follow-up questions interviewers ask next

  • Where do rails run in the stack?
  • Llama Guard vs regex filters?
Q62MediumSenior

Governance, ethics and compliance for GenAI?

30-second answer: Address bias, hallucinations, IP and privacy. Map systems to EU AI Act / NIST RMF and document oversight.

Audit for bias, mitigate hallucinations for high-stakes answers, respect copyright/IP on training and outputs, and follow privacy laws (GDPR, DPDP Act) plus frameworks like the EU AI Act and NIST AI RMF. Document model purpose, data sources and human oversight for regulated use cases.

Follow-up questions interviewers ask next

  • What is high-risk under the EU AI Act?
  • How do you reduce hallucination risk in production?

Go deeper: Prompt Injection · OWASP Top 10 for LLMs · PII Redaction · Red Teaming

Capstone: Full-Stack GenAI

End-to-end hybrid RAG + agents in production

Q63Medium2–5 yearsOften asked

What components belong in a full-stack GenAI system?

30-second answer: Hybrid RAG + agents + streaming UI + evals + guardrails + containerized deploy. Each layer fixes a different failure mode.

A production GenAI product typically combines hybrid RAG, multi-agent tool orchestration, streaming UI, automated evals, guardrails and containerized cloud deployment. Each piece addresses a failure mode: knowledge freshness, action-taking, UX latency, quality regressions, safety and operability.

Follow-up questions interviewers ask next

  • What do you build first in an MVP?
  • How do you stage a portfolio demo?
Q64HardSenior

How would you architecture a portfolio-ready GenAI capstone?

30-second answer: Narrow problem, real corpus RAG, few tools, streaming, evals, rails, Docker deploy - and document trade-offs. Depth beats buzzword breadth.

Start with a narrow user problem, add retrieval over a real corpus, one or two high-value tools, streaming chat, tracing, a golden eval set and basic rails. Deploy with Docker to a cloud target and document trade-offs (model choice, chunking, routing). Depth on one vertical beats a shallow demo of every buzzword.

Follow-up questions interviewers ask next

  • What metrics belong in the README?
  • How do you show agent reliability to interviewers?
Q65Medium2–5 years

How do the five GenAI tiers fit together in one product?

30-second answer: Foundations → control (prompts/tools) → knowledge (RAG) → orchestration (agents) → production (FT, evals, ops, security).

Foundations and transformers explain model behavior. Prompting and tools control the model. RAG supplies knowledge. Agents orchestrate multi-step work and multimodal I/O. Fine-tuning, inference optimization, evals, LLMOps and security make it reliable and shippable. Interviewers look for whether you can connect these layers, not memorize tool names.

Follow-up questions interviewers ask next

  • Where do most production systems underinvest?
  • What layer fails first without evals?

Go deeper: Multi-tenant Design · Cost per Request · Time to First Token · P95 Latency

How to prepare for a generative AI interview

A reasonable order for two to three weeks of preparation, an hour or two a day:

  1. Days 1 to 3: fundamentals. Tokenisation, attention, context windows and sampling parameters. You should be able to explain why a long prompt costs more and why temperature changes output.
  2. Days 4 to 8: building blocks. Prompt design, structured outputs, tool calling, embeddings and retrieval. Build one small retrieval pipeline yourself; the questions about chunking and reranking become easy once you have seen them fail.
  3. Days 9 to 12: agents and orchestration. The agent loop, planning, memory and when not to use an agent at all.
  4. Days 13 to 16: quality and operations. Evaluation sets, judge models, tracing, cost and latency budgets, caching and rollouts.
  5. Days 17 to 21: security and mock interviews. Prompt injection, data leakage and least-privilege tools, then two or three full mock interviews.

Interviewers for these roles care more about trade-offs than definitions. When you answer, name the alternative you rejected and why: "I would use hybrid search because..." is a stronger answer than describing hybrid search. The AI engineering lessons cover each topic in depth, with worked numbers and diagrams.