Eurekly.

01 / Language models

A response, one token at a time.

A large language model learns patterns in text. A generative language model uses the text already in its context to predict what could come next.

From text to a continuation

Text is split into tokens: pieces that may be words, word fragments or punctuation. A model assigns probabilities to possible next tokens. A decoding procedure selects one, adds it to the context, and repeats. The result can be a sentence, a program or an explanation. A fluent continuation is not a guarantee that its claims are true. See Google’s introduction to language models.

  1. Context
  2. Next-token probabilities
  3. Select a token
  4. Extend the context
A simplified generation loop. Each selected token becomes context for the next step.

An example: two different jobs

Compare “Write a short welcome note for a library” with “State the closing time of my local library today.” The first asks for a useful composition. The second needs a current, specific fact that the prompt does not supply. The same fluent writing ability can produce both answers, but only one task can be checked from the prompt alone.

If you add a verified notice saying “The library closes at 6 pm on Wednesday,” the model now has evidence to work with. You should still compare its answer with that notice. Supplying evidence is different from teaching the model new permanent knowledge.

Context is a working space

The prompt, previous conversation and supplied documents can influence the answer, within the model’s context limits. An instruction can change style or focus; it does not establish a fact. A model can omit a constraint or produce a plausible error even when useful evidence is present.

Put it to work

For a study explanation, specify your level and ask for one worked example. Then check the example independently: substitute values into a formula, run the code, or consult the original source. Use retrieval-augmented generation when an answer should refer to selected documents, and learn how embeddings can help find relevant passages.

← All topics