CS3 RET

Week 1 Overview

Mehmet Kerem Turkcan
Associate Research Scientist
Center for Smart Streetscapes, Columbia University
New York, USA
keremturkcan.com; mkt2126@columbia.edu

Move through the deck with (i) the arrow keys, (ii) a presentation clicker, or (iii) the buttons at the bottom left. The gear at the bottom right opens the slide settings.

Machine learning basics

Data, features, targets, and models

Paper airplane challenge: students change the wing width, fly each airplane, and measure the flight distance. Their goal is to predict how far a new airplane will fly.
TermStandard meaningPaper airplane example
Datarecorded facts or measurementsthe class flight notebook
Featurean input value supplied to a modelwing width before the flight
Targetthe value a model should learn to predictmeasured flight distance
Modela function that maps inputs to an outputa function that predicts distance from wing width

Illustrative classroom investigation.

Machine learning vocabulary

Examples, rows, and datasets

AirplaneWing width, featureFlight distance, target
A10 cm4.0 m
B12 cm5.0 m
C14 cm6.0 m
Exampleone case that a model can useone airplane flight
Rowone example written across a tableairplane B and both measurements
Dataseta collection of examplesthe complete flight notebook
Notebook metaphor: each flight gets one row, like one entry in a science notebook. All the rows together form the dataset.

Illustrative measurements.

Machine learning vocabulary

Targets, predictions, and ground truth

TermStandard meaningChild friendly metaphor
Targetthe output that the task asks the model to predictthe answer space on a worksheet
Predictionthe output calculated by the modelthe model writes its guess in the answer space
Ground truththe trusted answer used for comparisonthe teacher checks the official tape measure
Labela named category used as a targetshort, medium, or long flight

For a 13 cm wing, the model predicts 5.5 m. The measured ground truth is 4.9 m.

Machine learning vocabulary

Models, parameters, and hyperparameters

TermStandard meaningOne time metaphor
Modela function that calculates an output from inputsa prediction machine with adjustable settings
Parametera value learned from training dataa setting adjusted through practice
Weighta parameter that controls an input's influencea louder clue receives more attention
Biasa parameter added before an output or activationa starting adjustment before using the clues
Hyperparametera choice that controls the training processthe practice plan, including batch size and learning rate
Machine learning vocabulary

Errors, loss, and metrics

TermWhat it measuresPaper airplane example
Errora difference between a prediction and ground truththe predicted distance missed the measured distance
Residualground truth minus a numerical prediction4.9 m minus 5.5 m
Loss functiona function that gives prediction mistakes a numerical scorea practice score used to guide an update
Metrica named measurement used to evaluate performanceaverage distance error on reserved flights
Scorebook metaphor: the loss function guides practice, while a metric reports how the finished model performs.
Machine learning vocabulary

Training, validation, and test sets

Dataset partPurposeSchool metaphor
Training setexamples used to learn model parameterspractice questions with feedback
Validation setreserved examples used to choose model settingsa practice quiz used to choose a study plan
Test setreserved examples used after model choices are fixeda sealed quiz opened for the final check

Separation matters because repeatedly studying the final quiz would hide whether the student can answer new questions.

Machine learning vocabulary

Training and inference

StageWhat happensDo parameters change?School metaphor
Trainingexamples provide predictions, ground truth, loss scores, and updatesyespractice with feedback
Inferencelearned parameters calculate a prediction for a new inputnoanswering a new question

Chat example: an assistant usually performs inference while writing a response. A separate training process changes its stored parameters.

Training vocabulary

Eight practice questions

A small model receives eight training examples. It studies two examples at a time.

12;34;56;78

After each pair, the model measures loss and adjusts its parameters once.

How many parameter updates occur before the model has studied all eight examples?

four updates

Illustrative count. Concepts adapted from Mehmet Kerem Turkcan, CS3 RET Week 2 Day 4: Deep Learning Concepts, 2024.

Training vocabulary

The training loop

Batch
Read a few examples.
›
Forward pass
Calculate predictions.
›
Loss
Compare with ground truth.
›
Update
Adjust the parameters.

Backpropagation finds how each parameter affected the loss. An optimizer uses that information to choose a small update.

Coaching metaphor: the model tries, receives a score, and changes its technique before the next practice round.
Training vocabulary

Iteration

one parameter update
Examples
One batch enters the model.
›
Predictions
The forward pass calculates outputs.
›
Loss
Ground truth supplies the comparison.
›
Update
The optimizer adjusts parameters once.
Cooking metaphor: after tasting one batch of cookies, a baker adjusts the oven time once. That single adjustment matches one iteration.
Training vocabulary

Batch size

Batch size 2

The model reads two examples, measures their loss together, and then updates its parameters once.

School metaphor: a student completes one small stack of practice questions, checks the stack, and revises the study plan once.
12345678
Eight illustrative examples form four batches.
Training vocabulary

Epoch

one complete pass through the training set
Start
All training examples wait.
›
Use each batch
Each batch produces one update.
›
Epoch complete
Every example has appeared once.
Textbook metaphor: reading every chapter once is one complete pass. A second reading is a second epoch.
Training vocabulary

Counting training updates

Suppose the training set has eight examples.

Batch sizeExamples in each batchIterations in one epoch
1eight groups of one8
2four groups of two4
4two groups of four2
8one group of eight1

With batch size 2, two epochs contain eight updates: four updates in each epoch.

Illustrative count.

Training vocabulary

Learning patterns for new examples

Training patternTraining examplesNew examplesStudy metaphor
Underfittingmany mistakesmany mistakesthe student learned too little of the material
Useful fitfew mistakesfew mistakesthe student can solve familiar questions and new versions
Overfittingvery few mistakesmore mistakesthe student memorized the answer key
Generalization means that a model performs well on relevant examples that were outside its training set.
Statistics and research

A classroom research question

Does 10 minutes of recall practice improve a vocabulary score measured the next day?

During recall practice, students answer from memory before checking the answer.

  1. Population: the larger group that the study aims to understand.
  2. Sample: the smaller group of students who take part.
  3. Variables: the practice activity and the vocabulary score.
Class photo metaphor: a sample is one class photo. The population is the larger group that the photo is meant to represent.

Illustrative study.

Statistics and research

Study designs

Study designWhat researchers doWhat the design supports
Observational studyrecord choices and outcomes as they occurdescription and association
Randomized experimentassign students by chance, then measure outcomesa causal explanation when procedures and assumptions are sound
Shuffled teams metaphor: random assignment mixes students between groups, like shuffling names before forming teams.

Researchers plan the question, sample, assignment, measurements, and analysis before collecting the data.

Linear models

A linear model

A linear model uses a straight line to summarize an average relationship and calculate predictions.

Slope says how much the prediction changes when the feature rises by one unit.

Intercept is the prediction when the feature equals zero.

Ruler metaphor: a ruler placed through the point cloud shows the overall direction while the residuals show the gaps.
10121416wing width, cm flight distance, m residual
Illustrative measurements and fitted line.
Statistical uncertainty

