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

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.
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.
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.
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.
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.
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 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.
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.
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-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.