Practice 45 LLM interview questions on tokens, transformers, attention, context windows, embeddings, RAG, fine-tuning, evaluation, latency, safety, and deployment.
45 questions with answersKey Takeaways
An LLM, or large language model, is a model trained on large text and code datasets to predict the next token from context. That simple training goal supports tasks such as chat, summarization, extraction, coding, and classification. In interviews, LLM questions test how the model works, how applications use it, and how you manage grounding, evaluation, latency, cost, safety, and privacy.
Watch: Intro to Large Language Models
Video: Intro to Large Language Models (Andrej Karpathy, YouTube)
Test yourself and earn a certificate
6 quick questions. Score 70%+ to download your LLM certificate.
Start here. These are the definitions and first-principle checks that open most rounds.
A token is a piece of text, such as a word part, word, punctuation mark, or symbol, processed by the model.
Cost, context length, and output length are often measured in tokens.
Token changes LLM decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.
Watch a deeper explanation
Video: Intro to Large Language Models (Andrej Karpathy, YouTube)
A tokenizer converts text into token ids and converts generated token ids back into text.
Different tokenizers split the same text differently.
Tokenizer changes LLM decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.
Transformers process token sequences using attention, feed-forward layers, and learned representations.
They are the core architecture behind many modern LLMs.
Transformer changes LLM decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.
LLM application path
Validation belongs outside the model.
Attention lets the model weigh relationships between tokens in the context.
It helps the model use earlier text when predicting later tokens.
Attention changes LLM decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.
| Answer part | What to say | Evidence to mention |
|---|---|---|
| Definition | Attention in one direct sentence. | Official docs or course material |
| Use case | The work where it changes a decision. | Dataset, model, query, dashboard, or pipeline |
| Risk | What breaks when it is misunderstood. | Metric, log, test result, or review note |
A context window is the maximum amount of input and output tokens the model can consider in one request.
Longer context is useful but not free.
Context window changes LLM decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.
Watch a deeper explanation
Video: Deep dive into LLMs like ChatGPT (Andrej Karpathy, YouTube)
Embeddings map text to vectors so similar meanings are close in vector space.
They are used for semantic search, RAG, clustering, and dedupe.
Embedding changes LLM decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.
RAG retrieves external context and includes it in the prompt so the model can answer from supplied sources.
It is common for private or current knowledge.
RAG changes LLM decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.
Fine-tuning trains a model further on examples to adjust behavior, style, format, or domain task performance.
It does not replace retrieval for changing facts.
Fine-tuning changes LLM decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.
Decoding is the process of selecting output tokens from model probabilities.
Temperature and top-p affect variety and determinism.
Decoding changes LLM decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.
Temperature changes randomness during token selection.
Lower values are more stable. Higher values can be more varied.
Temperature changes LLM decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.
Hallucination is unsupported or false output that sounds plausible.
Grounding and evaluation reduce risk but do not remove it.
Hallucination changes LLM decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.
Prompt injection happens when untrusted text tries to change the model's intended instructions.
It matters in RAG, browsing, email, and tool-use systems.
Prompt injection changes LLM decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.
Structured outputs make responses easier to validate, parse, store, and test.
They are useful for extraction and workflow automation.
Structured output changes LLM decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.
Watch a deeper explanation
Video: Building Large Language Models (Stanford CS229, YouTube)
Tool calling lets the model request an external function or API to fetch data, calculate, or take action.
The application must validate arguments and permissions.
Tool calling changes LLM decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.
LLM outputs can be open-ended, partially correct, style-dependent, and sensitive to prompt changes.
Use rubrics, golden examples, human review, and automated checks.
Evaluation changes LLM decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.
These questions test whether you can apply the topic to real data, real code, and messy constraints.
Define summary type, chunk long text, preserve source references, constrain format, and evaluate factual consistency.
Summaries should not invent facts missing from the source.
summarization app changes LLM decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.
# Interview check: split data, run baseline, inspect metric
from sklearn.metrics import accuracy_score
print(accuracy_score(y_true, y_pred))Ingest docs, chunk cleanly, embed, retrieve, rerank if needed, generate from context, cite sources, and log feedback.
Access control must filter retrieval before generation.
RAG search assistant changes LLM decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.
Use a structured schema, examples, validation rules, confidence checks, and human review for low-confidence fields.
Extraction errors need a review path.
structured extraction changes LLM decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.
Include task instructions, relevant source context, user constraints, examples if useful, and output format.
Remove irrelevant history because it adds cost and distraction.
context design changes LLM decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.
Compare task quality, latency, cost, context length, privacy, tool support, structured output support, and failure behavior.
Use an eval set, not only a vendor description.
model choice changes LLM decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.
Collect realistic tasks, expected answers or rubrics, edge cases, unsafe prompts, and regression examples.
Keep examples versioned.
eval set changes LLM decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.
Ground answers in sources, require abstention, validate facts where possible, show citations, and test unsupported-answer cases.
Never promise zero hallucination.
reduce hallucination changes LLM decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.
Treat retrieved or user text as data, isolate instructions, validate tool calls, filter outputs, and run adversarial tests.
Do not let documents become system prompts.
handle prompt injection changes LLM decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.
Define tool schemas, permissions, input validation, confirmation for risky actions, rate limits, and audit logs.
The model suggests. The application enforces.
tool use design changes LLM decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.
Shorten context, cache stable calls, route easy tasks to smaller models, batch background work, and monitor token usage.
Cost control starts with observability.
cost reduction changes LLM decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.
Watch a deeper explanation
Video: Large Language Model Reasoning (Stanford CS25, YouTube)
Use faster models, shorten prompts, cache retrieval, stream output, parallelize safe work, and avoid unnecessary tool calls.
Measure each step before changing architecture.
latency reduction changes LLM decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.
Store user-approved facts, summarize conversations, retrieve only relevant memory, and let users inspect or delete it.
Memory has privacy and correctness risks.
memory design changes LLM decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.
Return a clear uncertainty response, ask for missing information, route to a human, or fall back to deterministic logic.
Guessing is a product bug in high-risk workflows.
fallback behavior changes LLM decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.
Run the same eval set, compare quality, latency, cost, safety failures, and user-facing output changes.
Model upgrades can break prompts.
regression testing changes LLM decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.
Filter access before retrieval, minimize prompt data, redact where needed, control logs, and define retention.
Privacy must be designed before the model call.
privacy control changes LLM decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.
Advanced rounds test trade-offs, failure modes, and whether the decision can hold up under production pressure.
The context may include irrelevant, conflicting, or poorly ordered information.
Long context is not the same as good context.
long context weak answer changes LLM decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.
Check chunking, embeddings, query rewriting, metadata filters, reranking, and document freshness.
Generation cannot fix missing context reliably.
retrieval miss changes LLM decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.
The prompt, validation, or answer policy may not force source-grounded responses and abstention.
Source-grounded apps need strict answer rules.
unsupported answer changes LLM decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.
Tool schema validation, permission checks, intent checks, and confirmation for risky actions.
Do not rely on model judgment alone.
tool misuse changes LLM decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.
Create a clearer rubric, examples for each score, and separate factual, style, safety, and completeness criteria.
LLM evaluation needs shared definitions.
eval disagreement changes LLM decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.
Regression evals and canary rollout should catch prompt or output changes.
Hosted models still need release checks.
model drift changes LLM decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.
Retrieval access control or document filtering likely failed.
Permissions must apply before generation.
privacy leak changes LLM decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.
Remove irrelevant history, summarize context, retrieve fewer better chunks, and route simple tasks to smaller models.
Track cost per request type.
prompt too expensive changes LLM decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.
Use structured output support, schema validation, retries with error feedback, or deterministic parsers where possible.
Validate before storing or acting.
JSON invalid changes LLM decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.
Require uncertainty wording, source checks, abstention, and confidence based on retrieval quality.
Tone should match evidence.
answer too confident changes LLM decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.
Use RAG for changing policy facts and consider fine-tuning only for repeated response style or format.
Fine-tuning is not a knowledge base.
fine-tune confusion changes LLM decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.
Use policy filters, refusal rules, safer completion paths, human review, and post-deployment monitoring.
Safety controls depend on the domain.
unsafe advice changes LLM decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.
Check task fit, trust, source visibility, response speed, integration point, and whether the output reduces actual work.
An LLM feature still needs product-market fit.
low adoption changes LLM decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.
Ask about data access, context design, evals, model choice, tool permissions, safety, privacy, cost, latency, logging, and fallback.
The wrapper decides most production quality.
senior review changes LLM decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.
LLM interviewers often ask how you improve responses. The technical detail the failure type: unclear task, missing knowledge, or repeated behavior mismatch comes first.
| Approach | Best for | Benefit | Risk |
|---|---|---|---|
| Prompting | Clearer task instructions and output format | Fast iteration | Can be brittle without evals |
| RAG | Private or current knowledge | Grounded answers from sources | Retrieval failure causes answer failure |
| Fine-tuning | Repeated style, format, or domain behavior | Shorter prompts and better consistency | Needs high-quality examples |
| Tool use | Live actions or calculations | Connects model to systems | Needs validation and audit |
LLM answer signals
Good answers discuss the system around the model.
Prepare by explaining both the model and the application wrapper. A strong answer covers input, context, model call, validation, output, and monitoring.
LLM interview prep flow
Most rounds reward clear reasoning more than memorized phrasing.
A strong LLM answer says what the model can and cannot know. It explains token limits, context design, retrieval quality, prompt structure, tool permissions, and evaluation. production-ready answers include privacy boundaries, prompt injection defenses, output validation, model version regression tests, cost tracking, latency budgets, and fallback behavior when the model should not answer.
LLMs generate likely tokens. They can solve hard tasks, but fluent output is not proof of truth.
Long context costs money and attention. Put the most useful information in the clearest form.
LLM quality needs task-specific test sets, not only manual chat checks.
Tool calls need schemas, permissions, confirmations, and logs.
6 questions, about 4 minutes. Score 70% or higher to earn a shareable certificate.
Use this LLM bank for model and application reasoning, then practice Python, data, and system tasks with Hyring's AI Coding Interviewer.
See Hyring AI Coding Interviewer