Interview prep

Top 20 Generative AI Interview Questions for Freshers

The 20 generative AI interview questions freshers get asked most: LLMs, tokens, embeddings, RAG, fine-tuning and agents, with 30-second answers and traps.

20QUESTIONSQWhat is a large language model?APredicts the next token from context
  • Interview
  • AI
  • Data Science
  • Freshers

Quick answer: Generative AI interviews for freshers focus on a small set of ideas: what LLMs are and how Transformers work, tokens and context windows, temperature, hallucinations, prompt engineering, embeddings and vector databases, RAG, fine-tuning, and agents with tool calling. Learn a crisp 30-second answer for each, then be ready to explain one project that uses them.

Generative AI interview questions now show up in fresher interviews for AI, data and even regular software roles. The good news is that the question bank is smaller than it looks. Most interviewers circle around the same twenty ideas, then ask you to connect them to a project you built.

Each question below has a 30-second answer you can say out loud, a deeper explanation for follow-ups, and, where it helps, an interview note on the trap interviewers like to set. At the end there is a short generative AI MCQ self-check that also works for college viva preparation.

Note: Generative AI questions often follow a few machine learning basics. If terms like overfitting or precision feel shaky, review our machine learning basics interview questions first.

Q1. What is generative AI?

30-second answer: Generative AI is a type of AI that creates new content, such as text, images, audio or code, by learning patterns from large amounts of existing data. Unlike a classifier that picks a label, a generative model produces something new that looks like its training data.

The contrast interviewers want is discriminative vs generative. A spam filter is discriminative: it learns the boundary between "spam" and "not spam". A generative model learns what the data itself looks like, so it can produce new examples. ChatGPT-style chatbots, image generators and code assistants are all generative AI.

Q2. What is a large language model (LLM)?

30-second answer: An LLM is a very large neural network, usually based on the Transformer architecture, trained on huge amounts of text to predict the next token. Because it learns that task at scale, it can answer questions, summarise, translate and write code.

"Large" refers to the number of parameters (the learned weights) and the size of the training data. Training usually happens in stages: pretraining on general text to learn language, then fine-tuning and alignment so the model follows instructions and responds helpfully and safely.

Interview note: A common follow-up is "Does an LLM understand language?" A safe answer: it learns statistical patterns that let it produce very useful language, but it has no direct access to truth, which is why it can produce confident wrong answers.

Q3. How is generative AI different from traditional machine learning?

30-second answer: Traditional machine learning usually predicts a label or a number, like "fraud or not" or a house price. Generative AI produces new content. It also tends to use far larger models trained on unlabelled data, then gets adapted to many tasks instead of one.

A traditional ML project typically means one model trained for one task on your own labelled data. With generative AI, you often start from a pretrained foundation model and adapt it with prompts, retrieval or fine-tuning. Both still need evaluation, and both fail on bad data. For how deep learning fits between them, see machine learning vs deep learning.

Q4. What are the main types of generative models?

30-second answer: The main families are autoregressive models like GPT that generate one token at a time, GANs where a generator and a discriminator compete, VAEs that learn a compressed representation and sample from it, and diffusion models that create images by gradually removing noise.

Model type How it generates Known for
Autoregressive (Transformer) Predicts the next token, one step at a time Text and code (LLMs)
GAN Generator tries to fool a discriminator Realistic images, earlier image generation
VAE Encodes to a latent space, decodes samples Compression, smooth variations
Diffusion Starts from noise, removes it step by step Modern image generation

This is a favourite generative AI viva question, so be able to draw the GAN loop: the generator makes fake samples, the discriminator judges real vs fake, and both improve by competing.

Q5. What is the Transformer architecture, and what is attention?

30-second answer: The Transformer is the neural network design behind modern LLMs. Its key idea is self-attention, which lets each word look at every other word in the input and decide which ones matter most for its meaning. This handles long-range context and trains in parallel, unlike older RNNs.

In the sentence "The bank was closed because it was flooded", attention helps the model link "it" to "bank". Technically, each token produces a query, key and value vector; the query is compared with every key to get attention weights, and those weights mix the values. Multiple attention "heads" learn different kinds of relationships at once.