A p value by shuffling

The scores stay in their rows. Advance to place the same two group labels into new rows.

StudentScore, fixedObserved groupShuffled group
Ana9practicecomparison
Bo7practicepractice
Cy5comparisoncomparison
Dee3comparisonpractice

Observed gap: 8 minus 4 equals 4. Shuffled gap: 5 minus 7 equals negative 2.

The six possible gaps are negative 4, negative 2, 0, 0, 2, and 4. Two are at least as far from zero as 4, so the exact p value is 2 divided by 6, about 0.33.

Illustrative exact permutation test.

Statistical uncertainty

What does a p value measure?

A p value asks how often the null model produces a result at least as unusual as the observed result.

QuestionQuantity or evidence
How unusual are these data under the null model?p value
How large is the estimated difference?effect size
How uncertain is the estimate?confidence interval
Does the study support a causal explanation?study design and assumptions
Coin game metaphor: a p value checks whether the observed result would be surprising in a game governed by the null model.

American Statistical Association statement on statistical significance and p values, 2016.

Statistical uncertainty

Estimates and uncertainty

Suppose a study estimates a 6 point average gain from recall practice.

2610estimate
Illustrative 95 percent confidence interval: 2 to 10 points.

The effect size, 6 points, describes the estimated difference. The confidence interval, 2 to 10 points, describes uncertainty under the procedure and assumptions.

Flashlight metaphor: the estimate marks one spot, while the interval shows a wider region that remains compatible with the evidence.
Statistics and research

Trustworthy research

  1. Ask a focused question.
  2. Plan the sample, measurements, comparison, and analysis.
  3. Collect the data using the plan.
  1. Inspect data quality, plots, and unusual cases.
  2. Report effect sizes, uncertainty, methods, and limits.
  3. Replicate with new data when possible.

Recipe metaphor: a written method lets another research team repeat the study and check whether the result appears again.

American Statistical Association, 2016; National Academies of Sciences, Engineering, and Medicine, 2019.

Neural networks

Exactly one switch

A door opens when exactly one of two switches is on.

Switch ASwitch BGround truth
offoffclosed
onoffopen
offonopen
ononclosed
switch A switch B open
Illustrative exclusive OR, commonly written XOR.
Neural networks

Why does one linear layer fail?

Choice 1 two errors Choice 2 two errors Choice 3 one error
Advance to compare three straight boundary choices. Red rings mark errors; every choice leaves at least one error.
Neural networks

A two layer network

switchesA and B hidden unit 1A on, B off hidden unit 2B on, A off predictionopen hidden layeroutput layer
The layer count includes two learned layers: the hidden layer and the output layer.

Like two spotters, the hidden units identify A on and B off, or B on and A off. The output layer predicts open when either hidden unit is active.

Neural networks

Activation functions and hidden features

The ReLU activation function keeps positive scores and replaces negative scores with zero. That step lets hidden units respond to different input regions.

ABHidden unit 1
A on, B off
Hidden unit 2
B on, A off
Door
offoff00closed
onoff10open
offon01open
onon00closed
Motion light metaphor: an activation function decides how strongly a hidden unit responds after it combines the input clues.

Illustrative XOR features.

Neural networks

How does a neural network learn?

Forward pass
Use the current weights to predict.
›
Loss
Compare predictions with ground truth.
›
Backward pass
Find each parameter's effect on loss.
›
Optimizer
Apply a small update.
Hillside metaphor: the gradient points toward the steepest local increase in loss. The optimizer steps in the direction that lowers the loss.

Repeated iterations can produce hidden features such as the two XOR hidden units.

Evaluation

Checking a trained model

CheckQuestionReport card metaphor
AccuracyWhat fraction of reserved examples were correct?the fraction of answers marked correct
CalibrationDo predicted probabilities match observed frequencies?claims of 70 percent should succeed about 70 times in 100 similar cases
Error analysisWhich examples and groups produce mistakes?review the questions that caused trouble

A test set stays reserved until the model choices are fixed. Its results describe that named set and scoring procedure.

Introduction recap

Machine learning basics recap

  1. Each example contains features and a target; a model calculates a prediction.
  2. Ground truth supplies the trusted comparison, while a loss function guides parameter updates.
  3. Batches group examples for one iteration; an epoch uses the full training set once.
  4. Statistical research connects a focused question with study design, effect size, uncertainty, and a p value when appropriate.
  5. A linear layer draws one straight boundary; hidden units and activation functions support more flexible boundaries.
Optional extension

Advanced worked examples

  1. Regression calculations: slope, intercept, residuals, and mean squared error.
  2. Statistical calculations: confidence intervals, permutation tests, and p values.
  3. Neural calculations: activation functions, matrices, gradients, and parameter updates.
  4. Data systems: provenance, OCR, pretraining, post training, and evaluation.

Preparation: these topics require comfort with algebra and calculations that contain several steps.

Classical statistics

A question for the assistant

Illustrative teacher prompt

Earlier flights averaged (i) 4 m at 10 cm, (ii) 5 m at 12 cm, and (iii) 6 m at 14 cm.

For a 13 cm wing, (i) predict the distance, (ii) assign the label clears when the prediction is at least 5 m, (iii) describe the evidence required for an uncertainty statement, and (iv) explain the answer.

Which part requests (i) a number, (ii) a label, (iii) an uncertainty statement, and (iv) an explanation?
After learners name the evidence behind each answer, revisit their first answers.

Which operations produced the assistant response?

The fitted line predicts 5.5 m. The stated threshold assigns the label clears. An uncertainty interval requires repeated flights and assumptions about how those flights vary.
Words in the answerStatistical operation
5.5 mregression predicts a number
the label clearsclassification assigns a label
repeated flights and assumptionsuncertainty requires a stated meaning and evidence
the complete sentencenext token generation writes the response

Illustrative assistant response. After isolating each operation, check it with a small example and use that example for teaching.

Where did 5.5 m come from?

The illustrative numerical claim is 5.5 m for a 13 cm wing.

Measured examples
wing width and flight distance
›
New input
wing width of 13 cm
›
Requested output
predicted distance

In regression, software fits a line to measured pairs so that the fitted line can predict a number.

Which relationship between the measured widths and distances would produce 5.5 m at 13 cm?

Illustrative input and requested output.

Slope from three measurements

Wing widthAverage distance
10 cm4 m
12 cm5 m
14 cm6 m
1Between the first two rows, distance changes by 1 m while width changes by 2 cm.
2\text{slope}=\frac{5-4}{12-10}=\frac{1}{2}=0.5 m per cm.

Illustrative measurements. The slope is 0.5 m of predicted distance per additional centimetre of wing width.

Intercept and fitted equation

1Start with \widehat{\text{distance}}=0.5(\text{width})+b.
2Insert the first measured pair: 4=0.5(10)+b.
34=5+b, so b=-1.
4\widehat{\text{distance}}=0.5(\text{width})-1.

The intercept completes the equation after the slope has been calculated.

The fitted line summarizes association in these measurements. Evidence for a causal claim requires a separate study design.

