Backpropagation in Neural Networks
- 57Unfamiliar
- 0Learning
- 0Familiar
- 0Mastered
How does a four-layer neural network turn a feature vector into a regression prediction?
57 questions
- 1
How does a four-layer neural network turn a feature vector into a regression prediction?
Model answer
It repeatedly applies weight matrices and activation functions to the feature vector, then takes a dot product of the final vector with the output weights to produce a score.
Explanation
The score is the network's prediction before the regression loss is calculated.
- 2
How is the squared regression loss for one example formed from the network's prediction and target?
Model answer
Subtract the target from the prediction to obtain the residual, then square the residual.
Explanation
The loss for a prediction y^ and target y is (y^−y)2.
- 3
Which gradients are needed to train the four-layer network using stochastic gradient descent?
Model answer
The gradients of the example's loss with respect to each parameter, including v1, v2, v3, and w.
Explanation
These gradients determine how to update the network's weights to reduce its loss.
- 4
Why is manually differentiating a deep network impractical even when the differentiation is straightforward?
Model answer
The calculations can be carried out directly, but doing them by hand is tedious and produces many symbolic expressions.
Explanation
Computation graphs and backpropagation automate the gradient calculation.
- 5
Why are computation graphs useful beyond automating gradient calculations?
Model answer
They also reveal the modular structure of expressions and gradients, making the calculations easier to understand.
Explanation
The graph shows how local computations combine into the full expression and its gradient.
- 6
How are computation graphs used by deep-learning software packages?
Model answer
Packages such as TensorFlow and PyTorch use computation graphs to automatically compute gradients.
Explanation
The graph supplies the structure that automatic differentiation and backpropagation operate on.
- 7
What is a computation graph, and what do its root and other nodes represent?
Model answer
It is a directed acyclic graph whose root represents the final expression; other nodes represent intermediate subexpressions.
Explanation
For example, a node could represent an intermediate value such as v(x).
- 8
How can a basic arithmetic operation be represented as a computation graph?
Model answer
The inputs point to a node representing the operation, and the operation's output is labeled as a new value.
Explanation
For addition, inputs a and b feed a plus node whose output is c.
- 9
In a computation graph, what does the gradient on an edge describe?
Model answer
It describes how much the output of that operation changes in response to a small change in the input on that edge.
Explanation
It acts as a local multiplicative factor, or gain, between an input perturbation and the output change.
- 10
What are the local derivatives of c=a+b with respect to a and b?
Model answer
Both derivatives are 1: ∂a∂c=1 and ∂b∂c=1.
Explanation
A small change in either input changes the sum by the same amount.
- 11
What are the local derivatives of c=ab with respect to its inputs?
Model answer
They are ∂a∂c=b and ∂b∂c=a.
Explanation
Perturbing one input changes the product in proportion to the other input.
- 12
What are the local derivatives of the operation a−b with respect to its two inputs?
Model answer
The derivative with respect to a is 1, and the derivative with respect to b is −1.
Explanation
Increasing the subtracted input reduces the result by the same amount.
- 13
What is the derivative of a2 with respect to a?
Model answer
The derivative is 2a.
Explanation
This follows from the power rule.
- 14
What are the local derivatives of max(a,b) when a and b are unequal?
Model answer
The derivative with respect to a is 1 if a>b and 0 if a<b; the derivative with respect to b is 1 if b>a and 0 if b<a.
Explanation
Only the input that currently determines the maximum affects the output for a small change.
- 15
What is the derivative of the logistic sigmoid σ(a) with respect to its input?
Model answer
It is σ(a)(1−σ(a)).
Explanation
The derivative can be written using the sigmoid's own output.
- 16
Why does the derivative of the logistic sigmoid approach zero for very large positive or negative inputs?
Model answer
The sigmoid saturates near 1 for large positive inputs and near 0 for large negative inputs, making σ(a)(1−σ(a)) approach zero.
Explanation
The derivative formula directly shows that it becomes small near either saturation value.
- 17
How can gradients through a sequence of operations be computed from local derivatives?
Model answer
Apply the chain rule by multiplying the local derivatives along the path connecting the input to the output.
Explanation
Each edge contributes a local gradient factor to the total derivative.
- 18
If b=a2 and c=b2, how can the derivative of c with respect to a be calculated using the graph?
Model answer
Multiply the local derivatives: ∂b∂c=2b and ∂a∂b=2a, giving ∂a∂c=4ab=4a3.
Explanation
Since b=a2, the result agrees with differentiating c=a4 directly.
- 19
What is the derivative of c=a4 with respect to a, and how does it verify the composed-gradient calculation?
Model answer
It is 4a3, matching the result obtained by multiplying the local derivatives through the two-square computation graph.
Explanation
Agreement with the power rule checks the chain-rule calculation.
- 20
How does a computation graph help organize the gradient of a complicated expression?
Model answer
It breaks the expression into simpler operations, so each local derivative can be identified and then combined along paths.
Explanation
Complicated gradients are built by composing the same basic derivative rules.
- 21
In a computation graph, how is a total gradient along a single path obtained?
Model answer
Multiply the gradients on all edges along that path.
Explanation
This is the chain rule expressed in graph form.
- 22
What does a gradient with respect to a parameter indicate in terms of perturbations?
Model answer
It indicates how much the output or loss changes when that parameter is changed by a small amount.
Explanation
The gradient measures the total effect of the perturbation through the connected operations.
- 23
How is the hinge loss computation graph for linear classification built from its main operations?
Model answer
Compute the score as a dot product of the weights and features, form the margin using the label and score, then take the maximum of 1 minus the margin and 0.
Explanation
The final maximum operation gives the hinge loss.
- 24
For the hinge loss L=max(1−ywTϕ(x),0), when is its gradient with respect to w nonzero?
Model answer
It is nonzero when the margin ywTϕ(x) is less than 1.
Explanation
In that case, the first argument of the maximum is positive and determines the loss.
- 25
What is the gradient of the hinge loss with respect to w when the margin is less than 1?
Model answer
It is −yϕ(x).
Explanation
The local derivatives contribute the maximum's active branch, a factor of −1 from subtracting the margin, the label y, and the feature vector.
- 26
What is the hinge-loss gradient with respect to w when the margin is greater than 1?
Model answer
It is zero.
Explanation
The maximum selects 0, so small changes to the weights do not change the loss in this region.
- 27
How does the computation graph make the hinge-loss gradient easier to derive?
Model answer
It separates the loss into operations whose local derivatives can be read off and multiplied from the loss back to the weights.
Explanation
The graph also labels intermediate quantities such as the score and margin, clarifying which derivative applies at each step.
- 28
How is the score computed in a two-layer neural network with feature vector ϕ(x)?
Model answer
Compute the hidden vector h=σ(Vϕ(x)), then take the dot product of w and h to obtain the score.
Explanation
The matrix V produces hidden-unit inputs, and the activation is applied element-wise.
- 29
How is the squared loss formed in the two-layer neural-network example?
Model answer
Subtract the target y from the score to get the residual, then square the residual.
Explanation
If the score is wTh, the residual is wTh−y and the loss is (wTh−y)2.
- 30
What is the gradient of the two-layer network's squared loss with respect to the output weights w?
Model answer
It is 2(wTh−y)h.
Explanation
The hidden vector h plays the role of the input features for the final linear prediction.
- 31
Why is the gradient with respect to the output weights a useful check against the linear-predictor result?
Model answer
It has the same form as the squared-loss gradient for a linear predictor, with the hidden vector h replacing the feature vector.
Explanation
For a linear predictor, the corresponding gradient is twice the residual times the features.
- 32
What is the gradient of the squared loss with respect to the hidden-layer matrix V?
Model answer
It is 2(wTh−y)[w⊙h⊙(1−h)]ϕ(x)T.
Explanation
The factors come from the squared loss, the output weights, the element-wise sigmoid derivative, and the input features.
- 33
What does the element-wise product symbol mean in the hidden-layer gradient?
Model answer
It means that corresponding entries of the vectors are multiplied together.
Explanation
The sigmoid is applied to each hidden-unit input separately, so its derivative is also applied element-wise.
- 34
Why do the gradients with respect to w and V share some factors?
Model answer
Both gradients pass through the same squared-loss and residual computations, so they share the loss derivative and the derivative of the residual with respect to the score.
Explanation
A graph makes these shared subexpressions visible.
- 35
What two phases make up the backpropagation algorithm?
Model answer
A forward pass computes intermediate values from the leaves to the root, and a backward pass computes gradients from the root back to the leaves.
Explanation
The forward values are retained for use in the backward calculations.
- 36
What does a forward value at a computation-graph node represent?
Model answer
It is the value of the subexpression represented by that node for the given inputs and parameters.
Explanation
A forward value may be a scalar, vector, or matrix.
- 37
What does a backward value at a node represent?
Model answer
It is the gradient of the final loss with respect to the value at that node.
Explanation
It measures how the loss changes if the node's value changes.
- 38
What is the backward value at the loss node itself?
Model answer
It is 1, because the derivative of the loss with respect to itself is 1.
Explanation
This provides the starting value for the backward pass.
- 39
How is a node's backward value calculated from its parent's backward value?
Model answer
Multiply the parent's backward value by the local gradient on the edge connecting that parent to the node.
Explanation
This step applies the chain rule as the backward pass moves toward the leaves.
- 40
In the example with w=(3,1) and ϕ(x)=(1,2), what score and loss are obtained if the residual is 3?
Model answer
The score is 5, and the squared loss is 9.
Explanation
The dot product is 3⋅1+1⋅2=5; squaring the residual gives 32=9.
- 41
In that numerical example, what is the gradient of the squared loss with respect to w?
Model answer
It is (6,12).
Explanation
The gradient is twice the residual times the feature vector: 2⋅3⋅(1,2)=(6,12).
- 42
Why does backpropagation retain intermediate values from the forward pass?
Model answer
The backward pass needs those values to evaluate local derivatives at the specific inputs and parameters.
Explanation
For example, differentiating a square requires the value of the quantity being squared.
- 43
Does backpropagation apply only to neural networks?
Model answer
No. It applies to general computation graphs and can compute gradients for many kinds of mathematical functions and models.
Explanation
Neural networks are one important use, not a restriction on the algorithm.
- 44
How does backpropagation fit into stochastic gradient descent?
Model answer
Backpropagation computes the loss gradients, and stochastic gradient descent uses them to update the model parameters.
Explanation
The gradients indicate how parameter changes affect the loss.
- 45
Why can gradient descent on a convex training loss reach a global minimum under suitable conditions?
Model answer
A convex loss has a single global minimum, and gradient descent with an appropriate step size can converge to it.
Explanation
The stated guarantee applies to convex losses such as those for linear predictors with a convex loss.
- 46
Why is there no comparable global-minimum guarantee for neural-network training?
Model answer
Neural-network training losses are generally non-convex, so gradient descent is not guaranteed to reach a global minimum.
Explanation
The method may converge to a local minimum or otherwise fail to reach the global optimum.
- 47
What does the difference between neural-network optimization theory and practice mean?
Model answer
Although theory provides no guarantee of finding a global minimum, neural networks often train successfully in practice; the reason for this gap is not fully understood.
Explanation
Successful practical results do not remove the theoretical difficulty of non-convex optimization.
- 48
Why does initialization matter when optimizing a non-convex neural-network loss?
Model answer
Different starting points can lead the optimization to different regions or local minima.
Explanation
Unlike a convex objective, a non-convex objective may have multiple basins of attraction.
- 49
Why can initializing every entry of a neural network's weight matrix to zero be harmful?
Model answer
The rows of the weight matrix can remain identical, preventing the hidden units from learning distinct useful representations.
Explanation
Random variation helps break this symmetry.
- 50
What are two approaches described for initializing a neural network?
Model answer
Initialize weights with small random noise around zero, or use pretraining to initialize the network.
Explanation
Both approaches provide alternatives to setting all weights to zero.
- 51
What is over-parameterization in the neural-network setting described?
Model answer
It means using more hidden units than are strictly needed.
Explanation
This corresponds to having more rows in the hidden-layer weight matrix.
- 52
What is the proposed benefit of over-parameterizing a neural network?
Model answer
Having more hidden units gives the network more opportunities to learn useful patterns; some units may be unhelpful while others prove useful.
Explanation
The extra units provide additional capacity from which useful representations may emerge.
- 53
How do adaptive step-size methods differ from using a single step size in stochastic gradient descent?
Model answer
They assign a separate step size to each parameter rather than using one shared step size.
Explanation
Methods such as Adagrad and Adam adjust how quickly each weight moves.
- 54
What can happen if gradients vanish during training?
Model answer
Updates become too small, so learning can stall and the model may make little progress.
Explanation
Gradients near zero provide little direction for changing the parameters.
- 55
What can happen if gradients explode during training?
Model answer
Updates can become too large, causing oscillation or divergence.
Explanation
Very large gradients can make parameter changes unstable.
- 56
What design and training choices can help prevent vanishing or exploding gradients?
Model answer
Careful initialization, suitable step sizes, and thoughtful neural-network architecture design can help keep gradients from vanishing or exploding.
Explanation
These choices affect how gradients propagate and how large parameter updates become.
- 57
Why do computation graphs support rapid experimentation with new models and loss functions?
Model answer
They provide a general way to represent mathematical expressions and compute their gradients, so new model structures and losses can be tried without deriving every gradient by hand.
Explanation
This generality supports differential programming across many types of functions.

Ask anything
We've read this whole study set, so questions about it get the best answers.