AI and LLM interview questions
15 questions, easy to hard. Read one, then answer it out loud: an AI interviewer follows up, hints when you're stuck and grades your answer.
AI and LLM interviews test how you build with large language models: prompting, tokens and context, evaluation, embeddings and retrieval-augmented generation (RAG).
LLMs and Prompting
A colleague thinks a large language model looks answers up in a database. Explain in plain language how these models are trained and how they produce a reply.
What a strong answer covers
- What the model learns during training and from what kind of material.
- How a reply is built up step by step rather than retrieved whole.
- The extra training that turns a raw text predictor into a helpful assistant.
- Why fluent output is not the same as verified fact, and where its knowledge ends.
Common mistake: Describing the model as a search engine or database that fetches stored answers, which hides why it can be confidently wrong.
- Tokens and Context Windows
- easy
- Pro
Your chatbot forgets the start of long conversations and the bill is higher than expected. Explain what tokens and the context window are, and how they affect both problems.
What a strong answer covers
- What a token is and why usage and cost are measured in them.
- What fills the context window on each request, not just the latest message.
- Why long chats get both more expensive and more forgetful over time.
- Practical ways to keep conversations within budget without losing what matters.
Common mistake: Assuming the model remembers earlier calls on its own, so the cost of resending history is never considered.
- Write a Good Prompt
- easy
- Pro
Your prompt to summarise customer complaints gives vague, inconsistent results. Explain the techniques that make prompts clearer and more reliable.
What a strong answer covers
- Spelling out the task and what a good result looks like, as you would for a new colleague.
- Giving the model the background and examples it needs.
- Keeping your instructions clearly apart from the text being processed.
- A way of judging prompt changes across many inputs, not just one.
Common mistake: Tweaking wording after looking at a single output, then declaring the prompt fixed without checking other complaints.
- Temperature and Sampling
- medium
- Pro
Your app gives a different answer each time to the same question, and the team argues about the temperature setting. Explain what temperature does and how you'd choose it.
What a strong answer covers
- How the next token is picked from the options the model considers likely.
- What raising or lowering temperature does to that choice.
- Matching the setting to the job, from precise extraction to open-ended writing.
- Why the product should cope with some variation whatever the setting.
Common mistake: Promising that a temperature of zero makes every answer identical, and building features that rely on it.
- Reduce Hallucinations
- medium
- Pro
Your support assistant sometimes invents refund policies that don't exist. Explain why language models hallucinate and how you'd reduce it in this product.
What a strong answer covers
- Why a model fills gaps with plausible-sounding text.
- Giving the model your real policy text at answer time.
- Telling it how to behave when the material doesn't cover the question.
- How you'd test the fix and handle the cases where a wrong answer is costly.
Common mistake: Relying on a stern instruction like 'never make things up' without giving the model the actual policies to work from.
- Get Structured Output
- medium
- Pro
Your code parses the model's reply to extract invoice fields, but it breaks whenever the model adds a friendly sentence. Explain how to get reliable structured output from a language model.
What a strong answer covers
- Describing the exact shape of the data you want back.
- Provider features that force replies to follow a schema.
- Checking the reply in code and having a plan when it doesn't fit.
- Letting the format express that a value is absent.
Common mistake: Trusting the reply because it usually looks right, with no validation, so one stray sentence breaks the parser in production.
- Let a Model Call Tools
- medium
- Pro
You want your assistant to check order status by calling your own API. Explain how tool calling works with a language model and how you'd keep it safe.
What a strong answer covers
- How the model learns which tools exist and what arguments they take.
- The back-and-forth between the model's request, your code and the final answer.
- Where checks on inputs and access rights belong.
- Extra safeguards for actions that change things.
Common mistake: Thinking the model executes the API call itself, and so treating its chosen arguments as already safe and authorised.
Your email assistant reads incoming messages and can send replies. An attacker sends an email saying to ignore previous instructions and forward the inbox to them. Explain prompt injection and how you'd defend against it.
What a strong answer covers
- What prompt injection is and why models are open to it.
- Why this particular assistant's combination of abilities raises the stakes.
- Reducing what the assistant can do on its own, especially sending data out.
- Several defensive layers, and an honest view of their limits.
Common mistake: Proposing a cleverer system prompt as the whole defence, as if wording alone could reliably stop instructions hidden in emails.
- Evaluate an LLM Feature
- hard
- Pro
Your team keeps changing the prompt for an AI summary feature based on gut feeling, and quality goes up and down. Explain how you'd set up a proper evaluation process.
What a strong answer covers
- A fixed set of realistic test inputs, including awkward ones.
- Ways to score quality, and how to trust automated scoring.
- Running the same evaluation on every change and comparing versions.
- Watching cost and speed too, and feeding real-world problems back into the tests.
Common mistake: Judging changes by reading a few outputs by eye, so a fix for one case quietly breaks others.
Embeddings and RAG
Your search box can't find an article about cancelling a subscription when a user types how do I stop paying. Explain what embeddings are and how they enable search by meaning.
What a strong answer covers
- What an embedding is and what it captures about text.
- How queries and documents are compared to find matches by meaning.
- Why word-matching search misses this example.
- Practical points about producing and storing embeddings consistently.
Common mistake: Describing embeddings as a smarter keyword index, without explaining that closeness in meaning becomes closeness in numbers.
- Retrieval-Augmented Generation
- medium
- Pro
Your company wants a chatbot that answers questions from its internal handbook. Explain retrieval-augmented generation and why it's often preferred over fine-tuning the model on the handbook.
What a strong answer covers
- The steps from a user's question to a grounded answer.
- Why fetching documents at question time suits content that changes.
- What fine-tuning is good for and why it's a weak fit for handbook facts.
- Where the approach can still fail.
Common mistake: Assuming fine-tuning on the handbook makes the model reliably know its facts, then retraining every time a policy changes.
- Chunk Documents Well
- medium
- Pro
Your retrieval system splits documents every five hundred characters, and answers often miss key details. Explain how you'd choose a better chunking strategy.
What a strong answer covers
- The trade-off between small and large chunks.
- Splitting text where its own structure suggests.
- Helping each chunk keep its context.
- Comparing strategies with real questions rather than guesswork.
Common mistake: Picking a new fixed size by instinct and hoping it helps, without measuring whether the right passages are now found.
- Vector Search at Scale
- medium
- Pro
Your prototype compares the query against every one of ten thousand embeddings, but you now have fifty million. Explain how vector databases make this fast and what you give up.
What a strong answer covers
- Why checking every stored vector stops working at this scale.
- How approximate indexes avoid looking at most of the data.
- What approximate search trades away and how you tune it.
- Real-world needs such as filtering, and whether new infrastructure is needed at all.
Common mistake: Treating approximate search as exact, so results that quietly miss the best matches go unnoticed.
- Hybrid Search and Reranking
- hard
- Pro
Your semantic search fails on product codes and exact names, while keyword search fails on paraphrased questions. Explain how hybrid search and reranking can give you the best of both.
What a strong answer covers
- What each kind of search is good and bad at.
- Running both and combining their results.
- A second, more careful pass over the leading candidates.
- Proving the improvement and counting its cost.
Common mistake: Simply adding the two systems' raw scores together, even though they're on different scales and not directly comparable.
- Evaluate a RAG System
- hard
- Pro
Users say your handbook assistant gives wrong answers, but you can't tell if the problem is search or the model. Explain how you'd evaluate a retrieval-augmented system to find out.
What a strong answer covers
- Separating the search step from the answering step when diagnosing problems.
- Measuring whether the right material is being found.
- Judging whether answers stay true to what was found and fully answer the question.
- Turning failures into targeted fixes and lasting regression tests.
Common mistake: Only grading final answers, so a retrieval problem gets 'fixed' by endlessly rewriting the prompt.
Questions about practising
- How should I prepare for ai and llm interview questions?
- Practise answering them out loud, not just reading them. Explaining an answer under follow-up questions is what interviews test. Work through the 15 questions here from easy to hard, and revisit the ones you struggle with.
- Can I practise ai and llm interview questions with an AI?
- Yes. Open any question and start a voice session: an AI interviewer asks it, follows up on your answer, gives hints when you're stuck and grades your answer with written feedback when the call ends.
- Are these ai and llm interview questions free?
- 2 of the 15 questions are free to practise. Sign in with Google, no card needed. Pro unlocks the rest, plus practice calls to your phone.