Bit by Bit
← All courses
Language and LLMs · Intermediate

How Large Language Models Work

Open up a chat assistant. Text becomes tokens, tokens become vectors, attention lets every word look at every other, and a temperature dial decides how adventurous the next word is. Then see how raw models are turned into helpful assistants.

4 lessons29 minutesFree
Start this course →

Lessons

  1. 1Text becomes tokensSee how text is chopped up and numbered before a model reads it.7 min
  2. 2Meaning as numbersUnderstand embeddings: words as points where nearby means similar.7 min
  3. 3Attention and transformersUnderstand how each word uses the other words around it.7 min
  4. 4Generating text, and becoming an assistantSee how the next word is chosen, and how a raw model becomes a helpful assistant.8 min

What you will learn

Terms explained in this course

tokenizer
The tool that splits text into tokens and gives each one a number, before the model sees it.
vocabulary
The fixed list of all tokens a model knows. Large models use tens of thousands to hundreds of thousands.
vector
A list of numbers. In AI, a vector often represents something, such as a word, as a point in space.
embedding
A vector that represents a token, word or sentence so that similar meanings get nearby vectors.
cosine similarity
A measure of how closely two vectors point in the same direction, from −1 (opposite) to 1 (same direction).
attention
The mechanism that lets each word in a text decide how much to take into account every other word.
transformer
The neural network design behind modern language models. It is built from many layers of attention and simple neuron layers.
softmax
A function that turns a list of scores into probabilities that are all positive and add up to 1.
temperature
A setting that sharpens or flattens the next-token probabilities. Low temperature makes the likeliest token even likelier; high temperature gives unlikely tokens more chance.
pretraining
The first, enormous training stage, in which a model learns to predict the next token on huge amounts of text.
fine-tuning
Further training of a pretrained model on a smaller, focused dataset to change its behaviour or specialise it.
reinforcement learning from human feedback
Training a model with a reward based on which of its answers people preferred, to make it more helpful and safer. Often shortened to RLHF.