Papa Programmer

Notes

Your notes, linked to the lessons they came from.

Loading your Notes…

A place for your Notes

Keep an idea from a lesson. Your Notes stay linked to its source.

Browse lessons

Glossary

Ablation
A test that removes one part of a system, such as one part of the context, and measures how the score changes. It shows which parts earn their place.
Accuracy
The fraction of predictions that are correct. It can hide poor performance on less common classes, so inspect class-level results too.
Adapter
A small set of new trainable weights added to a frozen model, so only the adapter is trained and saved. A LoRA adapter is the most common kind.
Agent loop
The cycle an agent repeats: look at the goal and history, decide the next action, run it and read the result. The program runs the loop. The model only makes the decision.
Agent memory
Text that an agent's program saves and puts back into the prompt. Short-term memory is the history of the current task. Long-term memory is notes stored outside the prompt that last between tasks.
Agentic workflow
A fixed sequence of steps in which your code decides the order and a language model does the work inside each step. It is cheaper and easier to test than an agent, which chooses its own steps.
AI agent
A program that uses a language model to work toward a goal. It chooses its own steps, uses tools to act, reads the results and repeats until the goal is met or a limit stops it.
AI hallucination
An answer that sounds confident but is false. The model wrote text that fits the pattern instead of text that is true.
Approximate nearest neighbour
A search that finds vectors close to a query without comparing it with every stored vector. It trades a small loss in recall for a large saving in time.
Attention
The step in a transformer that lets each token gather information from earlier tokens. Each token compares its query with the keys of earlier tokens and takes a weighted mix of their values.
Base model
An existing trained model chosen as the starting point for additional training or adaptation.
Batch size
The number of examples used together in training. Several smaller batches can contribute to one optimizer update through gradient accumulation.
BM25
A keyword scoring formula that ranks passages by the words they share with a query. A rare word counts for more than a common one, and a long passage is not rewarded just for being long.
Byte pair encoding
A way to build a tokeniser. It starts from single characters or bytes and keeps merging the most common neighbouring pair into a new token. Often shortened to BPE.
Catastrophic forgetting
A loss of previously useful behavior after a model is trained on new data. Test the old behavior as well as the new task.
Chunking
Splitting a document into passages that a retriever can return one at a time. Chunk size and boundaries decide what the model can read, so a bad cut can separate a rule from its condition.
Citation
A marker in an answer, such as [2], that points to the source passage behind a claim. It lets a reader and a test check the claim against the source.
Cohen's kappa
A score for how much two raters agree beyond what chance alone would give. It corrects raw agreement when most items get the same rating.
Context budget
A plan that gives each part of a request, such as instructions, history and documents, a size limit, so the whole fits in the context window with room left for the reply.
Context engineering
The work of choosing what a model reads before it replies: the instructions, examples, documents, history and tool results, and how much of each, in what order.
Context rot
The drop in reliability that appears as the input to a model grows longer, even on simple tasks. Sending less text is the main fix.
Context window
The maximum number of tokens a model can process in its context. Depending on the model, the limit can include the answer as well as the input.
Conversation summary
A short note that replaces older turns of a conversation, so the history stays small. It keeps the gist, but it can drop or distort a detail.
Cosine similarity
A score for how closely two vectors point in the same direction, from -1 to 1. Search systems use it to compare the vector of a question with the vectors of passages.
Data leakage
When information from the evaluation data reaches training, so scores look better than real performance. Duplicates shared between splits are a common cause.
Direct preference optimisation
A way to train a model from pairs of chosen and rejected answers without a separate reward model, while a reference model keeps it from drifting too far.
Epoch
One pass through the training set. The number of optimizer updates in a pass depends on batch size and how the final batch is handled.
Error analysis
Examining and grouping model failures to find patterns and decide what to investigate or change next.
Evaluation set
A list of tasks, each with a way to check the result, that you run again after every change to an agent. You measure how often the agent gets each task right.
F1 score
The harmonic mean of precision and recall for one label. It is low when either precision or recall is low.
Faithfulness
How far an answer says only what the retrieved passages support. It is measured against the sources, so a faithful answer can still be wrong when a source is wrong.
Few-shot prompting
Putting a few worked examples of the task in the prompt, so that the model copies their pattern and format in its answer.
Gradient accumulation
Adding up the gradients from several small batches before making one update, so a model trains as if it had a larger batch without needing the memory.
Gradient descent
A training method that uses gradients to update trainable parameters in a direction that reduces the loss, repeating the process across examples.
Grounding
Making an answer rest on supplied sources, so each claim can be traced to a passage the system retrieved. A grounded system also says so when the sources do not hold the answer.
Guardrail
A check in your program that holds even when the model ignores its instructions. Examples are a step limit, a cost limit and a validation of the final answer.
Human in the loop
A design in which a person approves an action before the agent runs it. It is used for actions that are hard to undo, such as sending money or deleting data.
Hybrid search
Retrieval that runs a keyword search and a vector search, then merges the two ranked lists. It finds exact names and also passages that use different words for the same idea.
Instruction tuning
Training a pre-trained model further on examples of requests and good answers, so that it follows instructions and replies as an assistant instead of only continuing text.
Inverted index
A table that lists, for each word, the passages that contain it. A keyword search looks up the query's words in the table instead of reading every passage.
Knowledge cutoff
The date at which a model's training text ends. The model knows nothing that happened after it, unless the prompt supplies that information.
KV cache
Stored keys and values of tokens the model has already read. While it writes a reply, the model reuses them instead of computing them again. It saves time but uses memory for every token.
Large language model
A model trained on a huge amount of text to predict the next token. Chat replies, summaries and code all come from repeating that prediction. Often shortened to LLM.
Learning rate
A training setting that scales an optimizer's parameter updates. A rate that is too high or too low can make training less effective.
Logits
The raw scores a model gives to every token in its vocabulary before softmax. A higher logit means a more likely token. Logits can be negative and do not add up to 1.
Loss
One number that says how wrong a model's predictions were. For LLMs it is usually cross-entropy: the negative logarithm of the probability the model gave to the true next token.
LoRA
Low-rank adaptation. A method that trains small matrices on selected layers while keeping the base model weights frozen.
Mean reciprocal rank
The average, over test questions, of 1 divided by the position of the right passage. It is 1 when the answer is always first and falls as the answer ranks lower.
Metadata filter
A rule on stored facts about a chunk, such as its date or audience, that removes chunks before ranking. It keeps results current and limits users to text they may read.
Model distillation
Training a student model to reproduce useful outputs or behavior from a teacher model. The student is often smaller, but still needs evaluation.
Model fine-tuning
Additional training of an existing model using new data. It updates model or adapter parameters to change performance or behaviour for a task; the result must be evaluated.
Model judge
A model used to score or compare outputs against a rubric. Its judgments need checks against human review and task evidence.
Model serving
Running a model so an application can send requests and receive its outputs, with the required performance and access controls.
Model weights
The numbers inside a model. Training sets them, and everything the model knows is stored in them.
Next-token prediction
The one task an LLM is trained on: given the text so far, give a probability to every token that could come next. A reply is written by repeating this prediction one token at a time.
Overfitting
When a model fits its training examples better than it generalizes to new examples. Compare training and validation results to investigate it.
Parameter-efficient fine-tuning
Adapting a trained model by updating a small set of parameters or an adapter while most base model weights remain frozen.
Perplexity
A measure of how surprised a language model is by real text, calculated from the probabilities it gave the actual words. Lower is better prediction, not necessarily better answers.
Positional encoding
Information about each token's place in the text, added so that the model can tell word order. Common forms are a learned table of positions, fixed sine waves and rotary encoding.
Pre-training
The first and largest stage of training. The model reads a huge amount of general text and learns to predict what comes next.
Prompt injection
An attack that hides instructions in text the agent reads, such as a web page or an email. The model may treat the hidden text as a command and act on it.
QLoRA
A fine-tuning method that trains LoRA adapters on a frozen four-bit quantized base model to reduce training memory.
Quantization
Representing numbers with fewer bits, often approximately. For model weights this can reduce memory use but may change outputs.
Query rewriting
Turning the user's words into a better search, for example by making a follow-up question standalone or by splitting a compound question into parts.
Recall@k
The share of test questions for which the right passage appears in the top k search results. A recall@3 of 0.9 means the answer was in the top three for 90 per cent of questions.
Reranking
A second pass that scores the top results of a first search more carefully and reorders them. It is slower than the first search, so it runs only on a short list.
Retrieval-augmented generation
A method where an app searches sources at question time and adds selected passages to the model's context. Updated information can inform later answers once it is available to retrieval, but the results and answers still need checking.
RLHF
Reinforcement learning from human feedback. People compare pairs of answers, a reward model learns their preferences, and the LLM is trained to produce answers that the reward model scores highly.
Temperature
A setting that sharpens or flattens the probabilities before a token is picked. A low temperature makes the most likely token win more often. A high temperature gives unlikely tokens more chances.
Scaling laws
Measured rules that predict how a model's loss falls as you add parameters, training tokens and compute. They are used to plan how big a model should be for a given budget.
Softmax
A formula that turns a list of scores into probabilities. It raises e to the power of each score and divides by the total, so every result is positive and they add up to 1.
System prompt
The instructions at the start of a prompt that set the model's role, its rules and the format of its answer. It stays the same on every call.
Test set
Examples held back until the end of a project and used once to estimate how a model will perform on data it has never seen.
Text classifier
A model that assigns text to one or more labels from a defined set, such as billing or access.
Token
A small piece of text that a model reads or writes as one unit, such as a short word, part of a longer word or a punctuation mark. In English, one token is about four characters.
Tokenization
Converting text into tokens and their numeric IDs for a particular model and tokenizer.
Tool call
A request from the model to run one of your functions. The model writes the tool name and its inputs as structured text, and your program checks the request, runs the function and sends back the result.
Top-p sampling
A sampling rule that keeps only the most likely tokens whose probabilities add up to a set value, such as 0.9, and picks from those. Also called nucleus sampling.
Training data
Examples used to update a model's trainable parameters. The examples and labels should be appropriate and permitted for the task.
Transformer
The model design used by nearly all LLMs. It stacks many identical blocks, and each block has an attention step and a feed-forward step. Google researchers introduced it in 2017.
Validation set
A held-out set used during development to compare settings or choose a checkpoint. A separate test set is kept for a final assessment.
Vector embeddings
Lists of numbers that stand for the meaning of a piece of text. Texts with similar meanings get similar numbers, so a search can find a passage even when the words differ.
Warm-up
The first steps of training, when the learning rate rises slowly from near zero to its peak so that early, noisy updates do not damage the model.