protologue

Foundations

Core concepts of prompting — the parts of a prompt, how models consume it, and the basic zero-shot and few-shot paradigms.

Definitions

Base Model
A base model is a language model after pretraining but before instruction tuning or preference tuning, so it continues text in the style of its training data rather than following instructions.
Chat Template
A chat template is the model-specific format that converts a list of role-tagged messages, such as system, user, and assistant turns, into the exact token sequence with special control tokens that the model was fine-tuned on.
Context Window
The context window is the maximum number of tokens a language model can attend to in a single call, covering both the prompt and the generated output.
Contrastive Decoding
Contrastive decoding is a text-generation method that chooses tokens by maximizing the difference in log-likelihood between a large "expert" language model and a smaller "amateur" model, restricted to tokens the expert itself finds plausible.
Delimiters
Delimiters are explicit markers, such as XML-style tags, triple quotes, or headings, that separate the parts of a prompt so the model can tell instructions, data, and examples apart.
Diffusion Language Model
A diffusion language model generates text by starting from a fully corrupted sequence, such as all mask tokens or noise over token embeddings, and refining the whole sequence over a series of denoising steps, instead of producing one token at a time from left to right.
Direct Preference Optimization
Direct preference optimization (DPO) aligns a language model to human preferences by training directly on preferred-versus-rejected response pairs, without fitting a separate reward model or running reinforcement learning.
Emergent Abilities
Emergent abilities are capabilities that appear in large language models above a certain scale but are near chance in smaller ones, such as multi-step arithmetic or benefiting from chain-of-thought prompting.
Evol-Instruct
Evol-Instruct is a method for generating instruction-tuning data in which a language model repeatedly rewrites a starting set of instructions into more complex versions, producing a range of difficulty levels to train on.
Few-shot Prompting
Few-shot prompting includes a small number of input-output examples in the prompt so the model can infer the task and the desired format from demonstrations.
Fine-Tuning
Fine-tuning is the further training of a pretrained model on a smaller, task- or domain-specific dataset so that its weights adapt to that task or domain.
FlashAttention
FlashAttention is an exact attention algorithm for transformers that computes attention in tiles held in fast on-chip GPU memory, reducing reads and writes to slower high-bandwidth memory so that attention runs faster and uses memory linear rather than quadratic in sequence length.
Flipped Interaction
Flipped interaction is a prompt pattern in which the user asks the model to lead the conversation by asking questions, one or a few at a time, until it has the information it needs to complete a stated task.
Foundation Model
A foundation model is a model trained on broad data at scale, usually with self-supervision, that can be adapted to a wide range of downstream tasks by prompting or fine-tuning.
Greedy Decoding
Greedy decoding generates text by always choosing the single most probable next token, which makes output deterministic for a given prompt and model.
Instruction Following
Instruction following is a model's ability to carry out explicit instructions in a prompt, including constraints on content, length, format, and style, rather than only answering the underlying question.
Instruction Tuning
Instruction tuning is fine-tuning a pretrained language model on many tasks phrased as natural-language instructions, so that it follows unseen instructions zero-shot.
Kahneman-Tversky Optimization
Kahneman-Tversky optimization (KTO) is a preference-alignment method that trains a language model from outputs labelled simply as desirable or undesirable, using a loss based on Kahneman and Tversky's prospect theory, instead of requiring pairs of preferred and dispreferred responses.
Knowledge Cutoff
A model's knowledge cutoff is the date after which its training data contains little or no information, so it does not know about later events unless they are supplied in the prompt or retrieved.
Knowledge Distillation
Knowledge distillation is training a smaller student model to imitate a larger teacher model, using the teacher's output probabilities or generated responses as training targets, so that the student keeps much of the teacher's ability at lower cost.
KV Cache
The KV cache stores the attention keys and values a Transformer has already computed for earlier tokens, so that generating each new token requires computing only that token's keys and values instead of reprocessing the whole sequence.
Large Language Model
A large language model (LLM) is a neural network, usually a Transformer with billions of parameters, trained on very large text corpora to predict the next token, which lets it generate text and perform many tasks from a prompt.
Log Probabilities
Log probabilities (logprobs) are the logarithms of the probabilities a model assigned to each token it generated, and optionally to the most likely alternatives, exposing how confident the model was at each step.
Min-p Sampling
Min-p sampling is a truncation sampling method that keeps only tokens whose probability is at least a fixed fraction of the most likely token's probability, so that the cutoff tightens when the model is confident and loosens when it is not.
Mixture of Experts
Mixture of experts (MoE) is a neural network architecture in which a layer contains many parallel sub-networks, called experts, and a learned router sends each token to only a few of them, so a model's total parameter count can grow much faster than the computation it uses per token.
Multimodal Prompting
Multimodal prompting is prompting a model with more than one kind of input, such as images, documents, audio, or video together with text, so the model reasons over all of them.
Odds Ratio Preference Optimization
Odds ratio preference optimization (ORPO) aligns a language model with preferences in a single training stage by adding an odds-ratio penalty that favors preferred over dispreferred responses to the ordinary supervised fine-tuning loss, with no reference model and no separate preference-tuning phase.
PagedAttention
PagedAttention is a technique for serving language models that stores each request's key-value cache in fixed-size blocks that need not be contiguous in memory, like pages in operating-system virtual memory, which reduces wasted memory and lets requests share cached blocks.
Prefill
Prefill is the technique of writing the first part of the model's response yourself, so that the model continues from that text and is steered into a specific format or direction.
Prompt
A prompt is the complete input text, and optionally other media, that is given to a language model to condition its output, including instructions, context, examples, and the user's request.
Prompt Engineering
Prompt engineering is the practice of designing, testing, and iteratively refining prompts so that a language model reliably produces the desired output for a task.
Prompt Template
A prompt template is a reusable prompt with placeholder variables that are filled in at run time, separating the fixed instructions from the per-request data.
Reinforcement Learning from AI Feedback
Reinforcement learning from AI feedback (RLAIF) is a variant of reinforcement learning from human feedback in which the preference labels used to train the reward model, or the rewards themselves, come from a language model instead of human annotators.
Reinforcement Learning from Human Feedback
Reinforcement learning from human feedback (RLHF) trains a language model to produce outputs people prefer, by learning a reward model from human comparisons and optimizing the model against it.
Reward Model
A reward model is a model trained to score a language model's outputs according to human or AI preferences, usually from pairwise comparisons, so that the score can serve as a training signal or a ranking criterion.
Role Prompting
Role prompting assigns the model a persona or professional role, such as "You are an experienced tax accountant," to shape its tone, vocabulary, and focus.
Rotary Position Embedding
Rotary position embedding (RoPE) is a way of encoding token positions in a transformer by rotating the query and key vectors by angles proportional to each token's position, so that attention scores depend on the relative distance between tokens.
Self-Instruct
Self-Instruct is a method for building instruction-tuning data in which a language model generates new task instructions, inputs and outputs from a small seed set, the results are filtered to remove invalid or near-duplicate examples, and the model is then fine-tuned on them.
Speculative Decoding
Speculative decoding is an inference technique in which a smaller, faster draft model proposes several next tokens and the large target model checks them in a single parallel pass, accepting or correcting them so that generation is faster while the output distribution stays the same as sampling from the target model alone.
System One Model
A System One model is a kind of AI model, named by TypeSafe AI in 2026, that returns typed, probabilistic decisions matching an output structure defined in advance, such as a label, score or branch choice with a confidence value, instead of generating free text token by token.
System Prompt
A system prompt is a privileged instruction block, placed before the conversation, that sets a model's role, rules, tone, and constraints for every subsequent turn.
Temperature
Temperature is a sampling parameter that rescales a model's output probabilities before a token is chosen; lower values make outputs more deterministic and higher values make them more varied.
Token
A token is the basic unit of text a language model reads and writes, typically a word, word fragment, or character sequence produced by a subword tokenizer such as byte-pair encoding.
Top-k Sampling
Top-k sampling is a decoding method that, at each step, restricts sampling to the k most probable next tokens and renormalizes their probabilities.
Top-p Sampling
Top-p sampling, also called nucleus sampling, draws each next token only from the smallest set of candidates whose cumulative probability exceeds a threshold p.
Zero-shot Prompting
Zero-shot prompting asks a model to perform a task from an instruction alone, without any worked examples in the prompt.