Illustrative measurements and fitted equation.

The fitted regression line

10 12 14 wing width (cm) distance (m)
Illustrative measurements and fitted line.
\widehat{\text{distance}}=0.5(\text{width})-1

The slope says that predicted distance increases by 0.5 m when wing width increases by 1 cm.

The line supplies one predicted distance for every width in its range.

Prediction and residual at 13 cm

1Insert the new width: \text{width}=13.
20.5(13)-1=5.5.
3The model predicts 5.5 m.

Suppose the measured flight distance is 4.9 m.

r=y-\hat y=4.9-5.5=-0.6\text{ m}

The residual is negative because the measured flight landed 0.6 m below the prediction.

Illustrative measured flight. The 13 cm width lies between measured widths, so the prediction is an interpolation.

Mean squared error for three candidate lines

Mean squared error is a loss function that squares each residual and averages the squared values.

Candidate equationSquared errors (\text{m}^2)Mean squared error (\text{m}^2)
0.4(\text{width})0, 0.04, 0.160.067
0.5(\text{width})-10, 0, 00
0.6(\text{width})-20, 0.04, 0.160.067

The middle equation has mean squared error 0, the smallest value in the table, so it fits these three averages best.

Illustrative measurements. Squaring prevents positive and negative residuals from cancelling.

Why does the fitted slope change?

A sample is the set of flights measured by one class. Two classes can repeat the same designs and obtain different measurements.

Wing widthClass A distanceClass B distance
10 cm4.0 m4.4 m
12 cm5.0 m4.8 m
14 cm6.0 m5.6 m
\text{Class A slope}=0.50,\qquad \text{Class B slope}=0.30

Sampling variability is the change in an estimate across samples produced by the same measurement process.

Illustrative class measurements.

Confidence interval calculation

1For a larger illustrative sample of repeated flights at several widths, software reports a fitted slope of 0.50.
2For that sample, the software estimates typical sampling variation as 0.075. This estimate is called the standard error.
3Under the stated normal approximation for a large sample, an approximate 95 percent interval uses plus or minus two standard errors.
40.50\pm2(0.075)=0.50\pm0.15=[0.35,0.65].

The interval ranges from 0.35 to 0.65 m of predicted distance per additional centimetre of wing width.

Illustrative regression interval. The assumptions are (i) independent flights, (ii) an approximately linear average relationship, (iii) similar residual spread at each width, and (iv) the stated large sample normal approximation. Software calculates the supplied standard error from the fitted sample.

Twenty intervals from repeated samples

fixed slope 0.50 interval excludes 0.50
One illustrative simulation with a fixed population slope of 0.50.

Coverage of the interval procedure

A confidence interval procedure produces a new interval from each fresh sample.

20 fresh samples
20 fitted intervals
›
19 include
the fixed slope
›
Illustrated coverage
19/20=95\%

If the assumptions hold, about 95 percent of intervals from many repeated samples would contain the fixed population slope.

The population slope is fixed. The interval endpoints change from sample to sample.

Illustrative repetition. NIST and SEMATECH guidance, accessed 2026, describes confidence intervals for regression parameters.

Why shuffle the distances?

Under this null model, each measured distance can be paired with any fixed width without changing its probability. Statisticians call this exchangeability.

Fixed widths
10, 12, 14 cm
›
Reassign distances
every possible order
›
Reference set
6 equally likely assignments

The alternative hypothesis states that width has a positive association with distance.

Illustrative null model and assignments.

Six assignments under the null model

Distance orderFitted slopeAt least +0.50?
4, 5, 6+0.50yes
4, 6, 5+0.25no
5, 4, 6+0.25no
5, 6, 4-0.25no
6, 4, 5-0.25no
6, 5, 4-0.50no

Exact illustrative permutation reference set.

An exact p value for positive association

The observed assignment has slope +0.50.

At least +0.50
+0.50
Smaller positive slopes
+0.25,+0.25
Negative slopes
-0.25,-0.25,-0.50

One of the six equally likely assignments has a positive slope at least as large as the observed slope.

p=\frac{1}{6}\approx0.167

Exact illustrative permutation test.

What does a p value measure?

Common misreading

p=1/6 means that the null model has a one in six chance of being true.

Counted
1 shuffled slope at least +0.50
›
Reference set
6 shuffled assignments
›
Reported
p=1/6

The calculation counts shuffled data patterns under the stated null model. A probability for the hypothesis requires a probability model for hypotheses and prior information.

The observed slope, 0.50 m per cm, reports the estimated magnitude. Future clearance requires a predictive model and evidence from new flights.

Illustrative p value. American Statistical Association statement on statistical significance and p values, 2016.

The linear decision boundary

1Predict distance: 0.5(13)-1=5.5\text{ m}.
2Apply the decision threshold: a predicted distance of at least 5\text{ m} receives the label clears.
3Choose the label clears.

The 5 m threshold is the decision boundary because it assigns different labels to predicted distances on its two sides.

Illustrative threshold. Changing it can change false positives and false negatives.

Probability from the sigmoid function

After a logistic classifier calculates a weighted score, z, it applies the sigmoid function, \sigma. The sigmoid function produces a value between 0 and 1.

Prepared input
u=(13-12)/2=0.5
›
Weighted score
z=2(0.5)+0=1
›
Probability
0.73
\sigma(1)=\frac{1}{1+e^{-1}}\approx\frac{1}{1+0.368}\approx 0.73

The constant e is approximately 2.718. The resulting value is the probability that this model assigns to clearance.

Illustrative sigmoid calculation.

Is the 70 percent prediction calibrated?

If a model assigns a 70 percent probability of clearance to 100 similar cases, about how many cases should clear?
\text{about }70\text{ of }100\text{ cases should clear}

If you answered about 70 cases, you were correct. Calibration compares predicted probabilities with observed frequencies among similar reserved cases.

Forecast bin
100 cases near 70 percent
›
Observed
about 70 cases clear

With only ten cases, ordinary variation can move the observed count far from seven. Calibration needs many relevant cases.

Illustrative calibration counts. Guo et al., On Calibration of Modern Neural Networks, ICML 2017.

Neural networks

Exclusive OR

A door opens when exactly one of two switches is on.

Switch ASwitch BDoor
offoffclosed
onoffopen
offonopen
ononclosed

When the switches are plotted as two coordinates, the open cases occupy opposite corners. No single linear decision boundary separates both open cases from both closed cases.

Illustrative switch example. This pattern is called exclusive OR, commonly written XOR.

ReLU calculation for exclusive OR

The ReLU function keeps positive numbers and replaces negative numbers with 0. Use the input with switch A on and switch B off.

1Write the switch values: A=1 and B=0.
2First difference: A-B=1, so \operatorname{ReLU}(1)=1.
3Second difference: B-A=-1, so \operatorname{ReLU}(-1)=0.
4Add the two ReLU outputs: 1+0=1, so the door opens.

Illustrative XOR weights and calculation.

Two ReLU features for exclusive OR

