Topic 2 of 20 · 47 words
LLM Fundamentals
How large language models turn text into tokens and embeddings, predict one token at a time, and follow system and user prompts.
The 47 words, in learning order
Start at 1. Each word builds on the ones before it.
- Large Language Model (LLM)A Large Language Model is a huge AI model trained on enormous amounts of text so it can read, write and answer questions in human language.
- Foundation ModelA foundation model is a big, general-purpose AI model trained on broad data that can be adapted to many different tasks.
- Generative AIGenerative AI is AI that creates new content, like text, images, music, video or code.
- Multimodal ModelA multimodal model is an AI that can understand or create more than one kind of data, like text, images, audio and video.
- Language ModelA language model is an AI that learns how language works so it can predict or produce words and sentences.
- TransformerA Transformer is a type of neural network design that reads all the words in a passage at once and works out how they relate, using attention.
- GPT (Generative Pre-trained Transformer)GPT stands for Generative Pre-trained Transformer, a family of language models by OpenAI that generate text after being pre-trained on huge amounts of data.
- EncoderAn encoder is the part of a model that reads an input and turns it into a set of numbers that capture its meaning.
- DecoderA decoder is the part of a model that produces output, one piece at a time, such as writing a sentence word by word.
- Encoder-Decoder ArchitectureAn encoder-decoder architecture is a model design with two parts: one that reads and understands the input, and one that writes the output.
- Autoregressive ModelAn autoregressive model creates output one piece at a time, using everything it has created so far to choose the next piece.
- Causal Language ModelA causal language model predicts the next word using only the words that came before it, never the ones after.
- Masked Language ModelA masked language model learns by filling in blanks: some words in a sentence are hidden and the model guesses them using words on both sides.
- Next Token PredictionNext token prediction is the simple training game behind LLMs: look at some text and guess which token comes next.
- TokenA token is a small chunk of text, like a word or part of a word, that a language model reads and writes.
- TokenizerA tokenizer is the tool that chops text into tokens and turns each token into a number the model can use.
- VocabularyA model's vocabulary is the complete list of tokens it knows, each with its own ID number.
- TokenizationTokenization is the process of splitting text into tokens so a language model can work with it.
- Subword TokenizationSubword tokenization splits words into common smaller pieces, so the model can handle any word using a limited vocabulary.
- Byte Pair Encoding (BPE)Byte Pair Encoding is a popular way to build a tokenizer by repeatedly merging the most common pairs of characters into new tokens.
- SentencePieceSentencePiece is a free tokenizer tool from Google that splits text into subword tokens and works with any language, even ones without spaces.
- EmbeddingAn embedding is a list of numbers that represents the meaning of something, like a word, sentence or image.
- Semantic RepresentationA semantic representation is a way of storing the meaning of text or data so a computer can work with it.
- Latent SpaceLatent space is the hidden map inside a model where every input is placed as a point based on its meaning or features.
- ContextContext is all the information an AI model can see when it answers, such as your message, earlier messages and any documents you give it.
- Context WindowThe context window is the maximum amount of text, measured in tokens, that a model can look at in one go.
- Context LengthContext length is the number of tokens a model can handle at once, or how many tokens are currently being used.
- Input TokensInput tokens are the tokens you send to a model, including your prompt, instructions and any documents.
- Output TokensOutput tokens are the tokens the model generates in its reply.
- System PromptA system prompt is a set of hidden instructions given to an AI model before the conversation starts, to shape how it behaves.
- User PromptA user prompt is the message a person types to an AI model, like a question or a request.
- Assistant MessageAn assistant message is a reply written by the AI model in a conversation.
- Prompt EngineeringPrompt engineering is the skill of writing and arranging instructions so an AI model gives the best possible answers.
- Zero-shot PromptingZero-shot prompting is asking an AI to do a task without giving it any examples first.
- One-shot PromptingOne-shot prompting is asking an AI to do a task after showing it exactly one example.
- Few-shot PromptingFew-shot prompting is giving an AI a handful of examples in the prompt before asking it to do the task.
- Chain of Thought (CoT)Chain of Thought is when an AI works through a problem step by step in writing before giving its final answer.
- TemperatureTemperature is a setting that controls how random or creative a model's answers are.
- Top-K SamplingTop-K sampling means the model only chooses the next token from its K most likely options.
- Top-P SamplingTop-P sampling means the model picks from the smallest group of likely tokens whose chances add up to P, such as 90%.
- Repetition PenaltyA repetition penalty is a setting that makes a model less likely to repeat the same words or phrases over and over.
- LogitsLogits are the raw scores a model gives every possible next token before they are turned into probabilities.
- SoftmaxSoftmax is a math function that turns a list of raw scores into probabilities that add up to 100%.
- Probability DistributionA probability distribution is a list of every possible outcome with the chance of each one happening, adding up to 100%.
- Next Token ProbabilityNext token probability is the chance a model gives to a specific token being the next one in the text.
- SamplingSampling is how a model picks the next token from its list of possible options, using their probabilities.
- Deterministic GenerationDeterministic generation means the model gives the exact same output every time for the same input.
How LLM Fundamentals fits together
A Large Language Model (LLM) never reads words the way you do. First, a tokenizer chops text into subword pieces called tokens and maps each piece to a list of numbers called an embedding. Then a Transformer predicts probabilities (logits) for which token should come next, repeating that loop over and over.
Everything else in prompting and generation builds on that loop: the context window sets how many tokens the model can see at once, prompt techniques steer what sits inside that window, and sampling settings like temperature and top-p control how bold or predictable each next-token choice becomes.