An AI engineer builds products on top of models: a chatbot over company documents, a tool that reads invoices, a feature that drafts replies. For freshers, the interview is less about inventing new models and more about proving you can write clean Python, call an LLM API safely, and ship something that works.
This page has 28 AI engineer interview questions for freshers with model answers, grouped from basics to project and coding-round scenarios. It focuses on the engineering side. For theory such as transformers and diffusion, use our generative AI interview questions page alongside this one.
I interview a lot of freshers from campus placements and bootcamps, and the strongest ones are rarely the ones with the most certificates. They are the ones who can open a laptop and explain how their small app handles a failed API call.
Use the Save as PDF button above to keep an offline copy for revision.
What do AI engineer interviews for freshers test?
AI engineer interviews for freshers test whether you can turn a model into a small, reliable piece of software.
Whether you apply to an AI startup, a product company or the AI team of an IT services firm, the rounds usually cover these areas:
| Area | Typical questions | What they look for |
|---|---|---|
| Python and APIs | Data structures, JSON, HTTP calls, error handling | Clean, readable code |
| ML fundamentals | Overfitting, train and test splits, precision and recall | Correct intuition, not maths proofs |
| LLM engineering | API calls, structured outputs, embeddings, basic RAG | Can you build with models safely? |
| Shipping | Git, FastAPI, Docker, testing, logging | Can your code run outside your laptop? |
| Projects | "Walk me through this project" | Honest ownership and trade-offs |
Most loops include a Python coding round and one or two technical discussions; some add a short take-home.
How to prepare for an AI engineer interview as a fresher
The best fresher plan is: strengthen Python, build and deploy one LLM project, then practise explaining it.
- Week 1: Python and ML basics. Revise lists, dicts, functions, classes, exceptions and file handling. Our Python for AI interview questions page covers this round in depth. Revise overfitting, data splits and evaluation metrics.
- Week 2: LLM engineering. Call an LLM API, return JSON output, and build a small RAG app over a PDF. Revise embeddings and vector databases.
- Week 3: ship it. Wrap the app in FastAPI, add a Dockerfile, write a few tests, push it to GitHub with a clear README, and deploy it on any free tier.
- Week 4: speak and code. Answer the questions below out loud in about 60 seconds each, and solve two easy Python problems daily. Use the mock prompts further down for practice.
If you have more time, go deeper with our RAG interview questions.
Basic AI engineer interview questions for freshers
These come up in the first technical round. Keep each answer short and practical.
1. What does an AI engineer do, and how is it different from a data scientist?
EasyAn AI engineer builds and ships software that uses AI models, while a data scientist mainly analyses data and builds models to answer business questions. An AI engineer's day involves calling model APIs, building retrieval pipelines, writing backend code, testing outputs and deploying services. A data scientist spends more time on data cleaning, experiments and statistics. An ML engineer sits in between, often training and serving custom models. In small startups, one person may do all three.
Interviewer tip: Connect your answer to the job description you applied for.
2. Why is Python the most common language for AI engineering?
EasyPython dominates AI because almost every important library, from NumPy and pandas to PyTorch, scikit-learn and the official LLM SDKs, is built for it first. Heavy computation runs in optimised C, C++ or CUDA underneath, so Python's own speed matters less than people think. The trade-off: for high-throughput services, teams sometimes use Go, Java or Node.js for the surrounding backend.
3. What is the difference between a list, a tuple and a dictionary in Python?
EasyA list is an ordered, mutable collection, a tuple is an ordered, immutable collection, and a dictionary stores key and value pairs for fast lookup by key. Use a list for items you will append or change, like chat messages in a conversation. Use a tuple for fixed records, like a (latitude, longitude) pair. Tuples can be dictionary keys because they are hashable; lists cannot.
4. What is a REST API, and what happens when you call one?
EasyA REST API lets one program talk to another over HTTP using standard methods such as GET to read data and POST to send data. When you call one, your code sends a request with a URL, headers (often including an API key) and usually a JSON body. The server processes it and returns a status code, like 200 for success or 429 for too many requests, plus a JSON response.
5. What is the difference between supervised and unsupervised learning?
EasySupervised learning trains on labelled examples, where each input has a known correct output, while unsupervised learning finds patterns in data without labels. Predicting whether a loan will default from past labelled loans is supervised. Grouping customers into segments by spending behaviour is unsupervised clustering. LLMs add a third idea, self-supervised learning, where labels come from the data itself, such as predicting the next word. See AI vs ML vs deep learning for the bigger picture.
6. What are overfitting and underfitting?
MediumOverfitting is when a model memorises the training data, including noise, so it performs well in training but poorly on new data. Underfitting is when the model is too simple to capture the real pattern, so it performs poorly everywhere. You spot overfitting when training accuracy is high but validation accuracy is much lower. Fix overfitting with more data, simpler models or regularisation; fix underfitting with better features or a more expressive model.
7. Why do we split data into training, validation and test sets?
EasyWe split data so we can measure how a model performs on examples it has never seen. The training set teaches the model, the validation set helps tune choices like hyperparameters or prompts, and the test set gives a final, honest score. If you tune on the test set, your reported accuracy becomes too optimistic. The same idea applies to LLM apps: keep a fixed set of evaluation questions that you never use while writing the prompt.
8. Precision vs recall: which one matters more?
MediumIt depends on which mistake costs more. Precision is the share of predicted positives that are correct; recall is the share of actual positives the model finds. For a UPI fraud alert system, missing real fraud is expensive, so recall matters more, even if some genuine payments get flagged. For a spam filter, wrongly hiding an important email hurts, so precision matters more. The F1 score balances both when you need one number.
Interviewer tip: Always attach a real example to the metric; it shows you understand the trade-off.
AI engineer interview questions and answers: LLM APIs, embeddings and RAG
Most AI engineer roles centre on these skills. For theory, pair this section with our LLM interview questions.
1. How do you call an LLM API from Python?
MediumYou install the provider's SDK, load the API key from an environment variable, and send a list of messages with a model name. A minimal example with the OpenAI Python SDK looks like this:
from openai import OpenAI
client = OpenAI() # reads OPENAI_API_KEY from the environment
response = client.chat.completions.create(
model="your-model-name",
messages=[
{"role": "system", "content": "You are a helpful tutor."},
{"role": "user", "content": "Explain recursion in two lines."},
],
temperature=0,
)
print(response.choices[0].message.content)Other providers follow the same pattern. SDKs change often, so mention that you check the official docs for current method names.
2. How do you keep API keys safe in an AI project?
EasyNever hard-code API keys in your source code; load them from environment variables or a secrets manager. Locally, keep them in a .env file that is listed in .gitignore. In deployment, set them in the hosting platform's secret settings. If a key ever lands on GitHub, rotate it immediately, because bots scan public repositories for leaked keys.
Interviewer tip: Interviewers often check your GitHub for leaked keys. Clean it before you apply.
3. What are structured outputs, and why do AI engineers care about them?
MediumStructured outputs means asking a model to return data in a fixed format, usually JSON that matches a schema, instead of free text. Your code can then read fields like name, amount and due_date directly. Many providers now offer a JSON or schema mode that constrains the output. You should still validate the result, for example with Pydantic, and retry or fall back if validation fails.
4. How do you handle rate limits, timeouts and errors when calling an LLM API?
MediumWrap every call in error handling, set a timeout, and retry transient failures with exponential backoff. A 429 status means you hit a rate limit, so wait and retry with increasing delays plus a little randomness. Server errors in the 5xx range are often worth one or two retries; a 400 error means your request is wrong, so retrying will not help. Log each failure and show users a friendly fallback message.
5. What are embeddings, and how is cosine similarity used with them?
MediumEmbeddings are vectors of numbers that capture the meaning of text, so similar meanings sit close together. Cosine similarity measures the angle between two vectors: values near 1 mean very similar meaning, values near 0 mean unrelated. In practice, you embed all document chunks once, embed each user question, and return the chunks with the highest similarity. "How do I reset my password" and "forgot login credentials" score high despite sharing few words. See what embeddings are.
6. Explain a basic RAG pipeline step by step.
MediumA basic RAG pipeline has two phases: indexing and answering. Indexing: load documents, split them into chunks, create an embedding for each chunk and store them in a vector database. Answering: embed the user's question, retrieve the most similar chunks, insert them into the prompt with an instruction to answer only from that context, and return the answer with sources. RAG lets a model answer from private or recent data without retraining. Read how RAG works for diagrams.
Interviewer tip: Draw the pipeline as two boxes, indexing and answering. It makes the answer easy to follow.
7. How do you choose the chunk size for a RAG system?
HardThere is no universal chunk size, so you start with a sensible default and tune it on an evaluation set. Small chunks give precise matches but may cut off the context needed to answer. Large chunks keep context but add noise and cost more tokens. A common starting point is a few hundred tokens with some overlap, split on natural boundaries like headings or paragraphs. Then test retrieval quality on 20 to 50 real questions and adjust.
8. How do you control the cost of an LLM feature?
MediumYou control cost by reducing tokens and choosing the smallest model that meets your quality bar. Shorten system prompts, send only the most relevant retrieved chunks, cap the maximum output length and cache answers to repeated questions. Route simple tasks, like classification, to a cheaper model and keep the larger model for hard ones. Remember that Indian languages often use more tokens per sentence than English, which raises cost for multilingual apps.
AI developer interview questions for freshers: git, FastAPI, Docker and testing
These questions check whether your code can live outside a notebook.
1. Which git commands do you use daily, and what is a merge conflict?
EasyDaily git work uses status, add, commit, pull, push, branch and switch or checkout. A merge conflict happens when two branches change the same lines of a file and git cannot decide which version to keep. You open the file, choose or combine the changes between the conflict markers, test the code, then commit the resolution. Good habits: small commits, clear messages and no secrets in the repo.
2. How would you turn a Python script into an API using FastAPI?
MediumWrap your logic in a function, define the input with a Pydantic model, and expose it through a route:
from fastapi import FastAPI
from pydantic import BaseModel
app = FastAPI()
class Question(BaseModel):
text: str
@app.post("/ask")
def ask(q: Question):
answer = answer_question(q.text) # your RAG or LLM logic
return {"answer": answer}Run it locally with uvicorn main:app --reload and open the automatic docs at /docs. FastAPI validates the request body for you and returns a clear error when the input is wrong.
3. What is Docker, and why would you containerise an AI service?
MediumDocker packages your code, Python version, libraries and system dependencies into a container that runs the same way on any machine. It removes the classic "works on my laptop" problem, which is common in AI projects with many pinned library versions. A beginner Dockerfile starts from a Python base image, copies requirements.txt, installs dependencies, copies the code and sets the start command. Keep secrets out of the image and pass them as environment variables at runtime.
4. What is the difference between a Docker image and a container?
EasyAn image is a read-only template that contains your application and its environment, while a container is a running instance of that image. You build an image once from a Dockerfile, then start one or many containers from it. A simple analogy: the image is the class, the container is the object.
5. How do you test code that calls an LLM?
HardSeparate deterministic code from model calls and test each differently. For unit tests, mock the LLM client so tests run fast, cost nothing and return a fixed response; then check that your parsing, validation and error handling work. For quality, keep a small evaluation set of real inputs with expected properties, such as valid JSON or the correct category, and run it whenever you change the prompt or model. Exact string matching rarely works because outputs vary.
Interviewer tip: Mentioning an evaluation set as a fresher immediately sets you apart.
6. When should a FastAPI endpoint be async, and why does it matter for LLM calls?
HardUse async endpoints when the work is mostly waiting on I/O, such as network calls to an LLM API or a database. An LLM call can take several seconds; with async and an async client, the server can handle other requests while it waits instead of blocking. If you use a blocking library inside an async function, you lose that benefit and can freeze the event loop. For CPU-heavy work, such as running a local model, use a worker process instead.
7. How would you log and monitor a small AI service after deployment?
HardLog every request with a request ID, latency, model name, token usage, status and any errors, but never log passwords, API keys or raw personal data. Track a few metrics: error rate, average and slow-percentile latency, daily cost and user feedback such as thumbs up or down. Review a masked sample of real conversations weekly and add failures to your evaluation set.
Scenario-based AI ML engineer interview questions for freshers
Answer with a structure: clarify, propose, name the risks, say how you would measure success.
1. Walk me through a project on your resume.
MediumUse a simple four-part structure: problem, your design, one challenge you solved, and the result with a number. For example: "I built a RAG assistant for our college placement rulebook. I used FastAPI, an embeddings model and Chroma. Answers were wrong for table-heavy pages, so I changed chunking to keep tables intact. Correct answers on my 40-question test set rose from 24 to 33." Be honest about what you built yourself versus what came from a tutorial.
Interviewer tip: Expect the follow-up: what would you change if you rebuilt it today?
2. Your chatbot gives a different answer every time to the same question. What do you check?
MediumFirst check the temperature and sampling settings, because a high temperature adds randomness; set it near 0 for factual tasks. Next, check whether retrieval returns different chunks each time, for example because of ties in similarity or documents being re-indexed. Then check whether the prompt or conversation history changes between calls. Even at temperature 0, outputs are not always perfectly identical across runs, so for strict needs, use structured outputs and validation. See AI hallucination for related failure modes.
3. How should you approach a Python coding round as an AI engineer fresher?
EasyClarify the problem and the input limits before writing any code, then talk through a simple solution first. Write clean code with meaningful names, test it on a normal case and an edge case such as an empty list, and then discuss improvements and time complexity. Expect arrays, strings, hashing and practical tasks like parsing JSON. A correct simple solution beats an unfinished clever one.
Interviewer tip: Think out loud. Silence for five minutes worries interviewers more than a slow solution.
4. How would you build an LLM tool that screens resumes for a hiring team?
HardI would start by asking what decision the tool supports, because fully automatic rejection is risky. A safer design extracts structured fields (skills, experience, education) from each resume into JSON, matches them against clear job criteria, and shows recruiters a ranked list with reasons, while humans make the final call. Remove names, photos, gender and college names from what the model scores to reduce bias. Handle the resumes as personal data, and test the tool on a reviewed sample before launch.
5. The LLM API your app depends on goes down during a demo. What should your app do?
HardYour app should fail gracefully instead of crashing. Set timeouts and limited retries, then show a clear message such as "The assistant is busy, please try again in a minute". For important features, add a fallback: a backup model from another provider, cached answers for common questions, or a simple keyword search over your documents. Monitoring and alerts should tell you about the outage before your users do.
Common mistakes freshers make in AI engineer interviews
The most common mistake is showing a notebook demo when the interviewer wants to see engineering.
- Only notebooks, no service. A Colab notebook proves curiosity. A deployed API with a README proves you can ship.
- Framework-first answers. Saying "I used LangChain" without knowing what happens underneath is weak. Learn the raw API call first.
- No error handling. Interviewers often ask what happens when the API fails. Have an answer.
- Ignoring basics. Freshers who skip Python fundamentals and what an LLM actually is get caught by simple follow-ups.
My contrarian tip: do not spend your last month grinding hundreds of hard coding problems. For most AI engineer fresher roles, steady easy and medium practice plus one shipped project gives a better return.
Last-week plan before your AI engineer interview
In the final week, revise and rehearse rather than learning anything new.
- Day 1: Re-read your own project code and README. Fix anything you cannot explain.
- Day 2: Revise ML basics: splits, overfitting, precision and recall.
- Day 3: Revise LLM APIs, structured outputs, embeddings and RAG.
- Day 4: Revise git, FastAPI, Docker and testing. Run your project from a fresh clone.
- Day 5: Do two timed coding problems and one full mock interview.
- Day 6: Practise your project story and three scenario answers out loud.
- Day 7: Rest, check your setup for online rounds, and prepare questions to ask.
For HR and behavioural rounds, see our HR round AI interview questions.
Your interview prep checklist
- Build one LLM project, wrap it in FastAPI and deploy it with a clear README.
- Write the raw LLM API call from memory, including error handling and timeouts.
- Explain overfitting, data splits, precision and recall with one example each.
- Draw a basic RAG pipeline and explain chunking, embeddings and retrieval.
- Solve two easy or medium Python problems daily for two weeks.
- Prepare a 90-second project story with one challenge and one number.