These 75 generative AI interview questions cover what GenAI engineer interviews in 2026 actually probe: how models behave, how you control them, and how you ship them safely. Interviewers are no longer impressed by a working prompt; they want to hear how you would ground, evaluate, secure, monitor and pay for a generative AI system once real users and real data hit it. Every answer below is written the way a senior engineer would say it in the room: direct answer first, then the trade-offs.
How to use this guide
- Freshers and early-career engineers: expect the fundamentals, prompting and structured-output sections. Interviewers check whether you understand tokens, sampling and embeddings well enough to debug, not just define them.
- Developers moving into GenAI (2 to 6 years): expect model selection, RAG, evaluation, guardrails and cost questions, plus at least one scenario. You are tested on judgement: when not to use an LLM, when to fine-tune, how to measure quality.
- Senior and architect roles: expect the architecture and scenario sections, often as a whiteboard. Interviewers listen for failure modes, ownership of evaluation, security boundaries and cost per outcome.
- Read the answer, then say it aloud in your own words with one example from your own project. These are high-value, commonly asked questions, not a script.
Contents
- GenAI fundamentals (Q1 to Q8)
- Prompting and context engineering (Q9 to Q14)
- Structured output and function calling (Q15 to Q18)
- Model selection and routing (Q19 to Q23)
- RAG basics (Q24 to Q27)
- Fine-tuning vs RAG (Q28 to Q30)
- Multimodal GenAI (Q31 to Q33)
- Hallucination and grounding (Q34 to Q37)
- Evaluation (Q38 to Q42)
- Safety and guardrails (Q43 to Q47)
- Latency and cost (Q48 to Q51)
- LLMOps basics (Q52 to Q55)
- GenAI architecture (Q56 to Q60)
- Real-world scenarios (Q61 to Q75)
- Key takeaways
- Interview preparation checklist
- FAQ
GenAI fundamentals
1. What is generative AI, and how is it different from traditional machine learning?
Answer: Generative AI produces new content (text, code, images, audio) by learning the distribution of its training data and sampling from it. Traditional supervised ML usually maps an input to a fixed label or number: fraud or not fraud, a price, a churn score. A large language model is trained to predict the next token, and that single objective, at scale, yields summarisation, translation, extraction, reasoning and code generation without a separate model per task. Generative outputs are open-ended and harder to score, so testing, guardrails and monitoring become first-class work.
2. What is a token, and why do engineers care about token counts?
Answer: A token is the unit a model reads and writes, usually a subword piece produced by a tokenizer such as byte-pair encoding. A common English word may be one token; a rare word, a number or code can be several. Token counts drive four things engineers own: cost (APIs bill input and output tokens, often at different rates), latency (output tokens are generated one at a time), context limits (everything must fit) and truncation bugs. Different models use different tokenizers, so the same prompt has different counts across providers.
Real-world example: Telugu, Hindi or mixed Hinglish text generally splits into more tokens per word than English, so a support bot for Indian customers can cost more and respond slower than a load test in English suggested. The mechanics are covered in tokens and context windows explained.
3. What is a context window, and what happens when you exceed it?
Answer: The context window is the maximum number of tokens a model can attend to in one request, and it includes the system prompt, conversation history, retrieved documents, tool definitions and the output being generated. If you exceed it, the API either rejects the request or your framework silently truncates something, often the oldest messages or the end of a document. A larger window is not a free pass: long contexts cost more, increase latency, and models can use information in the middle of a long prompt less reliably than information at the start or end.
4. What are embeddings, and where are they used in GenAI systems?
Answer: An embedding is a dense vector that represents the meaning of text (or an image) so that semantically similar items sit close together, usually compared with cosine similarity or dot product. In GenAI systems embeddings power semantic search for RAG, deduplication, clustering of user queries, routing (which intent is this?), semantic caching and recommendation. The rules that bite in production: queries and documents must be embedded with the same model, changing the embedding model means re-embedding the corpus, and embeddings capture topical similarity, not truth or recency. See embeddings explained for the deeper mechanics.
5. Explain temperature, top-p and top-k.
Answer: At each step the model produces a probability distribution over the vocabulary, and these parameters control how the next token is sampled. Temperature rescales the logits: low values make the distribution sharper and output more repeatable; high values flatten it and increase variety. Top-k restricts sampling to the k most likely tokens; top-p (nucleus sampling) restricts it to the smallest set whose cumulative probability reaches p. For extraction, classification and tool calling I keep temperature low; for brainstorming or marketing variants I raise it. Usually you tune temperature or top-p, not both aggressively.
Interview tip: Mention that temperature zero does not ensure identical outputs across calls on hosted APIs, and that some reasoning models fix or ignore sampling parameters, so check current provider documentation.
6. Why are LLM outputs non-deterministic, and how do you design around it?
Answer: Sampling is the obvious cause, but even with greedy decoding, batching, floating-point ordering on GPUs and silent model updates by providers can change outputs. You design around it rather than fight it: pin model versions where the provider allows, keep low temperature for deterministic tasks, validate outputs against schemas, make downstream actions idempotent, and evaluate on distributions (pass rate across a test set, repeated runs on critical cases) rather than single examples.
7. What is the difference between a base model, an instruction-tuned model and a reasoning model?
Answer: A base model is pretrained on next-token prediction and continues text; it is not naturally conversational. An instruction-tuned (chat) model is further trained with supervised examples and preference optimisation so it follows instructions, uses a chat format and refuses unsafe requests. A reasoning model is trained to spend extra tokens working through a problem before answering, which helps on multi-step maths, planning, complex code and analysis, at the cost of latency and token spend. Nearly all application work uses instruction-tuned or reasoning models; base models matter mainly when you fine-tune.
8. What is the difference between pretraining knowledge and context knowledge?
Answer: Pretraining knowledge is what the model absorbed from training data: broad, frozen at a cutoff date, not attributable to a source and unaware of your private data. Context knowledge is what you place in the prompt at request time: retrieved documents, tool results, user profile, today's date. Enterprise applications should treat pretraining knowledge as language skill and general reasoning, and treat context as the source of facts. When an answer must be current, private or citable, it must come from context.
Prompting and context engineering
9. What makes a good system prompt for a production application?
Answer: A good system prompt is a specification, not a vibe. It states the role and audience, the task boundaries, what sources to trust, what to do when information is missing ("say you do not know and offer escalation"), the output format, tone, and hard constraints such as never giving investment advice. It is versioned in Git, reviewed like code, and tested against an evaluation set before each change.
Interview tip: Never claim the system prompt is a security control. It shapes behaviour, but a determined user or an injected document can override it; enforcement belongs in code and permissions.
10. Zero-shot, few-shot and chain-of-thought prompting: when do you use each?
Answer: Zero-shot (instructions only) is the default for capable models on clear tasks. Few-shot adds a small number of input-output examples and is the quickest fix when the model gets the format, tone or edge-case handling wrong; choose examples that cover the hard cases, not the easy ones, and watch for the model copying example content. Chain-of-thought asks the model to reason step by step before answering; it helps standard models on multi-step problems, while reasoning models already do this internally and often need less explicit prompting. In production I usually ask for the reasoning in a separate field or hidden from the user, then parse only the final answer.
11. What is context engineering, and how is it different from prompt engineering?
Answer: Prompt engineering is wording the instruction well. Context engineering is designing everything the model sees on each call: which instructions, which retrieved documents, which tool definitions, how much history, what memory, what user and permission data, in what order and within what token budget. As applications became multi-turn and tool-using, most quality problems moved from wording to context: wrong chunk retrieved, stale history, too many tools, conflicting instructions. Context engineering treats the context window as a scarce resource assembled by code. Our context engineering guide goes deeper.
12. How do you manage conversation history in a long chat?
Answer: Keep the last few turns verbatim, replace older turns with a running summary, and store durable facts (user preferences, case IDs) in structured state outside the transcript, injecting only what the current turn needs. Trim tool outputs aggressively; a full JSON API response from three turns ago is rarely useful. Set a token budget per section so history can never push out instructions or retrieved evidence.
13. How do you version, test and roll out prompt changes?
Answer: Prompts live in source control or a prompt registry with versions, owners and change notes. Every change runs against an offline evaluation set (golden questions, edge cases, adversarial inputs) and must not regress agreed metrics. Then roll out gradually: shadow or canary traffic, compare online signals such as thumbs-down rate, escalation rate and cost per request, and keep instant rollback. Tools like LangSmith or Langfuse help trace which prompt version produced which response.
14. What is prompt chaining, and when is it better than one big prompt?
Answer: Prompt chaining splits a task into steps, each with its own focused prompt, where code passes the output of one step to the next: classify, then extract, then draft, then check. It beats one giant prompt when steps need different models, different temperatures or different validation, when you want to test and observe each step separately, or when a cheap step can short-circuit an expensive one. The cost is more calls and latency. If a single call is accurate enough on your evaluation set, keep it simple; chain only when you can show the quality or control gain.
Structured output and function calling
15. How do you get reliable structured output (JSON) from an LLM?
Answer: In order of reliability: use the provider's schema-constrained structured output feature where available (decoding is restricted to your JSON schema), otherwise JSON mode plus a schema in the prompt, otherwise instructions and examples alone. Regardless of the method, validate in code with something like Pydantic, and on failure retry with the validation error included, then fall back gracefully. Keep schemas small and flat, use enums for categories, and make optional fields explicit so the model is not tempted to invent values.
Interview tip: Point out that a schema enforces shape, not truth. A perfectly valid JSON object can still contain a hallucinated policy number, so field-level business validation still applies. More in function calling and structured outputs.
16. Explain function calling (tool calling) end to end.
Answer: You send the model the conversation plus a list of tool definitions: name, description and a JSON schema for arguments. If the model decides a tool is needed, it returns a structured tool call instead of text. Your application, not the model, validates the arguments, checks permissions, executes the function or API, and sends the result back as a tool message. The model then answers or calls another tool. The model never touches your systems directly; it only proposes calls.
User msg + tool schemas
→ LLM proposes tool_call(args)
→ App validates args + checks permission
→ App executes API / DB query
→ Tool result back to LLM
→ LLM writes final answer (or next call)
17. How do you design good tools for an LLM?
Answer: Design tools around user intents, not around your raw API surface. Prefer a few well-named tools with clear descriptions ("get_order_status: use when the customer asks where an order is") over dozens of thin wrappers. Use typed, constrained arguments (enums, IDs, date formats), return compact results with only the fields the model needs, return useful error messages the model can act on, and separate read tools from write tools. Write actions need idempotency keys, permission checks against the end user's identity and, for high-impact actions, human approval. Too many tools in context dilutes selection accuracy and costs tokens.
18. Where does MCP fit relative to function calling?
Answer: Function calling is the model-level mechanism: the model emits a structured call. MCP, the Model Context Protocol, is an open protocol introduced by Anthropic in late 2024 that standardises how AI applications discover and use tools, resources and prompts exposed by servers. Instead of hand-coding every integration into every app, a team exposes, say, a ServiceNow or Jira capability once as an MCP server, and any MCP-capable client can use it. MCP does not remove the need for authentication, authorisation, input validation or auditing; it standardises the plumbing.
Model selection and routing
19. How do you choose an LLM for an enterprise use case?
Answer: Start from the task and constraints, not the leaderboard. List the requirements: quality on your own evaluation set, latency target, cost per request at expected volume, context length, tool-calling and structured-output support, multilingual needs, data residency and contractual terms, availability on your approved cloud (Amazon Bedrock, Azure OpenAI in Microsoft Foundry, Gemini on Google Cloud), and whether self-hosting is needed. Shortlist two or three models, run the same evaluation, and pick the cheapest one that clears the quality bar.
Interview tip: Naming platforms correctly signals currency: Azure AI Foundry is now Microsoft Foundry, and Google has rebranded Vertex AI as Gemini Enterprise Agent Platform. Check current documentation before quoting features.
20. Reasoning model or fast model: how do you decide?
Answer: Use a fast, cheaper model when the task is well specified and short: classification, extraction, rewriting, simple Q&A over retrieved context, routing. Use a reasoning model when the task needs multi-step planning, complex analysis, tricky code or reconciling conflicting evidence, and when the user can tolerate extra seconds. Decide with evidence: run both on the evaluation set and compare quality, latency and cost per correct answer. Often the right design uses both: a reasoning model to plan or handle hard cases, a fast model for the high-volume steps.
21. What is model routing, and how would you implement it?
Answer: Model routing sends each request to the most appropriate model based on difficulty, intent, cost or policy. Implementations range from simple rules (intent X goes to the small model), to a lightweight classifier or embedding-similarity router, to a cascade where a cheap model answers first and escalates when confidence or a validator fails. Some platforms offer managed routing, for example Amazon Bedrock's intelligent prompt routing within a model family. A router needs its own evaluation: measure how often it sends hard queries to the weak model, because those mistakes are invisible unless you look.
22. When are small language models the right choice?
Answer: Small language models suit narrow, high-volume tasks (classification, PII detection, intent routing, extraction from a known format), strict latency budgets, on-device or on-premises deployment, and cases where data cannot leave a controlled environment. They are cheaper to run and fine-tune, and quantised versions can run on modest hardware. They are weaker on open-ended reasoning, long context and broad world knowledge.
23. Hosted API or self-hosted open-weight model: what are the trade-offs?
Answer: Hosted APIs give you frontier quality, no GPU operations and elastic scale, but you accept per-token pricing, provider rate limits, model deprecation schedules and a data-processing agreement. Self-hosting open-weight models (with servers such as vLLM on Kubernetes) gives control over data, versions and customisation, and can be cheaper at steady high volume, but you own GPU capacity planning, scaling, patching, security and evaluation of each upgrade. Many enterprises start on managed cloud model services within their existing cloud account and self-host only specific models where residency, cost or customisation justify it.
RAG basics
24. What is RAG, and why is it the default pattern for enterprise GenAI?
Answer: Retrieval-augmented generation retrieves relevant content from your own sources at query time and places it in the prompt so the model answers from that evidence, ideally with citations. It is the default because enterprise questions depend on private, changing information (policies, contracts, tickets, product docs) that the model never saw, and because RAG lets you update knowledge by re-indexing rather than retraining, enforce document-level permissions and show sources. Start with what is RAG, and for depth on retrieval, chunking and evaluation questions use our RAG interview questions guide.
25. Walk through the stages of a RAG pipeline.
Answer: There are two pipelines. Ingestion: connect to sources, parse documents (including tables and scanned PDFs), clean, chunk, attach metadata (source, date, owner, access groups), embed and index. Query: optionally rewrite the question, retrieve candidates with vector and keyword search, filter by permissions and metadata, rerank, assemble context within a token budget, generate with instructions to cite and to refuse when evidence is missing, then post-check grounding.
INGEST: sources → parse → chunk → embed → index
QUERY: question → rewrite → hybrid search
→ ACL filter → rerank → prompt → LLM
→ grounding check → answer + citations
26. Why do RAG systems give wrong answers even when the document exists?
Answer: The usual culprits, in rough order: the document was parsed badly (a table flattened into nonsense), the chunk split the answer across boundaries, the query wording does not match the document vocabulary (acronyms, product codes), pure vector search missed an exact identifier that keyword search would catch, too few or too many chunks were passed, an outdated version of the document outranked the current one, or the model ignored the evidence. Diagnose by separating retrieval from generation: check whether the right chunk was in the top results before touching the prompt.
27. What is hybrid search, and why add a reranker?
Answer: Hybrid search combines dense vector similarity (good at meaning and paraphrase) with sparse keyword search such as BM25 (good at exact terms, IDs, error codes), and merges the results, often with reciprocal rank fusion. A reranker, typically a cross-encoder, then scores each query-chunk pair together and reorders a larger candidate set so only the most relevant few reach the prompt. Retrieval casts a wide net cheaply; reranking spends more compute on a small set for precision. Measure both with retrieval metrics before and after.
Fine-tuning vs RAG
28. When would you fine-tune instead of using RAG?
Answer: Fine-tune to change behaviour, not to add facts. Good reasons: a consistent output format or style the model keeps missing, a domain-specific classification or extraction task with lots of labelled examples, shorter prompts at very high volume (moving instructions into weights), or making a small model perform a narrow task well. Use RAG when the need is knowledge: current, private, changing or citable information. Many production systems do both: RAG for facts, a lightly tuned model for format and tone. Try prompting and RAG first, because they are cheaper to change. Compare the two in RAG vs fine-tuning.
29. What are LoRA and parameter-efficient fine-tuning?
Answer: Parameter-efficient fine-tuning (PEFT) updates a small number of added parameters instead of all model weights. LoRA (low-rank adaptation) freezes the base model and trains small low-rank matrices injected into selected layers; QLoRA does this on a quantised base model to cut memory further. Benefits: far less GPU memory, faster training, small adapter files, and the ability to serve multiple adapters on one base model. Limits: you still need clean, representative training data and an evaluation set, and a tuned model can regress on general capability or safety behaviour, so re-run safety and regression tests after every tune.
30. What data do you need for fine-tuning, and what can go wrong?
Answer: You need high-quality examples that look exactly like production inputs and the outputs you want, a held-out test set, and a clear metric. Quality beats quantity; a few hundred carefully reviewed examples often teach a format better than thousands of noisy ones. Common failures: training on outputs with errors (the model learns them), leaking test data into training, overfitting to one template, personal data in training examples that cannot later be removed, catastrophic forgetting of general skills, and no plan for re-tuning when the base model is deprecated.
Multimodal GenAI
31. What is a multimodal model, and what enterprise tasks suit it?
Answer: A multimodal model accepts and sometimes produces more than one modality: text, images, audio, video or documents. Enterprise fits include reading invoices, claim forms and ID documents; understanding screenshots in IT tickets; describing damage photos in insurance; analysing charts in reports; and speech in voice assistants. The engineering questions are the same as text plus a few more: image resolution and token cost, document page limits, handwriting and low-quality scans, and the need to verify extracted fields against business rules.
32. For document processing, when do you use OCR plus an LLM versus a vision model directly?
Answer: A dedicated OCR or document-layout service gives deterministic text with coordinates and confidence scores, which is good for audit, highlighting and large volumes of standard forms; an LLM then structures or reasons over that text. A vision-capable model reading the page directly handles messy layouts, stamps, checkboxes and mixed content better and needs less pipeline code, but costs more per page and can misread digits without signalling uncertainty. A pragmatic design uses OCR plus layout extraction as the primary path, sends low-confidence or complex pages to a vision model, and validates critical fields (amounts, dates, IDs) with rules and human review.
33. What risks are specific to multimodal inputs?
Answer: Images and documents can carry hidden instructions (text in an image, white-on-white text in a PDF) that act as indirect prompt injection. Faces, signatures and ID numbers create personal-data obligations. Models can confidently misread numbers in low-resolution scans. Audio brings speaker identity and consent questions. Controls include treating every extracted text as untrusted data, redacting sensitive regions before model calls where possible, recording confidence, routing uncertain cases to humans, and applying content filters to image inputs where the platform supports it.
Hallucination and grounding
34. What is hallucination, and why does it happen?
Answer: Hallucination is output that is fluent and confident but false or unsupported by the provided sources. It happens because the model is trained to produce plausible continuations, not to verify facts; when knowledge is missing, ambiguous or outdated, a plausible guess is still the most likely continuation. Triggers include questions outside the model's knowledge, missing or wrong retrieval, prompts that pressure the model to always answer, long noisy contexts, and requests for specific details such as citations, numbers or names. It can be reduced, never eliminated, so the system must be designed to catch it. See LLM hallucinations explained.
35. How do you reduce hallucinations in a production system?
Answer: Layer the defences. Ground answers in retrieved or tool-provided evidence; improve retrieval first. Instruct the model to answer only from the context and to say it does not know otherwise, and reward that in evaluation instead of penalising it. Require citations at sentence or claim level and verify that cited passages exist and support the claim. Use structured output for facts that drive actions and validate them against systems of record. Add a grounding check (a judge model or a platform feature such as contextual grounding checks in Amazon Bedrock Guardrails). Narrow the task scope. Finally, route low-confidence or high-impact answers to a human.
36. What does "grounded" mean, and how do you measure it?
Answer: A grounded answer is one where every factual claim is supported by the supplied context. You measure it with faithfulness (groundedness) scoring: break the answer into claims and check each against the retrieved passages, using an LLM judge, an NLI model or a tool such as Ragas. Pair it with answer relevance (does it address the question?) and context relevance (was the retrieved context useful?). Grounded is not the same as correct: if the retrieved document is outdated, a faithful answer is still wrong, so source freshness and authority belong in the pipeline too.
37. How do you handle questions the system should not answer?
Answer: Define scope explicitly and treat refusals as a feature with its own tests. Detect out-of-scope or unsafe intents with a classifier or denied-topic guardrail before generation, respond with a helpful redirect ("I can help with leave policy; for payroll disputes contact HR via this link"), and escalate to a human where a real need exists. Track refusal rate in production: too low means over-answering; too high means users are blocked from legitimate help. Include both should-answer and should-refuse cases in the evaluation set.
Evaluation
38. How do you evaluate a generative AI application?
Answer: Build an evaluation set from real or realistic queries with expected answers or acceptance criteria, covering common cases, edge cases, should-refuse cases and adversarial inputs. Score with a mix: deterministic checks (schema valid, required fields, forbidden content, correct tool called), reference-based metrics where an exact answer exists, LLM-as-judge with rubrics for open-ended quality, and human review on a sample. Evaluate components separately (retrieval, tool selection, generation) and end to end. Run it in CI on every prompt, model or retrieval change, and monitor equivalent signals in production. Our LLM evaluation guide covers metrics in depth.
39. What is LLM-as-judge, and what are its weaknesses?
Answer: LLM-as-judge uses a model to grade outputs against a rubric (faithfulness, helpfulness, policy compliance) or to compare two responses. It scales review far beyond what humans can do. Known weaknesses: position bias in pairwise comparison, preference for longer or more confident answers, self-preference for outputs from the same model family, inconsistency across runs and blind spots in specialised domains. Mitigations: specific rubrics with examples, binary or small-scale scores instead of vague ten-point scales, randomised order in pairwise tests, a different model family as judge where possible, and, crucially, calibrating the judge against a human-labelled sample and re-checking agreement periodically.
40. What is the difference between offline and online evaluation?
Answer: Offline evaluation runs a fixed test set before release: it is repeatable, safe and catches regressions, but only covers cases you thought of. Online evaluation measures live traffic: user feedback, escalation and resolution rates, task completion, judge scores on sampled production traces, latency and cost, and A/B or canary comparisons between versions. Offline gates releases; online tells you whether the release actually helped and reveals new failure patterns. The loop that matters: harvest failed production cases, label them, and add them to the offline set so the same bug cannot ship twice.
41. How do you build a golden dataset when the business has none?
Answer: Start with real questions: support tickets, search logs, email inboxes, FAQs, and interviews with the people who answer these questions today. Have subject-matter experts write or approve expected answers and the source document for each. Add edge cases and refusal cases deliberately. Synthetic generation (an LLM writing questions from documents) helps fill coverage but must be reviewed, because synthetic questions are often easier and cleaner than real ones. Begin small and representative, version the dataset, record who approved each item and grow it from production failures.
42. Which metrics would you put on a GenAI quality dashboard?
Answer: Group them by audience. Quality: groundedness, answer relevance, judge pass rate on sampled traffic, refusal rate, user thumbs-down rate. Business: task completion or deflection, escalation to humans, time saved per case as measured by the business owner. Operations: time to first token, end-to-end latency percentiles, error and timeout rates, rate-limit hits. Cost: tokens and spend per request, per user and per successful outcome. Safety: guardrail block rates by category, prompt-injection detections, PII redaction events. Every metric needs an owner and a threshold that triggers action.
Safety and guardrails
43. What are guardrails, and where do they sit in the architecture?
Answer: Guardrails are controls that check inputs and outputs against policy. Input guardrails detect prompt attacks, denied topics, toxic content and sensitive data before the model is called. Output guardrails check for harmful content, PII leakage, ungrounded claims and format violations before the user sees the response. Tool guardrails validate arguments and permissions before any action. Managed options exist, for example Amazon Bedrock Guardrails offers content filters, denied topics, word filters, sensitive-information filters, contextual grounding checks and Automated Reasoning checks, and its ApplyGuardrail API can be used independently of model invocation. Guardrails complement, not replace, least-privilege access. See AI guardrails explained.
44. What is prompt injection, and how do you defend against it?
Answer: Prompt injection is text that tries to override the application's instructions. Direct injection comes from the user ("ignore previous instructions"). Indirect injection hides in content the system retrieves or receives: a web page, an email, a PDF, a ticket comment. There is no complete fix, so defend in depth: treat all retrieved and tool content as untrusted data and delimit it clearly, run injection classifiers, give the model only the tools and data the current user is allowed, require confirmation for consequential actions, never put secrets in prompts, and validate outputs before they trigger anything. It is listed in the OWASP Top 10 for LLM Applications, a useful reference to cite.
Interview tip: The strongest answer is architectural: "Even if injection succeeds, what can the model actually do?" Limit the blast radius.
45. How do you handle PII and sensitive data in GenAI applications?
Answer: Minimise first: send the model only the fields the task needs. Detect and mask or tokenise PII before model calls where possible, and redact it in logs and traces. Use providers and regions whose data-processing terms fit your obligations; for Indian personal data, map the flow against the DPDP Act with your compliance team. Enforce document-level access control in retrieval so the model never sees records the user cannot. Set retention for prompts, outputs and evaluation datasets, and keep personal data out of fine-tuning sets unless there is a clear legal basis.
46. What is jailbreaking, and how is it different from prompt injection?
Answer: Jailbreaking targets the model's own safety training: the user tries to make it produce content it would normally refuse, through role-play, encoding tricks or many-turn persuasion. Prompt injection targets the application: it hijacks instructions so the model takes actions or reveals data the developer did not intend. They overlap, but the defences differ in emphasis. Jailbreaks are mitigated with model choice, content filters and output moderation; injection is mitigated with privilege separation, tool permissions and untrusted-data handling. Red-team for both before launch and after major changes.
47. When do you put a human in the loop?
Answer: When the action is irreversible or high impact (payments, account changes, customer-facing legal or medical statements), when the model's confidence or a validator signals uncertainty, when regulation requires a human decision, and during early rollout while you build evidence. Design it properly: show the reviewer the evidence and the proposed action, make approve, edit and reject fast, capture the reason for edits, and feed rejections back into evaluation. A human-in-the-loop step that reviewers click through without reading is a control on paper only.
Latency and cost
48. Where does latency come from in an LLM application, and how do you reduce it?
Answer: Break it down: network and gateway overhead, retrieval and reranking, prompt processing (proportional to input tokens), time to first token, generation time (proportional to output tokens), tool calls and extra model round trips. Reductions: stream responses so users see text early, cut input tokens, cap output length, use a faster model for simple steps, run retrieval and independent tool calls in parallel, cache repeated work, use prompt caching for long stable prefixes, and avoid unnecessary agent loops. See LLM latency optimisation.
49. Explain prompt caching versus semantic caching.
Answer: Prompt caching is a provider feature that reuses the processed state of an identical prompt prefix (system prompt, long documents, tool definitions) across calls, reducing cost and latency for the cached part; it rewards putting stable content first and dynamic content last. Semantic caching is your own layer that stores previous answers and returns one when a new query is semantically similar. Semantic caching can save whole model calls but is risky: similar-looking questions can need different answers ("cancel my order" vs "cancel my subscription"), and cached answers can go stale or leak across users with different permissions. Use it only for low-risk, non-personalised content with tight thresholds and expiry.
50. How do you estimate and control the cost of a GenAI feature?
Answer: Estimate cost per request as input tokens times input price plus output tokens times output price, plus embeddings, reranking, guardrail calls and retries; multiply by requests per user per day and users. Then validate against real traces, because agent loops and retries often double what the spreadsheet said. Control it with per-request token budgets, model routing, prompt caching, shorter contexts, output limits, batch APIs for offline jobs, rate limits per user or tenant, and alerts on spend anomalies. Report cost per successful outcome, not just cost per call.
51. What is an LLM gateway, and why do teams introduce one?
Answer: An LLM gateway is a central proxy between applications and model providers. It gives one place for authentication and key management, routing and fallback across models or regions, rate limits and quotas per team, cost attribution, caching, logging and tracing, and policy enforcement such as guardrails or PII redaction. Teams introduce one when several applications call several providers and nobody can answer "who spent what on which model". The risks are a new single point of failure and added latency, so it needs high availability and must stay thin.
LLMOps basics
52. What is LLMOps, and how does it differ from MLOps?
Answer: LLMOps applies MLOps discipline to LLM applications, but the artefacts differ. In classic MLOps you version datasets, training code and model weights and monitor prediction drift. In LLMOps you mostly consume a model you did not train, so the versioned artefacts are prompts, retrieval configuration, tool definitions, model identifiers, guardrail policies and evaluation datasets. Testing relies on evaluation suites and judges rather than a single accuracy number, and monitoring adds token cost, groundedness, safety events and traces of multi-step chains. The release pipeline (CI, evaluation gates, canary, rollback) looks familiar to any DevOps engineer. See the MLOps and LLMOps interview questions for more.
53. What should you log and trace in a GenAI application?
Answer: For each request: a trace ID, user or tenant (pseudonymised where needed), prompt template version, model ID and parameters, retrieved document IDs and scores, tool calls with arguments and results, guardrail decisions, token counts, latency per step, final output and user feedback. Use OpenTelemetry-style spans so a single request across retrieval, model calls and tools is one trace, and tools like LangSmith or Langfuse to inspect them. Redact sensitive content per policy and set retention.
54. How do you handle model deprecations and upgrades?
Answer: Treat the model as a dependency with a lifecycle. Track provider deprecation notices, pin versions where possible, and keep model choice in configuration, not code. When a new version arrives, run the full evaluation suite, compare quality, latency, cost and refusal behaviour, and check that structured output and tool calling still parse. Re-tune prompts where needed, canary the change, and keep the old model available for rollback until the new one is proven. Fine-tuned models need a re-tuning plan, because the base model they depend on will also be retired.
55. What does CI/CD look like for a GenAI application?
Answer: The usual pipeline (lint, unit tests, container build, security scans, infrastructure as code) plus GenAI stages: prompt and config changes trigger the evaluation suite; a quality gate blocks merges that drop below thresholds on faithfulness, tool accuracy or safety cases; red-team prompts run as regression tests; and deployment is progressive with automated rollback on online metrics. Keep evaluation fast enough for pull requests by running a smoke subset on every change and the full suite nightly or before release. GitHub Actions and Argo CD fit this well.
GenAI architecture
56. Explain the progression from a raw LLM to a chatbot, RAG app, tool-using app, agent and multi-agent system.
Answer: Each step adds one capability and one new class of risk, and good engineers climb only as far as the problem needs.
LLM text in → text out, no memory
↓ + conversation state
Chatbot multi-turn, still only model knowledge
↓ + retrieval
RAG app answers from your documents, cites
↓ + tool calls
Tool app reads/writes systems, code controls flow
↓ + model-driven loop
Agent plans, picks tools, iterates to a goal
↓ + specialised agents
Multi-agent agents coordinate via orchestrator
A raw LLM call is stateless: prompt in, completion out. A chatbot adds conversation history and a system prompt, but still only knows its training data. A RAG application adds retrieval so answers come from private, current documents with citations; the new risks are retrieval quality and permissions. A tool-using application lets the model call functions, but your code decides the flow ("classify, then look up order, then answer"); now you need argument validation and authorisation. An agent hands control of the loop to the model: it plans, chooses tools, observes results and iterates until it reaches a goal or a step limit; the risks are runaway loops, cost, and unintended actions, so you add budgets, approval gates and traces. A multi-agent system splits work among specialised agents (triage, research, execution, review) coordinated by an orchestrator or a graph, which helps with separation of permissions and focus but multiplies latency, cost and debugging complexity.
Interview tip: Finish with the judgement call: "Most enterprise problems I have seen are solved at the RAG or tool-using level; I move to an agent only when the steps genuinely cannot be fixed in advance." For agent depth, see the agentic AI interview questions.
57. Draw a reference architecture for an enterprise GenAI assistant.
Answer: I separate it into channels, an application layer that owns orchestration, a model access layer, a knowledge layer and cross-cutting controls.
Users (web, Teams, WhatsApp)
→ API gateway + SSO (Entra ID / IAM)
→ Orchestrator service (FastAPI)
├ input guardrails
├ retrieval → vector + keyword index
├ tools → ServiceNow / CRM via MCP
├ LLM gateway → model providers
└ output guardrails + citations
→ Response (streamed)
Cross-cutting: traces, eval, cost, audit
Key decisions to state: identity propagates from the user to retrieval and tools; prompts and policies are versioned config; the model is behind a gateway so it can be swapped; evaluation and observability exist from day one. The enterprise AI architecture guide expands each layer.
58. How do you design for multi-tenancy in a GenAI platform?
Answer: Isolation must hold at every layer that holds data. Retrieval: per-tenant indexes or mandatory tenant filters enforced server side, never left to the prompt. Caches: keys include tenant and permission scope, or semantic caching is disabled for personalised content. Memory and conversation stores: tenant-partitioned. Tools: credentials scoped per tenant. Cost and rate limits: per-tenant quotas via the gateway. Logs: tenant-tagged with access controls. Then test isolation explicitly with cross-tenant evaluation cases, for example asking tenant A's assistant about tenant B's documents.
59. How do you design a GenAI system to degrade gracefully when the model provider fails?
Answer: Set timeouts and retries with exponential backoff and jitter for transient errors, but cap retries so you do not amplify an outage. Configure fallback to a secondary model or region through the gateway, with prompts already tested on the fallback model. Use circuit breakers to stop hammering a failing endpoint. Define a degraded mode: return search results with links instead of a generated answer, queue non-urgent jobs, or hand off to a human channel with a clear message. Watch rate limits proactively and request quota increases before launch peaks, not during them.
60. Synchronous chat versus asynchronous batch GenAI: how do architectures differ?
Answer: Synchronous chat optimises for latency: streaming, small contexts, fast models, tight timeouts and graceful degradation. Asynchronous batch work (summarising last night's tickets, extracting fields from thousands of documents, generating product descriptions) optimises for throughput and cost: queues, worker pools, provider batch APIs where available, larger or reasoning models, idempotent jobs with checkpoints, and a review step before results reach systems of record.
Real-world scenarios
61. Your RAG chatbot answers correctly in the demo but users report wrong answers in production. How do you investigate?
Answer: Demo questions were written by people who knew the documents; production questions are vaguer, use different vocabulary and cover content nobody tested. I would pull failing traces and classify each failure as retrieval, generation or data, then fix the largest bucket first.
What I would check:
- For each, check whether the correct document chunk appeared in the retrieved set.
- If not: parsing quality, chunking, missing documents, acronyms, need for hybrid search or query rewriting.
- If yes but the answer was wrong: prompt instructions, context ordering, too many chunks, model choice.
- Add every failure to the evaluation set before fixing.
Production consideration: Put retrieval metrics and groundedness on the dashboard so the next regression is caught by monitoring, not by users.
62. Consider a bank that wants a customer-facing assistant for credit card queries. What would you design and what would you refuse to build?
Answer: I would build a scoped assistant that answers product and policy questions from approved content with citations, and handles account-specific questions (balance, due date, transaction status) through authenticated read-only tools. I would not let it give personalised financial advice, approve limit changes or dispute outcomes without a human, or answer from model memory on fees and rates.
What I would check:
- Customer authentication and session binding before any account tool is exposed.
- Denied topics: investment advice, competitor comparison, anything outside cards.
- PII handling: masking in logs, minimum fields to the model, data residency terms.
- Grounding checks on every policy answer; fees must come from the current fee schedule.
- Compliance and risk sign-off on the evaluation set, including refusal cases.
Production consideration: Keep a complete audit trail of what the assistant said and which source supported it.
63. Monthly LLM spend tripled after a new feature launched. What do you do?
Answer: Find where the tokens go before optimising anything. Spend jumps usually come from a few causes: agent loops or retries, a prompt that grew (more history, more chunks, more tool definitions), a switch to a pricier model, or traffic from a single tenant or a bot.
What I would check:
- Break spend down by feature, model, tenant and endpoint from gateway or trace data.
- Compare input and output tokens per request before and after the launch.
- Look for request fan-out: how many model calls per user action.
- Check whether prompt caching hit rates dropped because dynamic content moved before static content.
Production consideration: Add per-feature budgets and anomaly alerts so the next spike is caught in hours, and route simple requests to a cheaper model after confirming quality on the evaluation set.
64. The assistant sometimes returns invalid JSON that breaks a downstream system. How do you fix it?
Answer: Move from "asking nicely" to enforcement. Use the provider's schema-constrained structured output if available, validate every response with a schema library, retry once with the validation error, and send persistent failures to a dead-letter queue instead of downstream.
What I would check:
- Which inputs trigger failures: long documents, unusual languages, output truncated by max-token limits.
- Whether the schema is too deep or has ambiguous optional fields.
- Whether the model was recently changed or upgraded.
Production consideration: Track schema validation failure rate as a metric; truncation at the output limit is a common hidden cause, and it shows up as a spike in failures on long inputs.
65. A user uploads a PDF and the assistant starts following instructions hidden in it. What happened and how do you respond?
Answer: That is indirect prompt injection: untrusted document content was treated as instructions. Immediate response: check what the assistant could actually do in that session (which tools, which data), confirm whether any action was taken or data exposed, and contain by disabling write tools for document-processing flows if needed.
What I would check:
- How document text is placed in the prompt: clearly delimited and labelled as untrusted data, or mixed with instructions?
- Whether an injection classifier or prompt-attack filter runs on extracted document text.
- Tool permissions in that flow; least privilege for the user, not the service account.
- Confirmation gates on consequential actions.
Production consideration: Add the malicious document to the red-team regression suite.
66. The business wants a reasoning model everywhere because it scored higher in a demo. How do you respond?
Answer: Agree to test it, and frame the decision as quality per rupee and per second on their own workload. Run the reasoning model and a fast model on the same evaluation set per task type.
What I would check:
- Quality difference per task type, not overall; reasoning often helps on a minority of hard cases.
- Latency percentiles against the user experience target.
- Cost per successful outcome at production volume, including reasoning tokens.
- Whether a router or cascade captures most of the quality gain at lower cost.
Production consideration: Present the results as a table to the business owner; a routed design often wins, and the decision is then made on evidence rather than a demo impression.
67. Consider a hospital that wants GenAI to summarise discharge notes. What are your design concerns?
Answer: This is clinical documentation, so the design is assistive with mandatory clinician review, never autonomous. The summary must be strictly grounded in the source notes, must not omit critical items (allergies, medication changes, follow-up instructions), and must flag uncertainty instead of guessing.
What I would check:
- Data handling: patient data stays in an approved region and provider agreement; access tied to the clinician's role.
- Structured sections for critical items, each with a link back to the source text.
- Evaluation with clinicians: omission rate and factual errors, not just fluency.
Production consideration: Measure omissions explicitly; in clinical settings a missing allergy is worse than an awkward sentence. Regulatory and hospital governance review belongs in the plan, not after launch.
68. Response times are fine on average but users complain the assistant is slow. What do you do?
Answer: Averages hide the tail. Look at time to first token and end-to-end latency percentiles, broken down by step and by request type.
What I would check:
- Is streaming enabled end to end, or does a proxy buffer the response?
- Which step dominates slow requests: retrieval, reranking, model, tools, or repeated agent iterations?
- Long inputs: users pasting large documents, or history growing unbounded.
- Provider throttling or rate-limit retries during peak hours.
Production consideration: Set a latency budget per step and alert on the slow tail. Perceived speed matters too: show progress ("searching policies") during tool calls.
69. Consider an insurer that wants to automate claim intake from emails with photos and PDFs. How would you approach it?
Answer: Treat it as a document and decision pipeline, not a chatbot. Classify the email, extract structured claim fields from text, attachments and photos, validate them against policy data, and create a draft claim for a handler to confirm. Automate the clean, high-confidence cases first.
What I would check:
- Field-level extraction accuracy on a labelled sample, especially policy numbers, dates and amounts.
- Confidence thresholds per field that decide auto-fill versus human review.
- Validation against the policy administration system through read-only tools.
- Handling of injected instructions or manipulated images in attachments.
Production consideration: Measure handler time saved and correction rate per field with the claims team; that is the business case, and it tells you which fields need work.
70. After a model upgrade, users say answers became longer and less precise. What do you do?
Answer: Roll back or reduce the new model's traffic if impact is significant, then compare old and new models on the evaluation set to quantify the change. New model versions often respond differently to the same prompt: different verbosity, refusal behaviour or format adherence.
What I would check:
- Length and format metrics old versus new on identical inputs.
- Whether the judge rubric captures conciseness; add it if not.
- Prompt adjustments: explicit length limits, examples of the desired style.
- Structured output and tool-call compatibility.
71. An internal knowledge assistant shows an employee content from an HR document they should not see. What went wrong?
Answer: Permissions were not enforced in retrieval. Usually documents were indexed with a service account that could read everything, and access-control metadata was either not captured or not filtered at query time. This is an incident: restrict the index, assess exposure from logs, and notify according to policy.
What I would check:
- Whether access-control lists were captured at ingestion for every source.
- Whether the retrieval query filters by the requesting user's groups, enforced server side.
- Permission sync: how quickly permission changes in the source reach the index.
- Caches or conversation memory that might replay restricted content.
Production consideration: Add permission test cases to the evaluation suite (same question, users with different roles, different expected answers), and run them on every ingestion change.
72. Consider a retailer that wants GenAI product descriptions for a large catalogue. How do you make it safe and scalable?
Answer: Run it as an asynchronous batch pipeline: structured product attributes in, descriptions out, generated only from those attributes so the model does not invent features, warranties or claims. Validate, sample-review and publish through the existing content workflow.
What I would check:
- Grounding: every claim maps to an attribute; banned phrases and unsupported claims are filtered.
- Brand tone via few-shot examples or a lightly tuned small model if volume justifies it.
- Regional languages: quality reviewed by native speakers, not only by an LLM judge.
- Human review sample size per category, higher for regulated categories such as health products.
Production consideration: Track post-publication corrections and customer complaints by category, and feed corrected descriptions back as examples.
73. A stakeholder asks you to fine-tune a model on all company documents so it "knows everything". How do you respond?
Answer: Explain that fine-tuning is poor at reliably storing facts: it cannot cite sources, it goes stale as documents change, it cannot respect per-user permissions, and removing a document later means retraining. Propose RAG over the documents with access control and citations, and reserve fine-tuning for behaviour gaps the evaluation reveals later.
What I would check:
- The actual questions users need answered and how often the content changes.
- Permission requirements across departments.
- Whether there is a format or style problem that fine-tuning might genuinely solve.
Production consideration: Offer a short pilot: RAG on one department's documents with an evaluation set, so the stakeholder sees cited answers and measured quality before larger decisions.
74. Consider a GCC IT team that wants an assistant to create and update ServiceNow tickets from chat. What controls do you add?
Answer: This is a tool-using application with write access, so the controls are about identity and blast radius. The assistant acts with the requesting employee's permissions, not a superuser account, and it shows a confirmation summary before creating or updating a ticket.
What I would check:
- OAuth or delegated identity so ServiceNow enforces the user's own access rights.
- Narrow tools: create_incident, add_comment, get_ticket_status, with validated fields and enums for category and priority.
- Idempotency keys so retries do not create duplicate tickets.
- Audit records linking each ticket change to the user, conversation and model output.
Production consideration: Exposing the tools through an MCP server lets other assistants reuse them with the same controls; measure tool-call accuracy (right tool, right arguments) as a first-class metric.
75. You are asked to take a GenAI proof of concept to production in a quarter. What is your plan?
Answer: Agree on the business outcome and success metric first, then harden the system in the order risk demands: evaluation, security and data access, reliability, observability, cost, and then rollout. A proof of concept proves possibility; production proves repeatability under real users, data and constraints.
What I would check:
- Owner, success metric and acceptance threshold signed off by the business.
- Evaluation set built from real queries with domain experts; baseline scores.
- Identity, permissions, PII handling, guardrails and a security review.
- Infrastructure as code, CI/CD with evaluation gates, environments and rollback.
- Tracing, dashboards, cost budgets, alerts and an on-call runbook.
- Pilot group, feedback loop, then staged rollout with go/no-go criteria.
Production consideration: Most delays come from data access approvals and security review, not model work, so start those in week one. This journey from AI demo to enterprise outcome is exactly what Forward Deployed Engineers do for customers; see how FDEs take AI from POC to production.
Want to practise these answers on real systems rather than slides? Cloudsoft's APEX AI, ML, Cloud and Cyber Security program covers Python, ML, GenAI, agentic AI and cloud deployment with hands-on projects, in classroom at Ameerpet or live online.
Key takeaways
- Fundamentals are tested through debugging: tokens, context budgets and sampling explain most cost, latency and consistency bugs.
- Facts come from context (retrieval and tools), behaviour comes from prompts and occasionally fine-tuning; keep that distinction sharp.
- Structured output and tool calling are where GenAI touches real systems, so validation, permissions and idempotency matter more than prompt wording.
- Choose models on your own evaluation set and cost per successful outcome; route between fast and reasoning models instead of picking one everywhere.
- Evaluation is the backbone: offline gates, online monitoring, calibrated LLM judges and a failure-harvesting loop.
- Security is architectural: assume injection can succeed and limit what the model can reach.
- Climb the LLM to multi-agent ladder only as far as the problem needs.
Interview preparation checklist
- Explain tokens, context windows, embeddings and temperature with one debugging story each.
- Build one RAG application with hybrid search, citations, access filtering and an evaluation set you can show.
- Build one tool-calling flow with schema validation, permission checks and a confirmation step.
- Run an LLM-as-judge evaluation and compare it with your own labels on a sample.
- Instrument an application with traces and show token cost per request.
- Try at least two model providers (for example Amazon Bedrock and Azure OpenAI) and compare quality, latency and cost on the same task.
- Prepare a whiteboard architecture for an enterprise assistant, including identity, guardrails and observability.
- Rehearse three scenario answers aloud: a production quality drop, a cost spike and a security incident.
- Read current platform documentation for the cloud the target employer uses; names and features change often.
FAQ
What does a GenAI engineer do?
A GenAI engineer designs, builds and operates applications that use large language models and other generative models, including prompts, retrieval pipelines, tool integrations, evaluation, guardrails, deployment and monitoring.
What skills are required for a generative AI engineer interview?
Python, APIs and backend fundamentals, LLM concepts such as tokens, embeddings and sampling, RAG, structured output and function calling, evaluation methods, security basics including prompt injection, and cloud deployment on at least one major platform.
How should I prepare for a GenAI engineer interview in 2026?
Build and deploy one or two real projects with evaluation and observability, practise explaining design trade-offs aloud, rehearse scenario questions on quality, cost and security, and read current documentation for the cloud platforms the employer uses.
Are generative AI interview questions different for freshers?
Yes. Freshers are mostly asked fundamentals, prompting, basic RAG and a project walkthrough, while experienced candidates face architecture, evaluation strategy, cost control and production incident scenarios.
Do I need machine learning or deep learning knowledge for GenAI roles?
Application-focused GenAI roles need a working understanding of how models are trained and why they behave as they do, but rarely require training models from scratch. Fine-tuning and model-serving roles need deeper ML knowledge.
Which programming language is most useful for GenAI engineering?
Python is the most common choice because most SDKs, frameworks and evaluation tools support it first. Java and TypeScript are also used in enterprise backends, so knowing how to call models from your team's main language helps.
What projects should I show in a generative AI interview?
A RAG assistant over real documents with citations and an evaluation set, a tool-calling application that safely reads and writes to a system such as a ticketing tool, and ideally one deployed project with tracing and cost tracking.
Is generative AI engineering a good career choice in 2026?
It suits engineers who enjoy combining software engineering, data and product thinking. The work is shifting from demos to production systems, so engineers who can evaluate, secure and operate GenAI applications are well placed.
How is a GenAI engineer different from a Forward Deployed Engineer?
A GenAI engineer focuses on building generative AI systems, usually inside a product or platform team. A Forward Deployed Engineer applies similar skills directly with customers, owning discovery, integration and deployment into their environment.
If you want structured, hands-on preparation across GenAI, ML, cloud and security, explore Cloudsoft's APEX program. If your goal is to deploy AI inside customer environments, FDE PRO, our AI Forward Deployed Engineer course, is a 12-week program with five enterprise projects and the GlobalBank capstone, with placement support until you're placed. Prefer a focused technical course? The AI, GenAI and Agentic AI course is another route. Classes run in Ameerpet, beside Ameerpet Metro, or live online; book a free demo on +91 96660 19191.



