Quick answer: these are the 30 Generative AI interview questions that come up most in 2026, from fresher basics (tokens, temperature, embeddings) to senior topics (hybrid search, LoRA, LLM-as-a-judge, agent safety and system design). Every question has a 30-second answer, a deeper answer, what the interviewer is really testing, and the follow-up they’ll likely ask next.
Part of our free AI Interview Prep Hub. Tick questions as you master them, and your progress shows up on the hub.
Foundations
What is Generative AI, and how is it different from traditional machine learning?
Show answer
β± 30-second answer: Traditional (discriminative) ML predicts a label or number from input, like “spam or not”. Generative AI creates new content (text, images, code, audio) that resembles its training data.
π Deeper answer: Discriminative models learn the boundary between classes, P(label | input). Generative models learn the patterns of the data itself, so they can sample new examples. LLMs like Claude, GPT and Gemini are generative models trained on huge text corpora. In practice, most GenAI apps combine both: a generative model writes, and classic ML or rules check and route.
π― What they’re testing: Whether you understand the core difference, not just buzzwords.
βͺ Likely follow-up: Give one business problem where traditional ML is a better choice than GenAI.
What is a Large Language Model (LLM), and how does it generate text?
Show answer
β± 30-second answer: An LLM is a very large neural network trained to predict the next token in a sequence. It generates text one token at a time, each time choosing the next token based on everything before it.
π Deeper answer: During pre-training the model reads massive amounts of text and learns to predict the next token, which forces it to learn grammar, facts and reasoning patterns. It is then usually instruction-tuned and preference-tuned to follow instructions and be helpful and safe. At inference, it repeatedly predicts a probability distribution over the vocabulary, samples a token, appends it, and repeats until it stops.
π― What they’re testing: The “next-token prediction” mental model and the pre-training vs fine-tuning stages.
βͺ Likely follow-up: Why can an LLM state something false so confidently?
What are tokens, and why do they matter?
Show answer
β± 30-second answer: Tokens are the chunks of text a model reads and writes, often parts of words. They matter because pricing, speed and the context limit are all measured in tokens.
π Deeper answer: A tokenizer splits text into sub-word pieces. As a rule of thumb, one English token is about 4 characters or ΒΎ of a word. Many non-English languages, including Hindi, often need more tokens for the same meaning, which raises cost and uses up the context window faster. Knowing token counts helps you estimate cost, trim prompts and choose chunk sizes in RAG.
π― What they’re testing: Practical awareness of cost and limits, which interviewers love in production roles.
βͺ Likely follow-up: How would you estimate the monthly cost of a chatbot handling 10,000 conversations a day?
Explain the transformer and self-attention in simple terms.
Show answer
β± 30-second answer: A transformer processes all tokens in parallel and uses self-attention, where each token “looks at” every other token and decides how much each one matters for understanding it.
π Deeper answer: For each token, the model creates query, key and value vectors. Attention scores come from comparing a token’s query with every key; these scores weight the values to build a context-aware representation. Multiple attention heads capture different relationships (grammar, meaning, long-range links), and stacked layers build richer understanding. Positional information tells the model word order. This parallelism is why transformers train efficiently on GPUs.
π― What they’re testing: Whether you can explain attention intuitively without drowning in maths.
βͺ Likely follow-up: Why does attention cost grow quickly with longer context?
What is a context window, and what happens when you exceed it?
Show answer
β± 30-second answer: The context window is the maximum number of tokens the model can consider at once, covering the prompt plus its answer. Beyond it, text must be cut, summarised or retrieved selectively.
π Deeper answer: Everything the model “knows” about your conversation must fit inside the window. If input is too long, the API returns an error or older content gets truncated, depending on the app. Even within large windows, models can miss details buried in the middle, so good apps send only relevant context (via RAG or summarisation) instead of stuffing everything in.
π― What they’re testing: Understanding real limits, plus strategies: chunking, summarising, retrieval.
βͺ Likely follow-up: Large context windows exist, so is RAG still needed? Why?
What do temperature and top-p control?
Show answer
β± 30-second answer: They control randomness. Low temperature gives focused, repeatable answers; higher temperature gives more varied, creative output. Top-p limits sampling to the most likely tokens whose probabilities add up to p.
π Deeper answer: Temperature rescales the probability distribution before sampling: near 0 it almost always picks the most likely token, and higher values flatten the distribution. Top-p (nucleus sampling) keeps only the smallest set of tokens covering probability p. Use low temperature for extraction, classification and code; moderate values for brainstorming and copywriting. Usually tune one, not both.
π― What they’re testing: Whether you can match settings to use cases.
βͺ Likely follow-up: Which settings would you use for a JSON-extraction pipeline, and why?
Prompting
What is the difference between zero-shot and few-shot prompting?
Show answer
β± 30-second answer: Zero-shot gives only the instruction. Few-shot also includes a few worked examples of input and desired output, so the model copies the pattern.
π Deeper answer: Few-shot examples are the fastest way to fix format and tone without fine-tuning. Choose diverse, representative examples, keep the format identical, and watch token cost. If you need hundreds of examples to get quality, that’s a signal to consider fine-tuning or better retrieval.
π― What they’re testing: Practical prompt design skill.
βͺ Likely follow-up: When would few-shot examples hurt performance?
What is chain-of-thought prompting, and what are “reasoning” models?
Show answer
β± 30-second answer: Chain-of-thought asks the model to work through intermediate steps before answering, which improves multi-step reasoning. Reasoning models are trained to do this thinking internally before they respond.
π Deeper answer: Asking for step-by-step reasoning helps on maths, logic and planning tasks. Newer models can spend extra “thinking” tokens before answering, improving accuracy at the cost of latency and tokens. In production you often hide the reasoning from end users, and you choose reasoning effort based on task difficulty and budget.
π― What they’re testing: Understanding the accuracy vs latency and cost trade-off.
βͺ Likely follow-up: How would you decide whether a task needs a reasoning model?
How do you get reliable structured output (like JSON) from an LLM?
Show answer
β± 30-second answer: Give a clear schema, use the provider’s structured-output or tool-calling features where available, keep temperature low, and always validate the output in code, with a retry on failure.
π Deeper answer: Steps: define the schema (e.g., with Pydantic or JSON Schema), show an example, request only JSON, and use native structured-output or function-calling modes that constrain output. Then parse and validate; on failure, retry with the error message included. Never trust model output blindly in downstream systems.
π― What they’re testing: Production mindset: validation, retries, schemas.
βͺ Likely follow-up: What would you do if 2% of outputs still fail validation?
What is prompt injection, and how do you defend against it?
Show answer
β± 30-second answer: Prompt injection is when untrusted text (a user message, web page or document) contains instructions that try to override your system’s rules. You defend with layered controls, not a single prompt.
π Deeper answer: Defences: treat all retrieved and user content as data, not instructions; keep secrets out of prompts; apply least privilege to tools (read-only by default, human approval for risky actions); validate outputs; use allow-lists for actions and URLs; and add detection or guardrail models. Indirect injection through retrieved documents is especially dangerous for agents.
π― What they’re testing: Security awareness, which is critical for agent and RAG roles.
βͺ Likely follow-up: An agent reads emails and can send emails. How do you stop a malicious email from making it forward data?
Embeddings & RAG
What are embeddings?
Show answer
β± 30-second answer: Embeddings are lists of numbers (vectors) that represent the meaning of text, so that similar meanings sit close together in vector space.
π Deeper answer: An embedding model converts text into a fixed-length vector. Similarity is usually measured with cosine similarity. Embeddings power semantic search, RAG retrieval, clustering, deduplication and recommendations. Choose embedding models by language support (important for Indian languages), quality on your data, dimensions and cost.
π― What they’re testing: Conceptual clarity; a must for RAG roles.
βͺ Likely follow-up: Why might keyword search beat embeddings for some queries?
What is RAG, and why is it used?
Show answer
β± 30-second answer: Retrieval-Augmented Generation first retrieves relevant information from your data, then gives it to the LLM to answer. It grounds answers in your documents, keeps them current and allows citations.
π Deeper answer: RAG solves three LLM problems: no access to private data, a training cutoff, and hallucination. It is cheaper and easier to update than fine-tuning, because you simply update the documents. Read our LLM, RAG and Agents explainer.
π― What they’re testing: Why RAG exists and when it fits.
βͺ Likely follow-up: What kinds of questions does RAG handle badly?
Walk me through a RAG pipeline end to end.
Show answer
β± 30-second answer: Ingest documents, then chunk, embed and store them in a vector index. At query time, embed the question, retrieve the top chunks, optionally re-rank, then prompt the LLM with the question plus chunks and an instruction to answer only from them, with citations.
π Deeper answer: Ingestion: parse (PDFs, HTML), clean, chunk with some overlap, add metadata (source, date, access rights), embed and index. Query: rewrite or expand the query if needed, retrieve with vector or hybrid search, filter by metadata and permissions, re-rank, build the prompt with clear instructions and an “I don’t know” rule, generate, and return the answer with sources. Monitor retrieval quality and answer faithfulness.
π― What they’re testing: Structured thinking and production details like permissions and evaluation.
βͺ Likely follow-up: Answers are wrong but the right document exists. How do you debug?
How do you choose chunk size and overlap?
Show answer
β± 30-second answer: Pick a chunk size that holds one complete idea, often a few hundred words, with a small overlap so ideas aren’t cut mid-way. Then tune it using evaluation on real questions.
π Deeper answer: Chunks that are too small lose context; chunks that are too large dilute relevance and waste tokens. Respect document structure (headings, sections, tables) instead of fixed character splits where possible. Store parent-document links so you can expand to surrounding context. Decide with an evaluation set, not guesswork.
π― What they’re testing: Pragmatism and evaluation-driven decisions.
βͺ Likely follow-up: How would you chunk a 200-page PDF full of tables?
What are hybrid search and re-ranking, and why use them?
Show answer
β± 30-second answer: Hybrid search combines keyword search (like BM25) with vector search, so you catch both exact terms and meaning. A re-ranker then reorders the retrieved results more accurately before they reach the LLM.
π Deeper answer: Vector search misses exact identifiers (error codes, product IDs, names); keyword search misses paraphrases. Hybrid merges both result lists (for example with reciprocal rank fusion). A cross-encoder re-ranker scores each queryβchunk pair jointly: slower, but much more precise, so you retrieve broadly (say 50) and re-rank to a few. This often improves RAG quality more than switching LLMs.
π― What they’re testing: Depth beyond basic RAG; expected for experienced roles.
βͺ Likely follow-up: How would you measure whether re-ranking is worth its extra latency?
RAG vs fine-tuning vs long context: when would you use each?
Show answer
β± 30-second answer: Use RAG for changing or private knowledge with citations, fine-tuning for consistent behaviour, style or format, and long context for a few documents in one-off tasks.
π Deeper answer: Knowledge problem: RAG. Behaviour problem (tone, format, domain-specific task patterns): fine-tuning. Small, static context: long context may be simplest. They combine well, for example a fine-tuned model that also uses RAG. Consider cost, freshness, latency and maintenance.
π― What they’re testing: Architectural judgement, the core of AI engineer and architect interviews.
βͺ Likely follow-up: A bank wants its bot to answer using policies updated weekly. Which approach and why?
Fine-tuning & model adaptation
What is fine-tuning, and what is parameter-efficient fine-tuning?
Show answer
β± 30-second answer: Fine-tuning continues training a pre-trained model on your examples to specialise it. Parameter-efficient fine-tuning (PEFT) trains only a small number of extra parameters, which is cheaper and faster.
π Deeper answer: Full fine-tuning updates all weights and needs lots of GPU memory. PEFT methods like LoRA freeze the base model and train small adapter matrices, cutting memory and storage, and you can swap adapters per task. Good fine-tuning needs clean, representative data and an evaluation set; it is not the right tool for adding frequently changing facts.
π― What they’re testing: Knowing when, and how cheaply, to fine-tune.
βͺ Likely follow-up: How many examples would you start with, and how would you check they helped?
Explain LoRA and QLoRA in simple words.
Show answer
β± 30-second answer: LoRA adds small trainable low-rank matrices next to frozen model weights, so you learn a tiny “patch” instead of retraining everything. QLoRA does the same on a base model loaded in 4-bit quantized form, so it fits on smaller GPUs.
π Deeper answer: A large weight update can be approximated by two small matrices multiplied together (low rank). Training only these reduces trainable parameters dramatically. QLoRA quantizes the frozen base model to 4-bit to save memory, while training LoRA adapters in higher precision. This made fine-tuning sizeable open models possible on a single GPU.
π― What they’re testing: Hands-on familiarity with modern fine-tuning.
βͺ Likely follow-up: What does the LoRA “rank” hyperparameter control?
What is RLHF, and how is DPO different?
Show answer
β± 30-second answer: RLHF trains a reward model from human preference comparisons, then optimises the LLM against it with reinforcement learning. DPO skips the separate reward model and learns directly from preference pairs, making it simpler and more stable.
π Deeper answer: RLHF (used for early chat assistants): collect “A is better than B” judgements, train a reward model, then optimise the policy (often with PPO) while staying close to the original model. DPO reformulates the objective so you train directly on chosen and rejected pairs with a simple loss. Both align models to human preferences such as helpfulness and harmlessness.
π― What they’re testing: Understanding how chat models are aligned, often asked in research-leaning roles.
βͺ Likely follow-up: What can go wrong if the reward model is imperfect?
What is quantization, and what is the trade-off?
Show answer
β± 30-second answer: Quantization stores model weights in lower precision (like 8-bit or 4-bit instead of 16-bit) to cut memory and speed up inference, at the cost of some accuracy.
π Deeper answer: Lower precision means smaller models that fit cheaper GPUs or even laptops (e.g., running open models locally). Modern methods keep quality loss small, but very aggressive quantization can hurt reasoning or rare-language performance. Always benchmark the quantized model on your own tasks.
π― What they’re testing: Deployment and cost awareness.
βͺ Likely follow-up: How would you decide between a bigger quantized model and a smaller full-precision one?
Agents & tools
What is tool calling (function calling)?
Show answer
β± 30-second answer: Tool calling lets an LLM request that your code run a function, like searching a database or calling an API, by outputting the function name and arguments in a structured format.
π Deeper answer: You describe available tools (name, description, parameter schema). The model decides whether to call one and returns arguments; your app executes it and sends the result back; the model continues. Good tool names and descriptions strongly affect accuracy. Always validate arguments and enforce permissions in your code, not in the prompt.
π― What they’re testing: Fundamental agent-building knowledge.
βͺ Likely follow-up: How do you prevent the model from calling a tool with dangerous arguments?
What is an AI agent, and how is it different from a fixed workflow?
Show answer
β± 30-second answer: A workflow follows predefined steps you coded. An agent lets the LLM decide the next step in a loop, choosing tools until the goal is met.
π Deeper answer: Workflows (chains) are predictable, cheaper and easier to test; use them when steps are known. Agents handle open-ended tasks but add cost, latency and failure modes such as loops and wrong tool choices. Many production systems are mostly workflows with agentic steps where flexibility is truly needed. Learn more in Building blocks of AI Agents.
π― What they’re testing: Judgement on when NOT to use agents, a sign of maturity.
βͺ Likely follow-up: Design a travel-booking assistant. Which parts are workflow and which are agentic?
What is MCP (Model Context Protocol)?
Show answer
β± 30-second answer: MCP is an open standard for connecting AI applications to tools and data sources. Build an MCP server once, and any MCP-compatible client (like Claude) can use its tools.
π Deeper answer: MCP standardises how clients discover and call tools, read resources and use prompt templates from servers, locally or remotely. It reduces custom integration work, the “USB-C for AI” idea. Security still matters: trust only reviewed servers, apply least privilege and require approvals for risky actions. See our MCP setup guide.
π― What they’re testing: Awareness of the modern agent ecosystem, increasingly asked in 2026.
βͺ Likely follow-up: How is MCP different from simply calling REST APIs from your agent?
How do you make agents safe and reliable in production?
Show answer
β± 30-second answer: Limit what they can do, check what they did, and keep humans in control of risky steps. Use least-privilege tools, step limits, validation, logging, evaluation and human approval for irreversible actions.
π Deeper answer: Practical controls: max iterations and budgets; timeouts and retries; typed tool schemas with server-side checks; read-only defaults; approval gates for payments, deletions and emails; sandboxed code execution; defences against prompt injection from retrieved content; full traces for debugging; and offline evaluation on realistic tasks before release.
π― What they’re testing: Senior-level thinking about real-world failure modes.
βͺ Likely follow-up: Your agent occasionally loops forever. What do you investigate first?
Evaluation, safety & production
What are hallucinations, and how do you reduce them?
Show answer
β± 30-second answer: Hallucinations are confident but false or unsupported outputs. Reduce them by grounding answers in retrieved sources, allowing “I don’t know”, asking for citations, lowering temperature and verifying critical facts.
π Deeper answer: Causes include missing knowledge, ambiguous prompts and the model’s drive to always answer. Mitigations: RAG with good retrieval, instructions to answer only from context, citation requirements, self-check or verifier steps, structured outputs, and human review for high-stakes use. Measure the hallucination rate with an evaluation set.
π― What they’re testing: Practical mitigation, not just a definition.
βͺ Likely follow-up: How would you measure hallucination rate for a legal-documents assistant?
How do you evaluate an LLM application?
Show answer
β± 30-second answer: Build a test set of real questions with expected answers or criteria, then score outputs automatically (exact checks, LLM-as-judge, retrieval metrics) and with periodic human review. Track scores every time you change prompts or models.
π Deeper answer: Layers: unit-style checks (format, banned content), task metrics (accuracy, faithfulness to sources, answer relevance), retrieval metrics (recall@k), and human ratings for quality. Add online metrics in production: thumbs up/down, escalation rate, latency and cost. Treat prompts like code: version them and run evaluations in CI.
π― What they’re testing: Engineering discipline, the most common differentiator in interviews.
βͺ Likely follow-up: What would be in your first 50 test questions for a customer-support bot?
What is LLM-as-a-judge, and what are its pitfalls?
Show answer
β± 30-second answer: Using an LLM to grade other LLM outputs against criteria. It scales evaluation cheaply, but judges can be biased, inconsistent or fooled, so you calibrate them against human labels.
π Deeper answer: Known pitfalls: position bias (preferring the first answer), verbosity bias (preferring longer answers), self-preference for similar models, and sensitivity to rubric wording. Mitigations: clear rubrics with examples, pairwise comparisons with swapped order, a different judge model, low temperature, and checking agreement with human graders on a sample.
π― What they’re testing: Depth in evaluation, valued for senior and architect roles.
βͺ Likely follow-up: How would you validate that your judge agrees with humans?
How do you reduce latency and cost of an LLM app in production?
Show answer
β± 30-second answer: Use the smallest model that meets quality, route easy requests to cheaper models, cache repeated work (including prompt caching), stream responses, trim prompts and retrieved context, and batch offline jobs.
π Deeper answer: Other levers: limit output length; summarise long histories; pre-compute embeddings; use asynchronous processing for non-urgent tasks; and monitor cost per conversation. Always re-run evaluations after optimisation so quality doesn’t silently drop.
π― What they’re testing: Business awareness; companies care deeply about cost per query.
βͺ Likely follow-up: Your monthly LLM bill doubled. How do you find out why?
What are guardrails in LLM applications?
Show answer
β± 30-second answer: Guardrails are checks around the model, on both input and output, that block or fix unsafe, off-topic or invalid content before it reaches the model or the user.
π Deeper answer: Input guardrails: detect prompt injection, PII, abuse and off-topic requests. Output guardrails: validate format, filter unsafe content, check claims against sources, and enforce business rules such as never giving investment advice. They can be rules, classifiers or smaller models. Balance safety against false blocks that annoy users.
π― What they’re testing: Responsible-AI and safety awareness.
βͺ Likely follow-up: How would you handle PII like Aadhaar or PAN numbers in user messages?
System design: how would you build a customer-support chatbot for an Indian bank?
Show answer
β± 30-second answer: Use a RAG assistant over approved policy and FAQ documents, with strict guardrails, authentication for account-specific queries, human handoff, multilingual support, and continuous evaluation and monitoring.
π Deeper answer: Clarify scope (FAQs only vs account actions), languages (English, Hindi, regional), channels (web, app, WhatsApp) and compliance needs. Architecture: authenticated API layer, intent routing, RAG over versioned policy documents with citations, tool calls for read-only account data behind proper auth, no money movement without strong verification and explicit confirmation, PII masking and audit logs, and escalation to humans on low confidence. Evaluate with a curated test set, monitor deflection rate, CSAT and errors, and plan for data residency and regulatory requirements.
π― What they’re testing: End-to-end architecture thinking: security, compliance, evaluation. This is the classic senior and architect question.
βͺ Likely follow-up: How would the design change if it had to support voice calls?
π€ Practice with AI: free mock interview
Copy this prompt into Claude or ChatGPT and get interviewed. Answer by typing or voice.
Act as a senior interviewer for a Generative AI Engineer role at an Indian product company. Ask me one question at a time from these topics: LLM fundamentals, prompting, RAG, fine-tuning, agents, evaluation and production. Start easy and increase difficulty based on my answers. After each answer: score it out of 10, tell me what was missing, and show a model answer in under 120 words. After 8 questions, give me my strongest and weakest areas and a 7-day study plan.
How to prepare in 7 days
- Day 1β2: Foundations and Prompting (Q1βQ10). Explain each out loud in under a minute.
- Day 3β4: Embeddings and RAG (Q11βQ16). Build a tiny RAG app; it gives you real stories to tell.
- Day 5: Fine-tuning and Agents (Q17βQ24).
- Day 6: Evaluation and production (Q25βQ29). Interviewers increasingly focus here.
- Day 7: Practise the system-design question (Q30) and do two AI mock interviews using the prompt above.
Tips that make you stand out
- Tell project stories: “In my RAG project, re-ranking improved accuracy from X to Y” beats any textbook definition.
- Talk trade-offs: cost, latency, quality and safety. Senior interviewers listen for this.
- Say “it depends”, then explain on what: it shows judgement, not indecision.
- Know one stack end to end: one model API, one vector store, one evaluation method.
Keep going
Next, follow our GenAI developer learning path, build a project with our free LLM API guide, and pick up the best interview prep books.