Write off as 0 and on as 1. The ReLU function keeps positive values and replaces negative values with 0.

h_1=\operatorname{ReLU}(A-B),\qquad h_2=\operatorname{ReLU}(B-A),\qquad y=h_1+h_2
ABh_1h_2output y
00000, closed
10101, open
01011, open
11000, closed

Illustrative XOR weights and calculations.

Weighted sums and activation functions

Inputs
x_1,x_2
›
Weighted sum
x_1w_1+x_2w_2+b
›
Activation
\max(0,\text{score})
›
Hidden feature
h

ReLU, pronounced ree loo, is the activation function \max(0,\text{score}). Negative scores become 0; positive scores remain unchanged.

A=1,\ B=0:\quad \text{score}=1(1)+0(-1)+0=1,\quad h=\operatorname{ReLU}(1)=1

The weights determine how strongly each input contributes. The bias shifts the score before the activation function is applied.

Illustrative ReLU calculation.

Input and weight matrices

Place two switch examples in the rows of an input matrix, X. Place the weights for two hidden units in the columns of W.

X=\begin{bmatrix}1&0\\1&1\end{bmatrix},\qquad W=\begin{bmatrix}1&-1\\-1&1\end{bmatrix}

The first row of X is the example (A,B)=(1,0). The second row is (1,1).

The first column of W calculates A-B. The second column calculates B-A.

Illustrative matrix setup for the XOR examples.

Matrix output after ReLU

Calculate each input row with both weight columns.

\begin{aligned}1(1)+0(-1)&=1,&1(-1)+0(1)&=-1\\1(1)+1(-1)&=0,&1(-1)+1(1)&=0\end{aligned}
XW=\begin{bmatrix}1&-1\\0&0\end{bmatrix}

Apply ReLU to each entry, replacing the negative entry with 0.

H=\operatorname{ReLU}(XW)=\begin{bmatrix}1&0\\0&0\end{bmatrix}

Illustrative matrix calculation. Each row contains the two hidden unit outputs for one example. Each column contains one hidden unit output for both examples.

The next token task

Complete sentence

The airplane flies.

Prediction context

The airplane ?

Given the visible context, the model calculates one score for each possible next token.

Possible tokenIllustrative score
flies1.35
lands0.59
is0

Exponentiated token scores and their sum

1Exponentiate each score: (i) e^{1.35}\approx3.86, (ii) e^{0.59}\approx1.80, and (iii) e^0=1.
2Add the three values: 3.86+1.80+1=6.66.

Softmax uses the total, 6.66, as the denominator for every token.

Illustrative softmax calculation. The constant e is approximately 2.718.

Token probabilities from the softmax denominator

1p(\text{flies})=3.86/6.66\approx0.58.
2p(\text{lands})=1.80/6.66\approx0.27.
3p(\text{is})=1/6.66\approx0.15.

Illustrative softmax calculation. Each probability is one exponentiated score divided by the same total.

The softmax probabilities

TokenProbability
flies0.58
lands0.27
is0.15
p_i=\frac{e^{z_i}}{\sum_j e^{z_j}}

The symbol \sum means add all listed values. The largest probability is 0.58. The argmax operation selects the entry with the largest value, which is flies.

Sampling draws a token from the full probability distribution.

Illustrative probabilities. After the generation program appends the selected token, the model calculates another distribution from the longer context.

Linear classifier and neural network

QuestionOne linear classifierNeural network
What enters?features chosen before fittinginputs followed by learned hidden features
What boundary is possible?one straight line or flat planea boundary composed from several learned features
What can the final layer be?a linear score with sigmoid or softmaxthe same kind of linear score after hidden layers
How are parameters learned?reduce a chosen lossreduce a chosen loss through all layers

The XOR calculation showed hidden units constructing features that support a nonlinear decision boundary.

Intervals, p values, probabilities, and accuracy

QuantityQuestion it answersEvidence needed for interpretation
95 percent confidence intervalHow variable is an estimation procedure across samples?repeated samples represented by a sampling model
p valueHow unusual are these data under a stated null model?a stated null model and sampling plan
73 percent predictionWhat probability does this fitted model assign to this outcome?reserved cases for checking calibration
74 percent accuracyWhat fraction of a particular evaluation set was correct?a named evaluation set and item count

Illustrative prediction and accuracy values.

Training and generalization

Training and inference

Training

During training, the model calculates predictions from examples. The loss function compares predictions with targets. The optimizer changes parameters.

Inference

During inference, the model calculates an output for a new input. The learned parameters remain fixed.

Training can require many passes through the training data. A chat response is usually inference.

Context and stored parameters

Common misconception

A long conversation trains the model while it responds.

Conversation
changes the input context
›
Forward pass
uses stored parameters
›
Response
adds new context

During an ordinary chat response, the stored parameters remain fixed. A separate training process calculates gradients and updates those parameters.

Eight illustrative flights

IDWing widthMeasured distanceIDWing widthMeasured distance
A10 cm4.0 mE10 cm4.2 m
B14 cm6.0 mF14 cm5.8 m
C11 cm4.5 mG11 cm4.6 m
D13 cm5.5 mH13 cm5.4 m

Each row contains (i) wing width as the input and (ii) measured flight distance as the target.

Illustrative training data.

Prepared values for two flights

AFor flight A, u=(10-12)/2=-1 and v=4-5=-1.
BFor flight B, u=(14-12)/2=1 and v=6-5=1.

After these two calculations, use u for prepared width and v for prepared distance.

u=\frac{\text{width}-12}{2},\qquad v=\text{distance}-5

The illustrative model predicts \hat v=wu. Add 5 m to \hat v to recover predicted distance.

Illustrative centering and scaling.

Parameter initialization

1Choose a model: \hat v=wu.
2Give its parameter a starting value: w=0.
3Before learning, every prediction is \hat v=0, or 5 m in original units.

The weight w is an adjustable model parameter. Each value of w produces a different prediction, and the optimizer changes w during training.

Training software usually initializes network weights with small random values so different units can learn different features. It commonly initializes biases at or near zero.

Illustrative scalar initialization. A recorded random seed can reproduce the initial draw in a larger network.

Forward pass and loss for flight A

Prepared input
u=-1
›
Current weight
w=0
›
Prediction
\hat v=0
1Forward pass: \hat v=wu=0(-1)=0.
2Residual: v-\hat v=-1-0=-1.
3Squared loss: (-1)^2=1.

Illustrative forward pass and loss calculation. After the forward pass uses the fixed current parameters to calculate a prediction, the loss compares that prediction with the recorded target.

Batch loss for flights A and B

Exampleutarget vprediction at w=0squared loss
A-1-101
B+1+101
L_{\text{batch}}=\frac{1+1}{2}=1

Batch size is the number of examples used to calculate one update. Here, the batch size is 2.

A laundry load provides a capacity analogy: the dataset is the full pile, and one batch is the group processed together for one update.

Illustrative batch and loss calculation.

What is the slope of the loss?

Try the same batch with nearby settings of the weight.

