“Your chatbot is confidently giving wrong answers in production. What do you do?”
Some candidates freeze at this question. They can explain what RAG stands for, but they have never had to work out why retrieval failed, why the bill doubled, or why users are getting wrong answers. That gap is exactly what interviewers are probing.
This guide covers GenAI interview questions for experienced developers at the 3-year and 5-year levels. Every question comes with what the interviewer is really testing, a sample answer, and a common mistake. Have 3 years of experience? Read Level 1, then Level 2 to see where interviews head next. Have 5 years? Skim Level 1 as a warm-up, since fundamentals still get asked, then spend your time on Level 2.
How interviewers judge 3 years vs 5 years in GenAI roles
Most product-engineering GenAI interviews are not machine learning research interviews. Interviewers want someone who can connect solid software engineering skills to LLM-based features. The difference between 3 and 5 years is not a longer list of tools. It is how much ownership you can show.
| Area | 3 years experience | 5 years experience |
|---|---|---|
| What they expect you to know | Build APIs, use LLMs, embeddings, basic RAG, prompting | Design production systems; handle evaluation, reliability, security and scale |
| Depth of answers | Explain concepts and how you implemented a feature | Explain decisions, alternatives, limitations and operational trade-offs |
| Typical question style | Fundamentals, coding tasks, feature implementation | Scenarios, architecture, debugging, system design, optimization |
| What gets you rejected | Tutorial-level knowledge, weak coding, can’t explain your own project | Poor design decisions, ignoring security or cost, no evaluation strategy, no ownership |
At 3 years, you should be able to build and ship a working LLM feature inside an existing application. At 5 years, you should be able to explain how to make that feature reliable, secure, measurable and affordable for real users.
The questions below are representative of common interview patterns, not a script from any particular company.
Level 1: LLM interview questions for 3 years experience
Expect follow-ups about implementation, not just definitions.
1. What are tokens and context windows, and why do they matter?
What they’re testing: whether you understand the practical limits of an LLM request.
Strong answer: Tokens are the chunks of text a model reads and writes: whole words, parts of words or punctuation. The context window is the most the model can handle in one request, and everything counts against it: system instructions, conversation history, retrieved documents and the reply. Overfill it and the request fails or gets truncated. Stuff it with marginal content and cost goes up while the model has a harder time focusing on what matters. So I trim old history, retrieve only relevant passages and cap output length.
Common mistake: Treating a token as one word, or assuming a bigger context window automatically gives better answers.
Likely follow-up: How would you shrink the context without losing what the model needs?
2. What are temperature and top-p, and how do you choose them?
What they’re testing: whether you tune generation deliberately instead of accepting defaults.
Strong answer: Temperature controls how predictable or varied the output is. Lower values give more focused responses, higher values give more variety. Top-p (nucleus sampling) limits sampling to the smallest set of likely tokens whose combined probability reaches a threshold. For extraction or structured output I start low and test; for brainstorming I allow more variety. I usually adjust one of the two, not both, and I check the provider’s documentation because some models restrict or ignore these settings.
Common mistake: Believing low temperature guarantees accuracy. It makes output more consistent, not more correct, and results can still vary between runs.
3. Why do LLMs hallucinate, and how do you reduce it in a real app?
What they’re testing: whether you can tell fluent output from verified information.
Strong answer: An LLM generates likely text from learned patterns. It does not check each claim against reality. When context is missing or ambiguous, it can produce a confident, plausible and wrong answer. In an app I ground answers in retrieved sources, instruct the model to say when the sources don’t contain the answer, narrow what it is allowed to answer, validate critical outputs, and fall back to a safe response or a human. I also keep a list of known failure cases and test them on every change.
Common mistake: Relying on a prompt line like “never make things up.” Hallucination can be reduced, never eliminated.
Likely follow-up: What if the retrieved documents are themselves outdated or wrong?
4. Which prompt techniques actually matter in real development?
What they’re testing: whether you treat prompts as part of application design, not clever wording.
Strong answer: Three do most of the work. System instructions set the role, rules and boundaries. Few-shot examples show the expected input-output behavior when it is hard to describe. Structured output, such as a JSON schema, gives the application something it can validate. Beyond that, I version prompts, avoid contradictory rules, and test changes against representative inputs before shipping.
Common mistake: One giant prompt full of conflicting rules, expected to solve every edge case.
5. What are embeddings, and how does semantic search work?
What they’re testing: whether you grasp the idea behind vector retrieval.
Strong answer: Embeddings are numeric vectors that represent text so that similar meanings land close together, even when the wording differs. For semantic search I embed the documents once, embed each query with the same model, and rank documents by a similarity measure such as cosine similarity. That finds content by meaning, not just exact keywords.
Common mistake: Saying semantic search always finds the right answer, or mixing embeddings from different models in one index.
Likely follow-up: Why might keyword search find a document that semantic search misses?
6. What is RAG, and when would you use it instead of just prompting?
What they’re testing: whether you can pick the right architecture for knowledge-based features.
Strong answer: RAG (retrieval-augmented generation) searches a knowledge source first, then passes the relevant content to the LLM as context for its answer. I use it when answers depend on company documents, frequently changing information or data the model was never trained on. For simple transformations like summarizing text that is already in the prompt, plain prompting is enough.
Common mistake: Adding a vector database to every AI feature, even when one API call would do.
7. RAG vs. fine-tuning: how do you decide?
What they’re testing: whether you know they solve different problems.
Strong answer: RAG supplies knowledge at request time. Fine-tuning changes the model’s behavior through additional training on examples. For frequently updated policies, I start with RAG because I can update the data without retraining anything. I consider fine-tuning when I need a consistent style, format or task behavior that prompting can’t deliver reliably. Before choosing, I compare quality, data requirements, maintenance effort and cost.
Common mistake: Fine-tuning a model to “memorize” documents that change regularly.
8. How does tool calling work, and what can go wrong?
What they’re testing: whether you understand how an LLM connects to real application actions.
Strong answer: The model can request a predefined action, such as a database search or an order lookup, usually as structured output. My application decides whether to run it. I define strict schemas, validate every argument, check the user’s permissions, handle failures, and never let the model trigger sensitive operations without application-level checks.
Common mistake: Trusting a tool request because it is well formatted.
Likely follow-up: How would you stop the model from requesting an action on another user’s account?
9. How do you call an LLM API reliably in production?
What they’re testing: whether you apply ordinary backend discipline to an AI service.
Strong answer: I wrap the call in a service layer with timeouts, retries for transient errors with exponential backoff, and rate-limit handling. I stream where it improves the experience and handle interrupted streams. I validate structured output instead of trusting returned JSON, track token usage and cost, and log metadata without leaking sensitive data. If a request can trigger side effects, I make sure a retry cannot repeat the action.
Common mistake: Retrying every error forever, or treating an HTTP 200 as proof the answer is valid.
Level 2: GenAI interview questions for 5 years experience
These questions are less about terminology and more about architecture, operational judgment and failure handling. This is where your backend and system design experience pays off.
1. Design a RAG system for a company’s internal documents.
What they’re testing: whether you can design the whole retrieval pipeline, not just plug a vector database into an LLM.
Strong answer:
- Ingestion: Extract text, metadata, ownership and access permissions from PDFs and internal pages.
- Chunking: Split by meaningful sections, keep headings, and test chunk sizes instead of guessing.
- Indexing: Store embeddings with chunk metadata, and keep a keyword index alongside.
- Hybrid retrieval: Combine semantic and keyword search so meaning-based queries and exact terms like policy names or product IDs both work.
- Reranking: Reorder candidates with a more precise relevance step before they reach the model.
- Freshness: Version documents, re-index on change, and remove deleted content.
- Access control: Filter by user permissions at retrieval time so restricted content never reaches the prompt.
- Generation: Pass the best passages with clear instructions and require citations.
- Evaluation: Test retrieval and answer quality on a question set, including questions the system should decline.
I would track latency and cost per stage and fix the weakest stage first.
Common mistake: Fixing chunk size, embedding model and retrieval count once, then never measuring their effect.
Likely follow-up: What happens when an answer spans several documents?
2. How do you evaluate an LLM application when outputs are non-deterministic?
What they’re testing: whether you can define and measure quality instead of trusting a good demo.
Strong answer: I start with a golden dataset: representative inputs paired with expected answers, source documents or scoring criteria. I re-run it whenever the prompt, model, retrieval logic or code changes. Automated checks cover correctness, relevance, format and whether the answer is supported by the retrieved context, while human review covers subjective cases. An LLM-as-judge scales well but needs validating, because judges can favor fluent or longer answers and share blind spots with the model being tested. Every production incident becomes a new regression case.
Common mistake: Judging quality from a few hand-picked prompts.
Likely follow-up: What do you do when the automated judge and a human reviewer disagree?
3. Answers got worse after a release. How do you debug it?
What they’re testing: whether you have a systematic troubleshooting process.
Strong answer: First find out what changed and which requests are affected. Then work through the layers:
- Diff the model, prompt, parameters, application code and dependencies.
- Compare retrieval results for the same questions. Are documents missing or irrelevant?
- Check how the context is built: truncation, ordering, formatting.
- Run the old and new versions against the same evaluation set.
- Read the failures to see whether the cause is retrieval, generation, parsing or application logic.
- Roll back or disable the change if users are being hurt.
- Fix the cause and rerun regression tests before releasing again.
Change one variable at a time, or you will never know which one caused the regression.
Common mistake: Rewriting the prompt before checking whether the data, retrieval or deployment changed.
4. How do you reduce LLM cost and latency without hurting quality?
What they’re testing: whether you can optimize with trade-offs in mind.
Strong answer: I measure where time and money go first. Then I cache repeated requests where it is safe (including provider-side prompt caching where available), route simple tasks to smaller models, trim context, cap output tokens, tighten retrieval, and batch suitable workloads, accepting longer waits for individual requests. Streaming makes responses feel faster but does not reduce total processing time. I compare every change against a baseline evaluation set so savings do not quietly degrade answers.
Common mistake: Switching to the cheapest model or cutting context without measuring quality.
5. What is prompt injection, and how do you defend against it?
What they’re testing: whether you know LLM apps carry security risks beyond ordinary API vulnerabilities.
Strong answer: Prompt injection is when instructions hidden in input try to override the app’s intended behavior. They can come directly from a user or indirectly from content the system reads, such as a retrieved document telling the model to reveal confidential data. I treat user input and retrieved text as untrusted, keep system instructions separate, give tools narrow permissions, enforce authorization outside the model, validate outputs, and keep secrets out of the context. I also test adversarial cases. No single prompt fully prevents injection, so the defense is layered.
Common mistake: Assuming “ignore malicious instructions” in the system prompt is enough.
Likely follow-up: Why can a retrieved document be dangerous even if the user typed nothing malicious?
6. How would you design an AI agent that uses tools safely?
What they’re testing: whether you can build a controlled workflow around a model that takes actions.
Strong answer: I give the agent a limited set of tools with clear schemas and scoped permissions. An orchestration layer validates requests, enforces authorization, tracks state and caps the number of steps. Actions with side effects, such as refunds or account changes, need confirmation or an independent policy check. Typical failures are wrong tool choice, invalid arguments, loops, stale information, runaway cost and duplicate actions. MCP-style standards give systems a consistent way to expose tools and context, but a standard interface does not make a tool safe.
Common mistake: Granting broad permissions and trusting the agent to always pick the right tool.
Likely follow-up: How do you stop an agent from repeating the same failed call?
7. Prompting vs. RAG vs. fine-tuning vs. a smaller model: how do you choose?
What they’re testing: whether you decide from the problem, not from trends.
Strong answer: I start with the simplest option that meets the requirements:
- Prompting: the task can be solved with instructions and context you already have.
- RAG: answers need external or frequently updated knowledge.
- Fine-tuning: you need consistent behavior or format and simpler options fall short.
- Smaller model: the task is narrow, cost or latency matters, and evaluation shows quality holds.
I compare the options on a representative dataset, along with security needs, operational complexity and total cost.
Common mistake: Starting with fine-tuning or a multi-agent setup before understanding the actual problem.
8. How do you handle PII, privacy and compliance when sending data to third-party models?
What they’re testing: whether you treat data protection as an architectural responsibility.
Strong answer: I classify the data and work out what the task actually needs. PII is information that can identify a person, such as contact details or personal records. I minimize what is sent, redact or pseudonymize sensitive fields, use approved providers and configurations, and review retention, access, logging and data-processing terms. Data should be protected in transit and at rest. The exact controls depend on company policy, contracts and law, for example India’s DPDP Act, 2023 or GDPR for EU users, so I would involve security and legal early.
Common mistake: Scrubbing sensitive data from logs while still sending it to the model unnecessarily.
9. What would you monitor in production for an LLM feature?
What they’re testing: whether you know how to operate AI features after launch.
Strong answer: LLM observability means being able to understand and investigate an AI app’s behavior from traces, metrics, evaluations and user feedback. I would monitor latency, errors, token usage and cost, output validation failures, refusal rates and user feedback. For RAG I would also track retrieved document IDs, relevance and context size, and trace each request across retrieval, generation and application logic. Logs should not store sensitive content unnecessarily. Dashboards and alerts catch regressions, and traces help investigate individual failures.
Common mistake: Watching only uptime and latency, not whether answers are useful or correct.
Likely follow-up: How do you track quality when users give no feedback?
10. System design: build an AI support assistant that answers from docs, looks up orders and escalates to a human.
What they’re testing: whether you can combine retrieval, APIs, security, workflow and user experience into one coherent system.
Strong answer:
- Entry point: A chat API authenticates the user and keeps conversation state.
- Intent handling: Decide whether the user needs a knowledge answer, an order lookup or a human. An LLM can help classify, but application rules validate the result.
- Knowledge answers: For returns, shipping and product questions, retrieve approved support documents with hybrid search and answer from them, with citations where possible.
- Order lookup: Expose one narrowly scoped order tool. The backend checks the user’s authorization and returns only permitted data. The model cannot bypass it.
- Escalation: If the answer is unsupported, the topic is sensitive, the user asks for a person, or the system keeps failing, create a ticket and pass along the conversation context.
- Reliability: Timeouts, safe retries, rate limits, fallback replies and duplicate-action protection.
- Measurement: Track answer quality, lookup success, escalation rate, latency, cost and user feedback.
I would launch with a small set of supported intents and expand based on evaluation and production results.
Common mistake: Designing everything around the LLM and forgetting that authentication, order APIs and ticketing must stay under backend control.
Two quick hands-on tasks you may be asked to code
Some interviews skip the architecture talk and ask for a small function. These tests show whether you can handle the basics without a framework doing the work.
Task 1: Call an LLM API with retry and validate the JSON
import json, time
def call_json(client, prompt, required_keys=(), retries=3):
for attempt in range(retries):
try:
data = json.loads(client.generate(prompt)) # placeholder client
if not isinstance(data, dict) or not all(k in data for k in required_keys):
raise ValueError("Invalid JSON structure")
return data
except (TimeoutError, ValueError): # JSONDecodeError is a ValueError
if attempt == retries - 1:
raise
time.sleep(0.5 * 2 ** attempt)
The retry waits 0.5 seconds, then 1 second (exponential backoff). Parsing catches malformed JSON, and the key check catches valid JSON with the wrong shape. client.generate() is a placeholder for whatever client you use. In production, also separate transient API errors from malformed output, since retrying a bad prompt rarely helps, and add a little random jitter to the wait.
Task 2: Calculate cosine similarity between embeddings
import math
def cosine_similarity(a, b):
if len(a) != len(b):
raise ValueError("Vector lengths must match")
dot = sum(x * y for x, y in zip(a, b))
na = math.sqrt(sum(x * x for x in a))
nb = math.sqrt(sum(y * y for y in b))
if na == 0 or nb == 0:
return 0.0
return dot / (na * nb)
print(cosine_similarity([1, 0, 1], [1, 1, 0])) # about 0.5
Cosine similarity compares the direction of two vectors, which is why retrieval systems use it to rank embeddings by closeness. How useful a score is depends on the embedding model and your data.
Beyond correctness, interviewers watch how you handle edge cases, explain trade-offs aloud, and keep code readable without overcomplicating it.
How to answer any GenAI question in an interview
When a question stumps you, do not start listing technologies. Use four steps:
- Clarify the goal and constraints: What are we building, and who uses it? What matters most: accuracy, speed, privacy or cost?
- State your approach: Name the architecture or technique and why it fits.
- Name the trade-offs: Cover alternatives, failure modes and what your solution does not solve.
- Explain measurement: Say how you would test it, monitor it and decide it is working.
Asked to design a RAG application, don’t jump straight to embeddings and a vector database. Ask about the documents, access permissions and expected answer quality first, then explain the pipeline, trade-offs and evaluation. A structured answer beats a long list of buzzwords.
One project that will carry your interview
Build a small RAG assistant over a set of PDFs. Give it document ingestion, chunking, embedding-based retrieval, citations and a basic chat interface. Add an evaluation script with questions, expected source documents and criteria for judging answers. Keep a simple log of retrieval results, failed questions, latency and approximate cost.
The project works because it gives you something concrete to discuss. You can explain how you chose chunk sizes, why a question failed, what you changed, and how you checked that the change helped.
Most first RAG projects break in the same few places. Chunks get split mid-sentence, so the answer is cut in half. The right document is retrieved but ranked too low to reach the model. The model answers confidently even when the documents say nothing relevant. And cost creeps up because every request carries too much context. Write down each failure you hit and what you changed. “Here is what broke and how I fixed it” is the answer interviewers remember.
You don’t need an enterprise platform. You need a project you understand well enough to defend when the interviewer starts changing the requirements.
Conclusion
Prepare for GenAI interviews the way you prepare for backend or system design interviews: learn the fundamentals, write code, explain trade-offs and show how you handle failure. Start with the 3-year questions if your LLM experience is limited, then practice the 5-year scenarios to build engineering judgment. This week, build one small RAG project, test it with deliberately hard questions, and be ready to explain three things that broke and how you fixed them.
FAQ
Are GenAI interview questions different for experienced developers?
Yes. Experienced candidates are expected to link AI concepts to software engineering: APIs, retrieval, reliability, security, evaluation, debugging and system design, not just model definitions. Your backend or full-stack experience is an asset when you can explain how you would adapt those systems for LLMs.
Do I need machine learning or maths knowledge for a GenAI developer role?
For most application-focused roles, you need a practical grasp of embeddings, similarity, model behavior and evaluation, not advanced mathematics or training models from scratch. Research and specialized ML roles go deeper, so read the job description instead of assuming every AI role is the same.
Is LangChain or any specific framework required?
No. Frameworks speed up retrieval, tool calling and orchestration, but interviewers care more about whether you understand the components underneath and can justify your choice. Learn one framework through a project, and be able to explain what happens without it.
Can a Java developer move into GenAI roles?
Yes. Java experience with APIs, concurrency, databases and service architecture transfers directly to GenAI application work, and you can call model APIs and retrieval systems from Java services. Some roles and tools favor Python, so expect to learn enough of it to follow examples and write small scripts.
How long does it take to prepare for GenAI interviews?
As a rough guide, a developer with solid backend experience can cover the fundamentals and build one small RAG project in about three to four weeks of steady practice. It takes longer if Python or API work is new to you. Use mock interviews to find your gaps.
- GenAI / LLM Interview Questions for Experienced Developers (3 and 5 Years Experience) - November 24, 2026
- Is Prompt Engineering (Natural Language) the New Programming Language? - November 24, 2026
- What is Python? A Beginner-Friendly Introduction with Real-World Examples - July 4, 2026


