Batch size, epochs and steps
Work out how many steps a run takes from examples, batch size, gradient accumulation and epochs, and why accumulation matches a larger batch.
Lessons you kept for later.
Loading your saved lessons…
Saved lessons
Save a lesson from any learning path or the lesson library.
Browse lessonsSaved lessons
Sign in to save a lesson from any learning path or the lesson library.
Sign inThis browser is blocking storage, so saved lessons can’t be read or saved here.
Work out how many steps a run takes from examples, batch size, gradient accumulation and epochs, and why accumulation matches a larger batch.
A tuned model can lose skills it had before. See how narrow training erases them, and how mixing in replay examples or training less keeps them.
Choose a starting model by memory fit, licence and score on your own questions, not by a leaderboard. Includes a runnable shortlist script.
Select context by permission, freshness and relevance, and keep a log of why each piece went in or stayed out. Includes a runnable selector.
A grounded RAG answer cites its sources and admits when they do not hold the answer. Check citations in code and refuse when retrieval finds nothing useful.
Remove duplicates, conflicting labels and personal data from training examples before they reach the model, with runnable checks and a by-eye review.
Gather training examples from records, experts and synthetic drafts, check that annotators agree, and confirm you may use each source. Includes runnable code.
A code assistant cannot read a whole repository. Learn what to send in full, what to outline, and why agents fetch files on demand. Includes runnable code.
Build the full context for a support assistant in code: pick facts by permission and topic, order and escape every part, and hand over when nothing applies.
A context window is a fixed budget shared by input and reply. Reserve the reply, fund the essentials first, then add optional parts in priority order.
Write the task in one sentence, fix the labels, pick a score that counts the costly mistakes, and set a baseline before training. Includes runnable code.
Train a small student model to copy a large teacher on one task, see how soft targets carry more signal, and work out when the saving repays the cost.
An embedding turns text into numbers so passages with similar meaning sit close together. Rank them with cosine similarity, even when no words match.
Read failures, sort them into causes, count them and choose the next change from the pattern, then check the same cases again in the next round.
Compare a tuned model with its baseline on the same held-out cases, read gains and losses by slice, and judge whether the difference is more than noise.
Train a small model to label support messages, then read a confusion matrix and compare with a keyword baseline. Includes runnable scoring code.
Render chat examples with the model's template, train a small instruction model for two steps, and compare its replies before and after on held-out requests.
Estimate where training memory goes, then cut it with smaller batches, gradient checkpointing, mixed precision and adapters. Includes a runnable estimator.
Store examples as JSON Lines, in prompt-and-completion or chat form, and validate every line before training. Includes runnable code that reports bad lines.
Long conversations outgrow the window. Compare a sliding window with pinned facts and a summary, and see in code which one keeps an order number alive.
Compare fine-tuning through a provider's API with training open weights you control, and find the request volume where running your own pays off.
Pre-training and fine-tuning use the same loop: predict the next token, measure the miss, adjust the weights. Only the data changes. Includes runnable code.
Wrong answers often trace to the context: a bad fact repeated, too much noise, rival sources or a stale rule. Learn four failures and a check for the last.
Follow LoRA with real numbers: two small matrices add an update to a frozen layer, rank sets their size, and alpha sets how strongly the update counts.
Split documents into passages small enough to match one question and large enough to stay true. Compare fixed windows, overlap and heading splits in code.
Score qualities a formula cannot with a rubric, blind side-by-side review and a model judge, and check agreement and position bias in plain Python.
Combine keyword and semantic rankings with reciprocal rank fusion, then reorder a short list with a reranker. See how each step changes the passages sent on.
Write instructions a model can follow and pick examples that teach the task. Select the closest examples for each request in code, edge cases included.
BM25 ranks passages by the words they share with a question, giving rare words more weight. Build it in 20 lines of Python and see where it fails.
Full, parameter-efficient, instruction, continued pre-training and classification tuning differ in what they change and cost. Compare them side by side.
See how too high and too low learning rates behave, then build a warm-up and decay schedule and read its values step by step. Includes runnable code.
Strip menus, scripts and duplicates from source documents before you index them, so retrieval returns useful text. Includes a runnable HTML cleaner.
Attach a LoRA adapter with PEFT, check that it targets the right layers and trains only a small share of the weights, then save, reload and merge it.
Check that each sentence of a RAG answer is supported by the retrieved passages. Score faithfulness with a word-overlap check, then add a model judge.
Test retrieval on its own with a list of questions and the passages that answer them. Score recall@k and MRR in code, then use the failures to improve search.
Store a source, a date and an audience with every chunk, then filter before ranking so users see only current text they may read. Includes a runnable filter.
Calculate accuracy, precision, recall, F1, exact match, word overlap and perplexity in plain Python, and see what each one misses.
Where a part sits and how it is marked changes the answer. Put stable text first, label every part, and escape untrusted text so it cannot fake a label.
Compare prompt tuning, prefix tuning, adapter layers and DoRA with LoRA by where their trainable weights sit and how many there are.
Tell memorising from learning by comparing training and validation scores, then fix it with early stopping, regularisation and more varied data.
Build the RAG prompt: an instruction, numbered sources inside delimiters, then the question. Fit the passages to a token budget and order them with care.
See how storing weights in fewer bits saves memory and adds rounding error, then how QLoRA trains a LoRA adapter on a frozen 4-bit base model.
Rewrite follow-up questions into standalone searches and split compound questions into parts. Compare one search with several in code, and know when to stop.
Read training and validation loss together, spot overfitting and failed runs, and pick the best checkpoint with a runnable early-stopping check.
Check licences, remove private data before training, test for harmful output and watch a released model for drift, with code for the scan and the alert.
Merge an adapter, pick a precision and size a GPU for real traffic, then estimate the cost of a request and re-check quality after every conversion.
Estimate the memory a model needs, check your GPU, and save the versions and settings that make a fine-tuning run repeatable. Includes runnable code.
Train a model to return JSON and tool calls, then parse, validate and permission-check every output in code before the application acts on it.
Test every context change on a fixed question set. Remove one part at a time to see what each is worth, and catch a harmless-looking edit that breaks an answer.
Define the task, set a baseline, prepare three splits, train, and test once. See the seven steps, what each costs, and where projects usually go wrong.
See how text becomes token IDs, padding, attention masks and labels, and why the loss ignores the prompt with -100. Includes runnable code.
A tool call can return far more than the model needs. Trim results to useful fields, cap long lists with a note, and treat what comes back as untrusted.
Split examples into training, validation and test sets by group or by time so related records stay together, and check for leakage with runnable code.
Learn how preference pairs train a reward model in RLHF or feed DPO directly, and compute the preference loss that DPO minimises in plain Python.
Exact vector search compares a question with every stored vector. Approximate indexes check only some. See the speed and recall trade in a short program.
Context is everything a model reads before it replies. Learn its six parts, who supplies each one, and how to check that a request has what it needs.
RAG searches your documents for passages that fit a question, then gives them to a language model so it answers from sources. See the steps in a short program.
Trace a wrong RAG answer through indexing, retrieval, the prompt budget and the model. A runnable diagnosis shows which stage lost the right passage.
Full fine-tuning copies and updates every weight. See what that costs in memory and storage, and how freezing the base model with adapters changes it.
Attention lets each token pull information from the tokens before it. Work through queries, keys, values and the mask in a few lines of NumPy.
Run a small open model on your own computer with a few lines of Python, then see how hosted APIs take the same list of messages.
The best model is the cheapest one that passes your own tests. Build a small evaluation, compare quality, cost and speed, and start small.
A base model only continues text. Instruction tuning trains it on requests and good answers, and a chat template marks who said what.
Attention on its own ignores word order. See the problem in code, then compare the three ways models add position: learned, sine waves and rotary.
A model writes one token at a time and feeds each one back in. Learn the loop, when it stops and why the reply counts against the context window.
In pre-training, a model reads trillions of tokens and learns to predict each next one. The text is its own answer key, so no one has to label it.
Comparing two answers is easier than writing a perfect one. See how RLHF and DPO turn people's preferences into training, and what can go wrong.
Loss is one number for how wrong the model was. Gradient descent nudges each parameter to lower it. Run both in plain Python and watch a bad learning rate fail.
Count GPT-2's 124 million parameters by hand, see where they sit, and work out how much memory a model needs at different precisions.
At every step the model scores every token it knows. Softmax turns those scores into probabilities that add up to 1.
Loss falls in a predictable way as models grow. Learn the compute formula, what Chinchilla changed, and why small models now read far more text.
The model gives probabilities, and a sampling rule picks the token. See in code how temperature, top-k and top-p change that pick.
A transformer stacks one block many times. Each block has an attention step, a feed-forward step and shortcuts that carry the signal through.
A model reads tokens, not letters or words. See how byte pair encoding builds a vocabulary, and why token counts decide cost and length.
Each token id becomes a list of numbers called an embedding. Tokens with related meanings get similar lists, and the rest of the model works with those lists.
An LLM learns one skill from a huge amount of text: guess the next piece of text. Chat, summaries and code all come from repeating that guess.
Attention compares every token with every earlier token, so work grows faster than the text. Learn prefill, decode and the KV cache that makes replies fast.
A model writes likely text, not checked facts. Learn why it states false things with confidence, and four ways to catch and reduce it.
A model only knows what you put in the prompt. State the task, give the context, show examples and ask for a format you can check.
Write a small agent in plain Python, run it, and read its trace. Then swap the stand-in decision for a real model.
An agent is only as good as what it reads. Learn how to judge a source for relevance, trust and freshness, and what to do when sources disagree.
Long AI tasks fill the context window. Learn four ways to keep it lean—trim, summarise, retrieve, reorder—and when to use each.
A tool is an interface for a model, not for a person. Learn the five habits that make an agent pick the right tool and use it correctly.
An agent can only aim at a goal you can check. Learn to write goals that can be tested, plans the agent can follow and when to change the plan.
Checks in code catch what prompts cannot. Learn the limits, validations and fallbacks that keep a failing agent from doing harm.
The model never runs a tool. It writes a request, and your program runs it. Learn the full round trip and how to guard it.
A model forgets everything when a call ends. Learn the two kinds of agent memory, and how to decide what to store and what to forget.
An agent should have the least power that lets it do the job. Learn to separate safe actions from risky ones and where a person must say yes.
Let the agent look things up instead of remembering them. Learn the four steps of RAG and what can go wrong at each one.
The same task can follow a different path each run. Learn to test the outcome, repeat each case, and keep a set of examples that guards against regressions.
Every agent repeats one cycle: look, decide, act, read the result. Learn the cycle, and the three ways it should stop.
A model reads and writes tokens, and it can hold only so many at once. Learn how to estimate them and why the limit shapes every agent.
Once real people use your agent, you need to see what it does. Learn what to record, what to measure and how to turn problems into fixes.
A model, instructions, tools, memory and a loop. Learn what each part does and which part to fix when the agent misbehaves.
The model sees one block of text on every call. Learn the six parts that fill it, and why the order matters.
A chatbot answers one message. An agent works toward a goal, using tools and checking its own results. Learn what that changes and what it does not.
One agent is simpler than many. Learn the two cases where splitting the work pays off, and what each hand-off costs.
Small errors add up over many steps. Learn the arithmetic of long tasks and the five failure patterns that cause most real problems.
In a workflow your code chooses the steps. In an agent the model chooses them. Learn how to pick, and why the simpler one usually wins.
Learn what fine-tuning is, how training updates a language model's weights on your examples, and what you get at the end.
Retrieval ranks stored passages against a question and returns the top few. See the two phases, the top-k choice and what a retriever hands to the model.
Fine-tuning changes how a model behaves. Retrieval changes what it can look up. Learn which problem you have and which fix is cheapest.