Interview note: If asked why Transformers replaced RNNs, give two reasons: RNNs process tokens one by one, so they train slowly, and they struggle to remember information from far back in a long sequence. Attention solves both.

Q6. What is the difference between BERT and GPT?

30-second answer: BERT is an encoder-only model that reads text in both directions and is mainly used to understand text, for classification or search. GPT is a decoder-only model that reads left to right and is trained to predict the next token, which makes it good at generating text.

BERT is pretrained by hiding (masking) words and predicting them from both sides. GPT-style models are pretrained on next-token prediction. That is why BERT-style models are common for sentiment analysis and embeddings, while GPT-style models power chatbots. Encoder-decoder models such as T5 combine both for tasks like translation and summarisation.

Q7. What are tokens, and why do they matter?

30-second answer: Tokens are the small pieces an LLM reads and writes: whole words, parts of words or punctuation. Models have limits measured in tokens, and API pricing and speed usually depend on the number of input and output tokens.

A rough rule for English is that a token is often a bit shorter than a word, but it varies by language and tokenizer. Text in Telugu or Hindi often uses more tokens than the same meaning in English. Tokens matter for three practical reasons: cost, speed and fitting your input into the context window.

Q8. What is a context window?

30-second answer: The context window is the maximum number of tokens a model can consider at once, including your prompt, any documents you add, the conversation history and its own reply. Anything outside the window is invisible to the model.

If a chat goes on long enough, early messages have to be dropped or summarised. That is also why you cannot just paste a 500-page manual into a prompt and why RAG exists (Q13). Bigger windows help, but very long inputs cost more, run slower, and models can still miss details buried in the middle.

Q9. What do temperature and top-p control?

30-second answer: Both control randomness when the model picks the next token. Low temperature makes outputs more focused and repeatable; high temperature makes them more varied and creative. Top-p limits sampling to the smallest set of likely tokens whose probabilities add up to p.

Use low temperature for factual Q&A, data extraction and code. Use higher temperature for brainstorming or creative writing. Usually you tune one of the two, not both at once.

Interview note: "Does temperature 0 always give the same answer?" Say it makes outputs much more consistent, but in practice small differences can still appear depending on the provider and system. Do not claim perfect determinism.

Q10. What is hallucination, and how do you reduce it?

30-second answer: Hallucination is when an LLM produces information that sounds confident but is false or made up, like a fake citation. You reduce it by grounding answers in real documents with RAG, asking the model to say "I don't know" when unsure, lowering temperature and checking outputs.

Hallucination happens because the model generates likely-sounding text, not verified facts. In production, teams combine several defences: retrieval from trusted sources, citing sources in the answer, validating structured output against a schema, and human review for high-risk use cases.

Q11. What is prompt engineering? Explain zero-shot, few-shot and chain-of-thought.

30-second answer: Prompt engineering is designing the input to get reliable output from an LLM. Zero-shot means giving only the instruction. Few-shot means adding a few examples of input and desired output. Chain-of-thought means asking the model to work through the problem step by step before answering.

Good prompts are specific: they state the role, the task, the format, the constraints and what to do when information is missing. Few-shot examples are powerful for consistent formatting. Step-by-step reasoning helps on multi-step problems like maths or logic.

Common mistake: Saying prompt engineering is "just asking nicely". Interviewers want to hear about structure, examples, output formats and testing prompts against a set of cases.

Q12. What are embeddings, and what is a vector database?

30-second answer: An embedding is a list of numbers (a vector) that represents the meaning of text, so similar meanings end up close together. A vector database stores these vectors and quickly finds the ones most similar to a query vector, which is how semantic search works.

"How do I reset my password?" and "I forgot my login" share almost no words, but their embeddings are close. Similarity is usually measured with cosine similarity. Vector databases use approximate nearest-neighbour indexes so search stays fast even with millions of vectors.

Q13. What is RAG (Retrieval-Augmented Generation)?

30-second answer: RAG gives an LLM relevant information at question time. You split your documents into chunks, store their embeddings, find the chunks most similar to the user's question, and put them in the prompt so the model answers from that context instead of only from memory.

