You can define temperature, top-k, and top-p in an interview and still get stuck when the interviewer asks why a test failed at temperature 0. To practice that kind of follow-up, enter $0 for the free Top 30 AI Engineer Interview Questions PDF (13 pages, each with what the interviewer tests and the follow-up to expect).
What the interviewer is checking
At each generation step, the model scores possible next tokens. The interviewer wants you to explain how each setting changes the distribution used to select that next token, then connect the setting to a product requirement.
The harder part comes when you move from decoding to serving. An interview answer should explain both what greedy decoding does with a fixed set of scores and why repeated requests can produce slightly different scores in a production system.
A strong answer
I think of temperature as changing how strongly the decoder favors the highest-scoring tokens. At positive temperatures, it divides the logits by the temperature before softmax. Lower temperature concentrates probability on the leading tokens, while higher temperature spreads it out. I’d lower it for a constrained task like extraction and raise it if I wanted more varied draft suggestions.
Top-k keeps a fixed number of the highest-scoring tokens. I’d use it when I want a hard cap on how many choices the decoder considers at each step. Top-p keeps the smallest group of highest-probability tokens whose cumulative probability reaches the threshold. I’d use that when I want the number of choices to adapt. A clear favorite can leave a small pool, while a flatter distribution can leave a larger one. After filtering, the remaining probabilities are renormalized before sampling.
Temperature 0 typically selects the highest-scoring token directly. That choice is deterministic given the same scores and tie-breaking rule. In a live service, batching can change how floating-point computations run, which can flip the order of two nearly tied tokens. Once one token changes, the next step has a different prefix. For tests, I’d check the output contract and run several generations to see whether the feature holds up across outputs.
Follow-ups to expect
- Why can batching change the result for the same prompt? A request may run alone or alongside other requests. The batch shape can affect kernel selection or the order of floating-point operations. Because intermediate results are rounded, a different computation order can move scores enough to change which token wins a close contest.
- When would you choose top-k over top-p? Use top-k when the size of the candidate pool is the constraint. Use top-p when you want the pool to expand on ambiguous steps and shrink on obvious ones. If either filter leaves a single token, the decoder has only one choice at that step.
- How would you test a model that extracts fields from support tickets? Parse the response and validate the schema. Check that required fields exist, allowed labels are used, extracted values are supported by the ticket, and missing values follow the contract. Assert exact values for fields where the task requires them.
- What if the feature writes a summary? Define rubric checks for preserving the central claim, covering required facts, and avoiding unsupported additions. A model grader can apply that rubric with the source text in view. Review examples of its judgments against human assessments before relying on it. Run each test case several times and inspect where the outputs fail.
The weak answer
A candidate says temperature 0 makes every call identical, top-k and top-p both make answers more creative, and a good regression test saves one response and compares every future response to it.
That answer skips the difference between reshaping probabilities and filtering candidates. The regression test also treats a harmless wording change as a failure. If the feature promises a particular field value or a literal token required by a parser, assert it directly. For open-ended prose, assert the properties the user depends on.
A drill
Use a prompt that turns a support ticket into structured fields and a short summary. Write down three assertions before generating anything.
- The response parses and satisfies the schema.
- The priority label is allowed and any extracted identifiers appear in the ticket.
- The summary names the problem without adding an unsupported cause.
Run the prompt several times at temperature 0, then try a positive temperature. Evaluate each output against the same assertions. Practice explaining how two differently worded summaries can both pass, and identify one plausible response that should fail.
Keep practicing
Rehearse the strong answer aloud, then have a partner interrupt with one of the follow-ups. For more practice, see The 0 to 1 AI Engineer Interview Playbook (twenty chapters on RAG, agents, evals, fine-tuning and LLM system design), 30 percent off with code BF30 through Mon Nov 30.
Valenx Press. Practice material, no company affiliation, no interview promise.
