Model fundamentals

Large language model (LLM)

A large language model (LLM) is a neural network trained on huge amounts of text to predict the next token; by repeating that prediction it writes answers, code and any other text.

An LLM reads text as tokens and, for each step, scores every token in its vocabulary as a possible continuation; one is chosen, appended, and the process repeats until the reply ends. Its knowledge comes from pre-training on books, web pages and code, stored implicitly in billions of parameters, and further training on dialogues and human feedback turns it into an assistant that follows instructions. On its own it only produces text: it cannot browse, run code or remember past conversations. An agent is a program that gives an LLM tools and runs it in a loop.

Key points

  • It generates text one token at a time, each token conditioned on everything before it.
  • Its knowledge is learned from training data, not looked up - and stops at the training cutoff.
  • Within one call it sees only its context window; it has no memory between calls.
  • It can produce fluent, confident and wrong answers (hallucinations), so outputs need checking.
  • Tools and a loop around the model - an agent - supply fresh data, memory and the ability to act.

Learn it by building

Way of the Agent teaches AI agent engineering level by level - concepts like this one, then hands-on practice, XP, and the AI Chronicles.

Start learning free →