Backpropagation and Neural Networks
- 47Unfamiliar
- 0Learning
- 0Familiar
- 0Mastered
How is the overall loss defined from the costs of individual examples?
47 questions
- 1
How is the overall loss defined from the costs of individual examples?
Model answer
It is the average of the cost functions for the individual examples.
Explanation
The loss or cost function is described as the average cost across examples.
- 2
What quantities can an individual example's cost function depend on?
Model answer
It can measure the difference between a model output, such as hθ(x), and the example's label y; cross-entropy is one possible loss.
Explanation
The lecture gives model output, input, label, and cross-entropy as an example of the cost setup.
- 3
How does the simplest described form of stochastic gradient descent update parameters?
Model answer
It updates parameters by subtracting the learning rate times the loss gradient for a randomly sampled example: θ←θ−η∇θLik(θ).
Explanation
The example index ik is sampled from the data set, and its gradient is used in the update.
- 4
What computation does backpropagation perform during training?
Model answer
It computes the gradient of the loss with respect to the model parameters.
Explanation
This parameter gradient is the quantity needed for gradient-based updates such as SGD.
- 5
What are the forward pass and backward pass?
Model answer
The forward pass evaluates the model or function, while the backward pass computes its gradients.
Explanation
These are the lecture's terms for evaluating a function and computing its gradient.
- 6
Why is it useful to understand backpropagation even when software performs it automatically?
Model answer
Understanding it helps explain how training computations work and informs decisions about models and computation.
Explanation
The lecture notes that automatic differentiation removes the need to calculate gradients by hand, but understanding the process remains useful.
- 7
What kinds of operations can form a differentiable computational circuit?
Model answer
A circuit can combine arithmetic operations, such as addition, subtraction, and division, with elementary functions such as cosine, exponential, or sigmoid.
Explanation
The circuit is built from a sequence of differentiable operations and elementary functions.
- 8
How does a computational circuit differ from a formula when an intermediate result is used more than once?
Model answer
A circuit can reuse the computed intermediate result, whereas a formula must expand and write the computation again wherever it is used.
Explanation
Reusing a part of a computation is the stated distinction between circuits and formulas.
- 9
In the stated gradient-computation result, what does the size n of a circuit represent?
Model answer
It represents the number of operations in the circuit.
Explanation
The result measures circuit size by counting its operations.
- 10
For a differentiable circuit of size n that computes a scalar function of l inputs, what is the dimension and computation time of the input gradient?
Model answer
The gradient has l components, one for each input, and can be computed in O(n) time.
Explanation
The result gives one partial derivative per input coordinate and states that the gradient computation is linear in circuit size.
- 11
What assumption about elementary operations underlies the circuit's O(n) computation-time measure?
Model answer
Each elementary operation is assumed to take one unit of time.
Explanation
With this assumption, evaluating a circuit takes time proportional to its number of operations.
- 12
How does the gradient-computation result relate the cost of the forward pass to the cost of the backward pass?
Model answer
If evaluating the function takes O(n) time, computing its gradient also takes O(n) time.
Explanation
The lecture states that the forward and backward passes have similar asymptotic time for a differentiable circuit.
- 13
Why can the circuit result be applied to neural networks?
Model answer
Neural-network operations, including matrix operations and activation functions, can be represented as compositions of elementary differentiable operations.
Explanation
This lets a neural network be treated as a differentiable computational circuit.
- 14
How does the number of operations in many neural networks relate to the number of parameters?
Model answer
It is generally proportional to the number of parameters.
Explanation
The lecture says this relationship holds for almost all networks in common use, with possible small exceptions.
- 15
For a D×D matrix and a vector, how do the parameter count and the operation count for the matrix-vector product scale?
Model answer
Both scale as D2: the matrix has D2 parameters, and the product requires a proportional number of operations.
Explanation
The matrix-vector example illustrates why network operation counts often scale with parameter counts.
- 16
What computational cost does the circuit result imply for evaluating a network loss and its parameter gradient?
Model answer
When the number of network operations is proportional to the parameter count, both the forward evaluation and gradient computation take time proportional to that count.
Explanation
The circuit result makes the backward-pass cost comparable to the forward-pass cost.
- 17
How can differentiating through a gradient-descent step produce a second-order quantity?
Model answer
The updated parameter depends on a gradient, so differentiating a loss evaluated after the update differentiates through that gradient and can involve second derivatives.
Explanation
The lecture considers taking a descent step and then differentiating the resulting loss with respect to the original parameters.
- 18
Why can a loss defined by running an algorithm for several steps still be differentiated efficiently?
Model answer
If the algorithm's steps and resulting loss can be computed efficiently, the combined computation can be differentiated using automatic differentiation.
Explanation
The algorithm's operations become part of the computation defining the loss.
- 19
How can differentiating through an optimization algorithm be used in meta-learning?
Model answer
It can optimize choices such as the learning rate or regularization by differentiating a final loss through the algorithm's training steps.
Explanation
The lecture describes tuning these choices based on the result of running an algorithm for a specified number of steps.
- 20
What is the Hessian-vector product, and how can it be obtained by differentiation?
Model answer
For a scalar function f, the Hessian-vector product is ∇2f(x)v. It is the gradient of g(x)=∇f(x)⋅v.
Explanation
Differentiating the directional derivative represented by g yields the Hessian multiplied by v.
- 21
Why can a Hessian-vector product be computed efficiently even when the full Hessian is too large to construct?
Model answer
The product can be computed by differentiating a scalar function involving a vector inner product, without explicitly forming the full Hessian matrix.
Explanation
The Hessian may be an n×n matrix, while its product with a vector is accessible through an additional differentiation.
- 22
What does the chain rule accomplish when a variable u is computed from z and a final scalar J depends on u?
Model answer
It uses the gradient of J with respect to u and the local derivatives of the function mapping z to u to compute the gradient with respect to z.
Explanation
This is the basic backward step used to pass gradients through a computation.
- 23
If u=g(z) has n components and z has m components, how is ∂zi∂J expressed using the chain rule?
Model answer
∂zi∂J=j=1∑n∂uj∂J∂zi∂uj.
Explanation
The derivative with respect to an input coordinate sums contributions through all intermediate coordinates.
- 24
How can the chain rule for u=g(z) be written using the Jacobian?
Model answer
In column-vector gradient notation, ∇zJ=Jg(z)T∇uJ, where Jg(z) is the Jacobian of g.
Explanation
The Jacobian transpose maps the gradient at the output of g back to its input.
- 25
What local information is needed to propagate a gradient backward through a function g?
Model answer
The backward computation needs the function g, the input value z, and the gradient arriving at its output; it does not need the full details of later computations.
Explanation
The local Jacobian and the incoming gradient determine the gradient with respect to z.
- 26
Why can a complicated downstream computation be ignored when computing the local backward step for g?
Model answer
Its effect is already summarized by the gradient arriving at u, so the local step only needs that gradient and information about g at z.
Explanation
The chain rule passes a gradient from one operation to the preceding operation without revisiting the downstream computation.
- 27
How does backpropagation apply the chain rule through a sequence of functions?
Model answer
It starts with the gradient at the final output and repeatedly applies each function's local backward mapping in reverse order.
Explanation
Each step converts the gradient with respect to a function's output into a gradient with respect to its input.
- 28
Must the functions in a neural network use the same backward mapping?
Model answer
No. Each operation, such as matrix multiplication or an activation function, has its own local derivative and backward mapping.
Explanation
The overall backward pass composes the appropriate local mappings for the operations in the network.
- 29
In a neural network, why can parameters be treated as inputs when computing their gradients?
Model answer
A layer's output depends on its parameters as well as its data input, so the parameters can be viewed as inputs to that layer's computation and differentiated through it.
Explanation
The same chain-rule procedure applies whether the quantity of interest is an activation or a parameter.
- 30
What two kinds of gradients are computed during backpropagation through a parameterized network?
Model answer
Backpropagation computes gradients with respect to intermediate activations and gradients with respect to the layer parameters.
Explanation
The activation gradients pass information backward through the network, while the parameter gradients give the quantities needed for learning.
- 31
Why must the backward computation pass through intermediate activations to obtain gradients for earlier layers?
Model answer
A layer's output gradient is needed to compute the gradient for that layer's input, which carries the gradient toward earlier layers.
Explanation
Gradients with respect to activations are propagated successively backward through the computation graph.
- 32
How can parameter-gradient calculations be organized alongside the backward pass through activations?
Model answer
Once the relevant activation gradient for a layer is available, that layer's parameter gradient can be computed; these calculations can branch from the activation-gradient sequence.
Explanation
The lecture notes that some parameter-gradient computations can be performed alongside the sequential propagation of activation gradients.
- 33
How can the order of gradient computations affect memory use?
Model answer
Once stored values are no longer needed for later gradient calculations, they can be discarded to free memory.
Explanation
Knowing which quantities depend on others helps determine when intermediate computations can be released.
- 34
Why does the computational graph matter for optimizing neural-network training systems?
Model answer
It reveals dependencies among quantities, which helps determine computation order, opportunities for parallelism, memory release, and communication between GPUs.
Explanation
These system-level choices depend on which values are needed by later computations.
- 35
For an affine layer u=Wz+b, what is the gradient with respect to its input z given the output gradient ∇uJ?
Model answer
∇zJ=WT∇uJ.
Explanation
The local Jacobian of the affine transformation with respect to z is W, so its transpose propagates the gradient backward.
- 36
For u=Wz+b, what is the derivative of output coordinate uk with respect to input coordinate zi?
Model answer
∂zi∂uk=Wki.
Explanation
In the expression uk=bk+∑sWkszs, only the term containing zi contributes to this derivative.
- 37
For u=Wz+b, what is the gradient of the loss with respect to a weight Wij?
Model answer
∂Wij∂J=∂ui∂Jzj.
Explanation
The weight connects input coordinate zj to output coordinate ui, so its gradient is the output-side gradient times the input value.
- 38
How can the weight gradient for an affine layer be written as a matrix?
Model answer
∇WJ=(∇uJ)zT.
Explanation
The outer product places the coordinatewise products of the output gradient and input into the weight-gradient matrix.
- 39
What is the gradient of the loss with respect to the bias vector b in u=Wz+b?
Model answer
∇bJ=∇uJ.
Explanation
Each output coordinate depends on its corresponding bias with derivative one and does not depend on the other bias coordinates.
- 40
What rank does the weight-gradient matrix have for one example in an affine layer, and why?
Model answer
It has rank at most one because it is the outer product (∇uJ)zT.
Explanation
A single-example weight gradient is formed from one output-gradient vector and one input vector.
- 41
Does the rank-one property of a single-example weight gradient necessarily hold for a gradient averaged across multiple examples?
Model answer
No. Averaging the separate outer-product gradients can produce a matrix that is not rank one.
Explanation
The rank-one observation applies to one example's gradient, not necessarily to an aggregate over examples.
- 42
For an elementwise activation ui=σ(zi), what is the Jacobian of the activation?
Model answer
It is diagonal, with entry σ′(zi) in position (i,i) and zeros off the diagonal.
Explanation
Each output coordinate depends only on the corresponding input coordinate.
- 43
How is the gradient propagated through an elementwise activation?
Model answer
Each incoming gradient component is multiplied by the local derivative: ∂zi∂J=∂ui∂Jσ′(zi).
Explanation
This is multiplication by the diagonal activation Jacobian.
- 44
Why can an elementwise activation's backward pass avoid constructing its full Jacobian?
Model answer
Because the Jacobian is diagonal, the backward computation only needs the vector of elementwise derivatives and can multiply corresponding components.
Explanation
The diagonal structure means there are no cross-coordinate derivative terms.
- 45
How does the computational cost of the backward pass through a matrix multiplication compare with its forward cost?
Model answer
Both take time proportional to the matrix's number of entries, such as O(mn) for an m×n matrix.
Explanation
The input-gradient calculation uses a transposed matrix product, while the parameter-gradient calculation forms an outer product of the same overall size.
- 46
How does the computational cost of an elementwise activation's backward pass scale with its input dimension m?
Model answer
It takes O(m) time.
Explanation
The pass computes one scalar derivative per coordinate and applies it elementwise.
- 47
What general property makes activation functions suitable for use in differentiable neural-network computations?
Model answer
They are differentiable one-dimensional functions whose derivatives can be computed efficiently.
Explanation
The lecture describes commonly used activation functions in terms of efficient differentiation, without requiring a specific activation choice.

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