# llm engineering
// [38] real interview questions. Answers and sources live in the practice app.
practice this topic- Your RAG-powered support assistant confidently gives a wrong answer that isn't in any of your documents. Walk through where a RAG pipeline can fail and how you'd localize the fault.(senior)
- How do you choose a chunking strategy for RAG, and what are the tradeoffs of small vs large chunks?(mid)
- When would keyword/BM25 retrieval beat embedding-based retrieval, and why is hybrid search common in production RAG?(senior)
- How do you know your LLM feature actually works? Design an evaluation approach for an open-ended generation feature before and after shipping.(senior)
- You're using LLM-as-a-judge to evaluate outputs. What are the failure modes, and how do you make the judge trustworthy?(senior)
- Your LLM agent reads documents fetched from the web and a user's uploaded files. Explain the indirect prompt injection risk and how you defend against it.(senior)
- What is hallucination in LLMs, and what concrete mitigations reduce it in a production feature?(mid)
- Your downstream code needs to parse JSON from the LLM, but sometimes it returns malformed or extra text. How do you make structured output reliable in production?(mid)
- Design the tool-use interface for an LLM agent that can query a database and send emails. What makes tool design succeed or fail?(senior)
- You have a large, growing knowledge base to expose through an LLM. Should you fine-tune, use RAG, or rely on long context? How do you decide?(senior)
- Your LLM feature feels slow. Break down LLM latency and explain how streaming changes the UX and where it doesn't help.(mid)
- Explain the three kinds of LLM caching — exact, prompt/prefix, and semantic — and when each is worth the complexity.(senior)
- How does prompt (prefix) caching actually work, and what breaks a cache hit? Give the rules you'd follow to maximize hit rate.(mid)
- Your LLM API bill is growing faster than usage. How do you control cost at scale without hurting quality?(senior)
- A prompt change that helped one case silently regressed several others in production. How do you version and manage prompts so this doesn't happen?(mid)
- Design input and output guardrails for an LLM assistant. What goes on each side and what are the tradeoffs?(senior)
- Design an agent that plans and executes multi-step tasks with tools. What are the failure modes and how do you contain them?(senior)
- What is a model gateway / router in front of LLM calls, and why do serious LLM products put one there?(mid)
- How do you make an LLM feature observable? What do you log and which metrics actually matter?(mid)
- Explain the economics of the context window. Why isn't 'just stuff everything into a long context' the answer even when it fits?(senior)
- What is a re-ranker in RAG, when do you add one, and what does it cost you?(mid)
- How would you evaluate a RAG system specifically, separating retrieval quality from generation quality?(senior)
- Your embedding-based retrieval returns plausible but subtly off results. What can go wrong with embeddings and vector search in practice?(mid)
- You need to upgrade to a newer/better base model. Why is this risky for an existing LLM product, and how do you do it safely?(senior)
- What is the 'composability gap' in multi-step LLM pipelines, and how do you test a chain of LLM steps?(mid)
- What are temperature and top-p (sampling parameters), and how do you set them for a factual extraction task vs a creative task?(junior)
- How would you defend an LLM feature against jailbreaks and abuse, and what's realistic to expect from those defenses?(senior)
- When should you reach for an orchestration/agent framework, and when is it a mistake?(mid)
- Design a customer-support chatbot that can read a user's account data and internal docs. Walk the full production design: retrieval, guardrails, actions, fallback.(senior)
- How do you build a golden/regression eval set for an LLM feature, and why is it more urgent than in normal software?(mid)
- You're deciding whether to self-host an open-weights model or call a hosted API. What actually drives that decision?(senior)
- Few-shot examples in your prompt sometimes help and sometimes hurt. How do you use them well and detect when they backfire?(mid)
- How do you catch and handle bad LLM outputs at runtime — empty, malformed, toxic, or off-brand — without tanking latency?(senior)
- What does an LLM agent's memory look like, and how do short-term (context) and long-term memory differ in a real system?(mid)
- An LLM product that worked at launch is quietly getting worse in production over weeks, with no code change. What could cause silent quality drift and how do you catch it?(senior)
- How do you estimate and set token/cost budgets for an LLM feature before shipping, and enforce them at runtime?(mid)
- When you ask ChatGPT something, the answer appears word by word instead of all at once. Why does it stream like that, and is it just a UI animation?(mid)
- With an AI chatbot the first word takes a noticeable beat to appear, then the rest of the answer flows quickly. Why is the first token slow and the rest fast?(senior)