Weight wPrediction for APrediction for BBatch loss
-0.1+0.1-0.11.21
0001.00
+0.1-0.1+0.10.81
\text{approximate slope}=\frac{0.81-1.21}{0.1-(-0.1)}=-2

The gradient gives the local slope of loss with respect to each parameter. Because this finite difference estimate is -2, a small increase in w decreases the loss near w=0.

Illustrative finite difference calculation. Backpropagation computes exact derivatives efficiently. The gradient of the loss surface gives the direction of steepest local increase with respect to every parameter.

Precalculus explanation

Delta as a numerical change

1The Greek letter \Delta, pronounced delta, means a change in the quantity that follows it.
2For flight A, the prediction begins at \hat v=0. The target is v=-1. The loss is (0-(-1))^2=1.
3Increase the weight by \Delta w=0.1. Because u=-1, the prediction changes by \Delta\hat v=u\Delta w=(-1)(0.1)=-0.1.
4The new prediction is -0.1, and the new loss is (-0.1-(-1))^2=0.81. Therefore, \Delta L=0.81-1=-0.19.

Illustrative small change calculation.

Precalculus explanation

The exact change in squared loss

Subtract the old squared loss from the new squared loss:

[(\hat v-v)+\Delta\hat v]^2-(\hat v-v)^2=2(\hat v-v)\Delta\hat v+(\Delta\hat v)^2

For flight A, \hat v-v=1 and \Delta\hat v=-0.1.

\underbrace{2(1)(-0.1)}_{-0.20}+\underbrace{(-0.1)^2}_{0.01}=-0.19

Illustrative continuation of the flight A calculation. As the size of a change approaches zero, its square approaches zero more quickly. For a tiny change, the term proportional to the change therefore gives a close approximation.

Precalculus explanation

Small changes in a backward pass

1For one example, squared loss is L=(\hat v-v)^2.
2A small prediction change, \Delta\hat v, produces about 2(\hat v-v)\Delta\hat v change in the loss.
3A weight change, \Delta w, changes the prediction by u\Delta w.
4Combining the changes gives about 2(\hat v-v)u\Delta w change in the loss.

At w=0, flight A has the loss change coefficient 2(0-(-1))(-1)=-2.

Flight B also has the coefficient 2(0-1)(1)=-2.

\text{batch gradient}=\frac{-2+(-2)}{2}=-2

Illustrative backward pass.

Optional calculus

Chain rule notation

A partial derivative is a local slope with respect to one quantity while the other quantities remain fixed.

1Prediction to loss: \frac{\partial L}{\partial\hat v}=2(\hat v-v).
2Weight to prediction: \frac{\partial\hat v}{\partial w}=u.
3Multiply the local slopes: \frac{\partial L}{\partial w}=\frac{\partial L}{\partial\hat v}\frac{\partial\hat v}{\partial w}=2(\hat v-v)u.

Backpropagation traverses the calculation in reverse and applies this chain rule at each step.

Partial derivatives express the local slopes used by backpropagation.

A gradient descent update

Use an illustrative learning rate of r=0.2. The estimated loss slope is g=-2.

1w_{\text{new}}=w_{\text{old}}-rg
2w_{\text{new}}=0-0.2(-2)=0.4
3At w=0.4, the two predictions are -0.4 and +0.4.
4Because each squared loss is 0.6^2=0.36, the batch loss falls from 1.00 to 0.36.

The learning rate controls the step length along the gradient direction. Individual updates can vary, so training is assessed across many updates.

Neural weight update

1Suppose (i) one neural weight is w_{\text{old}}=0.10, (ii) its loss slope is g_w=-0.30, and (iii) the learning rate is r=0.20.
2Calculate the signed change: -rg_w=-0.20(-0.30)=+0.06.
3Apply the change: w_{\text{new}}=0.10+0.06=0.16.
4Because the gradient is negative, increasing this weight locally decreases the loss, so gradient descent increases the weight.

Illustrative neural update.

Updating all neural parameters

The basic gradient descent optimizer used here applies the same update formula to every neural weight and bias.

\text{for each parameter }q:\qquad q_{\text{new}}=q_{\text{old}}-r g_q
SymbolMeaning
qone weight or bias
g_qlocal slope of loss with respect to that parameter
rlearning rate

Other optimizers combine gradients using different update formulas.

A complete parameter update

Batch Forwardpass Losscalculation Backwardpass Optimizerupdateof w Updated parameter for the next batch

One iteration is one completed parameter update. One update contains (i) a forward pass, (ii) a loss calculation, (iii) a backward pass, and (iv) an optimizer step.

Illustrative parameter update loop.

Batches, iterations, and epochs

Training examplesBatch sizeExamples in successive batchesIterations in one epoch
81eight groups of 18
822, 2, 2, 24
8881
1044, 4, then 23

One iteration is one parameter update. One epoch is one complete pass through the training dataset.

Before another epoch, the program usually shuffles the examples and forms new batches. The updated parameters persist.

Illustrative batch counts. An epoch counts all training examples encountered in one pass. An iteration counts one parameter update.

Training loop

initialize model parameters

for each epoch:
    shuffle training examples
    for each batch:
        predictions = model(batch.inputs)
        loss = compare(predictions, batch.targets)
        gradients = backward(loss)
        optimizer.step(gradients)
        clear old gradients

Within one iteration, (i) model(...) runs the forward pass; (ii) backward(loss) stores gradients; (iii) optimizer.step(...) updates the parameters; and (iv) gradient clearing prepares the next iteration. The outer loop counts epochs.

Parameters, hyperparameters, and random seeds

KindExamplesWhat determines it?
Parametersweights and biasesthe optimizer during training
Hyperparameterslearning rate, batch size, number of epochsthe practitioner or tuning procedure
Random stateinitial random values, shuffle order, random augmentation drawsa seeded pseudorandom generator

A recorded seed helps reproduce random choices. Hardware and software differences can create small numerical differences.

Training accounting exercise

Illustrative exercise: (i) 10 training examples, (ii) a batch size of 4, and (iii) 3 epochs. The final smaller batch is kept.
  1. How many iterations occur in one epoch? 3 iterations.
  2. How many updates occur across 3 epochs? 3(3)=9 updates.
  3. How many examples are in the final batch? 10-4-4=2 examples.
Ask a learner to (i) draw ten dots, (ii) circle groups of four, and (iii) mark one update after each group.

Leakage from a copied record

In this illustrative example, suppose one scan enters training and software extracts a text copy for the test set. This extraction process is optical character recognition, or OCR.

Training record
Bake for 20 minutes.
›
Raw OCR test record
Bake for 2O minutes.
›
Reported result
test score can be biased upward

Leakage occurs when information unavailable in the intended future use influences training or model selection.

A random row split can place related (i) rows, (ii) people, (iii) documents, or (iv) time periods in different partitions. Group related records before assigning partitions.

Training, validation, and test partitions

PartitionUseInfluence on model choices
Trainingcalculate updates to parametersdirect
Validationcompare settings and choose a checkpointindirect
Testestimate final performance after choices are fixedreserved until all choices are fixed

