Macalinao StudioLearnAll enriched lessons ↗
High school path · 7 sectionsSwitch to college ↗

High school / LONGER LESSON 02

Pretraining: data, loss and a finite compute budget

Design a reproducible training experiment and identify leakage before trusting its score.

Preparation: Fractions and basic next-token prediction.

Plan 20–35 minutes with the activities; this is a study estimate, not a timed requirement. Both paths have complete narration. Your notes and progress are kept separately for each level.

Section 01 / 07

Define the learning task

High-school path. Design a reproducible training experiment and identify leakage before trusting its score.

Preparation: Fractions and basic next-token prediction. Work through one section at a time. Predict the experiment result before changing its controls, then explain what the example leaves out.

Pretraining learns statistical structure from a chosen collection using a specified objective. More text is not automatically more useful text; relevance, quality and duplication matter. Imagine studying the same worksheet a hundred times instead of learning from a varied set of problems.

Worked step 1. Collect three documents.

Worked step 2. Mark exact duplicates and near duplicates.

Worked step 3. Count unique content separately from stored copies.

Try it yourself. Does duplicating a document add independent evidence?

Pause the recording and write your reasoning before continuing. The worked solution follows.

Reveal worked solution

Worked solution. No. It changes its training weight and compute cost, but does not create a new independent example.

Section 02 / 07

Split before tuning

A held-out test estimates performance on data not used to choose parameters or settings. Repeatedly adjusting the system after reading test results gradually turns that test into development data. Keep some practice questions sealed until you have finished choosing your study method.

Worked step 1. Use training data for updates.

Worked step 2. Use validation data for choices.

Worked step 3. Open the test set for the final comparison.

Try it yourself. Can near-duplicate passages leak across different filenames?

Pause the recording and write your reasoning before continuing. The worked solution follows.

Reveal worked solution

Worked solution. Yes. File names are not content independence. Check similarity and shared source provenance.

Section 03 / 07

Follow one loss calculation

Next-token loss rewards probability on observed targets. Padding and packing affect which positions should contribute. Count the valid targets before dividing a summed loss. If two worksheet boxes are blank, do not grade them as two incorrect answers.

Worked step 1. Valid target losses are 1,2,3.

Worked step 2. Their mean is 2.

Worked step 3. Adding two padded zeros and dividing by five would incorrectly give 1.2.

Try it yourself. Why is the second average misleading?

Pause the recording and write your reasoning before continuing. The worked solution follows.

Reveal worked solution

Worked solution. It rewards extra padding and changes the denominator. Divide by the intended valid-target count.

Section 04 / 07

Balance model size and data

A fixed compute budget forces trade-offs between parameter count and training tokens. Historical scaling fits guide experiments under their assumptions; they are not timeless recipes for every deployment. A bigger workbook leaves less time to practice if your study time is fixed.

C ≈ 6ND

Worked step 1. At N=1 billion and D=20 billion, 6ND is 1.2 times ten to the twentieth operations.

Worked step 2. Doubling both quantities quadruples this estimate.

Try it yourself. Does doubling parameters at fixed compute also allow twice the tokens?

Pause the recording and write your reasoning before continuing. The worked solution follows.

Reveal worked solution

Worked solution. No. In this approximation, doubling N requires halving D to hold their product fixed.

Section 05 / 07

Save enough to reproduce a continuation

A model weight file is not always a complete training checkpoint. Continuing the same optimization can require optimizer state, schedule position, data order and random generator state. A bookmark tells you the page; it does not preserve every note and timer setting used while studying.

Worked step 1. Save weights and optimizer moments.

Worked step 2. Record global step and data cursor.

Worked step 3. Test resuming on a small controlled run.

Try it yourself. Is reloading weights alone identical to resuming Adam training?

Pause the recording and write your reasoning before continuing. The worked solution follows.

Reveal worked solution

Worked solution. Usually not. Missing moments and schedule state change subsequent updates.

Section 06 / 07

Adapt without forgetting the original job

Continued pretraining can improve domain familiarity while harming other capabilities. Compare before and after on both the target domain and a retained general evaluation set. Studying only chemistry vocabulary may help chemistry without proving that your history answers improved.

Worked step 1. Measure a domain benchmark before adaptation.

Worked step 2. Measure the same held-out benchmark afterward.

Worked step 3. Also repeat a general-task check.

Try it yourself. What if domain loss improves but factual answers worsen?

Pause the recording and write your reasoning before continuing. The worked solution follows.

Reveal worked solution

Worked solution. Report both. Better predictive loss does not automatically imply better behavior on the actual task.

Section 07 / 07

Mastery and transfer

Bring the pieces together. First answer the checkpoint without the worked solutions. Then explain the mechanism in your own words, using one numerical example from this lesson.

Which practice best protects a final evaluation? Option 1: Tune repeatedly on test answers. Option 2: Keep test data out of training and model selection. Option 3: Rename duplicated test files.

Pause here and choose an answer before continuing. The checkpoint explanation follows.

Reveal worked solution

The correct choice is option 2: Keep test data out of training and model selection. Independence concerns content and decisions, not file names.

Transfer task. Change one assumption in the worked example. State your prediction, calculate or test it in Workbench, then explain whether the result supports your prediction.

Reveal worked solution

Self-check rubric. Name the changed assumption, keep the other inputs fixed, show at least one intermediate calculation, and distinguish what the toy example guarantees from what would require a trained model or a real measurement.

MODERN MODEL CASE STUDY

DeepSeek V4.1 Flash: where this idea goes next

Separate active parameters, total parameters, cache bytes and measured cost. Follow the worked examples, then evaluate the reported gains and their limits.

Open the high-school case study →

Added October 21, 2026. This optional extension has its own complete local narration.

LONGER INFERENCE LESSONS

Follow the mechanism in depth

Worked examples, local narration and connected learning modes at your level.

LONGER POST-TRAINING LESSONS

Follow demonstrations, rewards and preferences

Worked examples, local narration and connected experiments at your level.

Sources and scope

Original worked examples and teaching text, grounded in these primary references. Numerical fixtures explain mechanisms; model quality and hardware performance require separate measurements. Both levels share key examples, with different explanations and checkpoints.

Explore illustrated Field Notes, a worked example and rotating practice at your level.

Read the weights Field Notes · Start the weights study coach

Reset this high school path?

This removes only this path’s notes, progress and experiments from this browser.