mlprep
Medium10 min·1 round·Sequence Modeling

What happens step-by-step inside an LLM during token generation?

Written by the mlprep team · Updated

Interviewer Mode
Interviewer

Walk me through exactly what happens inside an LLM when it generates a response — from receiving the raw prompt string to producing each output token. Cover tokenization, the forward pass, logit projection, and how temperature and top-p change the output distribution.

Ready to compare your reasoning?

The key takeaway unlocks after you reveal an expert answer.

Follow-up Questions to Test Yourself

Interviewers often pivot here once you cover the core concept.

  • Why does lowering temperature make the model more deterministic but not necessarily more accurate?
  • What is repetition penalty and how is it applied in logit space?
  • How does beam search differ from nucleus sampling, and when would you prefer each?

How confident do you feel explaining this?

Track your understanding or flag it to revisit before your next loop.

Related Questions