A validation pass uses a forward pass and a score. Parameters remain fixed during that pass. Repeated choices based on validation results use information from that set.

Keep the test set unused until all model choices are fixed. Keep related items in the same partition, including (i) flights from the same airplane, (ii) pages from the same document, and (iii) nearly duplicate questions.

Training and validation loss by epoch

EpochTraining lossValidation loss
01.001.05
10.620.68
20.380.46
30.240.39
40.150.44
50.090.56

Illustrative loss values. Epoch 3 has the lowest validation loss, 0.39. After epoch 3, training loss falls and validation loss rises.

Underfitting and overfitting

In this illustrative run, overfitting begins after epoch 3 because validation loss rises from 0.39 to 0.56 and training loss decreases during the same epochs.

PatternTraining resultValidation resultClassroom analogy
Underfittingpoorpoorthe student has not learned the material
Useful fitgoodgoodthe student can solve familiar and new versions
Overfittingexcellentworseningthe student memorized exact questions and struggles with variants

Illustrative training run.

Checkpoint selection by early stopping

Epoch 2
validation loss 0.46
›
Epoch 3
validation loss 0.39
save the epoch 3 checkpoint
›
Epoch 4
validation loss 0.44
  1. Checkpoint storage: save parameter checkpoints during training.
  2. Validation monitoring: measure validation loss.
  3. Checkpoint selection: choose the checkpoint with the lowest validation loss.

After epoch 4 fails to improve on the saved validation loss, this illustrative procedure stops training and keeps the epoch 3 checkpoint. A separate test set provides the final estimate.

Data construction

Source record and three derived records

IDRecordRelation and first concern
D2.sourceoriginal community cookbook page containing Bake for 20 minutescollected source; permission and handling
D2.scanimage derived from D2.sourcetransformed record; layout and legibility
D2.ocr.rawOCR text from D2.scan: Bake for 2O minutes.transformed record; recognition error
D2.ocr.reviewedreviewed text reading Bake for 20 minutescorrected record; preserve the source link

Illustrative records. Each derived record keeps the ID of the record from which it was produced.

Duplicates and a reserved question

IDRecordFirst decision
D1HTML cooking lessonreview permission and page extraction
D4mirror copy of D1mark as an exact duplicate
D5copy of D1 with a changed footermark as a duplicate with a changed footer
D6question written for final evaluationreserve D6 for evaluation

Illustrative records. A large corpus requires automated checks together with sampled human audits.

Four questions for dataset records

Dataset roleQuestion for one concrete record
PretrainingWhich recorded sequence supplies the next token targets?
Supervised fine tuningWhich prompt is paired with which approved response?
PreferenceWhich response better satisfies the stated rubric?
EvaluationWhich reserved prompt and scoring rule measure the fixed model?

D2 supplies concrete records for (i) pretraining, (ii) supervised fine tuning, and (iii) preference learning. D6 supplies the reserved evaluation record.

Permission for collected sources

Before extracting text, record why the source is in scope.

  1. Authority: who created or controls it?
  2. Basis: (i) a license, (ii) permission, (iii) applicable terms, or (iv) another documented basis?
  3. Purpose: does the intended training use match that basis?
  4. Removal: how can corrections or exclusions propagate?

For this project, a public page enters review for (i) permission, (ii) privacy, (iii) attribution, and (iv) suitability before extraction.

Illustrative provenance record

Record IDD2.scan
Input recordD2.source
Original creatorcommunity cooking club
Digitized byarchive volunteer
Rights basiswritten permission
Checksum9f3a
Partitionunassigned

Illustrative D2.scan record. A checksum is a compact fingerprint for detecting a changed or duplicate file.

Provenance after OCR review

Output recordD2.ocr.reviewed
Input recordD2.ocr.raw
Operationcorrect 2O to 20
Reviewerreviewer 17
Statusapproved
Release versionOCR workflow 1.1

The pipeline appends this illustrative entry after a reviewer checks D2.ocr.raw.

What do provenance fields establish?

After each transformation, the pipeline appends an entry to the provenance record.

  1. Lineage: the input and output IDs connect the derivative to its source.
  2. Responsibility: the operator and reviewer identify who performed and checked the work.
  3. Reproducibility: the version identifies the transformation settings and source records in one release.
  4. Separation: an automated validation check reads the partition field and rejects reserved records from training shards.

OCR from scan to reviewed text

COMMUNITY COOKBOOK

Bake for 20 minutes.

Illustrative reconstruction of D2.scan.

StageText
raw OCRBake for 2O minutes.
reviewedBake for 20 minutes.

Optical character recognition, or OCR, converts pixels into proposed characters. Here, the digit zero became the letter O.

The pipeline (i) detects layout, (ii) recognizes characters, (iii) reviews risky regions, (iv) stores corrected text, and (v) preserves the source link.

OCR quality assurance

1Sample 20 recipe lines from the D2 source group.
2Compare every sampled line with its scan.
3Find 19 exact lines and one character error.
419/20=95\% line accuracy in this illustrative audit.

The single error changes 20 into 2O, so the team adds a targeted check for (i) numbers, (ii) times, (iii) temperatures, (iv) ingredient amounts, (v) names, and (vi) units.

The correction record stores (i) the raw OCR, (ii) corrected text, (iii) reason, (iv) reviewer, (v) date, and (vi) dataset version.

A high exact line accuracy can coexist with a consequential instruction error.

Illustrative audit. Sampling should cover (i) relevant languages, (ii) years, (iii) layouts, (iv) scan qualities, and (v) source types.

HTML extraction and filtering

HOME; ABOUT; DONATE
Banana bread
Let the loaf cool before slicing.
Teacher phone: 212 555 0142
COOKIE SETTINGS; COPYRIGHT 2026
Extracted regionAction and reason
lesson heading and sentencekeep with document boundaries
navigation and cookie footerremove as repeated boilerplate
teacher phone numberquarantine for privacy review

Illustrative HTML record and phone number. The pipeline applies (i) deterministic filters, (ii) heuristic procedures, and (iii) statistical classifiers, and it records a reason code for each decision. Sampled audits estimate the resulting errors.

Deduplication before partitioning

RecordTextDecision
D1Let the loaf cool before slicing.keep canonical copy
D4Let the loaf cool before slicing.exact duplicate
D5Let the loaf cool before slicing. Copyright 2026.duplicate with a small edit
Duplicate group
D1, D4, D5
›
Assign the group
to one partition
›
Create chunks
that retain the document ID
›
Check overlap
before release

Exact deduplication compares identical normalized text or checksums. Deduplication for similar text uses fingerprints that tolerate small edits. D6 remains reserved for evaluation.

Illustrative duplicate records.

Lee et al., Deduplicating Training Data Makes Language Models Better, ACL 2022; Kandpal et al., ICML 2022.

Tokens, mixtures, and shards

Store cleaned documents
with their boundaries
›
Tokenize
text to integer IDs
›
Mix sources
according to sampling weights
›
Write training shards
with a recorded version
Illustrative mixture of 100 tokensChosen share
classroom lessons50
school newspapers30
general reference pages20