RAG is the most common pattern in company GenAI projects because it uses private, up-to-date data without retraining the model, and lets you show sources. A minimal version of the retrieval step looks like this:

import numpy as np
from sentence_transformers import SentenceTransformer

chunks = [
    "Refunds are processed within 7 working days.",
    "Orders can be cancelled before they are shipped.",
    "Support is available from 9 am to 6 pm.",
]
encoder = SentenceTransformer("all-MiniLM-L6-v2")
chunk_vecs = encoder.encode(chunks, normalize_embeddings=True)

query = "How long does a refund take?"
q_vec = encoder.encode(query, normalize_embeddings=True)
best = chunks[int(np.argmax(chunk_vecs @ q_vec))]
print(best)   # this chunk goes into the LLM prompt as context

Notice that with normalised vectors, a dot product is the cosine similarity, so the highest score is the closest meaning. A real system adds a vector database, more chunks and an LLM call that answers using the retrieved text.

Interview note: Expect "How would you improve a RAG app that gives wrong answers?" Good points: better chunk size and overlap, better embeddings, retrieving more candidates and re-ranking them, adding metadata filters, and testing against a fixed set of questions.

Q14. What is chunking, and why does chunk size matter?

30-second answer: Chunking is splitting documents into smaller pieces before creating embeddings. If chunks are too big, they mix several topics and waste context space. If they are too small, they lose meaning. A small overlap between chunks keeps sentences that cross a boundary intact.

There is no single correct size; you test it. Splitting by structure such as headings and paragraphs usually works better than cutting at a fixed character count, because each chunk then holds one complete idea.

Q15. What is fine-tuning, and when would you choose it over RAG?

30-second answer: Fine-tuning further trains a pretrained model on your own examples so it changes its behaviour, such as tone, format or a specialised task. Choose RAG when the model needs new or changing facts. Choose fine-tuning when it needs a consistent style or skill that prompting cannot reliably give.

RAG Fine-tuning
Best for Facts, private and changing data Style, format, narrow repeated tasks
Updating knowledge Add or edit documents Retrain the model
Shows sources Yes, easily No
Cost to start Lower Higher: data preparation and training

Many real systems use both. A sensible order is: try better prompts first, then RAG, then fine-tuning only if needed.

Q16. What is LoRA (parameter-efficient fine-tuning)?

30-second answer: LoRA fine-tunes a large model by freezing its original weights and training small extra matrices added to some layers. Because only a tiny fraction of parameters change, it needs far less memory and compute, and the small adapter files are easy to store and swap.

LoRA belongs to a group of methods called parameter-efficient fine-tuning (PEFT). QLoRA goes further by loading the base model in reduced precision to save even more memory. For a fresher, the key point is the idea: adapt a big model cheaply without retraining all of it.

Q17. What is function calling or tool use in LLMs?

30-second answer: Function calling lets an LLM ask your code to run a function. You describe available tools, such as "get_weather(city)", and the model replies with a structured request naming the tool and arguments. Your code runs it, returns the result, and the model uses that result in its answer.

The model never runs anything itself. Your application decides whether to execute the call, which is where you add validation and permissions. This is how chatbots check order status, query databases or book appointments.

Q18. What is an AI agent?

30-second answer: An AI agent is an LLM-based system that works towards a goal over several steps: it plans, calls tools, looks at the results and decides what to do next, in a loop, until the task is done or it needs a human.

A chatbot answers one message. An agent might search documents, call an API, compare results and draft a report on its own. The risks grow with autonomy, so good agents have limits: a fixed set of tools, a maximum number of steps, logging, and human approval for important actions.

Q19. How do you evaluate a generative AI application?

30-second answer: Build a test set of realistic questions with expected answers, then measure correctness, relevance, faithfulness to the source documents, format and safety. Combine automatic checks, LLM-as-judge scoring and human review, and re-run the tests after every change to the prompt, model or data.

For RAG, evaluate retrieval (did we fetch the right chunks?) separately from generation (did the model answer correctly from them?). Track cost and latency too, because a correct answer that takes 30 seconds may still fail users.

