AI Engineering Interview Questions — LLM Model Selection
Reviewed by Mark Dickie · Last updated
LLM model selection is the process of choosing which large language model best fits a given task, budget, and deployment constraint. For interview purposes, you should know the key axes of comparison: parameter count, context window length, training data cutoff, open-weight vs. API access, latency, cost per token, and benchmark performance on task-relevant evaluations. Interviewers also expect you to reason about when to fine-tune versus when to rely on prompt engineering, and how model choice interacts with downstream system architecture like retrieval pipelines or agentic workflows.
The table below summarizes the main factors you should be ready to discuss:
| Factor | What to Know | Common Interview Angle |
|---|---|---|
| Parameter count | Ranges from ~1B to 1T+; larger models generally score higher on benchmarks | When does a smaller model outperform a larger one? |
| Context window | 4K to 2M+ tokens depending on model; affects how much text fits in a single call | How do you handle inputs that exceed the context window? |
| Open-weight vs. closed | Open-weight models (Llama, Mistral) can be self-hosted; closed models (GPT-4, Claude) are API-only | Trade-offs of self-hosting vs. using a managed API |
| Cost per token | Pricing varies by orders of magnitude; input vs. output token pricing differs | How do you estimate monthly cost for a production workload? |
| Latency | First-token latency and tokens-per-second differ by model and provider | How does latency affect UX in a chat application? |
| Evaluation fit | General benchmarks (MMLU, HumanEval) vs. task-specific evals | How do you decide if a benchmark is relevant to your use case? |
What does an AI engineering interview test about model selection?
Interviewers typically probe your ability to reason through trade-offs rather than recite model specs. Be ready to address these recurring themes:
- Matching model capability to task requirements: Can you identify which model attributes matter for a specific use case (e.g., code generation, summarization, classification)? The answer is rarely "pick the biggest model."
- Cost and latency optimization: Given a throughput target and a token budget, can you compare per-request cost across providers and choose the model that meets your latency SLA?
- Context window management: When input exceeds the context limit, what strategies do you reach for — chunking, retrieval, sliding window, or simply upgrading to a longer-context model?
- Fine-tuning vs. prompting vs. RAG: Can you articulate when each approach is appropriate, and how model selection changes once fine-tuning enters the picture?
- Evaluating model quality on your data: How do you build a task-specific evaluation set and use it to compare candidate models before committing to one in production?
How do you compare open-weight and closed models for production?
Open-weight models give you control over deployment, data privacy, and inference infrastructure, but require GPU capacity and operational overhead. Closed models offer faster integration and regular updates, but you depend on the provider's API limits, pricing changes, and data policies. The interview question usually presents a scenario — a regulated industry, a latency budget, or a cost ceiling — and asks you to justify your choice. Be concrete: name the models you would shortlist, the trade-offs you weighed, and the evaluation you would run before locking in a decision.
Key facts
- Tarmac has 37 AI Engineering interview questions on this topic, 10 of them on this page, at difficulty 1–5 of 5.
- Tarmac last reviewed these AI Engineering interview questions on 3 August 2026.
At a glance
| Questions | 10 shown · 37 in the bank |
|---|---|
| Difficulty | 1–5 of 5 |
| Formats | Flashcard, True / false, Fill in the blank, Multiple answer, Ordering, Coding exercise, Find the bug, Design exercise, Short answer, Multiple choice |
| Interactive | 1 run your code against tests, in the app |
What you'll review
- model selection
Practice questions
AI Engineering/llm-foundations/model-selection
What does it mean to "quantize" a model, and why does it matter for model selection?#
Show answer
Quantization stores a model's weights at lower numeric precision instead of retraining it, shrinking memory footprint and speeding up inference at a small, tunable quality cost. It matters for selection because a quantized version of a larger model can run cheaper and faster than a smaller full-precision one while keeping more of the larger model's capability, so it becomes a third option alongside "big and accurate" versus "small and cheap."
Quantization is a post-training compression technique, distinct from distillation (which trains a new, smaller model to mimic a teacher) or pruning (which removes weights entirely). It matters for selection because it widens the shortlist: instead of choosing between 'the big accurate model' and 'the small cheap model,' a quantized variant of the big model is often a third option that gets most of the accuracy at close to the small model's cost.
AI Engineering/llm-foundations/model-selection
A model with a larger number of parameters always produces higher-quality outputs than a smaller model, regardless of the task or how the models were trained.#
Options
Show answer
False — a larger parameter count does not guarantee better outputs for every task. A smaller model that is fine-tuned on domain-specific data, or that has undergone better instruction-tuning or RLHF, can outperform a much larger general-purpose model on that domain. Training data quality, alignment techniques, and task fit all play a significant role alongside raw size.
Parameter count is not the sole determinant of output quality. A smaller model that has been fine-tuned on domain-specific data can outperform a larger general-purpose model on that domain. Additionally, instruction-tuning, RLHF, quantization trade-offs, and the quality of training data all heavily influence real-world performance. Benchmarks repeatedly show task-specific smaller models (e.g., fine-tuned 7B models) beating larger base models on targeted tasks.
AI Engineering/llm-foundations/model-selection
When selecting an LLM, two key axes to evaluate are the model's _____ window (the maximum amount of text it can process in a single call) and its _____ cost (the price charged per thousand input/output tokens when using a hosted API).#
Show answer
When selecting an LLM, two key axes to evaluate are the model's context window (the maximum amount of text it can process in a single call) and its inference cost (the price charged per thousand input/output tokens when using a hosted API).
The 'context window' (also called context length) determines how much text — including the system prompt, conversation history, and user message — can be processed in one API call. Models with larger context windows (e.g., 128k tokens) are better suited for tasks like document summarisation or long conversations. 'Inference cost' (charged per token) directly impacts budget planning; models like GPT-4 cost significantly more per token than smaller alternatives, making it a critical factor during model selection.
AI Engineering/llm-foundations/model-selection
You are an AI engineer tasked with selecting an LLM for a production customer-facing summarization service that must process documents up to 50,000 tokens. Which of the following are primary practical criteria you should evaluate when selecting the model?#
Options
Pick every one that applies.
Show answer
When selecting an LLM for a production use case, the number of attention heads is NOT a primary selection criterion. The practical factors that matter are: context window length (can the model handle your input size?), inference cost and latency, licensing terms (commercial use rights), and benchmark performance on domain-relevant tasks. Attention head count is an internal architectural detail irrelevant to model suitability.
When selecting an LLM for a production use case, several factors critically constrain model choice: (1) context window size matters when inputs are long (e.g., entire documents); (2) inference latency and cost per token directly impact feasibility at scale; (3) licensing terms (e.g., commercial use restrictions on some open-weight models like LLaMA 2's acceptable-use policy) can disqualify a model legally; and (4) demonstrated performance on benchmarks relevant to the task domain matters. However, the number of attention heads is an internal architectural detail that has no direct bearing on model selection for a downstream task — it affects implementation details but is not a practical selection criterion on its own.
AI Engineering/llm-foundations/model-selection
Order the steps of narrowing a long list of candidate models down to a single production choice.#
Put these in order
Show answer
Narrow a model shortlist in this order:
- Filter out any model that fails a hard constraint (context window, required features, data/compliance policy)
- Run the surviving candidates against a task-specific eval set built from your own representative data
- Estimate cost and latency for each surviving candidate at your expected production volume
- Pilot the leading candidate in shadow or canary mode against a slice of real traffic
- Commit to the model and document the fallback for if it needs to be swapped later
Hard constraints go first because they are cheap, binary, and eliminate the most candidates for free — there is no point running an expensive quality eval on a model that cannot legally or technically be used. Quality on your own data comes next, since generic benchmarks don't tell you how a model performs on your task. Only among candidates that are both eligible and good enough do cost and latency at your real volume become the deciding factor. A shadow or canary pilot catches gaps between the eval set and live traffic before full commitment, and documenting the fallback up front means a later swap is a known procedure, not a scramble.
AI Engineering/llm-foundations/model-selection
Implement select_model(models, required_context, max_cost_per_output_token). models is a list of dicts, each with keys name (str), context_window (int), and cost_per_output_token (float).#
Starter code
def select_model(models, required_context, max_cost_per_output_token):
# TODO: filter by context window and price ceiling, then pick the cheapest
return models[0]["name"] if models else NoneYour solution must pass
- no models
- picks the cheapest of several eligible models
This one is written and run, not read. Solve it in the app and your code is executed against these tests and the hidden ones.
AI Engineering/llm-foundations/model-selection
This helper is supposed to return the cheapest model with enough context for the current input. In testing, it keeps recommending models that are too small. Which line is the bug?#
function pickCheapestModel(models, requiredContext) {
const eligible = models.filter((m) => m.contextWindow < requiredContext);
if (eligible.length === 0) return null;
return eligible.reduce((best, m) =>
m.costPerToken < best.costPerToken ? m : best
);
}Show answer
Line 2 has the bug: contextWindow < requiredContext keeps only the models whose context is too small — exactly backwards. It should read contextWindow >= requiredContext to keep models that meet or exceed the requirement. The rest of the function is correct: returning null for an empty eligible set is right, and the reduce correctly finds the minimum-cost model.
Line 2's filter condition is inverted: contextWindow < requiredContext keeps only the models whose context is too small, which is exactly backwards — it should be >= requiredContext to keep models that meet or exceed what's needed. That is why the function recommends undersized models: the 'eligible' set it builds is precisely the set that should have been excluded. The rest of the function is correct — line 3's null return for an empty eligible set is the right behavior when nothing qualifies, and the reduce on lines 4-6 correctly finds the minimum-cost model by keeping m over best only when m is cheaper.
AI Engineering/llm-foundations/model-selection
Your team is adding an AI code-review assistant that will run on every pull request for the whole engineering org — roughly 5,000 requests/day, each sending ~3,000 tokens of diff and context and expecting ~800 tokens of structured JSON feedback back. The assistant must return machine-parseable structured output, and your company's data-handling policy forbids sending source code to any vendor whose terms allow training on customer data. Design the process you would follow to select the model, and state which model class you would recommend and why. State your assumptions.#
Show answer
First filter the vendor list to those whose terms explicitly disallow training on customer data (or offer a compliant private/VPC deployment) and who support structured/JSON output — anything failing either is out regardless of quality. Then build a golden set of real pull requests with known-good review feedback and score the surviving candidates against it, not a public leaderboard. At 5,000 requests/day and ~3,800 tokens/request, estimate daily token volume and multiply by each candidate's per-token pricing for a real cost comparison, and check p50/p99 latency against the CI-feedback UX budget. Pick the cheapest model that clears a quality bar on the golden set, run it in shadow mode against a slice of real PRs to compare its suggestions with reviewer outcomes before full rollout, and document a fallback — a second qualifying model, or a 'skip AI review' path — for provider outages. Revisit the choice if the org's PR mix shifts (e.g. a new language) or a cheaper or better model later clears the same bar.
The exercise tests whether a candidate treats data policy and required output shape as disqualifying filters applied before any quality comparison, rather than folding them into a single weighted score where a great answer from a non-compliant vendor could still 'win.' It also tests whether cost and latency get grounded in the feature's actual volume rather than compared as abstract per-token prices, and whether the plan includes a real-traffic pilot rather than jumping straight to full rollout.
AI Engineering/llm-foundations/model-selection
Explain the core mathematical property of Rotary Position Embeddings (RoPE) that makes them particularly well-suited for extending context length (e.g., via methods like YaRN or LongRoPE), and contrast this with how ALiBi encodes positional information. Your answer should identify: (1) where in the transformer computation each method applies its positional signal, and (2) why RoPE's property enables context-length extrapolation strategies that ALiBi's approach makes more difficult.#
Show answer
RoPE encodes position by rotating query and key vectors by angle multiples of position index, using paired dimensions. The crucial property is that the inner product ⟨RoPE(q, m), RoPE(k, n)⟩ depends only on the relative offset (m−n), not absolute positions, because the rotation matrices cancel to yield only the difference. This relative-distance property means extrapolation strategies can adjust the rotation frequency base (theta) — e.g., YaRN scales theta so that the model sees 'familiar' relative angles at longer distances — without retraining from scratch. ALiBi, by contrast, adds a head-specific linear penalty (−slope × |m−n|) directly to the attention logit matrix after the QK dot-product, bypassing the embedding space entirely. Because ALiBi's bias is fixed and linear, extending context simply continues the linear penalty — which works reasonably well for modest extensions. However, ALiBi cannot benefit from frequency-interpolation techniques (like NTK-aware scaling) that operate on the Q/K rotation frequencies, making fine-grained context-length tuning harder. In short: RoPE applies positional signal in the Q/K vector space (enabling frequency rescaling), while ALiBi applies it in the attention logit space (simple but less flexible for advanced extrapolation).
Rotary Position Embeddings (RoPE) encode position by rotating query and key vectors in pairs within the attention computation. The key property is that the dot-product between a query at position m and a key at position n depends only on the relative offset (m − n), not their absolute positions — this emerges naturally from the rotation mathematics. This is why RoPE-based models generalize better to sequence lengths beyond their training context: the relative distances are inherently represented. ALiBi (Attention with Linear Biases) achieves a similar effect differently — it subtracts a linear position bias directly on attention logits rather than modifying Q/K vectors. The critical distinction is that RoPE operates in the Q/K embedding space, while ALiBi operates on the attention score matrix post-QK dot-product. Extended context methods like YaRN and LongRoPE scale the RoPE frequency base (theta) — NOT the embedding dimension — to accommodate longer sequences without full fine-tuning.
AI Engineering/llm-foundations/model-selection
In speculative decoding, a small draft model proposes a sequence of K tokens, which are then verified by the large target model in a single forward pass. An engineer claims the following:#
Options
Show answer
Speculative decoding is lossless with respect to the target model's output distribution. When a draft token is rejected, the algorithm samples a corrected token from a modified distribution that ensures the final sequence is distributed exactly as if the large target model had generated every token autoregressively. The real tradeoff is between wall-clock speedup (governed by how often draft tokens are accepted) and the computational overhead of running both models — not any degradation in output quality.
Speculative decoding uses a small, fast 'draft' model to propose multiple candidate tokens in parallel, then the large 'verifier' model checks them in a single forward pass. The acceptance criterion is designed so that the output distribution is identical to sampling from the verifier alone — this is the key correctness guarantee. The speedup comes from the fact that verifying K tokens costs only slightly more than verifying 1 (batch dimension), while the draft model is cheap. Critically, speculative decoding does NOT change the output distribution of the target model; it only accelerates sampling. The acceptance rate (α) depends on how well the draft model's distribution matches the verifier's. If the draft model is too mismatched (low α), the overhead of running both models exceeds the gain, negating the speedup. Self-speculative decoding (e.g., Medusa heads, EAGLE) avoids the need for a separate draft model by using auxiliary prediction heads on the base model itself.
Related interview questions
The other 27 questions
This page shows 10. A free account opens the rest and marks your answers, which a page of answers can't do. Miss one and it returns a few days later, then a week after that, until you stop missing it.
Free · the whole bank · 100 graded answers per 30 days · written feedback and job-ad quizzes on the paid plan