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

  • 65Unfamiliar
  • 0Learning
  • 0Familiar
  • 0Mastered
Topic: Optimization Foundations

What is the purpose of a classifier function f(x;W)f(x; W)f(x;W)?

65 questions

  1. 1

    What is the purpose of a classifier function f(x;W)f(x; W)f(x;W)?

    Model answer

    It maps input data xxx to a vector of scores, with one score for each class.

    Explanation

    The weights WWW parameterize the classifier and determine the class scores produced for each input.

  2. 2

    How is the total loss LLL typically constructed?

    Model answer

    The total loss combines a data loss term with a regularization term.

    Explanation

    The data term measures how well the scores perform on the data, while regularization expresses a preference for simpler models.

  3. 3

    Why is regularization included in the loss function?

    Model answer

    Regularization favors simpler models, which can improve generalization to unseen data.

    Explanation

    A model that is overly complex may fit the training data well but generalize poorly.

  4. 4

    How does gradient descent minimize a loss function?

    Model answer

    It repeatedly updates the parameters in the direction of the negative gradient, which is the direction of steepest descent.

    Explanation

    Following the negative gradient moves the parameters toward lower values of the loss landscape.

  5. 5

    Compare numerical and analytic gradients.

    Model answer

    Numerical gradients use finite differences and are easy but slow and approximate; analytic gradients are fast and exact once derived but require mathematical derivation.

    Explanation

    Analytic gradients can contain implementation or calculus errors, so numerical gradients are useful for checking them.

  6. 6

    Why should numerical gradients be used to check analytic gradients?

    Model answer

    They provide an independent approximation that can reveal mistakes in the derived or implemented analytic gradient.

    Explanation

    In practice, analytic gradients are preferred for efficiency, while numerical gradients serve as a correctness check.

  7. 7

    What is a computational graph?

    Model answer

    A computational graph represents a function as a sequence of computation nodes, where each node performs an operation on its inputs.

    Explanation

    For example, matrix multiplication, addition, loss computation, and regularization can each be represented as nodes.

  8. 8

    How can a linear classifier with regularization be represented as a computational graph?

    Model answer

    The graph can contain nodes for multiplying WWW and xxx, computing the data loss, computing the regularization loss, and adding the two loss terms.

    Explanation

    The final node represents the total loss obtained by summing the data and regularization terms.

  9. 9

    What is the main advantage of expressing a function as a computational graph?

    Model answer

    It allows backpropagation to compute gradients for complex functions by combining simple local derivatives with the chain rule.

    Explanation

    This avoids deriving one large symbolic gradient for the entire function.

  10. 10

    Why are computational graphs especially useful for deep learning models?

    Model answer

    Deep models contain many transformations, so a graph provides a practical way to compute gradients through all intermediate variables.

    Explanation

    Without this modular structure, manually deriving gradients for models such as convolutional networks would be impractical.

  11. 11

    What are the forward and backward passes in a computational graph?

    Model answer

    The forward pass evaluates the function from inputs to output, while the backward pass computes gradients from the output back toward the inputs.

    Explanation

    The backward pass uses values and local derivatives recorded during the forward pass.

  12. 12

    For f(x,y,z)=(x+y)zf(x,y,z)=(x+y)zf(x,y,z)=(x+y)z, what intermediate variable can simplify the computational graph?

    Model answer

    Define q=x+yq=x+yq=x+y, so that f=qzf=qzf=qz.

    Explanation

    Naming intermediate values makes each operation and its local derivative explicit.

  13. 13

    For x=−2x=-2x=−2, y=5y=5y=5, and z=−4z=-4z=−4, what are the values of qqq and fff when q=x+yq=x+yq=x+y and f=qzf=qzf=qz?

    Model answer

    The values are q=3q=3q=3 and f=−12f=-12f=−12.

    Explanation

    The forward pass first computes −2+5=3-2+5=3−2+5=3 and then computes 3(−4)=−123(-4)=-123(−4)=−12.

  14. 14

    What is the derivative of q=x+yq=x+yq=x+y with respect to either xxx or yyy?

    Model answer

    Both derivatives are 111: rac{\partial q}{\partial x}=1 and rac{\partial q}{\partial y}=1.

    Explanation

    Changing either input to an addition node changes the output by the same amount.

  15. 15

    For f=qzf=qzf=qz, what are the local derivatives with respect to qqq and zzz?

    Model answer

    They are rac{\partial f}{\partial q}=z and rac{\partial f}{\partial z}=q.

    Explanation

    For multiplication, the derivative with respect to one input is the value of the other input.

  16. 16

    Why is the gradient of the output with respect to the output itself equal to 111?

    Model answer

    Because a quantity changes one-for-one with itself, so rac{\partial f}{\partial f}=1.

    Explanation

    This value initializes the backward pass at the final node.

  17. 17

    Using backpropagation, what is rac{\partial f}{\partial z} for f=qzf=qzf=qz when q=3q=3q=3?

    Model answer

    The gradient is rac{\partial f}{\partial z}=q=3.

    Explanation

    The local derivative at the multiplication node is qqq, and the upstream gradient is 111.

  18. 18

    Using backpropagation, what are rac{\partial f}{\partial x} and rac{\partial f}{\partial y} for f=(x+y)zf=(x+y)zf=(x+y)z when z=−4z=-4z=−4?

    Model answer

    Both gradients are −4-4−4.

    Explanation

    For either variable, the chain rule gives rac{\partial f}{\partial q} rac{\partial q}{\partial x}=-4(1)=-4, and the same applies to yyy.

  19. 19

    State the local-chain-rule operation performed at a node during backpropagation.

    Model answer

    The node multiplies the upstream gradient by its local gradient to produce gradients for its inputs.

    Explanation

    This modular operation allows each node to use only its immediate inputs, output, and local derivative.

  20. 20

    What information must a computational node know during backpropagation?

    Model answer

    It needs its local inputs, its direct output, its local gradients, and the upstream gradient arriving from later computations.

    Explanation

    The node uses this information to calculate and pass gradients to preceding nodes.

  21. 21

    Why does backpropagation avoid deriving the entire gradient symbolically?

    Model answer

    It breaks a complex function into simple operations, computes each local derivative, and combines them numerically using the chain rule.

    Explanation

    The method replaces one difficult global derivation with many simple local calculations.

  22. 22

    For a max gate with inputs z=2z=2z=2 and w=−1w=-1w=−1, how is an upstream gradient of 222 propagated?

    Model answer

    The gradient passed to zzz is 222, while the gradient passed to www is 000.

    Explanation

    Only the input that achieved the maximum affected the forward output, so it receives the gradient.

  23. 23

    Why is a max gate called a gradient router?

    Model answer

    It routes the upstream gradient to the input that was selected as the maximum and sends zero to the other input.

    Explanation

    The forward pass depends only on the selected maximum branch.

  24. 24

    Why is an addition gate called a gradient distributor?

    Model answer

    It sends the same upstream gradient to every input branch.

    Explanation

    Each input to an addition has local derivative 111, so every branch receives the upstream value unchanged.

  25. 25

    How does a multiplication gate propagate gradients?

    Model answer

    It multiplies the upstream gradient by the value of the other input.

    Explanation

    For z=xyz=xyz=xy, the local derivatives are rac{\partial z}{\partial x}=y and rac{\partial z}{\partial y}=x.

  26. 26

    Why can a multiplication gate be viewed as a gradient scaler or switcher?

    Model answer

    Each branch scales the upstream gradient according to the value on the other branch.

    Explanation

    A large value on one input produces a large local gradient for the other input.

  27. 27

    What happens to gradients when one node feeds into multiple later nodes?

    Model answer

    The gradients returning from all connected later nodes are added to form the total upstream gradient at that node.

    Explanation

    This follows from the multivariate chain rule because changing the shared node affects every downstream branch.

  28. 28

    What is the sigmoid function?

    Model answer

    The sigmoid function is \sigma(x)= rac{1}{1+e^{-x}}.

    Explanation

    It is a common nonlinear function that can be treated as a single computational node.

  29. 29

    What is the derivative of the sigmoid function?

    Model answer

    Its derivative is rac{d\sigma(x)}{dx}=\sigma(x)(1-\sigma(x)).

    Explanation

    Knowing this local derivative allows the entire sigmoid computation to be grouped into one gate.

  30. 30

    Why can several simple computational nodes be grouped into one more complex node?

    Model answer

    They can be grouped whenever the local gradient of the combined operation is known.

    Explanation

    Grouping simplifies the graph but trades simpler individual operations for a more complex local derivative.

  31. 31

    What is the purpose of caching values during the forward pass?

    Model answer

    Cached values are reused during the backward pass to calculate local gradients efficiently.

    Explanation

    For a multiplication gate, the backward pass needs the stored values of both inputs.

  32. 32

    When scalar variables become vectors, what form do their gradients take?

    Model answer

    The derivatives become Jacobian matrices containing derivatives of every output element with respect to every input element.

    Explanation

    The scalar chain rule generalizes to matrix-based derivatives for vector-valued operations.

  33. 33

    What is the output shape of the gradient of a scalar function with respect to a vector?

    Model answer

    It has the same shape as the input vector.

    Explanation

    Each gradient element measures how the corresponding input element affects the scalar output.

  34. 34

    For the element-wise function f(x)=�max(x,0)f(x)=�max(x,0)f(x)=�max(x,0) applied to a 409640964096-dimensional vector, what is the size of its full Jacobian?

    Model answer

    The Jacobian is a 4096imes40964096 imes 40964096imes4096 matrix.

    Explanation

    There is one derivative for every pair of output and input dimensions.

  35. 35

    Why is the Jacobian of an element-wise operation diagonal?

    Model answer

    Each output element depends only on the corresponding input element, so cross-element derivatives are zero.

    Explanation

    For an element-wise maximum, input dimension iii affects output dimension iii but not other dimensions.

  36. 36

    Why is it usually unnecessary to explicitly construct the full Jacobian for an element-wise operation?

    Model answer

    Its diagonal structure allows the needed gradient products to be computed directly without storing the large matrix.

    Explanation

    This avoids the impractical memory and computation cost of forming the full Jacobian.

  37. 37

    For q=Wxq=Wxq=Wx, what is rac{\partial q_k}{\partial W_{ij}}?

    Model answer

    It is xjx_jxj​ when k=ik=ik=i and 000 otherwise.

    Explanation

    The element WijW_{ij}Wij​ contributes only to output component qiq_iqi​, and its contribution is multiplied by xjx_jxj​.

  38. 38

    For q=Wxq=Wxq=Wx, what is rac{\partial q_k}{\partial x_i}?

    Model answer

    It is WkiW_{ki}Wki​.

    Explanation

    The iiith input contributes to the kkkth output through the corresponding weight in row kkk.

  39. 39

    Why should a gradient have the same shape as the variable with respect to which it is computed?

    Model answer

    Each gradient element corresponds to the effect of one element of that variable on the output.

    Explanation

    Shape matching is a useful sanity check when implementing gradient calculations.

  40. 40

    For f(q)=q12+q22f(q)=q_1^2+q_2^2f(q)=q12​+q22​, what is the gradient with respect to qqq?

    Model answer

    The gradient is ablaqf=2q abla_q f=2qablaq​f=2q.

    Explanation

    Differentiating each squared component gives rac{\partial f}{\partial q_i}=2q_i.

  41. 41

    For f(W,x)=ormWx22f(W,x)= orm{Wx}_2^2f(W,x)=ormWx22​, how can the gradient with respect to WijW_{ij}Wij​ be expressed?

    Model answer

    If q=Wxq=Wxq=Wx, then rac{\partial f}{\partial W_{ij}}=2q_i x_j.

    Explanation

    The chain rule combines rac{\partial f}{\partial q_i}=2q_i with rac{\partial q_i}{\partial W_{ij}}=x_j.

  42. 42

    How can the gradient of f(W,x)=ormWx22f(W,x)= orm{Wx}_2^2f(W,x)=ormWx22​ with respect to xxx be obtained?

    Model answer

    Use the chain rule through q=Wxq=Wxq=Wx, combining the gradient with respect to qqq and the Jacobian of qqq with respect to xxx.

    Explanation

    The resulting gradient has the same shape as xxx and can be written in vectorized matrix form.

  43. 43

    What two functions should each computational gate implement in a deep-learning framework?

    Model answer

    It should implement a forward function that computes its output and a backward function that computes gradients for its inputs.

    Explanation

    This forward/backward API makes complex networks modular and composable.

  44. 44

    In what order should gates be processed during the forward pass?

    Model answer

    They should be processed in topologically sorted order, so all inputs to a gate are computed before that gate.

    Explanation

    This order ensures that every operation has the values it needs.

  45. 45

    In what order should gates be processed during the backward pass?

    Model answer

    They should be processed in reverse topological order, starting from the final output and moving toward the inputs.

    Explanation

    This order ensures that upstream gradients are available when each gate performs its backward computation.

  46. 46

    For a multiplication gate z=xyz=xyz=xy, what does its backward function receive and return?

    Model answer

    It receives the upstream gradient rac{\partial L}{\partial z} and returns rac{\partial L}{\partial x}=y rac{\partial L}{\partial z} and rac{\partial L}{\partial y}=x rac{\partial L}{\partial z}.

    Explanation

    The backward function applies the chain rule using the cached inputs xxx and yyy.

  47. 47

    How are computational layers implemented in frameworks such as Caffe?

    Model answer

    Each layer defines a forward computation and a backward gradient computation, and networks stack these layers together.

    Explanation

    Examples of layers include sigmoid, convolution, and Argmax operations.

  48. 48

    What procedure should be followed when deriving gradients for a new complex function?

    Model answer

    Represent the function as a computational graph, define intermediate variables, compute local derivatives, and apply the chain rule backward.

    Explanation

    This procedure makes even complicated gradient calculations modular and manageable.

  49. 49

    What is a two-layer neural network in the simplest formulation?

    Model answer

    It applies one linear transformation, a nonlinear activation, and then a second linear transformation to the input.

    Explanation

    A typical form is a matrix multiplication by W1W_1W1​, a nonlinearity, and a matrix multiplication by W2W_2W2​.

  50. 50

    Why must nonlinearities be inserted between stacked linear layers?

    Model answer

    Without nonlinearities, multiple linear transformations collapse into a single linear transformation.

    Explanation

    Nonlinear activations allow the network to represent more complex nonlinear functions.

  51. 51

    What is the general idea behind a neural network as a function?

    Model answer

    It hierarchically stacks simpler functions, usually linear transformations and nonlinearities, to form a more complex nonlinear function.

    Explanation

    Each layer transforms the representation produced by the preceding layer.

  52. 52

    How does a multilayer network address the limitation of one template per class in a linear classifier?

    Model answer

    It can detect multiple intermediate templates and combine their scores to represent different modes of the same class.

    Explanation

    For example, separate templates for red and yellow cars can contribute to the final car score.

  53. 53

    What roles do W1W_1W1​, hhh, and W2W_2W2​ play in the template interpretation of a neural network?

    Model answer

    W1W_1W1​ contains intermediate templates, hhh contains the activation scores for those templates, and W2W_2W2​ weights those scores to produce final class scores.

    Explanation

    The second layer combines multiple template responses rather than selecting only one template.

  54. 54

    How can a network with three linear layers and nonlinearities be described?

    Model answer

    It is a three-layer neural network or a two-hidden-layer neural network.

    Explanation

    The first terminology counts linear layers, while the second counts hidden layers.

  55. 55

    Why are matrix multiplications useful for computing a neural-network layer?

    Model answer

    A single matrix multiplication efficiently computes the outputs of many neurons at once using vectorized operations.

    Explanation

    A layer can represent a whole vector of neurons rather than evaluating each neuron separately.

  56. 56

    How are neural-network parameter updates related to backpropagation?

    Model answer

    Backpropagation computes gradients with respect to the parameters, and an optimization method such as gradient descent uses those gradients to update the parameters.

    Explanation

    Backpropagation calculates the information needed for optimization but does not itself perform the update.

  57. 57

    What is the basic biological analogy for the inputs and outputs of an artificial neuron?

    Model answer

    Inputs resemble signals received through dendrites, while the output resembles a signal transmitted through an axon to downstream neurons.

    Explanation

    The analogy compares information flow in a computational node with signal flow through a biological neuron.

  58. 58

    What is the biological analogy for the weighted sum and activation function in an artificial neuron?

    Model answer

    The weighted sum resembles integration of incoming signals in the cell body, and the activation resembles the neuron's firing or spiking response.

    Explanation

    The artificial neuron combines inputs using weights and then produces an output through a nonlinear function.

  59. 59

    What is the ReLU activation function?

    Model answer

    ReLU outputs zero for negative inputs and a linear output for positive inputs.

    Explanation

    It is often written as ReLU(x)=�max(0,x)ReLU(x)=�max(0,x)ReLU(x)=�max(0,x) and was described as roughly resembling neural firing at a high level.

  60. 60

    Why should biological analogies for artificial neural networks be treated cautiously?

    Model answer

    Biological neurons are much more complex: dendrites can perform nonlinear computations, synapses are dynamic systems, and firing-rate models are incomplete.

    Explanation

    Artificial neurons capture only a loose, high-level resemblance to biological neurons.

  61. 61

    Why is interpreting an activation value as a biological firing rate an incomplete model?

    Model answer

    Real neurons communicate through variable and discrete spikes, so a single firing-rate value does not capture all aspects of neural communication.

    Explanation

    The timing and variability of spikes may also carry important information.

  62. 62

    What is a fully connected neural network?

    Model answer

    It is a network in which layers use matrix multiplications to connect their units, with nonlinear activations between the linear layers.

    Explanation

    Each fully connected layer computes many neuron outputs efficiently through a matrix operation.

  63. 63

    What does the term hidden layer mean in a neural network?

    Model answer

    A hidden layer is an intermediate layer between the input and the final output.

    Explanation

    For example, a network with two linear layers has one hidden layer when the intermediate activation lies between them.

  64. 64

    How are the terms two-layer network and one-hidden-layer network related?

    Model answer

    They describe the same architecture when the network has two linear or fully connected layers and one intermediate hidden layer.

    Explanation

    The terms differ only in whether the count includes linear layers or hidden layers.

  65. 65

    What makes a neural network a deep neural network?

    Model answer

    It has many stacked layers of hierarchical computation, with nonlinearities separating the linear transformations.

    Explanation

    The word deep refers to the number of computational layers in the network.

1 of 65
Question 1 of 65

Ask anything

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

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent