Neural Networks and Backpropagation
- 85Unfamiliar
- 0Learning
- 0Familiar
- 0Mastered
- spaceFlip card
- KI knew it
- DI didn't know it
- ←Previous card
- →Next card
What is backpropagation in a neural network?
A recursive process that computes the gradient of the loss with respect to network variables by propagating gradients backward from the output.
Or swipe the card
85 cards
What is backpropagation in a neural network?
A recursive process that computes the gradient of the loss with respect to network variables by propagating gradients backward from the output.
What is a loss function?
A function that measures how incorrect a model's predictions are.
Is softmax the only loss function used in deep learning?
No. Softmax is widely used for classification, but other losses, such as hinge loss, are also used.
How does hinge loss differ from softmax-based loss?
Hinge loss does not convert scores into probabilities.
What condition does hinge loss encourage for a correct class score syi?
It encourages syi to be greater than every incorrect-class score sj by at least a margin.
When is the hinge loss zero?
When the correct-class score exceeds all incorrect-class scores by at least the required margin.
How does hinge loss penalize a violated margin?
The loss increases proportionally to how far the scores are from satisfying the margin.
What is a loss landscape?
A representation in which each point corresponds to a different set of weight parameters and has an associated loss value.
What is the basic gradient descent update direction?
Weights are moved in the negative direction of the gradient of the loss with respect to the weights.
What role does the step size or learning rate play in gradient descent?
It determines how far the weights move during each update.
How are analytical and numerical gradients used in practice?
Analytical gradients are typically used for optimization, while numerical gradients are often used to check the implementation.
Why are mini-batches used when computing gradients?
Computing the loss and gradient over an entire large dataset can be expensive, so a sampled subset is used instead.
What are examples of optimizers that improve on basic stochastic gradient descent?
SGD with momentum, RMSProp, and Adam.
How is the learning rate commonly scheduled?
Training may begin with a larger learning rate and reduce it over time by a decay factor.
What is the simplest neural network described in the content?
A single linear layer that maps input features to outputs using weights, represented conceptually as a linear transformation of x by W.
What do D and C represent in the basic network?
D is the input dimensionality or number of features, and C is the number of output classes or output neurons.
What is the role of a second weight matrix W2 in a two-layer network?
It transforms the activations produced by the first layer into the network's output.
What does H represent in a two-layer neural network?
The number of neurons in the hidden layer.
Why must adjacent layer dimensions match?
The output dimensionality of one layer must equal the input dimensionality expected by the next layer.
What is the purpose of a bias term in a neural network layer?
A bias completes the layer's affine transformation and provides an adjustable offset in addition to the weight-input product.
What are fully connected networks or multilayer perceptrons?
Networks composed of layers in which units are connected through weight-based transformations, without operations other than the layer transformations and activations described.
Why are multiple layers useful in a neural network?
They allow the network to build progressively more complex representations and functions.
How can hidden neurons be interpreted at a high level?
They can learn templates or representative patterns from the training data.
Why can hidden-layer templates be useful across different classes?
Different classes may share parts or features, such as eyes appearing in birds, cats, deer, dogs, frogs, and horses.
What problem can a nonlinear transformation solve that one linear classifier cannot?
It can transform data into a new representation in which classes that were not linearly separable become linearly separable.
What example of a nonlinear transformation is described?
Mapping Cartesian coordinates to polar coordinates, such as x and y to radius r and angle θ.
What would happen if the activation function were removed from a two-layer network?
The composition would become linear because W2W1 could be replaced by a single matrix W3.
What is an activation function?
A function applied within a neural network layer that introduces a nonlinear transformation.
What is ReLU?
The rectified linear unit, an activation function that outputs the input when it is positive and outputs zero otherwise: ReLU(x)=max(0,x).
What problem can ReLU cause?
It can create dead neurons because inputs that are not positive are mapped to zero.
How does leaky ReLU address dead neurons?
It allows a nonzero response for negative inputs instead of mapping all of them exactly to zero.
What is ELU, and what advantage is mentioned for it?
ELU is the exponential linear unit; it is described as having a better zero-centered function than some alternatives.
What are GELU and SiLU?
GELU is the Gaussian error linear unit, and SiLU is the sigmoid linear unit, also called Swish.
Where are GELU activations often used?
They are often used in transformer architectures.
What are sigmoid and tanh used for in neural networks?
They can be used as activation functions, especially in later layers or output settings.
Why are sigmoid and tanh often avoided in hidden layers?
They squash values into a narrow range, which can contribute to vanishing gradients.
What factors influence the choice of activation function?
Nonlinearity, differentiability, resistance to vanishing gradients, zero-centered behavior, smoothness, and the architecture being used.
What is the usual default choice of activation function?
ReLU is often a good default choice.
What are the main steps in a neural network forward pass?
Apply the weight transformations and biases layer by layer, apply activation functions, produce predictions, and calculate the loss.
What are the main steps in the backward pass?
Compute analytical gradients of the loss and use them with gradient descent to update the weights.
How does increasing the number of hidden neurons affect model capacity?
It generally gives the network more capacity to learn complex functions and create more detailed class separations.
What risk results from giving a network too much capacity?
Overfitting: the network may memorize training data and fail to generalize to unseen data.
How does regularization affect the total loss?
It adds a penalty based on the weights to the data loss, producing a total loss consisting of data loss plus regularizer.
What does the regularization strength λ control?
It controls how much influence the regularizer has on the total loss.
Why can an excessively large regularization strength cause underfitting?
It restricts the weights too strongly, limiting the model's freedom to represent detailed decision boundaries.
What is the recommended strategy for choosing network size and regularization?
Start with a somewhat larger network, then use regularization to control overfitting rather than treating network size itself as the primary regularizer.
How is the number of neurons needed for a problem usually determined?
Empirically, by examining similar networks and running experiments that balance model complexity and performance.
What is the biological analogy for a neural network activation?
A neuron aggregates signals from inputs, applies a function, and passes an activation to other neurons.
What do dendrites and axons do in the biological analogy?
Dendrites carry impulses toward the cell body, while axons carry impulses away to other neurons.
Why should biological analogies for artificial neural networks be treated cautiously?
Biological neurons are much more complex, and the similarities between biological and artificial neurons are loose rather than exact.
Why are artificial neural networks often organized into regular patterns?
Regular organization improves computational efficiency during implementation.
What does a neural network scoring function do?
It transforms inputs using weight vectors or matrices into scores for the possible outputs.
What is a computational graph?
A step-by-step representation of the operations that transform inputs and parameters into a final loss.
Why are computational graphs useful for neural networks?
They modularize complex functions and make it possible to compute gradients without manually deriving one giant expression for the entire network.
What components commonly appear in a neural-network computational graph?
Inputs, weights, intermediate operations such as multiplication and addition, an output score, a loss function, and a regularizer.
Why is manual differentiation impractical for complex neural networks?
It requires extensive matrix calculations and must be redone whenever the loss or network structure changes.
What is the function in the basic scalar backpropagation example?
f(x,y,z)=(x+y)z.
For x=−2, y=5, and z=−4, what is q=x+y?
q=3.
For q=x+y, what are the local derivatives with respect to x and y?
∂x∂q=1 and ∂y∂q=1.
For f=qz, what are the local derivatives?
∂q∂f=z and ∂z∂f=q.
What is the starting gradient in backpropagation?
The derivative of the final quantity with respect to itself is 1, so ∂f∂f=1.
What is the upstream gradient?
The gradient arriving at the current node from operations closer to the final output.
What is the local gradient?
The derivative of a node's output with respect to each of its inputs.
How is a downstream gradient computed at a node?
By multiplying the upstream gradient by the node's local gradient.
Using the chain rule, how is ∂y∂f computed for f=qz and q=x+y?
∂y∂f=∂q∂f∂y∂q=z.
For x=−2, y=5, and z=−4, what are ∂x∂f and ∂y∂f?
Both are −4.
What is the key purpose of backpropagation for neural-network training?
To obtain the loss gradient with respect to every weight so the weights can be updated toward lower loss.
What is the local derivative of the sigmoid function σ(x)?
dxdσ(x)=σ(x)(1−σ(x)).
What is the gradient rule for an addition gate?
It distributes the upstream gradient unchanged to each input.
What is the gradient rule for a multiplication gate?
It sends each input the upstream gradient multiplied by the other input.
What is the gradient rule for a max gate?
It routes the upstream gradient to the input that achieved the maximum and gives zero to the other inputs.
How is a ReLU related to a max gate?
ReLU is the elementwise maximum of zero and its input: ReLU(x)=max(0,x).
Why do neural-network operators commonly provide forward and backward implementations?
The forward implementation computes outputs, while the backward implementation computes gradients needed for optimization.
Why might an operator save or memorize its inputs during the forward pass?
The backward pass may need those inputs to calculate local gradients.
How are scalar-to-scalar derivatives characterized?
If both input and output are scalars, the derivative is also a scalar.
What is the derivative structure for a vector-to-scalar function?
The derivative is a vector with the same number of elements as the input vector.
What is the Jacobian for a vector-to-vector function?
A matrix whose entries describe how each output element changes with respect to each input element.
What is the dimensionality of the gradient of a scalar loss with respect to a vector variable?
It has the same dimensionality as the vector variable.
Why can a ReLU Jacobian be sparse?
ReLU is elementwise, so each output depends only on its corresponding input element.
How is the backward pass for vectorized ReLU usually implemented?
By applying the rule elementwise rather than explicitly constructing and multiplying by the full sparse Jacobian.
Can backpropagation be extended beyond vectors?
Yes. The same ideas extend to matrices and tensors.
Why is explicitly constructing the Jacobian for matrix operations often impractical?
The Jacobian can become extremely large, even for one matrix multiplication.
How can matrix-operation gradients be computed without storing a huge Jacobian?
Analyze which output elements depend on each input element and implement equivalent matrix operations directly.
For a matrix multiplication node, what is the general idea behind the gradient with respect to one input?
It is computed using the other matrix and the upstream gradient, following the multiplication rule in matrix form.
What is the relationship between the total loss and its components in a neural network?
The total loss is the data loss plus a regularization term: Ltotal=Ldata+R(W).

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