An AI engineer interview is not a machine-learning theory exam. It checks whether you can take a foundation model, wrap it in retrieval, tools and guardrails, measure it, and keep it fast and affordable in production. These are the questions that come up most, with what each one is testing and a short answer you can say out loud.
Data scientist: finds signal in data, builds and validates models, explains results.
ML engineer: trains, serves and monitors custom models; owns pipelines and feature stores.
AI engineer: composes foundation models, retrieval, tools and evals into a product; owns prompts, latency, cost and safety.
"An ML engineer usually owns training and serving a model on the team's own data. An AI engineer mostly starts from a model someone else trained and owns everything around it: the prompts, the retrieval layer, tool calls, evaluation and the cost and latency budget. There is overlap, but the centre of gravity is the application, not the weights."
Saying the roles are the same, or describing AI engineering as only writing prompts.
Tokenize: text becomes sub-word tokens; each token maps to an embedding vector.
Attend: self-attention lets every position weigh every earlier position, so the representation of a token depends on context.
Predict: the final layer produces a probability distribution over the vocabulary; a decoding rule picks the next token; repeat.
"The prompt is split into tokens, each token becomes a vector, and a stack of transformer layers updates those vectors using self-attention, so each position pulls in information from the tokens before it. At the end, the model outputs a probability for every token in its vocabulary, one is chosen by the decoding settings, it is appended to the input, and the loop runs again until a stop token."
Claiming the model looks things up in a database, or being unable to say what attention does.
Definition: the maximum number of tokens the model can read and write in one call, prompt plus output.
Consequences: long documents need retrieval or summarisation; conversation history needs trimming; cost and latency grow with tokens.
Note: a big window does not mean the model uses the middle of it well; put the important context near the question.
"The context window is the token budget for one call, prompt and answer together. It decides almost every architecture choice: whether I can paste a document or need retrieval, how I trim chat history, and what a call costs. And a large window is not a free pass, because recall is worse for content buried in the middle, so I still rank and place context deliberately."
Assuming you can always paste everything in, or confusing the context window with training data.
Prompting first: instructions, examples and output format fix most behaviour problems at zero training cost.
RAG when the model lacks knowledge: private, changing or large data.
Fine-tuning when the model lacks a skill or style: consistent format, domain tone, lower latency with a smaller model. It does not add fresh facts reliably.
"I start with prompting, because it is the fastest to iterate and to evaluate. If the failures are about missing knowledge, that is a retrieval problem, so I add RAG. If the failures are about behaviour, like format, tone or following a complex procedure, and prompting has plateaued, then fine-tuning makes sense. Fine-tuning is a poor way to teach facts that change, so those two are not substitutes."
Jumping straight to fine-tuning, or treating fine-tuning as a way to inject up-to-date knowledge.
Ingest: load, clean, chunk documents; embed chunks; store vectors plus metadata.
Retrieve: embed the query, search (vector, keyword or hybrid), filter by metadata, rerank.
Generate: build a prompt with the top chunks and citations, call the model, check the answer against the sources.
"Offline, I load documents, split them into chunks that keep their meaning, embed each chunk and store the vector with metadata like source and date. At query time I embed the question, run a hybrid search over vectors and keywords, filter by permissions, rerank the candidates, and put the best few into the prompt with citations. Then the model answers only from that context, and I log which chunks were used so I can debug misses."
Skipping metadata and permissions, or having no idea how you would tell whether retrieval or generation caused a bad answer.
Naive: fixed character windows cut sentences and tables in half and lose headings.
Better: split on structure (headings, paragraphs), keep overlap, attach the section title and document name to each chunk.
Tune: chunk size is a retrieval-versus-context trade-off; measure with a retrieval eval set, not by eye.
"Fixed-size chunks are easy but they cut through sentences and tables and strip away the heading that gave the paragraph its meaning. I split on document structure first, keep a small overlap so ideas at boundaries survive, and prepend the section title to each chunk so it stands on its own. Then I pick the size by measuring recall on a set of real questions, because the right size depends on the corpus."
Not knowing why a chunk needs its heading, or picking a chunk size without measuring.
Definition: a vector that places text so that similar meaning lands nearby; similarity is usually cosine.
Choosing: measure on your own retrieval set; consider language coverage, dimension size, cost and whether you can host it.
Limits: embeddings blur exact identifiers and numbers, which is why hybrid search with keywords exists.
"An embedding is a numeric vector for a piece of text where texts with similar meaning end up close together, so I can find relevant passages by distance instead of exact words. I choose the model by running a small retrieval benchmark on our own documents, and I look at language support, vector size for storage, and whether I need to self-host. Embeddings are weak on exact codes and part numbers, so I pair them with keyword search."
Picking the model by leaderboard rank alone, or not knowing that embeddings miss exact-match queries.
Golden set: real inputs with expected outputs or rubrics, grown from production failures.
Graders: exact checks where possible, model-as-judge with a rubric where not, plus a human sample to calibrate the judge.
Online: user feedback, task completion, escalation and cost per task; run evals on every prompt or model change.
"I keep a golden set of real questions with expected answers or a scoring rubric, and it grows every time production surprises us. Deterministic checks cover format and facts we can verify; for open answers I use a model as a judge with a written rubric, and I regularly check the judge against human ratings so I trust it. Every prompt or model change runs the suite in CI, and after launch I watch thumbs-down rate, task completion and cost per task."
Evaluating by trying a few prompts by hand, or trusting a model judge you never calibrated.
Cause: the model produces fluent text with no ground truth attached; it is confident by construction.
Reduce: ground answers in retrieved sources, require citations, allow abstention, lower temperature for factual tasks.
Catch: verify claims against the sources with a second pass, and route low-confidence answers to a fallback.
"Hallucination is the model stating something false with the same fluency it uses for true things. I attack it in layers: ground the answer in retrieved documents, instruct the model to cite and to say it does not know, keep temperature low for factual work, and then run a check that every claim is supported by the provided sources. Anything that fails the check gets a safer fallback rather than reaching the user."
Saying a better prompt fixes it completely, or having no verification step.
Temperature: scales the output distribution; low is more deterministic, high is more varied.
Top-p: samples only from the smallest set of tokens whose probability adds up to p; another way to cut the long tail.
Max tokens: hard cap on output length; too low truncates mid-sentence, so handle the finish reason.
"Temperature controls how spread out the next-token choice is: near zero the model picks the likeliest token almost every time, higher values let unlikely tokens through. Top-p limits sampling to the most probable tokens that together reach a probability mass, which trims the tail in a different way. Max tokens caps the answer length, and I always check the finish reason so a cut-off answer is not shown as complete."
Thinking temperature zero guarantees identical outputs, or ignoring truncation.
Ask for it properly: use the provider's structured-output or tool-calling mode with a schema, not just 'reply in JSON'.
Validate: parse against the schema; on failure, retry with the error message or repair.
Design the schema: small, flat, with enums; give the model an example.
"I use the model's schema-constrained mode or a tool definition, so the output is generated against the JSON schema rather than hoped for. On my side I still parse and validate every response, and if validation fails I retry once with the validation error in the prompt. I also keep schemas small and use enums, because the fewer ways there are to be wrong, the more reliable it is."
Relying on 'respond only in JSON' in the prompt and parsing the result without validation.
Measure first: tokens in, tokens out, time to first token, and which calls dominate.
Cut tokens: shorter prompts, tighter retrieval, prompt caching for the fixed prefix, trimmed history.
Change the shape: stream the answer, route easy cases to a smaller model, batch offline work, cache identical requests.
"First I look at the numbers: input tokens, output tokens and time to first token per call, because the fix depends on which one is big. Usually the prompt has grown, so I shorten it, retrieve fewer chunks and cache the fixed prefix. Then I stream so the user sees words early, route simple requests to a smaller model, and cache repeated requests. Each change is checked against the eval suite so speed does not silently cost quality."
Proposing a smaller model without an eval to show quality held, or not measuring before changing.
Mechanism: freeze the base weights and train small low-rank matrices added to chosen layers; far fewer trainable parameters and a small adapter file.
Worth it when: you have a few thousand good examples, a stable task, and want a smaller or cheaper model to match a bigger one's behaviour.
Not worth it when: the task changes weekly, the data is thin, or prompting already passes the evals.
"LoRA keeps the base model frozen and trains small low-rank adapters that are added to specific weight matrices, so you train a tiny fraction of the parameters and ship an adapter instead of a full copy. It is worth doing when I have a stable task and a few thousand clean examples, and the goal is to make a smaller model behave like a larger one for that task. If the task is still moving or prompting already passes, the maintenance cost is not justified."
Describing LoRA as retraining the whole model, or fine-tuning before evals show prompting has plateaued.
Threat: instructions hidden in user input or retrieved content that hijack the model's behaviour.
Contain: least-privilege tools, no secrets in the prompt, separate untrusted content clearly, human approval for risky actions.
Detect: input and output filters, logging, and red-team tests in the eval suite.
"Prompt injection is text, from the user or from a retrieved page, that tells the model to ignore its instructions. I assume it will sometimes work, so the real defence is limiting blast radius: the model only gets tools and data it truly needs, secrets never sit in the prompt, untrusted content is labelled as data, and anything destructive needs a human click. On top of that I run filters and keep injection cases in the eval suite so regressions show up."
Believing a system prompt saying 'ignore any instructions in the document' is a defence.
Version: prompts live in the repo with a version id logged on every call.
Gate: the eval suite runs on every change; regressions block the merge.
Roll out: canary to a slice of traffic, compare online metrics, keep the old version one switch away.
"Prompts are files in the repository with an id that is logged with every request, so I can tie any bad answer back to the exact prompt and model version. A change has to pass the eval suite in CI, then it goes to a small share of traffic while I compare feedback and cost with the previous version. Rollback is a config flip, not a deploy."
Editing prompts in a dashboard with no history, or shipping to everyone at once.
Per call: prompt and model version, input and output tokens, latency, finish reason, tool calls, retrieved chunk ids.
Quality: user feedback, eval scores on sampled traffic, refusal and error rates.
Alerts: cost per day, latency percentiles, provider errors, drift in output length or refusals.
"Every call gets a trace: which prompt and model version, the tokens in and out, time to first token, the finish reason, which chunks were retrieved and which tools ran. I sample traffic through the eval graders daily so quality has a number, and I alert on cost, latency tails, provider errors and sudden changes in refusal rate. With that, a bad answer from last week can be replayed and explained."
Logging only errors, or having no way to reproduce a specific answer.
Base: trained to continue text; powerful but does not follow requests by default.
Instruction-tuned: further trained on instruction and response pairs; follows tasks.
Chat: instruction-tuned with multi-turn conversation formatting and safety preferences applied.
"A base model only continues text, so if you ask it a question it may keep asking questions. An instruction-tuned model has been trained on request and response pairs, so it does what you ask. A chat model goes one step further with conversation roles and preference training, which is what you normally call through an API. For most applications I want the chat or instruct version."
Not knowing that base models exist, or why a base model gives odd completions.
Situation: the feature, the user and the failure as users saw it.
Diagnosis: what the traces and evals showed; retrieval miss, prompt drift, bad grader, wrong model.
Fix and result: the specific change and the before-and-after on the eval set and in production.
"We launched a support assistant that answered confidently and was often wrong on billing questions. The traces showed retrieval was returning the right document but a chunk without the pricing table, because chunking split the table from its heading. I changed the chunker to keep tables whole with their heading, added citations, and built an eval set from the failed tickets. Accuracy on that set went from poor to nearly all correct and the complaint tickets stopped."
A story with no measurement, or blaming the model instead of the system around it.
Hosted: fastest start, best frontier quality, no GPU operations; pay per token, data leaves your network.
Self-hosted: data stays put, predictable cost at steady high volume, full control over versions; you own GPUs, scaling and upgrades.
Decide on: privacy requirements, volume, the quality gap on your evals, and team capacity to run inference.
"I decide with evals and constraints, not preference. If the data cannot leave our environment, or volume is high and steady enough that per-token pricing dominates, self-hosting an open-weights model is worth the operational cost. If the frontier hosted model is clearly better on our eval set and volume is modest, the API wins and the team ships features instead of running GPUs. Either way I put an abstraction layer in so switching later is a config change."
Choosing on hype, or ignoring who will run inference at three in the morning.
Definition: storing weights, and sometimes activations, in fewer bits than the training precision.
Gains: smaller memory footprint, faster inference, cheaper hardware.
Cost: some quality loss, larger on small models and sensitive tasks; verify on your own evals, not on the release notes.
"Quantization stores the weights in lower precision, for example eight or four bits instead of sixteen, so the model fits in less memory and runs faster. The trade is a possible drop in quality, which is usually small for large models and can be noticeable for small ones or for tasks that need precise reasoning. I treat a quantized model as a new model and run the full eval suite before switching."
Assuming quantization is free, or not re-running evals after switching.
AI engineering interviews jump from transformer basics to RAG design to cost trade-offs in one breath. When the interviewer asks why your retrieval missed, or how you would evaluate a prompt change, you need the frame instantly.
ClapAssist is your silent co-pilot. Runs natively on macOS and Windows, listens to the interviewer's exact question, and surfaces concise talking points right next to your camera eye-line. Excluded at the OS level from Zoom, Google Meet, and Teams screen sharing.