Java Zero to All All questionsPractise free
Interview questions › Build AI Features as a Java Backend Engineer › Start Here — Build Your First AI Feature

In one or two sentences, what actually happens when an LLM 'answers' a question, and why does that mental model matter for backend design?

Level II · JuniorStart Here — Build Your First AI Feature
Short answer

An LLM is a function that, given a sequence of tokens, predicts a probability distribution over the next token, and text is generated by sampling one token at a time and feeding it back in.

Explanation

The weights are frozen at inference time, so the model has no live memory, no database lookup, and no awareness of anything outside the tokens you send in the current request. This matters because every 'conversation' is really you resending the whole history each turn, every fact the model 'knows' is either baked into weights during training or supplied in the prompt, and anything time-sensitive or private must be injected by your code via retrieval or tools. Interviewers probe this to see if you understand that the LLM is stateless and non-deterministic rather than a magic knowledge service, because that shapes how you handle memory, grounding, and caching.

Common mistakes
  • Saying the model 'looks up' answers in a database.
  • Treating its output as verified fact.

Can you say this out loud in two minutes? Drill it in a timed mock interview, with flashcards and runnable code for Start Here — Build Your First AI Feature.

Practise free

More on Start Here — Build Your First AI Feature