1. Home
  2. Explore
  3. Computer Science
  4. Backpropagation and Neural Networks

Study methods

Flashcards
Quiz
Fill in the blanks
Written test
Lesson
Notes
Podcast
Content

Backpropagation and Neural Networks

  • 47Unfamiliar
  • 0Learning
  • 0Familiar
  • 0Mastered
Topic: Loss and Training

How is the overall loss defined from the costs of individual examples?

47 questions

  1. 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. 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)h_\theta(x)hθ​(x), and the example's label yyy; 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. 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(θ)\theta \leftarrow \theta - \eta\nabla_\theta L_{i_k}(\theta)θ←θ−η∇θ​Lik​​(θ).

    Explanation

    The example index iki_kik​ is sampled from the data set, and its gradient is used in the update.

  4. 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. 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. 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. 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. 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. 9

    In the stated gradient-computation result, what does the size nnn 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. 10

    For a differentiable circuit of size nnn that computes a scalar function of lll inputs, what is the dimension and computation time of the input gradient?

    Model answer

    The gradient has lll components, one for each input, and can be computed in O(n)O(n)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. 11

    What assumption about elementary operations underlies the circuit's O(n)O(n)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. 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)O(n)O(n) time, computing its gradient also takes O(n)O(n)O(n) time.

    Explanation

    The lecture states that the forward and backward passes have similar asymptotic time for a differentiable circuit.

  13. 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. 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. 15

    For a D×DD\times DD×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 D2D^2D2: the matrix has D2D^2D2 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. 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. 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. 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. 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. 20

    What is the Hessian-vector product, and how can it be obtained by differentiation?

    Model answer

    For a scalar function fff, the Hessian-vector product is ∇2f(x)v\nabla^2 f(x)v∇2f(x)v. It is the gradient of g(x)=∇f(x)⋅vg(x)=\nabla f(x)\cdot vg(x)=∇f(x)⋅v.

    Explanation

    Differentiating the directional derivative represented by ggg yields the Hessian multiplied by vvv.

  21. 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×nn\times nn×n matrix, while its product with a vector is accessible through an additional differentiation.

  22. 22

    What does the chain rule accomplish when a variable uuu is computed from zzz and a final scalar JJJ depends on uuu?

    Model answer

    It uses the gradient of JJJ with respect to uuu and the local derivatives of the function mapping zzz to uuu to compute the gradient with respect to zzz.

    Explanation

    This is the basic backward step used to pass gradients through a computation.

  23. 23

    If u=g(z)u=g(z)u=g(z) has nnn components and zzz has mmm components, how is ∂J∂zi\frac{\partial J}{\partial z_i}∂zi​∂J​ expressed using the chain rule?

    Model answer

    ∂J∂zi=∑j=1n∂J∂uj∂uj∂zi\displaystyle \frac{\partial J}{\partial z_i}=\sum_{j=1}^{n}\frac{\partial J}{\partial u_j}\frac{\partial u_j}{\partial z_i}∂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. 24

    How can the chain rule for u=g(z)u=g(z)u=g(z) be written using the Jacobian?

    Model answer

    In column-vector gradient notation, ∇zJ=Jg(z)T∇uJ\nabla_z J=J_g(z)^T\nabla_u J∇z​J=Jg​(z)T∇u​J, where Jg(z)J_g(z)Jg​(z) is the Jacobian of ggg.

    Explanation

    The Jacobian transpose maps the gradient at the output of ggg back to its input.

  25. 25

    What local information is needed to propagate a gradient backward through a function ggg?

    Model answer

    The backward computation needs the function ggg, the input value zzz, 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 zzz.

  26. 26

    Why can a complicated downstream computation be ignored when computing the local backward step for ggg?

    Model answer

    Its effect is already summarized by the gradient arriving at uuu, so the local step only needs that gradient and information about ggg at zzz.

    Explanation

    The chain rule passes a gradient from one operation to the preceding operation without revisiting the downstream computation.

  27. 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. 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. 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. 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. 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. 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. 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. 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. 35

    For an affine layer u=Wz+bu=Wz+bu=Wz+b, what is the gradient with respect to its input zzz given the output gradient ∇uJ\nabla_u J∇u​J?

    Model answer

    ∇zJ=WT∇uJ\nabla_z J=W^T\nabla_u J∇z​J=WT∇u​J.

    Explanation

    The local Jacobian of the affine transformation with respect to zzz is WWW, so its transpose propagates the gradient backward.

  36. 36

    For u=Wz+bu=Wz+bu=Wz+b, what is the derivative of output coordinate uku_kuk​ with respect to input coordinate ziz_izi​?

    Model answer

    ∂uk∂zi=Wki\frac{\partial u_k}{\partial z_i}=W_{ki}∂zi​∂uk​​=Wki​.

    Explanation

    In the expression uk=bk+∑sWkszsu_k=b_k+\sum_s W_{ks}z_suk​=bk​+∑s​Wks​zs​, only the term containing ziz_izi​ contributes to this derivative.

  37. 37

    For u=Wz+bu=Wz+bu=Wz+b, what is the gradient of the loss with respect to a weight WijW_{ij}Wij​?

    Model answer

    ∂J∂Wij=∂J∂uizj\frac{\partial J}{\partial W_{ij}}=\frac{\partial J}{\partial u_i}z_j∂Wij​∂J​=∂ui​∂J​zj​.

    Explanation

    The weight connects input coordinate zjz_jzj​ to output coordinate uiu_iui​, so its gradient is the output-side gradient times the input value.

  38. 38

    How can the weight gradient for an affine layer be written as a matrix?

    Model answer

    ∇WJ=(∇uJ)zT\nabla_W J=(\nabla_u J)z^T∇W​J=(∇u​J)zT.

    Explanation

    The outer product places the coordinatewise products of the output gradient and input into the weight-gradient matrix.

  39. 39

    What is the gradient of the loss with respect to the bias vector bbb in u=Wz+bu=Wz+bu=Wz+b?

    Model answer

    ∇bJ=∇uJ\nabla_b J=\nabla_u J∇b​J=∇u​J.

    Explanation

    Each output coordinate depends on its corresponding bias with derivative one and does not depend on the other bias coordinates.

  40. 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(\nabla_u J)z^T(∇u​J)zT.

    Explanation

    A single-example weight gradient is formed from one output-gradient vector and one input vector.

  41. 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. 42

    For an elementwise activation ui=σ(zi)u_i=\sigma(z_i)ui​=σ(zi​), what is the Jacobian of the activation?

    Model answer

    It is diagonal, with entry σ′(zi)\sigma'(z_i)σ′(zi​) in position (i,i)(i,i)(i,i) and zeros off the diagonal.

    Explanation

    Each output coordinate depends only on the corresponding input coordinate.

  43. 43

    How is the gradient propagated through an elementwise activation?

    Model answer

    Each incoming gradient component is multiplied by the local derivative: ∂J∂zi=∂J∂uiσ′(zi)\frac{\partial J}{\partial z_i}=\frac{\partial J}{\partial u_i}\sigma'(z_i)∂zi​∂J​=∂ui​∂J​σ′(zi​).

    Explanation

    This is multiplication by the diagonal activation Jacobian.

  44. 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. 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)O(mn)O(mn) for an m×nm\times nm×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. 46

    How does the computational cost of an elementwise activation's backward pass scale with its input dimension mmm?

    Model answer

    It takes O(m)O(m)O(m) time.

    Explanation

    The pass computes one scalar derivative per coordinate and applies it elementwise.

  47. 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.

1 of 47
Question 1 of 47

Ask anything

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

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent