AI Engineer Interview Questions 2027: Rounds, Answers and Code
Quick answer
Eleven AI engineer interview questions for 2027, grouped by round, with runnable Python, a system design outline and a project review checklist.
AI engineer interview questions in 2027 centre on building and running LLM-powered software: calling models through APIs, retrieval, tool use and agents, evaluation, cost, latency and security. Expect a Python coding round, a system design round built around a RAG or agent use case, and a deep review of one project you have shipped or built yourself.
Key takeaways
- The role is tested as software engineering with models inside it. Model-training theory matters less than reliability, testing and cost control.
- Know the difference between a workflow and an agent, and be ready to argue for the simpler one.
- Security questions now follow the OWASP Top 10 for LLM Applications 2025, where prompt injection is listed first.
- Tools change every few months. As of late 2026 the concepts below are stable, so re-check framework names in 2027 but keep the fundamentals.
On this page:
- What rounds does an AI engineer interview have?
- What is asked in the coding round?
- Which system design questions come up?
- What do interviewers ask about agents and tools?
- How are production, cost and security tested?
- How do you prepare for the project review?
- Frequently asked questions
What rounds does an AI engineer interview have?
Most processes have four or five stages, and each one filters for something different. The mix varies by company, so treat this as a preparation map and confirm the actual format with your recruiter.
| Round | What it checks | Typical task | How to prepare |
|---|---|---|---|
| Screening | Concept clarity | Explain embeddings, RAG, tool calling in plain words | One-minute spoken answers |
| Coding | Python and problem solving | Parse model output, write retrieval, a DSA problem | Write code without an assistant |
| System design | Architecture and trade-offs | Design a support bot or document search | Practise drawing the pipeline and naming failure points |
| Production and security | Operational thinking | Cut cost, handle prompt injection, add monitoring | Learn evals, caching, guardrails |
| Project review | Ownership | Defend choices in your own project | Keep numbers from your own tests |
If you are moving from a developer role, the comparison of software engineer and AI engineer roles shows which of your existing skills carry over. For concept-only revision, use the generative AI interview questions list first.
What is asked in the coding round?
You are asked to write small, correct Python that handles the messy parts of working with models. Two tasks appear again and again: similarity search and defensive parsing.
Q1. Implement top-k retrieval with cosine similarity.
import math
def cosine(a, b):
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))
return dot / (na * nb)
def top_k(query, docs, k=2):
scored = [(cosine(query, vec), name) for name, vec in docs.items()]
return sorted(scored, reverse=True)[:k]
docs = {"refund": [0.9, 0.1, 0.0],
"shipping": [0.2, 0.8, 0.1],
"login": [0.0, 0.2, 0.9]} # illustrative 3-d embeddings
print(top_k([0.8, 0.3, 0.0], docs))
# [(0.9693..., 'refund'), (0.5636..., 'shipping')]
Follow-ups: what happens with a zero vector (division by zero, so guard it), and why real systems use an approximate nearest-neighbour index instead of scanning every document.
Q2. The model must return JSON. Write code that does not crash when it does not.
import json
def parse_reply(text, required=("intent", "confidence")):
start, end = text.find("{"), text.rfind("}")
if start == -1 or end == -1:
return None
try:
data = json.loads(text[start:end + 1])
except json.JSONDecodeError:
return None
return data if all(k in data for k in required) else None
print(parse_reply('Sure! {"intent": "refund", "confidence": 0.82}'))
print(parse_reply("I think it is a refund")) # None, so retry or fall back
The point is the behaviour on failure. Say what you would do next: retry once with the error message, then fall back to a safe default.
Q3. How would you chunk a 200-page PDF?
By structure first (headings, sections), then by size with a small overlap so sentences are not cut from their context. Keep the source page and heading as metadata for citations. Then test: chunk size is a setting you tune against retrieval quality on real questions.
General data-structure questions still appear, so keep the most asked DSA questions in your revision plan.
Which system design questions come up?
The usual prompt is "design X with an LLM", where X is document question answering, a support assistant or an internal search tool. Structure your answer as requirements, pipeline, evaluation, then failure handling.
Q4. Design a support assistant for an e-commerce company.
Illustrative answer outline for a company with 5,000 help articles and order data in a database:
- Requirements: Languages, expected traffic, which actions are allowed (read order status: yes; issue refund: only with human approval).
- Retrieval: Index help articles with embeddings plus keyword search. Hybrid retrieval helps with order IDs and product codes that embeddings handle poorly.
- Tools: A read-only order lookup function with the user's ID enforced on the server, never taken from the model's text.
- Generation: Answer from retrieved context with citations, refuse when context is missing, hand off to a human on low confidence.
- Evaluation: A fixed set of past tickets with known resolutions, scored on correctness and correct refusals before every release.
- Operations: Log prompts, retrieved chunks, tool calls, latency and token cost per conversation.
Q5. When would you fine-tune instead of using RAG?
When the gap is behaviour, format or a narrow skill, and you have enough clean examples. Use retrieval when the gap is knowledge that changes. The guide to RAG, fine-tuning and AI agents covers the decision in more depth.
What do interviewers ask about agents and tools?
They ask whether you know when an agent is the wrong choice. The clearest public framing comes from Anthropic's engineering guide Building Effective Agents (December 2024), which separates workflows, where "LLMs and tools are orchestrated through predefined code paths", from agents, where LLMs "dynamically direct their own processes and tool usage". The same guide recommends "finding the simplest solution possible, and only increasing complexity when needed".
Q6. Workflow or agent for invoice processing?
A workflow. The steps are known: extract fields, validate against the purchase order, route exceptions. Fixed code paths are cheaper, faster and easier to test. Choose an agent only when the number and order of steps cannot be predicted in advance.
Q7. Explain tool calling.
You describe functions to the model with names and typed parameters. The model replies with a request to call one, your code executes it, and the result goes back to the model, which then writes the final answer. The model never runs anything itself, so your code is the place for permission checks.
Q8. What is MCP?
The Model Context Protocol is, in the words of its official documentation, "an open-source standard for connecting AI applications to external systems" such as data sources, tools and workflows. In an interview, explain it as a common connector so that a tool written once can be used by many AI clients. The explainer on A2A vs MCP covers how it differs from agent-to-agent protocols.
How are production, cost and security tested?
Through "what would you do if" questions. Have one concrete action ready for each.
Q9. How do you test a prompt change before release?
Run it against a versioned evaluation set, compare scores with the current prompt, review the failures by hand, then release to a small share of traffic and watch live metrics. Treat prompts like code: version control and review.
Q10. What are the main security risks in an LLM application?
The OWASP Top 10 for LLM Applications 2025 lists prompt injection as LLM01, followed by items such as sensitive information disclosure, improper output handling, excessive agency and system prompt leakage. A good answer picks two and gives a control for each: for example, treat retrieved text as untrusted data, and give tools the narrowest permissions that work.
Q11. The monthly model bill doubled. How do you investigate?
Break cost down by feature and by input versus output tokens. Common causes are growing conversation history, oversized retrieved context, retries, and a large model used for simple tasks. Fix with context trimming, caching, and routing easy requests to a cheaper model.
How do you prepare for the project review?
Prepare a five-minute walkthrough of one project with evidence. Interviewers probe until you run out of first-hand detail, so choose the project you know best, even if it is small.
- The user problem in one sentence.
- The architecture, and one alternative you rejected with the reason.
- Your evaluation set: how many cases, where they came from, the score before and after your main change.
- One failure that surprised you and what you did about it.
- What it costs to run per request, even roughly, from your own logs.
If you do not have such a project yet, the AI engineer roadmap for India lists what to build first. What to re-check in 2027: current model names and limits on each provider's own documentation, and which agent frameworks the job description names.
Next step: take the 11 questions above and answer each aloud against your own project. For guided depth, the Advanced Certification in AI & ML from Vishlesan i-Hub, IIT Patna is an 08-month programme aimed at engineers.
Frequently asked questions
What is the difference between an AI engineer and an ML engineer interview?
AI engineer interviews focus on building applications with existing models: APIs, retrieval, agents, evaluation and deployment. ML engineer interviews spend more time on training models, feature engineering, statistics and ML theory. Many companies blend the two, so read the job description closely.
Do AI engineer interviews include DSA questions?
Many do, especially at product companies. Expect one or two standard problems on arrays, strings, hash maps or graphs alongside LLM-specific coding. Service companies and startups vary, so ask the recruiter about the format.
Which programming language should I use in an AI engineer interview?
Python is the safest choice because most model SDKs, data libraries and examples use it. Some full-stack AI roles also test TypeScript. Use the language named in the job description if there is one.
How do I prepare for AI engineer interviews as a fresher in 2027?
Build one RAG or tool-calling project, write a small evaluation set for it, and practise explaining it. Revise Python, basic data structures, embeddings, prompting and the workflow versus agent distinction. Re-check current model and framework names on official documentation before interviews.
What system design topics should an AI engineer know?
Retrieval pipelines, hybrid search, caching, streaming, rate limits, model routing, evaluation, logging and guardrails. You should also know standard backend basics such as queues, databases and API design, because LLM features sit inside ordinary systems.