Preparation · Software engineering

LLM interview questions for software engineers: 15 questions with answers

Laptop on a dark desk showing a glowing neural network visual, representing AI and LLM concepts

A few years ago, AI questions came up only if you applied for a machine learning role. Now they show up in ordinary backend and full-stack interviews, usually as "how would you add an LLM feature to this product?"

You do not need a research background. You need the vocabulary, a few working ideas, and the habit of talking about trade-offs. The questions below are grouped by what interviewers are testing.

How to answer these well

  • Lead with the trade-off, then your choice. "It depends on X and Y, so I would start with Z" beats a definition.
  • Use one real example, even a small side project.
  • Say what you have not used. Interviewers can tell when someone is bluffing about tools they only read about.
  • Mention cost, latency and failure, because software roles care about all three.

Part 1: Fundamentals

1. What is an LLM, in plain words?

A model trained on a very large amount of text to predict the next token. That simple objective is why it can write, summarise and answer questions, and also why it can sound confident while being wrong.

2. How is calling an LLM different from calling a normal API?

A normal API returns the same output for the same input. An LLM is probabilistic, can be wrong with confidence, is slower, and is billed per token. You design around that with validation, retries, timeouts and fallbacks.

3. What are tokens, and why do they matter?

Tokens are the chunks of text a model reads and writes. Cost, speed and the context limit are all measured in tokens, so long prompts cost more and respond slower. Trimming what you send is one of the cheapest optimisations.

4. What is a context window?

The maximum amount of text, input plus output, the model can handle in one request. Past that you must shorten, summarise or retrieve only what is relevant.

5. What does temperature do?

It controls randomness. Lower values give more consistent answers and suit extraction or classification. Higher values give more varied output and suit brainstorming.

Part 2: Prompting and retrieval

6. What is prompt engineering, and what actually helps?

Giving clear instructions, relevant context and examples of the output you want. In practice: be specific, state the output format, give two or three examples, and test on real inputs instead of guessing.

7. What is RAG, and when would you use it?

Retrieval-augmented generation fetches relevant documents first and gives them to the model along with the question. Use it when answers must come from your own data, the data changes often, or you need the model to point to a source.

8. RAG or fine-tuning?

Start with RAG and good prompts. Fine-tune when you need a consistent style or format, or the task is narrow and you have good training data. RAG is usually cheaper to update, because changing a document is easier than retraining.

9. How do embeddings and vector search work, in one minute?

An embedding turns text into a list of numbers so that similar meanings sit close together. You embed your documents, store them in a vector index, embed the question, and fetch the nearest chunks. Chunk size and overlap affect quality a lot.

10. A RAG system gives wrong answers. How do you debug it?

Separate retrieval from generation. First check whether the right chunk was retrieved. If not, fix chunking, embeddings or search. If it was retrieved and the answer is still wrong, fix the prompt or the instructions about using the context.

Part 3: Reliability, cost and safety

11. How do you reduce hallucinations?

Give the model the source material, tell it to say when it does not know, keep the task narrow, and check the output where a wrong answer is costly. Never present model output as fact without checks when the stakes are high.

12. How do you handle latency in an LLM feature?

Stream the response so users see text early, keep prompts short, cache repeated work, and use a smaller model when quality allows. Perceived speed often matters more than total time.

13. How do you evaluate whether the feature is good?

Build a small test set of real examples with expected answers, run it on every change, and track failures over time. "I would try it and see" is the weak answer.

14. How would you control cost?

Measure tokens per request, cap input and output length, cache common results, route simple tasks to cheaper models, and set per-user limits.

15. What are the risks of putting user data into an AI feature?

Privacy, data retention by the provider, prompt injection, and leaking one user's data into another's context. Decide what is sent and what is stored, and treat model input as untrusted.

A short system design example

A common prompt: "Design a support assistant that answers customer questions from our help articles."

A good answer walks through:

  1. Data: split articles into chunks and index them for retrieval.
  2. Query path: take the question, retrieve the best chunks, build a prompt with those chunks, call the model and stream the answer.
  3. Guardrails: if retrieval finds nothing relevant, say so instead of guessing. Add links to sources.
  4. Evaluation: a test set of real questions, plus a thumbs-up and thumbs-down signal from users.
  5. Operations: timeouts, retries, rate limits, logging that avoids personal data, and a cost dashboard.

You do not need to name specific products to score well. Explaining why each piece exists is what counts. For a general framework, see our system design interview questions guide.

Common mistakes

  • Giving definitions and no trade-offs.
  • Saying "just use the latest model" without discussing cost or latency.
  • Ignoring evaluation.
  • Claiming experience with tools you have only read about.
  • Forgetting privacy and failure handling.

How to prepare in a week

  1. Build a small RAG app over a document set you know, even a handful of PDFs.
  2. Break it on purpose and note what fails.
  3. Write down your answers to the 15 questions above in your own words.
  4. Say three of them aloud in 60 seconds each.
  5. Prepare one honest story about something an AI tool got wrong and how you caught it.

If your coding round allows AI tools, read AI-allowed coding interviews and how to prepare as well.

Frequently asked questions

Do I need to know machine learning maths?

Not for most software roles. Know the concepts and trade-offs, not the equations.

Which model or framework should I learn?

The concepts transfer. Build one small project with any major provider's API and understand it end to end.

Will these questions replace DSA rounds?

Not yet. They are added on top, usually in a design or discussion round.

Are these asked to freshers?

Basic ones sometimes are, usually about how you used AI tools in your projects.

What if the interviewer asks about a tool I have not used?

Say so, then explain the concept it implements and how you would learn it.

How deep do I need to go on transformers?

Know that attention lets the model weigh different parts of the input, and why that makes context length costly. Deeper detail is only for ML roles.

What project should I build to prove this?

A small RAG app with an evaluation set and a cost estimate. It covers most of the questions above.

Related reading: the best AI interview assistants in 2026 and AI-allowed coding interviews.

These topics sound simple on paper and come out messy in speech. Qevra AI gives new accounts 10 free minutes to practise aloud, then ₹3/min.

Practise AI and LLM interview answers out loud

Explore Qevra AI