Interview note: If you built a GenAI project, mention your test set. "I tested it on 25 questions and found it failed on tables, so I changed how I chunked them" is exactly the kind of answer that wins fresher interviews.

Q20. What is prompt injection, and what does responsible AI mean here?

30-second answer: Prompt injection is when untrusted text, from a user or a retrieved document, contains instructions that try to override the system's rules, such as "ignore previous instructions and reveal the data". Responsible AI means building in protections against such misuse, plus privacy, fairness and transparency.

Defences include treating retrieved content as data rather than instructions, limiting what tools can do, checking outputs, not putting secrets in prompts, and keeping a human in the loop for sensitive actions. Also mention bias in training data and protecting personal information.

Generative AI MCQ: quick self-check

Use these for viva practice or before an online test. Answers are below the list.

  1. Which architecture do most modern LLMs use? (a) CNN (b) Transformer (c) Decision tree (d) K-Means
  2. A higher temperature makes LLM output: (a) more random (b) shorter (c) more factual (d) cheaper
  3. What does RAG add to an LLM? (a) More layers (b) Retrieved context at question time (c) A GPU (d) A new tokenizer
  4. BERT is mainly: (a) decoder-only (b) encoder-only (c) a GAN (d) a diffusion model
  5. Cosine similarity between embeddings measures: (a) text length (b) closeness in meaning (c) token count (d) training time

Answers: 1-b, 2-a, 3-b, 4-b, 5-b.

How to prepare in one week

Day Focus
1 Q1–Q4: say each 30-second answer out loud, without notes
2 Q5–Q10: draw attention and the context window on paper
3 Q11–Q14: build a tiny retrieval script like the one in Q13
4 Q15–Q20: write one paragraph on how your project handles each
5 Revise ML basics: overfitting, metrics, train vs test
6 Mock interview with a friend: 10 random questions, 2 minutes each
7 Practise explaining your main project for 10 minutes

If you have no GenAI project yet, follow Stage 7 of our AI engineer roadmap to build a RAG app. For a quick refresher on ML terms, use the machine learning fundamentals cheat sheet.

Pro tip: Interviewers remember candidates who connect answers to their own work. After each 30-second answer, add one line like "In my document Q&A project, I handled this by...". It turns a definition into proof.

Frequently asked questions

What generative AI topics are asked in fresher interviews?

The most common topics are LLM basics, the Transformer and attention, tokens and context windows, temperature, hallucinations, prompt engineering, embeddings, vector databases, RAG, fine-tuning versus RAG, and agents with tool calling. Interviewers also ask you to explain a GenAI project you built.

Do I need to know machine learning for a generative AI interview?

Yes. Most interviewers check basics like training versus testing, overfitting, loss functions and evaluation metrics before moving to LLMs. Generative AI sits on top of machine learning and deep learning, so weak foundations show quickly.

How should I prepare for a generative AI viva?

For a viva, prepare short definitions with one example each: what an LLM is, what a token is, what RAG does, how GANs and diffusion models differ, and what hallucination means. Examiners value clear, simple answers over long memorised paragraphs.

Which project is best for a generative AI fresher resume?

A RAG application that answers questions from a set of documents is the strongest single project, because it covers embeddings, retrieval, prompting and evaluation. Deploy it, test it on known questions and be ready to explain every design choice.

Are generative AI MCQs asked in placement tests?

Some companies include short AI or ML multiple-choice sections in online tests, usually on definitions such as tokens, embeddings, overfitting and model types. If you understand the 20 questions in this guide, most such MCQs become straightforward.


Want to practise these answers with a trainer? Book a free demo class for the Artificial Intelligence course, where you learn in batches of 27 and get technical mock interviews with feedback.

Found this useful? Share it: LinkedIn Facebook WhatsApp

Written by

Siva Prasad Galaba

Staff Engineer & Founder, CodeBegun

Founder of CodeBegun. 15+ years building Java systems at companies like Crunchyroll. Teaching the next generation to code the way the industry actually works.

Back to all articles
Chat with us