A 5-step way to answer any generative AI question
- Define it. One plain sentence on what the concept is.
- Explain how it works. The mechanism, at the level an engineer needs.
- Name the trade-off. Quality, cost, latency, control or risk.
- Show how to measure. The metric or test you would use.
- Give an example. A product situation where it matters.
Contents: Fundamentals (questions 1 to 4) · Building products (questions 5 to 8) · Evaluation, safety and cost (questions 9 to 14)
Fundamentals (questions 1 to 4)
1. How does a large language model generate text?
- It predicts a probability distribution over the next token given the previous tokens.
- A decoding strategy picks a token, which is appended, and the process repeats.
- Pretraining on large text corpora teaches general patterns; post-training such as instruction tuning and preference tuning shapes behavior.
- Generation stops at an end token or a length limit.
Common pitfall: Saying the model looks up answers in a database.
2. How do diffusion models generate images?
- Training teaches a network to remove noise from noised images step by step.
- Generation starts from random noise and repeatedly denoises toward an image.
- Text conditioning guides the process, often with classifier-free guidance.
- Many systems run diffusion in a compressed latent space for efficiency.
Common pitfall: Describing diffusion as a single-step generator.
3. What do temperature and top-p control?
- Temperature rescales the token distribution: lower is more deterministic, higher is more varied.
- Top-p samples only from the smallest set of tokens whose cumulative probability reaches p.
- Use low temperature for extraction and classification, higher for creative tasks.
- Change one at a time and evaluate.
Common pitfall: Thinking temperature 0 guarantees identical outputs in every serving setup.
4. What are tokens and why do they matter?
- Tokens are the units the model reads and writes, often subword pieces.
- Pricing, context limits and latency are counted in tokens.
- Different languages and formats use different numbers of tokens for the same content.
- Count tokens with the model's tokenizer instead of estimating from characters.
Common pitfall: Assuming one word equals one token.
Building products (questions 5 to 8)
5. When do you use prompting, RAG or fine-tuning?
- Prompting first: fastest and cheapest to iterate.
- RAG when the model needs private, large or changing knowledge, with citations.
- Fine-tuning for consistent format, style or narrow behavior that prompting cannot reach.
- They combine: a fine-tuned model can still use RAG.
Common pitfall: Fine-tuning to teach the model frequently changing facts.
6. Why do generative models hallucinate?
- They generate plausible continuations, not verified facts.
- Gaps or conflicts in training data and missing context increase errors.
- Grounding with retrieval, asking for citations and allowing "I don't know" reduce it.
- Measure with faithfulness checks and human review on sampled outputs.
Common pitfall: Saying a bigger model eliminates hallucination.
7. How do you get structured output reliably?
- Use structured output or JSON schema features where the provider supports them.
- Validate outputs in code and retry or repair on failure.
- Keep schemas small and fields well described.
- Track the validation failure rate.
Common pitfall: Parsing free text with regular expressions and hoping.
8. How do you choose a model for a product?
- Define the task and build a small evaluation set first.
- Compare candidate models on quality, latency, cost and data policies.
- Consider open-weight self-hosting when control or data residency matters.
- Re-evaluate when new model versions ship.
Common pitfall: Choosing a model by leaderboard rank alone.
Get the free 50 RAG and LLM interview questions
Join the voluntary email list and open the free set of 50 RAG and LLM interview questions with short model answers. You will also get occasional new question sets. No spam, and you can unsubscribe at any time by replying "unsubscribe" to any email.
Evaluation, safety and cost (questions 9 to 14)
9. How do you evaluate generative AI output?
- Use automatic checks where possible: exact match, schema validity, tests.
- Use LLM-as-a-judge with a clear rubric, calibrated against human labels.
- Add human review for high-stakes or subjective outputs.
- Track online signals such as user edits, retries and ratings.
Common pitfall: Using BLEU or ROUGE as the only measure for open-ended answers.
10. What safety measures does a generative AI product need?
- Input and output moderation for harmful content.
- Defenses against prompt injection, especially with tools.
- Privacy controls for user data and logs.
- Red teaming and incident response.
Common pitfall: Treating safety as only a content filter.
11. How do you control generative AI cost?
- Shorter prompts, caching and output length limits.
- Route simple tasks to smaller models.
- Batch offline work.
- Track cost per successful task.
Common pitfall: Optimizing cost before measuring quality impact.
12. What is multimodal AI?
- Models that take or produce more than one modality, such as text, images and audio.
- Use cases: document understanding, image questions, speech assistants.
- Evaluation must cover each modality's failure modes, such as OCR errors.
- Costs and latency can differ sharply by modality.
Common pitfall: Assuming text evaluation covers image or audio inputs.
13. What is the difference between a chat model and a reasoning model?
- Reasoning models are trained to spend more computation on intermediate reasoning before answering.
- They tend to help on math, code and multi-step problems.
- They cost more tokens and add latency.
- Use them where accuracy gains justify the cost.
Common pitfall: Using a reasoning model for every simple request.
14. How do you keep a generative AI feature reliable after launch?
- Version prompts, models and retrieval settings.
- Run evaluation gates before each change.
- Monitor quality signals, cost and latency.
- Plan for provider outages and model deprecations with fallbacks.
Common pitfall: Changing prompts in production without regression tests.
FAQ
Is generative AI the same as an LLM?
No. LLMs are one kind of generative model; image, audio and video models are others.
Do I need math for these interviews?
Engineering roles usually need intuition (probabilities, embeddings, attention) more than derivations. Research roles go deeper.
What projects help?
A small RAG app with an evaluation set, or a tool-using assistant with tests and cost tracking.
How should I study?
Learn the fundamentals, then practice explaining trade-offs out loud with examples from your own projects.
The 0 to 1 AI Engineer Interview Playbook covers answer frameworks, system-design walkthroughs and an 8-week plan. $19.99 on Gumroad.
Get the playbookAll interview topics · Prep guides · Question deep dives · Free 50 RAG and LLM questions