A mixture is a design decision, so chosen shares can differ from the raw collection. A shard is a manageable file portion used by the training system.

Next token targets for pretraining

For next token training, the training program shifts each token sequence to construct its targets.

Input contextTarget token
Bakefor
Bake for20
Bake for 20minutes

With self supervision, the training program constructs each target from sequence order.

This illustrative tokenizer treats each displayed word or number as one token. A deployed tokenizer may split text differently.

People and dataset work for pretraining

Cover one token in a complete sentence. Ask learners to predict it before revealing the recorded training target.

  1. Sources created by people, including (i) lessons, (ii) books, (iii) code, (iv) discussions, and (v) archives, already embody human work.
  2. Dataset teams perform (i) collection, (ii) rights review, (iii) OCR, (iv) filtering, (v) deduplication, (vi) mixing, and (vii) documentation.

Self supervision describes how the training program forms targets from sequence order. People (i) create, (ii) select, (iii) transform, (iv) document, and (v) govern the dataset.

Training systems for pretraining

System workPurpose
tokenization and shardingprepare stored examples for training
storage and data deliverysupply each requested batch
compute and optimizationrun forward passes, backward passes, and parameter updates
monitoring and incident responsedetect failures and recover training jobs

Penedo et al. (2024) report 15 trillion tokens in FineWeb. Soldaini et al. (2024) document an open Dolma corpus of 3 trillion tokens. Provenance and evaluation remain necessary at this scale.

Post training and evaluation

Illustrative SFT demonstration

Prompt

OCR read the cooking time 20 as 2O in a scanned recipe. Explain why a reviewer should correct it. Use two sentences for grade 9.

Approved response

The digit zero and the letter O can look alike in a scan. A reviewer checks the page and restores the cooking time to 20 minutes.

Supervised fine tuning, or SFT, updates the model toward approved responses to recorded prompts.

Illustrative prompt and approved response derived from D2.ocr.reviewed.

Fields in the SFT record

Stored fieldIllustrative value
sourceD2 corrected text
rubric(i) accuracy, (ii) directness, (iii) grade 9 language
originwritten by a person
reviewindependent approval
versionSFT OCR 1.2

Because a response may be (i) written by a person, (ii) edited from a model draft, or (iii) synthesized and verified, the record stores its origin.

The source ID preserves the path back to D2.ocr.reviewed. The review field records whether another reviewer approved the example.

Direct labor and total annotation cost

11{,}000(45\text{ s})=45{,}000\text{ s}
2\frac{45{,}000\text{ seconds}}{3{,}600\text{ seconds per hour}}=12.5\text{ hours}
3At an illustrative 25 dollars per hour, direct task labor is 312.50 dollars.

Additional costs include (i) paid onboarding, (ii) qualification, (iii) repeated labels for an audit subset, (iv) review, (v) adjudication, (vi) management and tools, (vii) breaks and benefits, and (viii) worker support.

Illustrative timing and pay.

Annotation preparation

  1. Write the rubric: include (i) positive examples, (ii) boundary cases, (iii) ties, and (iv) an unsure option.
  2. Train and pay annotators: pay them for (i) onboarding, (ii) practice, (iii) breaks, and (iv) qualification work.
  3. Randomize candidate order so that position bias is less likely to affect judgments.

Ouyang et al. (2022) document (i) labeler screening, (ii) onboarding, (iii) detailed instructions, and (iv) agreement measurements.

Annotation and review procedures

  1. Audit: use independent ratings on a subset and inspect agreement by task and language.
  2. Preserve disagreement: after distinguishing ambiguous prompts from careless work, adjudicate cases that reveal a problem in the rubric.
  3. Protect workers: use privacy procedures and support people exposed to harmful content.

Ouyang et al. (2022) report agreement checks. Fairwork (2023) and the International Labour Organization (2024) discuss conditions in digital labor.

Illustrative preference record

Prompt

OCR read the cooking time 20 as 2O in a scanned recipe. Explain why a reviewer should correct it. Answer for a grade 9 reader in exactly two sentences.

CandidateResponseJudgment
AThe letter O and the digit zero can look alike in a scan. A reviewer checks the page and restores the cooking time to 20 minutes.chosen for the rubric
BOptical character recognition can exhibit glyph substitution when the source image has limited contrast. Human verification resolves the ambiguous character class.accurate content with a reading level above grade 9

Illustrative responses. Candidate A better satisfies the stated grade 9 rubric for this prompt.

Fields in the preference record

Stored fieldIllustrative value
prompt and candidatesD2 prompt, response A, response B
judgmentA chosen; tie and unsure available
rubric reasonaccurate, direct, grade 9 language
rater recordscience teacher; independently reviewed
dataset versionpreference science 1.2

The rubric asks for (i) factual accuracy, (ii) two sentences, (iii) grade 9 language, and (iv) a direct answer.

The preference label records which response better satisfies this rubric for this prompt.

Reward prediction for a comparison

In this illustrative reward model, one learnable parameter, q, equals the difference between the two candidate scores. A full reward model calculates both scores from many weights.

Illustrative calculationValue
score for chosen A0.4
score for candidate B0.1
illustrative parameterq=0.4-0.1=0.3
predicted preference\sigma(q)=\sigma(0.3)\approx0.57

The sigmoid function converts the score difference into a 57 percent predicted preference for A. The recorded judgment says that A was chosen.

Illustrative scores. Ouyang et al., InstructGPT, 2022.

Output correction for the comparison

1The chosen response has target y=1. The model prediction is p=0.57.
2Use pairwise logistic log loss to compare target y with probability p. Because p=\sigma(q), the correction with respect to q is p-y=0.57-1=-0.43.
3Because the correction is negative, increasing q decreases the loss locally.

The correction supplies the direction for updating the illustrative parameter q.

Illustrative correction. Tutor note: for pairwise logistic log loss, this correction equals the derivative of loss with respect to q.

Reward parameter update

This illustrative reward model has one parameter, q_{\text{old}}=0.3. Use an illustrative learning rate of 0.2 for the update.

q_{\text{new}}=0.3-0.2(-0.43)=0.386
\sigma(0.386)\approx0.60

After the optimizer updates q, another forward calculation gives a predicted preference of about 60 percent for A.

Training software uses repeated comparisons across many batches and optimizer updates to train a reward model. A full reward model updates the weights that produce both candidate scores.

Illustrative reward parameter update.

How does RLHF use the reward model?

Prompt
new training context
›
Language model
generates a response
›
Reward model
assigns a score
›
PPO update
changes the language model

Reinforcement learning from human feedback, or RLHF, uses the trained reward model to score new responses.

Proximal policy optimization, or PPO, uses those scores to update the language model. In InstructGPT, a probability penalty at each token discourages the updated language model from assigning token probabilities that differ greatly from the SFT reference model.

The InstructGPT study, Ouyang et al. (2022), documents separate datasets for (i) SFT demonstrations, (ii) reward model comparisons, and (iii) PPO prompts.

