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

Study methods

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

Neural Networks and Backpropagation

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

What is back propagation, and why is it important for neural networks?

89 questions

  1. 1

    What is back propagation, and why is it important for neural networks?

    Model answer

    Back propagation is a process for computing how the loss changes with respect to the network's parameters so the parameters can be optimized. It allows neural networks to learn from their errors.

    Explanation

    Back propagation supplies the gradients needed to update weights and is used in many neural-network algorithms.

  2. 2

    What is the purpose of a loss function in machine learning?

    Model answer

    A loss function measures how poorly a model's predictions match the desired outputs. Training attempts to minimize this loss.

    Explanation

    The loss provides the objective that optimization methods use to improve the model's parameters.

  3. 3

    What is the role of regularization in the total loss?

    Model answer

    Regularization adds a penalty based on the model's weights to the data loss. The total loss is the data loss plus the regularization term.

    Explanation

    The regularizer constrains the weights and helps reduce overfitting.

  4. 4

    Why is softmax not the only possible loss function?

    Model answer

    Softmax is widely used for classification, but other loss functions can be better suited to different tasks or classification settings.

    Explanation

    The choice of loss depends on the problem; hinge loss is another classification loss discussed in the material.

  5. 5

    How does hinge loss differ from softmax loss?

    Model answer

    Hinge loss does not convert scores into probabilities. Instead, it encourages the correct score to exceed every incorrect score by at least a specified margin.

    Explanation

    Softmax interprets scores probabilistically, whereas hinge loss directly imposes a margin between correct and incorrect scores.

  6. 6

    When does hinge loss assign zero loss to an example?

    Model answer

    It assigns zero loss when the correct class score is higher than every incorrect class score by at least the required margin.

    Explanation

    If the margin condition is satisfied, no penalty is needed for that example.

  7. 7

    What happens when the margin condition in hinge loss is violated?

    Model answer

    The loss increases in proportion to how far the scores are from satisfying the required margin.

    Explanation

    Hinge loss penalizes cases in which incorrect items receive scores that are too high.

  8. 8

    What does the loss landscape represent?

    Model answer

    The loss landscape represents the loss values associated with different choices of model parameters. Each point corresponds to a different set of weights.

    Explanation

    Optimization searches this landscape for parameters that produce a low loss.

  9. 9

    How does gradient descent use the gradient of the loss?

    Model answer

    Gradient descent updates the weights by taking a step in the negative direction of the loss gradient.

    Explanation

    The negative gradient points toward decreasing loss, while the step size determines how far the update moves.

  10. 10

    What is the learning rate in gradient-based optimization?

    Model answer

    The learning rate is the step size used when changing the model's parameters in response to the gradient.

    Explanation

    A learning rate that is too large can cause unstable updates, while one that is too small can make training slow.

  11. 11

    Why are mini-batches used instead of the entire data set during every optimization step?

    Model answer

    Computing the loss and gradients over a large data set can be expensive, so mini-batches use a sampled subset to estimate the gradients more efficiently.

    Explanation

    Common mini-batch sizes include 32, 64, 128, and 256 examples.

  12. 12

    How are numerical and analytical gradients used in practice?

    Model answer

    Analytical gradients are generally used to train the model, while numerical gradients are often used to check whether the analytical-gradient implementation is correct.

    Explanation

    Analytical gradients are efficient once derived, whereas numerical gradients are useful for verification but can be computationally expensive.

  13. 13

    What is the purpose of learning-rate scheduling?

    Model answer

    Learning-rate scheduling changes the learning rate during training, often beginning with a larger value and reducing it over time.

    Explanation

    Reducing the learning rate can help optimization converge more effectively.

  14. 14

    How do some modern optimizers handle learning-rate decay?

    Model answer

    Some modern optimizers, such as Adam and its variants, often incorporate adaptive behavior so the learning rate does not need to be manually reduced as explicitly.

    Explanation

    The material contrasts this with optimizers that commonly require a manually scheduled learning rate.

  15. 15

    What is the most basic neural network described in the material?

    Model answer

    The most basic network is a single linear layer that maps the input using weights, commonly represented as a weight matrix multiplied by the input.

    Explanation

    This model produces outputs directly from a linear transformation of the input features.

  16. 16

    What do the dimensions of the input and output represent in a linear neural network?

    Model answer

    The input dimension represents the number of features in the input, and the output dimension represents the number of classes or output neurons.

    Explanation

    Matching dimensions are required for the matrix operations between layers.

  17. 17

    How is a second layer added to a neural network?

    Model answer

    A second weight matrix is applied to the representation produced by the first layer, creating a hidden-layer representation before producing the final output.

    Explanation

    The second layer transforms the intermediate values rather than operating directly on the original input.

  18. 18

    What does the hidden-layer size represent?

    Model answer

    The hidden-layer size is the number of neurons or nodes in that hidden layer.

    Explanation

    Increasing this number gives the network more units with which to represent patterns.

  19. 19

    Why must the dimensions of consecutive neural-network layers match?

    Model answer

    The output dimension of one layer must match the input dimension expected by the next layer so that their matrix multiplication is defined.

    Explanation

    Dimension compatibility allows representations to be passed from one layer to the next.

  20. 20

    What is the role of a bias term in a neural-network layer?

    Model answer

    A bias is added to the weighted input to provide a more complete and flexible layer transformation.

    Explanation

    Although it may be omitted in simplified notation, practical neural-network layers generally include biases.

  21. 21

    What are fully connected networks and multilayer perceptrons?

    Model answer

    They are networks composed of layers connected through weights, with transformations based primarily on matrix multiplication, inputs, and activation functions.

    Explanation

    The material uses the terms fully connected network and multilayer perceptron, or MLP, for this type of architecture.

  22. 22

    How can a neural network be made larger?

    Model answer

    A neural network can be enlarged by stacking additional layers or increasing the number of neurons in its hidden layers.

    Explanation

    These changes increase the network's representational capacity.

  23. 23

    What is the relationship between neural-network weights and learned templates?

    Model answer

    The weights can learn templates or representative patterns from the training data that help the network recognize inputs.

    Explanation

    In image tasks, these templates may represent useful visual structures rather than exact complete objects.

  24. 24

    Why can hidden-layer neurons learn templates for parts of objects?

    Model answer

    A hidden layer can combine features to represent patterns shared across different classes, such as parts of objects that appear in many categories.

    Explanation

    For example, different animal classes may share features such as eyes, which can be represented by hidden neurons.

  25. 25

    Why is a nonlinear transformation needed in a multilayer network?

    Model answer

    Without a nonlinear transformation, multiple linear layers collapse into a single linear transformation and cannot solve many nonlinear classification problems.

    Explanation

    Nonlinearity allows the network to transform the input into a representation in which previously inseparable samples may become separable.

  26. 26

    What happens mathematically if the activation function is removed between two linear layers?

    Model answer

    The product of the two weight matrices can be replaced by one matrix, so the entire network remains equivalent to a single linear function.

    Explanation

    This prevents the extra layer from adding nonlinear modeling power.

  27. 27

    What is an activation function?

    Model answer

    An activation function applies a nonlinear transformation to the output of a neural-network layer.

    Explanation

    Activation functions are essential for giving multilayer networks the ability to model nonlinear relationships.

  28. 28

    What is ReLU, and how does it transform its input?

    Model answer

    ReLU, or the rectified linear unit, outputs the input when it is positive and outputs zero when it is not positive.

    Explanation

    It is a widely used activation function that introduces nonlinearity through this thresholding behavior.

  29. 29

    What problem can ReLU create in a neural network?

    Model answer

    ReLU can create dead neurons because inputs that are not positive are mapped to zero, potentially preventing those neurons from contributing useful outputs.

    Explanation

    A neuron that remains in the zero-output region may receive ineffective gradient updates.

  30. 30

    How does leaky ReLU address a limitation of ReLU?

    Model answer

    Leaky ReLU allows a small nonzero response for negative inputs instead of setting all negative inputs exactly to zero.

    Explanation

    This can reduce the likelihood of neurons becoming permanently inactive.

  31. 31

    What is ELU, and what advantage was attributed to it?

    Model answer

    ELU, or the exponential linear unit, is an alternative activation function described as having a better zero-centered behavior than ReLU.

    Explanation

    Zero-centered activations can support more effective optimization in some settings.

  32. 32

    What are GELU and SiLU or Swish used for?

    Model answer

    GELU and SiLU, also called Swish, are newer activation-function variants used in modern architectures, including transformers and some convolutional networks.

    Explanation

    The material identifies them as alternatives used in contemporary neural-network designs.

  33. 33

    What are sigmoid and tanh activation functions commonly used for?

    Model answer

    Sigmoid and tanh are activation functions that may be used in neural networks, particularly in later layers for tasks such as producing or binarizing outputs.

    Explanation

    They are less commonly used in the middle of modern networks because of gradient-related limitations.

  34. 34

    Why can sigmoid and tanh cause vanishing gradients?

    Model answer

    They squash values into a narrow range, which can make gradients very small and cause them to vanish during back propagation.

    Explanation

    Very small gradients make it difficult for earlier layers to learn effectively.

  35. 35

    What is a common default choice for an activation function?

    Model answer

    ReLU is often used as a good default activation function.

    Explanation

    It is popular across many neural-network architectures, although alternatives may be better for particular problems.

  36. 36

    How are activation functions typically selected for a new problem?

    Model answer

    The choice is mostly empirical: practitioners often begin with ReLU or an activation commonly used in the relevant architecture and then evaluate alternatives.

    Explanation

    There is no single activation function that is optimal for every data set and task.

  37. 37

    What characteristics besides nonlinearity influence the design of activation functions?

    Model answer

    Important considerations include differentiability, resistance to vanishing gradients, zero-centered behavior, and smoothness.

    Explanation

    These properties can affect optimization speed and the ability of the network to converge.

  38. 38

    Are the same activation functions always used in every layer?

    Model answer

    The same activation is often used throughout the hidden layers, but later or output layers may use different functions such as sigmoid or tanh.

    Explanation

    The output requirements can determine which activation is appropriate in the final layer.

  39. 39

    What are the main stages of a simple neural-network implementation?

    Model answer

    The main stages are initializing the data and weights, performing a forward pass, calculating the loss, computing analytical gradients, and updating the weights with an optimizer.

    Explanation

    Together, these stages implement training for a small fully connected network.

  40. 40

    What happens during the forward pass?

    Model answer

    The forward pass applies the weights, biases, and activation functions layer by layer to the input and produces the model's predictions.

    Explanation

    The predictions are then used to calculate the loss.

  41. 41

    What is the purpose of random weight initialization?

    Model answer

    Random initialization provides starting values for the network's weights before training begins.

    Explanation

    The optimizer subsequently adjusts these weights using gradient information.

  42. 42

    What occurs after the loss is calculated during training?

    Model answer

    The analytical gradients of the loss with respect to the weights are computed, and an optimization method uses them to update the weights.

    Explanation

    The update moves the parameters toward values that reduce the loss.

  43. 43

    How does hidden-layer size affect a network's decision boundaries?

    Model answer

    More hidden neurons generally give the network greater capacity to learn complex functions and produce more flexible separation between classes.

    Explanation

    Additional capacity can improve separation, but it can also increase the risk of overfitting.

  44. 44

    What is the danger of giving a neural network too much capacity?

    Model answer

    A network with excessive capacity may memorize the training data, overfit, and fail to generalize to unseen data.

    Explanation

    High-capacity models can learn detailed patterns that do not apply beyond the training examples.

  45. 45

    Why is network size generally not used as the primary regularization hyperparameter?

    Model answer

    Practitioners often choose a somewhat larger network and control overfitting through regularization rather than relying mainly on network size as the regularizer.

    Explanation

    Network size may still be varied experimentally, but regularization directly constrains the learned weights.

  46. 46

    How does increasing the regularization coefficient affect the model?

    Model answer

    Increasing the coefficient gives the regularization term more influence, constrains the weights more strongly, and can make the learned decision boundaries more generic.

    Explanation

    If regularization is too strong, the model may underfit and fail to predict the outputs accurately.

  47. 47

    Why can excessive regularization cause underfitting?

    Model answer

    Excessive regularization restricts the weights too much, leaving the model insufficient freedom to represent the patterns needed for accurate predictions.

    Explanation

    Regularization must balance fitting the data with preventing overly complex solutions.

  48. 48

    How are network size and regularization commonly adjusted during model development?

    Model answer

    Practitioners may start with a smaller network, increase its capacity until overfitting appears, and then use regularization to reduce the overfitting.

    Explanation

    This approach helps identify a model with enough capacity while controlling its generalization behavior.

  49. 49

    How is the required number of neurons usually determined?

    Model answer

    It is usually determined empirically by examining similar models and running experiments that balance network complexity and performance.

    Explanation

    There is no universal prescription for the number of neurons required by every problem.

  50. 50

    Why may theoretical recommendations for architecture and activation choices not transfer directly to a new problem?

    Model answer

    Such recommendations often rely on assumptions about the data set or task that may not hold for the new application.

    Explanation

    Architecture and hyperparameter choices remain dependent on the specific problem and data.

  51. 51

    What biological structures are loosely compared with components of artificial neural networks?

    Model answer

    A biological neuron receives impulses through dendrites, aggregates them in the cell body, and sends signals through its axon to other neurons.

    Explanation

    This provides a loose analogy for information flowing through layers of an artificial neural network.

  52. 52

    How does an artificial neuron loosely correspond to a biological neuron?

    Model answer

    An artificial neuron combines signals from previous layers, applies an activation function, and passes the resulting activation onward, loosely resembling signal aggregation and transmission in a biological neuron.

    Explanation

    The analogy is conceptual rather than an exact description of biological neural processing.

  53. 53

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

    Model answer

    Biological neurons are much more complex than the simplified computational units used in typical neural networks.

    Explanation

    The biological inspiration is loose and should not be interpreted as a complete or scientifically exact model of the brain.

  54. 54

    Why are artificial neural networks often organized into regular patterns?

    Model answer

    Regular organization improves computational efficiency when the networks are implemented.

    Explanation

    Although more biologically complex network structures have been studied, regular architectures often achieve comparable results in practice.

  55. 55

    What is a computational graph?

    Model answer

    A computational graph represents a neural network as a sequence of interconnected operations from the inputs and parameters to the final loss.

    Explanation

    It makes complex computations explicit and provides a structure for computing gradients.

  56. 56

    Why are computational graphs useful for neural networks?

    Model answer

    They break complex functions into modular operations so that forward values and backward gradients can be computed step by step.

    Explanation

    This avoids manually deriving one enormous expression for the entire network.

  57. 57

    How can a computational graph represent the total loss?

    Model answer

    The graph can compute scores from inputs and weights, pass those scores to a loss function, compute a regularization term, and add the two terms to obtain the total loss.

    Explanation

    This structure works for losses such as softmax loss, hinge loss, and other alternatives.

  58. 58

    Why is back propagation especially useful for complex or unrolled networks?

    Model answer

    Back propagation computes gradients modularly even when a network has many layers or repeated operations, making manual differentiation impractical.

    Explanation

    This is particularly important for complex architectures that process temporal or sequential data.

  59. 59

    For the function f(x,y,z)=(x+y)zf(x,y,z)=(x+y)zf(x,y,z)=(x+y)z, what intermediate quantity can be introduced in the computational graph?

    Model answer

    Let q=x+yq=x+yq=x+y; then the function can be written as f=qzf=qzf=qz.

    Explanation

    Introducing intermediate variables decomposes the computation into an addition operation followed by a multiplication operation.

  60. 60

    For q=x+yq=x+yq=x+y, what are the partial derivatives of qqq with respect to xxx and yyy?

    Model answer

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

    Explanation

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

  61. 61

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

    Model answer

    The derivatives 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 other input.

  62. 62

    For x=−2x=-2x=−2, y=5y=5y=5, and z=−4z=-4z=−4, what are qqq and fff in the function f=(x+y)zf=(x+y)zf=(x+y)z?

    Model answer

    The intermediate value is q=x+y=3q=x+y=3q=x+y=3, and the final value is f=qz=−12f=qz=-12f=qz=−12.

    Explanation

    The forward pass first evaluates the addition and then multiplies its result by zzz.

  63. 63

    What is the first derivative used when beginning back propagation?

    Model answer

    The derivative of a quantity with respect to itself is 111, so the gradient of the final output with respect to itself is initialized to 111.

    Explanation

    This starting value is propagated backward through the computational graph.

  64. 64

    What is the chain rule's role in back propagation?

    Model answer

    The chain rule expresses a derivative through intermediate variables by multiplying local derivatives along the computational path.

    Explanation

    It allows gradients to move backward even when two variables are not directly connected.

  65. 65

    What is an upstream gradient?

    Model answer

    An upstream gradient is the gradient arriving at a node from operations later in the network, toward the final output.

    Explanation

    It represents how the node's output affects the final loss through subsequent operations.

  66. 66

    What is a local gradient?

    Model answer

    A local gradient is the derivative of a node's output with respect to one of its immediate inputs.

    Explanation

    It describes the node's own local sensitivity to each input.

  67. 67

    How is a downstream gradient computed during back propagation?

    Model answer

    The downstream gradient is computed by multiplying the upstream gradient by the local gradient.

    Explanation

    The resulting gradient becomes the upstream gradient passed to preceding nodes.

  68. 68

    Using f=(x+y)zf=(x+y)zf=(x+y)z with x=−2x=-2x=−2, y=5y=5y=5, and z=−4z=-4z=−4, what are rac{\partial f}{\partial x} and rac{\partial f}{\partial y}?

    Model answer

    Both derivatives are −4-4−4 because rac{\partial f}{\partial q}=z=-4 and each of rac{\partial q}{\partial x} and rac{\partial q}{\partial y} equals 111.

    Explanation

    Applying the chain rule gives rac{\partial f}{\partial x}=z rac{\partial q}{\partial x} and rac{\partial f}{\partial y}=z rac{\partial q}{\partial y}.

  69. 69

    What is the gradient behavior of an addition gate?

    Model answer

    An addition gate distributes the incoming gradient unchanged to each of its inputs.

    Explanation

    Because the derivative of a sum with respect to each input is 111, all inputs receive the same upstream gradient.

  70. 70

    What is the gradient behavior of a multiplication gate?

    Model answer

    A multiplication gate sends each input's gradient as the upstream gradient multiplied by the other input.

    Explanation

    This is sometimes described as a swap because the local derivative with respect to one input is the value of the other input.

  71. 71

    What is the gradient behavior of a copy gate?

    Model answer

    A copy gate passes its input onward, and when multiple copied paths contribute to a later node, their gradients are combined by addition.

    Explanation

    The addition of contributions reflects the total effect of the copied value on the output.

  72. 72

    How does a max gate route gradients?

    Model answer

    A max gate routes the gradient to the input that produced the maximum value and gives no gradient to the other input in the basic case.

    Explanation

    This behavior is similar to the gradient routing used by ReLU.

  73. 73

    Why are forward and backward interfaces useful when implementing neural-network operations?

    Model answer

    They allow each operation to compute its output in the forward pass and its local gradient in the backward pass, making the network modular.

    Explanation

    This design is used by deep-learning systems such as PyTorch to compose complex models from reusable operators.

  74. 74

    What value is often stored during the forward pass for use during the backward pass?

    Model answer

    The operation often stores or memorizes its inputs and intermediate values so they can be used to calculate gradients later.

    Explanation

    For example, a multiplication operation needs its input values to compute the local derivatives.

  75. 75

    What is the derivative of the sigmoid function in terms of the sigmoid output?

    Model answer

    If the sigmoid output is sigma(x), its derivative can be written as sigma(x)(1-sigma(x)).

    Explanation

    Expressing the derivative using the sigmoid output makes the backward computation convenient and reusable.

  76. 76

    Why is sigmoid convenient in a computational graph?

    Model answer

    Its local gradient can be computed directly from the sigmoid output, so the backward pass can reuse a value already produced during the forward pass.

    Explanation

    This avoids needing to reconstruct the entire original expression when calculating the gradient.

  77. 77

    What is a scalar-to-scalar derivative?

    Model answer

    It is the derivative between two scalar quantities, and the derivative is itself a scalar.

    Explanation

    It indicates how a small change in one scalar affects the other scalar.

  78. 78

    What is the shape of the derivative when a vector input produces a scalar output?

    Model answer

    The derivative is a vector with the same number of elements as the input vector.

    Explanation

    Each element indicates how changing the corresponding input component affects the scalar output.

  79. 79

    What is a Jacobian matrix?

    Model answer

    A Jacobian is a matrix of partial derivatives describing how each component of a vector output changes with respect to each component of a vector input.

    Explanation

    It arises in vector-to-vector differentiation.

  80. 80

    What does each entry of a Jacobian represent?

    Model answer

    Each entry represents the sensitivity of one output component to a particular input component.

    Explanation

    The arrangement of the entries records all pairwise partial derivatives between the input and output components.

  81. 81

    Why does the gradient of a scalar loss with respect to a variable have the same shape as that variable?

    Model answer

    Each element of the variable has its own partial derivative with respect to the scalar loss, so the collection of derivatives matches the variable's dimensions.

    Explanation

    This applies to scalar, vector, matrix, and tensor variables.

  82. 82

    For the elementwise ReLU function y_i=max(0,x_i), what does its Jacobian look like?

    Model answer

    Its Jacobian is sparse and has nonzero entries only on the main diagonal, with each diagonal entry equal to either 000 or 111.

    Explanation

    Because each output depends only on the corresponding input, there are no off-diagonal dependencies.

  83. 83

    When is a diagonal ReLU Jacobian entry equal to 111 or 000?

    Model answer

    It is 111 when the corresponding input passes through ReLU and 000 when ReLU replaces that input with zero.

    Explanation

    The derivative depends on which branch of the maximum operation is active.

  84. 84

    Why is the full ReLU Jacobian usually not explicitly stored?

    Model answer

    The Jacobian may be large, but its sparse, elementwise structure allows the backward pass to use a simple rule-based gradient calculation instead.

    Explanation

    This saves memory and computation while producing the same downstream gradients.

  85. 85

    How do matrix and tensor inputs affect back propagation?

    Model answer

    The gradients with respect to matrix or tensor variables have the same shapes as those variables, and the same upstream-local-downstream gradient principle applies.

    Explanation

    Higher-dimensional data extends the vector case without changing the fundamental back-propagation procedure.

  86. 86

    Why can explicitly forming the Jacobian of a matrix multiplication be impractical?

    Model answer

    Matrix multiplication can produce a very large Jacobian, requiring excessive memory even for a single operation.

    Explanation

    The material gives an example in which the Jacobian would require more than 256256256 GB for one matrix multiplication.

  87. 87

    How can matrix-multiplication gradients be computed without constructing the full Jacobian?

    Model answer

    They can be derived by tracking how each input element affects the output and then expressed efficiently using matrix operations.

    Explanation

    For the input gradient, the relevant weight matrix is used, while for the weight gradient, the relevant input matrix is used.

  88. 88

    What does the matrix-multiplication gradient reveal about the effect of an input element on an output element?

    Model answer

    The effect of an input element on an output element is determined by the corresponding weight connecting that input row to that output column.

    Explanation

    This relationship permits efficient gradient calculations without explicitly storing every input-output derivative.

  89. 89

    How does back propagation support optimization of multiple weight matrices?

    Model answer

    It propagates the loss gradient backward through every operation until the gradients with respect to each weight matrix are obtained.

    Explanation

    Those gradients are then used by gradient descent or another optimizer to update the network parameters.

1 of 89
Question 1 of 89

Ask anything

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

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent