6.S191 LEARNING NOTE
Study notes for the 2026 edition of MIT 6.S191, Introduction to Deep Learning. Course materials
Lesson 1 — Introduction to Deep Learning
Matrix Multiplication Recap
If
To find a column of
If
To find one entry of
For example, if row 1 of
Neurons and Single-Layer Networks
One Neuron
For an input row vector
The neuron takes the dot product
One Dense Layer
All
With
With an elementwise activation like ReLU,
Hidden Layers and Dimensional Changes
A hidden layer sits between the input and the final output. Its output vector contains the hidden activations, which become the input to the next layer.
Start with an input row vector
The next layer now receives
For example, with four input features, three hidden neurons, and two output neurons, the vector widths are
Loss Evaluation
A loss function assigns a penalty to a network prediction
Squared Error
If the target is
Empirical Loss and Mean Squared Error
The empirical loss averages the per-example losses over the observed dataset. For
For example, losses of
Cross-Entropy Loss
In single-label classification, the predicted probabilities sum to
For example, given probabilities
For binary classification, let
Why Take the Negative Log?
The minus sign makes higher probabilities for the correct class give lower losses. The loss is zero at
The probabilities of the incorrect classes sum to
When the likelihood factors across examples, the probabilities assigned to their correct labels multiply. The logarithm turns this product into a sum, so minimizing mean cross-entropy is equivalent to maximizing the likelihood of the observed labels.
Gradient Descent and Backpropagation
Gradient descent updates one shared set of weights and biases to reduce the average training loss. A network with many nonlinear layers generally requires an iterative search. At each step, the negative gradient points in the direction of steepest local decrease.
Gradient Descent
Start with initial parameters
- Run a forward pass to predict on the training examples used in this step.
- Compare the predictions with their targets and compute the mean loss
. - Use backpropagation to compute the gradient
, which contains one partial derivative per weight and bias. - Subtract the gradient multiplied by the learning rate, then repeat with the updated parameters.
Learning Rate
The learning rate
For a fixed learning rate, a larger gradient produces a larger step. A smaller rate can keep a steep gradient from sending the parameters too far. On a flat stretch with a small gradient, a larger rate can help make progress. A gradient can also be small near a minimum, where a large step can overshoot if the slope changes quickly. The step size depends on both the rate and the gradient, and the curvature of the loss determines how quickly that gradient changes as we move.
The global minimum is the lowest loss over all possible parameters. On the nonconvex loss surfaces of deep networks, gradient descent can reach a local minimum or a saddle point. At a point with zero gradient, the update is zero for any learning rate. Choosing a rate helps the optimizer make steady progress, and plain gradient descent offers no general guarantee of reaching the global minimum.
Mini-Batch SGD
In mini-batch stochastic gradient descent (SGD), each step uses a batch of
The average is computed separately for each weight and bias. For example, if two examples give weight gradients
A randomly sampled mini-batch provides an estimate of the full training-set gradient. With
Backpropagation and the Chain Rule
For one neuron with a scalar input
The bias gradient shares the first two factors. Since
Backpropagation applies this rule from the loss back through the network, reusing derivatives already computed for later layers. When an activation feeds several neurons, their contributions to its gradient add together.
Worked Example
Take
The derivative of squared loss with respect to the prediction is
With a learning rate of
Overfitting
Overfitting happens when a model learns patterns specific to the training examples, including noise, and performs worse on new examples. Generalization is how well the model predicts on examples it has never seen.
Imagine fitting a curve to points scattered around a U-shaped trend.
- Underfitting. A straight line misses the curved trend, so errors tend to be high on both training and validation data.
- Good fit. A smooth curve captures the overall U shape and predicts well on similar new examples.
- Overfitting. A highly flexible curve bends to follow individual training points. It can score well on those points and make worse predictions between them.
To detect overfitting, track the same loss on the training set and on a separate validation set whose examples are held out from weight updates. If training loss falls from 0.30 to 0.10 while validation loss rises from 0.35 to 0.55, the later model fits the training examples better but generalizes worse on the validation set.
Regularization
Regularization changes how a model is trained to help it generalize. It can reduce overfitting, but too much regularization can make the model miss useful patterns and underfit. Compare validation loss to see which strength works best on held-out examples.
Dropout
During training, dropout randomly sets some activations in a layer to zero before passing the vector to the next layer. Each activation has a probability
In inverted dropout, let
For example, with
Early Stopping
Early stopping uses validation loss to decide which version of the model to keep. In the lecture figure, the green training-loss curve keeps falling, while the blue curve starts rising after its lowest point. The later weights fit the training examples better and make worse predictions on the held-out examples. The blue curve, labeled “Testing” in the slide, serves as the validation curve because it guides when to stop.
For example, split 1,000 labeled images into three groups before training.
- 800 training images provide the examples and targets used to compute gradients and update the weights.
- 100 validation images measure how well the model predicts labels for images held out from weight updates. Use their loss to choose which checkpoint to keep.
- 100 test images measure final performance after choosing the checkpoint.
A checkpoint is a saved version of the model weights. During training, check validation loss at regular intervals and save the weights whenever that loss improves. A common rule is to stop after several checks without improvement and restore the checkpoint with the lowest validation loss. The number of checks to wait is called patience.