DPO and synthetic SFT records

For the D2 prompt, candidate A is chosen and candidate B is rejected. DPO updates the language model from this stored pair.

ConceptStored recordRole in the pipeline
Direct preference optimization, or DPO(i) prompt, (ii) chosen response, (iii) rejected responseuse stored preference pairs as the training records
Synthetic SFT data(i) prompt or response drafted by a model, (ii) provenance, (iii) filters, (iv) reviewexpand task coverage before supervised fine tuning

Because generation can repeat model errors or evaluation questions, synthetic records pass through (i) deduplication, (ii) verification, and (iii) targeted human review.

DPO is a training objective for preference records. Synthetic generation is a possible origin for SFT records.

Rafailov et al., DPO, NeurIPS 2023; Wang et al., Self-Instruct, ACL 2023.

Illustrative evaluation record

Prompt IDEvaluation 0042
Source recordD6
Authorteacher A
Reviewerteacher B
Accessprivate
Rubricversion 3
Failure categorycausal claim
Test versionfrozen 1.0

The prompt and rubric stay private during model choices. Freezing version 1.0 of the evaluation set prevents silent question changes.

Evaluation overlap checks

CheckIllustrative methodResult for D6
exact texthash of normalized text0 training matches
similar textfingerprint built from sequences of five tokens, with human review at similarity 0.85 or higher0 records above threshold
source groupcompare parent source IDs0 shared source groups

The checks for (i) exact text, (ii) similar text, and (iii) shared source groups answer different contamination questions. The record stores (i) the method, (ii) the threshold, (iii) the result, and (iv) the review status.

Illustrative checks. Contamination checks compare evaluation records with the indexes for every training release.

Accuracy on 100 reserved items

1The frozen model answers 74 of 100 reserved items correctly under the frozen scoring rule.
2\text{accuracy}=\frac{74\text{ correct}}{100\text{ scored}}=74\%.
3The value 74\% is the observed accuracy on these 100 items.

Report (i) the numerator, (ii) the denominator, (iii) the dataset version, (iv) the scoring rule, and (v) results by relevant topic or group.

Illustrative evaluation result.

Uncertainty for a broader item population

For this illustrative calculation, define the population as grade 9 science questions that satisfy evaluation specification 1.0.

1Assume that the 100 reserved items are independent random draws from that defined population.
2Use the frozen model and frozen scoring rule for every item.
3The target is the probability that this frozen model answers a new random item from that population correctly.
4Under a binomial sampling model, an illustrative 95 percent Wilson interval for that probability is 65\% to 82\%.

Additional evaluation sets are needed for (i) other tasks, (ii) other populations, and (iii) other deployment conditions.

Illustrative interval. NIST and SEMATECH guidance, accessed 2026, describes the Wilson score method for a population proportion.

The path from scan to evaluated assistant

Collect
rights and source ID
›
Extract
layout and OCR
›
Curate
clean records and assign partitions
›
Pretrain
next token targets
›
Post training
SFT and preference data
›
Evaluate the fixed model
on reserved test groups
1The scan remains linked to the corrected cooking time.
2The text can contribute next token examples during pretraining.
3SFT examples teach the requested classroom explanation format.
4Preference records favor accurate, appropriately qualified explanations.
5A private question measures whether the fixed model generalizes.

Data lineage records the source and every transformation through evaluation. Gebru et al. (2021) and Bender and Friedman (2018) provide documentation frameworks for datasets.

Dataset decisions and their consequences

DecisionWhat it can changeRecord for accountability
source inclusionrepresented languages and knowledgesource list, rights basis, exclusions
filter selectionretained dialects, formats, and topicsfilter version, audit rates, error analysis
annotator recruitmentnorms used to define a good responseexpertise, pay, and agreement
selection metricemphasized and omitted failure modesrubric, evaluation groups, uncertainty, limitations

Data work combines (i) technical decisions, (ii) legal decisions, (iii) economic decisions, and (iv) social decisions. Training records and curation choices influence the patterns learned by the model.

Dataset curation exercise

Illustrative case: (i) D1 is a lesson, (ii) D4 is an exact mirror, (iii) D5 changes only the footer, and (iv) D6 is a reserved test question.
  1. Which records form one duplicate group? The duplicate group contains (i) D1, (ii) D4, and (iii) D5.
  2. When should the group be assigned to a split? Assign the duplicate group to one partition before creating chunks.
  3. May D6 become a synthetic SFT prompt? D6 remains a reserved evaluation record and stays outside synthetic SFT generation.
  4. Do 52 preference wins out of 100 establish a dependable lead? A lead of four cases requires an interval or repeated evidence before it supports a strong claim.
Pixels as model inputs

Four pixel values in one patch

In this illustrative grayscale image, 0 represents black. The value 1 represents white. Values between 0 and 1 represent gray.

01
10.5
1Group the four neighboring pixels into one image patch.
2Read the patch row by row: 0,1,1,0.5.
3Store those values in the row vector x=[0,1,1,0.5].

Illustrative two by two grayscale patch.

Pixels as model inputs

A weight matrix for one image patch

An image encoder is the part of a vision model that represents an image with numerical features. Here, it multiplies the patch vector by a learned weight matrix.

Four pixel values
x=[0,1,1,0.5]
›
Four by two weight matrix
W
›
Two output values
xW
W=\begin{bmatrix}1&0\\1&0\\0&1\\0&1\end{bmatrix}

The four rows match the four pixel values. The two columns produce two output values. This matrix is illustrative.

Pixels as model inputs

Patch embedding calculation

1First output: 0(1)+1(1)+1(0)+0.5(0)=1.
2Second output: 0(0)+1(0)+1(1)+0.5(1)=1.5.
3Put the two outputs together: xW=[1,1.5].

The result, a vector with two values, is a patch embedding. Practical image encoders commonly calculate patch embeddings from larger patches and use a larger embedding dimension, which is the number of columns in W. The optimizer updates the entries of W during training.

Illustrative patch embedding calculation.

Evidence for the assistant response

  1. Prediction and label: the regression line produced the 5.5 m prediction, and the decision threshold assigned the label clears.
  2. Uncertainty: repeated samples and a stated statistical model support a confidence interval.
  3. Generated explanation: at each generation step, the network calculated token scores from learned features, and the softmax function converted those scores into probabilities.
  4. Learned parameters: the training program (i) ran forward passes, (ii) calculated losses, (iii) ran backward passes, and (iv) applied optimizer updates across batches and epochs.
  5. Evidence base: records document (i) source provenance, (ii) OCR review, (iii) pretraining, (iv) SFT, (v) preference annotation, and (vi) reserved evaluation. They show how people (i) prepared the data, (ii) trained the model, and (iii) evaluated the fixed model.

Illustrative assistant response.

Sources: statistics and learning

Unless attributed to a study, numerical classroom examples are illustrative.

Sources: collection, OCR, and pretraining

Sources: post training and evaluation

Intro to AI, Week 1 OverviewM. K. Turkcan, Columbia University