Interview Q&A / AI & Generative AI
AI & Generative AI interview questions
LLMs, tokens, embeddings, RAG and prompt engineering, the questions every AI role now asks.
Prefer rapid revision? Practise AI & Generative AI short interview answers →
- What are hallucinations in LLMs, and how can you reduce them?
A hallucination is when an LLM produces fluent, confident output that is false or not supported by its input, such as an invented fact or citation. You reduce them by grounding the model in real sources, allowing it to say "I don't know", lowering randomness and checking outputs.
BeginnerIn-depth3 min read - What are tokens and the context window in an LLM?
Tokens are the small pieces of text (whole words, parts of words or symbols) that an LLM reads and writes. The context window is the maximum number of tokens the model can consider at once, including both your input and its output.
BeginnerIn-depth3 min read - What is a large language model (LLM), and how does it generate text?
An LLM is a neural network trained on a huge amount of text to predict the next token. It generates text by predicting one token at a time, adding it to the input, and repeating until it stops.
BeginnerIn-depth3 min read - What is prompt engineering, and what makes a good prompt?
Prompt engineering is writing and testing the input to an LLM so it reliably produces the output you need. Good prompts give clear instructions and context, show a few examples when the format matters, and ask for a specific output structure.
BeginnerIn-depth3 min read - What are embeddings, and how is vector similarity used to compare text?
An embedding is a list of numbers that represents the meaning of a piece of text, so texts with similar meaning get vectors that point in similar directions. Similarity measures such as cosine similarity compare these vectors to find related text.
IntermediateIn-depth3 min read - What do temperature and top-p control in an LLM?
Both control how the next token is picked from the model's probabilities. Temperature sharpens or flattens the probabilities (low means predictable, high means varied), and top-p limits sampling to the smallest set of tokens whose probabilities add up to p.
IntermediateIn-depth3 min read - What is retrieval-augmented generation (RAG), and when would you use it?
RAG first retrieves relevant passages from your own data, then gives them to the LLM along with the question so it answers from that material. Use it when answers must come from private, large or frequently changing information the model was not trained on.
IntermediateIn-depth3 min read - When would you use prompting, RAG or fine-tuning to adapt an LLM?
Start with prompting because it is cheapest and fastest to change. Add RAG when the model needs knowledge it does not have, such as private or changing data. Use fine-tuning when you need consistent behaviour, style or format that prompting cannot reliably achieve, not mainly to add facts.
AdvancedIn-depth4 min read