Neural Network Training
- 95Unfamiliar
- 0Learning
- 0Familiar
- 0Mastered
What is a computational graph, and how can it represent a function?
95 questions
- 1
What is a computational graph, and how can it represent a function?
Model answer
A computational graph represents a function as a sequence of interconnected computational operations. Neural networks can be expressed as computational graphs.
Explanation
The content states that any function can be represented using a computational graph.
- 2
What distinguishes a neural network computational graph from a general computational graph?
Model answer
A neural network typically stacks linear layers with nonlinear activation functions between them.
Explanation
The network structure is described as repeated linear transformations followed by nonlinearities.
- 3
What is the defining structural property of a convolutional neural network?
Model answer
A convolutional neural network uses convolutional layers to preserve spatial structure throughout the network hierarchy.
Explanation
Convolutional layers maintain relationships among nearby spatial locations.
- 4
How is an activation map produced by a convolutional layer?
Model answer
A filter of weights slides over all spatial locations in the input, producing an activation at each location.
Explanation
Each filter detects a pattern across local spatial regions.
- 5
What determines the depth of a convolutional layer's output?
Model answer
The output depth equals the total number of filters in the convolutional layer, because each filter produces a separate activation map.
Explanation
Multiple filters create multiple feature maps while retaining spatial dimensions.
- 6
What is the goal of optimizing neural-network parameters?
Model answer
The goal is to find parameter values in the loss landscape that produce a low loss.
Explanation
Training searches for weights that make the network's predictions fit the data well.
- 7
In which direction does gradient descent update parameters?
Model answer
Parameters are updated in the direction of the negative gradient, because that direction locally decreases the loss.
Explanation
The gradient points toward increasing loss, so its negative points toward decreasing loss.
- 8
Describe the steps of mini-batch stochastic gradient descent.
Model answer
Sample a mini-batch, forward-propagate it through the network, compute the loss, backpropagate to obtain gradients, and update the weights using those gradients.
Explanation
These steps are repeated continuously during neural-network training.
- 9
What does backpropagation compute during training?
Model answer
Backpropagation computes gradients of the loss with respect to the network's parameters by applying the chain rule through the computational graph.
Explanation
The gradients determine how each weight should be changed.
- 10
What is the sigmoid activation function?
Model answer
The sigmoid is σ(x)=1+e−x1 and applies elementwise to squash inputs into the range [0,1].
Explanation
Large positive inputs approach 1, while large negative inputs approach 0.
- 11
Why has the sigmoid historically been interpreted as a neuron's firing rate?
Model answer
Because its output lies between 0 and 1, it can be interpreted as a saturating firing rate.
Explanation
The bounded output gives the sigmoid a natural rate-like interpretation.
- 12
Why can saturated sigmoid neurons cause vanishing gradients?
Model answer
In the highly positive or highly negative regions, the sigmoid is nearly flat, so its local derivative is close to zero and backpropagated gradients become very small.
Explanation
The chain rule multiplies the upstream gradient by the sigmoid derivative.
- 13
What happens to the sigmoid gradient when its input is near zero?
Model answer
The gradient is reasonably large because the sigmoid is in its approximately linear region near zero.
Explanation
The sigmoid's slope is useful for learning around its central region.
- 14
Why are sigmoid outputs not being zero-centered a problem for optimization?
Model answer
Non-zero-centered activations can cause weight gradients to have coordinated signs, restricting updates and making optimization inefficient.
Explanation
When inputs are all positive, gradients for weights tend to be either all positive or all negative.
- 15
Why does an input that is always positive restrict gradient directions?
Model answer
For a linear transformation, the local gradient with respect to a weight is the input x. If all x values are positive, each weight gradient has the sign of the upstream gradient, so updates tend to move together.
Explanation
The weight gradient is formed by multiplying the upstream gradient by the input.
- 16
Why can coordinated weight updates make optimization inefficient?
Model answer
If all weights can only increase together or decrease together, the optimizer cannot move directly toward an optimum requiring mixed-sign changes and must take a zigzagging sequence of updates.
Explanation
The allowable update directions are restricted to coordinated sign patterns.
- 17
What is the main computational disadvantage of the sigmoid function?
Model answer
It requires evaluating an exponential, making it more computationally expensive than a simple maximum operation.
Explanation
This disadvantage is usually minor compared with the cost of convolutions and dot products.
- 18
How does hyperbolic tangent differ from sigmoid?
Model answer
The hyperbolic tangent squashes inputs into [−1,1] and is zero-centered, whereas sigmoid squashes inputs into [0,1]. Tanh still suffers from saturation and vanishing gradients.
Explanation
Tanh fixes sigmoid's centering problem but not its flat saturated regions.
- 19
Define the ReLU activation function and describe its behavior for positive and negative inputs.
Model answer
ReLU is f(x)=max(0,x). It outputs zero for negative inputs and passes positive inputs through unchanged.
Explanation
ReLU is applied elementwise and is linear in its positive region.
- 20
What is the main gradient advantage of ReLU over sigmoid and tanh?
Model answer
ReLU does not saturate in its positive region, so positive inputs can propagate useful gradients without the severe saturation problem of sigmoid and tanh.
Explanation
Its positive half has a constant nonzero slope.
- 21
Why is ReLU computationally efficient?
Model answer
ReLU only requires a maximum operation, unlike sigmoid, which requires an exponential.
Explanation
Its simple piecewise-linear form makes it fast to evaluate.
- 22
How does ReLU typically compare with sigmoid and tanh in convergence speed?
Model answer
In practice, ReLU often converges about six times faster than sigmoid and tanh.
Explanation
The content identifies faster convergence as a major practical advantage of ReLU.
- 23
What are two important disadvantages of the standard ReLU?
Model answer
ReLU is not zero-centered, and it has zero gradient for negative inputs, which can produce dead ReLU units.
Explanation
The negative half of ReLU is flat at zero.
- 24
What gradients does ReLU provide at inputs of −10, 10, and 0 in practice?
Model answer
At −10 the gradient is zero, at 10 it is nonzero and in the linear regime, and at 0 the derivative is mathematically undefined but is conventionally assigned zero in practice.
Explanation
These cases illustrate ReLU's active positive region and inactive negative region.
- 25
What is a dead ReLU?
Model answer
A dead ReLU is a unit that remains inactive for the relevant data, producing zero outputs and receiving no useful gradient updates.
Explanation
A ReLU whose activation region lies outside the training-data cloud may never activate.
- 26
How can poor initialization cause dead ReLUs?
Model answer
Unlucky initial weights can place a ReLU's active half-space away from the training data, so the unit never activates and never receives useful updates.
Explanation
The position of the ReLU's separating hyperplane depends on its weights.
- 27
How can an excessively high learning rate create dead ReLUs?
Model answer
Large updates can move an initially active ReLU off the data manifold, after which it may stop activating and stop receiving gradients.
Explanation
The unit can become dead during training even if its initialization was initially suitable.
- 28
Why might slightly positive biases be used when initializing ReLUs?
Model answer
Slightly positive biases increase the likelihood that ReLUs are active at initialization, allowing them to receive updates early in training.
Explanation
Positive biases shift pre-activation values toward the active region.
- 29
How does a leaky ReLU modify the standard ReLU?
Model answer
A leaky ReLU uses a small negative slope instead of a flat zero region for negative inputs.
Explanation
This allows gradients to flow even when the input is negative.
- 30
What advantages does leaky ReLU have over standard ReLU?
Model answer
It avoids a fully flat negative region, remains computationally efficient, generally retains fast convergence, and reduces the dying-ReLU problem.
Explanation
The nonzero negative slope prevents inactive units from completely losing gradient flow.
- 31
What distinguishes PReLU from leaky ReLU?
Model answer
PReLU learns the negative-region slope through a parameter α, whereas leaky ReLU uses a fixed slope.
Explanation
Learning α gives PReLU additional flexibility.
- 32
What is an ELU, and how does it differ from leaky ReLU?
Model answer
An ELU retains ReLU-like behavior for positive inputs but uses a negative saturating region, rather than the linear negative slope of leaky ReLU.
Explanation
The negative saturation can produce outputs closer to zero mean and may improve robustness to noise.
- 33
What is a Maxout neuron?
Model answer
A Maxout neuron outputs the maximum of two or more learned linear functions, such as max(W1x+b1,W2x+b2).
Explanation
Maxout differs from standard activations because it takes a maximum over learned affine functions.
- 34
Why does Maxout generalize ReLU and leaky ReLU?
Model answer
Because it takes the maximum of linear functions, Maxout can represent the piecewise-linear behavior of ReLU and leaky ReLU while avoiding saturation and dying units.
Explanation
Its output remains in a linear regime determined by whichever learned function is largest.
- 35
What is the main cost of using Maxout neurons?
Model answer
Each neuron requires multiple sets of weights, so using two linear functions approximately doubles the number of parameters per neuron.
Explanation
The increased flexibility comes at the cost of model size.
- 36
What is the general practical recommendation for choosing an activation function?
Model answer
Use ReLU as the standard starting choice, consider variants such as leaky ReLU, PReLU, ELU, or Maxout experimentally, and generally avoid sigmoid.
Explanation
ReLU and its variants usually train more effectively than sigmoid in the settings described.
- 37
What are the two standard stages of preprocessing numerical input data?
Model answer
First subtract the mean to zero-center the data, then optionally divide by the standard deviation to normalize feature scales.
Explanation
Zero-centering improves optimization, while normalization helps features contribute on comparable scales.
- 38
Why is zero-centering data useful for gradient-based optimization?
Model answer
Zero-centering prevents systematic biases in the inputs from causing weight gradients to move in coordinated directions, which improves optimization efficiency.
Explanation
Both all-positive inputs and other strong biases can restrict useful update directions.
- 39
Why is feature normalization useful in general machine-learning problems?
Model answer
It places features on comparable scales so that they contribute more equally during optimization.
Explanation
Features with very different scales can otherwise affect learning disproportionately.
- 40
Why are image pixels often zero-centered but not fully normalized?
Model answer
Image pixels at corresponding locations generally already have comparable scales and distributions, so zero-centering is often sufficient.
Explanation
More general datasets may require standard-deviation normalization because their features can differ substantially in scale.
- 41
Why are PCA and whitening often avoided for image inputs in convolutional networks?
Model answer
They can project pixels into new lower-dimensional features and obscure the original spatial structure that convolutional networks are designed to exploit.
Explanation
Image processing typically preserves the original spatial arrangement.
- 42
How should preprocessing be applied to test data?
Model answer
Compute preprocessing statistics from the training data and apply the same statistics to the test data.
Explanation
Using test-set statistics would make evaluation inconsistent and could leak information from the test set.
- 43
What is the difference between subtracting a mean image and subtracting a per-channel mean?
Model answer
A mean image contains a separate mean value for every pixel location and channel, whereas a per-channel mean uses one mean for each channel, such as red, green, and blue.
Explanation
Per-channel subtraction is simpler and can be adequate when statistics are similar across spatial locations.
- 44
Over what data should a mean image be computed?
Model answer
It should be computed across the training images, typically once before training begins.
Explanation
The empirical training mean is then subtracted from each training and test image.
- 45
Why should the mean generally not be recomputed separately for every mini-batch during preprocessing?
Model answer
A single estimate from the training set is more consistent and efficient; reasonable mini-batches should produce similar estimates anyway.
Explanation
The preprocessing statistic is intended to characterize the training distribution rather than each batch.
- 46
What problem occurs when every neural-network weight is initialized to zero?
Model answer
Neurons in the same layer perform identical computations, receive identical gradients, and continue to learn the same features because symmetry is not broken.
Explanation
The neurons do not specialize in different functions.
- 47
Why is initializing all weights to the same value generally undesirable?
Model answer
Equal initialization causes neurons to behave identically and receive the same updates, preventing them from learning different representations.
Explanation
Randomness or another mechanism is needed to break symmetry.
- 48
What is the basic idea of small random weight initialization?
Model answer
Initialize weights as small random values sampled from a distribution, such as a Gaussian with standard deviation 0.01, to break symmetry.
Explanation
This works reasonably for small networks but can fail in deep networks.
- 49
What happens to activations in a deep network initialized with weights that are too small?
Model answer
Repeated multiplication by small weights causes activation magnitudes and their standard deviations to shrink across layers until they collapse near zero.
Explanation
The forward-pass signal becomes increasingly small at deeper layers.
- 50
Why do very small weights produce small gradients in deep networks?
Model answer
Weight gradients are multiplied by small input activations, while backpropagated gradients are repeatedly multiplied by small weights, causing both weight gradients and upstream gradients to vanish.
Explanation
The repeated products in the forward and backward passes cause signal collapse.
- 51
What happens when weights are initialized too large in a network using tanh?
Model answer
Large pre-activation values push tanh into its positive or negative saturated regions, producing activations near +1 or −1 and gradients near zero.
Explanation
The weights then receive almost no updates.
- 52
What is the central trade-off in choosing the scale of initial weights?
Model answer
Weights that are too small cause activations and gradients to vanish, while weights that are too large cause saturation and vanishing gradients.
Explanation
Effective initialization must preserve useful signal through both forward and backward passes.
- 53
What is Xavier initialization designed to accomplish?
Model answer
Xavier initialization scales random weights according to the number of inputs so that the variance of activations remains approximately stable across layers.
Explanation
It aims to make input and output variances comparable.
- 54
Why should a layer with many inputs generally use smaller initial weights under Xavier initialization?
Model answer
Many inputs contribute to the output, so smaller weights help prevent the output variance from becoming too large.
Explanation
With fewer inputs, larger weights may be needed to maintain comparable output variance.
- 55
What assumption of the original Xavier derivation can fail for ReLU networks?
Model answer
The derivation assumes an approximately linear or active activation regime, but ReLU sets roughly half of its inputs to zero.
Explanation
This changes the variance propagation compared with the assumptions used for the original initialization.
- 56
How can Xavier-style initialization be adjusted for ReLU units?
Model answer
The initialization can account for ReLU removing approximately half of the activations by including an additional factor related to division by 2 in the variance calculation.
Explanation
This adjustment helps prevent activation distributions from progressively collapsing toward zero.
- 57
Why is proper weight initialization important in practice?
Model answer
It can determine whether a network trains effectively at all by controlling activation magnitudes and gradient flow across layers.
Explanation
Initialization remains an active research area because different architectures require different signal-preservation properties.
- 58
What is the purpose of batch normalization?
Model answer
Batch normalization normalizes layer activations using the mean and variance of the current mini-batch, helping maintain stable activation scales during training.
Explanation
It enforces normalization functionally on each forward pass rather than only through initial weights.
- 59
How are activations batch-normalized for a fully connected layer?
Model answer
For each feature dimension, compute the mini-batch mean and variance, subtract the mean, and divide by the standard deviation with a small numerical-stability term if needed.
Explanation
The normalization is performed independently for each feature across examples in the mini-batch.
- 60
Why can batch normalization be inserted into a neural network without preventing backpropagation?
Model answer
Mean calculation, variance calculation, centering, and scaling are differentiable operations, so gradients can be propagated through the normalization layer.
Explanation
The normalization is part of the computational graph.
- 61
Where is batch normalization typically inserted?
Model answer
It is typically inserted after fully connected or convolutional layers.
Explanation
These layers repeatedly multiply inputs by weights and can otherwise cause activation-scale problems.
- 62
How does batch normalization differ for convolutional layers compared with fully connected layers?
Model answer
For convolutional layers, normalization is performed jointly across examples and spatial locations for each activation map, using one mean and variance per map.
Explanation
This preserves the convolutional property that corresponding spatial locations share parameters and statistics.
- 63
Why are convolutional activation maps normalized across spatial locations?
Model answer
Using shared statistics across spatial locations respects the convolutional structure and treats corresponding positions in an activation map consistently.
Explanation
A convolutional filter is applied across the spatial field, so its map is normalized as a unit.
- 64
What are the learned parameters added after batch normalization?
Model answer
After normalization, the activation is scaled by a learned parameter γ and shifted by a learned parameter β.
Explanation
These parameters give the network control over the final scale and mean.
- 65
Why are the scale and shift parameters γ and β needed?
Model answer
They allow the network to choose how much scaling, shifting, and saturation is useful rather than forcing every activation to remain exactly unit Gaussian.
Explanation
The parameters give batch normalization flexibility beyond strict normalization.
- 66
How can the learned scale and shift after batch normalization recover the identity mapping?
Model answer
If γ and β learn values that reverse the normalization's scale and shift, the overall operation can reproduce the original activation.
Explanation
This ensures normalization does not permanently restrict the representational function of a layer.
- 67
Why might forcing inputs to tanh into a unit-Gaussian distribution not always be ideal?
Model answer
It may constrain tanh inputs mostly to its linear region, whereas some degree of saturation could be useful for the network.
Explanation
The learned scale and shift allow the network to select an appropriate amount of saturation.
- 68
What effects does batch normalization have on training?
Model answer
It improves gradient flow, makes training more robust to learning-rate and initialization choices, and generally makes optimization easier.
Explanation
Stable activation distributions reduce the sensitivity of deep networks to parameter scale.
- 69
Why can batch normalization have a regularization effect?
Model answer
Because each example is normalized using statistics from the other examples in its mini-batch, its representation depends on the sampled batch and is therefore slightly randomized.
Explanation
This batch-dependent variation can act like a small amount of noise or jitter.
- 70
How is batch normalization handled at test time?
Model answer
At test time, use mean and variance estimated from the training data, often through running averages, rather than recomputing them from the test batch.
Explanation
Evaluation should use fixed training-distribution statistics.
- 71
What limitation can small batch sizes create for batch normalization?
Model answer
Small batches produce less accurate estimates of the mean and variance, making normalization noisier or less reliable.
Explanation
Alternative normalization methods may be considered for settings such as recurrent or reinforcement-learning models with very small batches.
- 72
What is the first preprocessing step when beginning to train a network?
Model answer
Zero-center the input data using statistics computed from the training set.
Explanation
The same preprocessing must later be applied to validation and test data.
- 73
What should be checked immediately after initializing a network?
Model answer
Perform a forward pass and verify that the initial loss is reasonable and matches the expected value.
Explanation
This is an early sanity check for implementation or initialization errors.
- 74
For a ten-class softmax classifier with small weights, what initial loss should be expected approximately?
Model answer
The loss should be approximately −log(101)≈2.3, because the predicted class probabilities are initially close to uniform.
Explanation
A uniform distribution assigns probability 101 to the correct class.
- 75
What should happen to the loss when regularization is turned on?
Model answer
The total loss should increase because an additional regularization term has been added to the data loss.
Explanation
With regularization disabled, the initial loss reflects only the data term.
- 76
Why should a newly implemented network first be tested on a very small dataset?
Model answer
A sufficiently flexible network should be able to overfit a small dataset, providing a strong test that the implementation and gradient updates work.
Explanation
With regularization disabled, the training loss should approach zero and training accuracy should approach 1.
- 77
What does a very small learning rate typically look like during training?
Model answer
The loss changes very slowly because parameter updates are too small to make meaningful progress.
Explanation
A nearly flat loss curve is evidence that the learning rate may be too low.
- 78
How can accuracy improve substantially while softmax loss changes little?
Model answer
Accuracy depends only on which class has the largest probability, whereas softmax loss also reflects the confidence of the probability distribution. Small shifts can change the winning class without greatly concentrating the probabilities.
Explanation
Thus, accuracy can jump even while probabilities remain relatively diffuse.
- 79
What does a loss containing NaN values usually indicate during training?
Model answer
It usually indicates that the loss has exploded, often because the learning rate is too high.
Explanation
Reducing the learning rate is a typical response to exploding loss values.
- 80
What rough learning-rate range was suggested for cross-validation in this setting?
Model answer
A rough range is from 10−3 to 10−5, with values adjusted according to whether training is too unstable or too slow.
Explanation
The appropriate range depends on the network and optimization behavior.
- 81
What can a loss curve that is steep initially and then plateaus suggest?
Model answer
It can indicate that the learning rate is too high, causing overly large steps that prevent the optimizer from settling effectively near a local optimum.
Explanation
The loss decreases rapidly but then fails to continue improving smoothly.
- 82
What might cause a loss curve to remain flat initially and then begin decreasing?
Model answer
Bad initialization may initially produce poor gradient flow; later, an update may move the network into a region where learning becomes effective.
Explanation
The delayed improvement suggests the network was initially in an unfavorable activation or gradient regime.
- 83
What does a large gap between training and validation accuracy usually indicate?
Model answer
It usually indicates overfitting, so increasing regularization strength may help.
Explanation
The model performs much better on training data than on unseen validation data.
- 84
What does little or no gap between training and validation accuracy suggest?
Model answer
It may indicate that the model has not yet overfit and that increasing model capacity could improve performance.
Explanation
Additional hidden units, depth, or another capacity increase may be appropriate.
- 85
What ratio of update magnitude to parameter magnitude is a useful diagnostic target?
Model answer
A useful approximate target is an update-to-weight norm ratio around 0.001, although substantial variation is acceptable.
Explanation
The ratio helps detect updates that are either too large to be stable or too small to matter.
- 86
What is hyperparameter optimization?
Model answer
Hyperparameter optimization is the process of selecting settings such as learning rate, regularization, update rule, and architecture to obtain good validation performance.
Explanation
These settings are chosen outside the ordinary parameter-learning process.
- 87
How is cross-validation used to select hyperparameters?
Model answer
Train models on the training set using different hyperparameter values, then evaluate their performance on a validation set and compare the results.
Explanation
The validation set provides an estimate of how well each setting generalizes.
- 88
Why should hyperparameter search usually be performed in stages?
Model answer
Begin with a broad, coarse search using only a few epochs, then perform a longer and finer search around the promising region.
Explanation
This approach saves computation while progressively narrowing the search.
- 89
Why is it useful to stop a hyperparameter trial early when its loss becomes extremely large?
Model answer
A rapidly increasing loss, such as a value several times larger than the initial loss, signals that the trial is unstable and unlikely to succeed.
Explanation
Early termination allows computation to be redirected to better hyperparameter choices.
- 90
Why should learning rates generally be sampled in log space rather than uniformly in ordinary numerical space?
Model answer
Learning rates have multiplicative effects, so values differing by orders of magnitude are more meaningful than equal additive intervals.
Explanation
Sampling values such as powers of 10 gives better coverage across scales.
- 91
What does it mean if the best values in a hyperparameter search lie at the edge of the tested range?
Model answer
The search range may be poorly chosen or too narrow, so it should be extended beyond that edge to determine whether even better values exist.
Explanation
Good values concentrated at a boundary suggest that the relevant region has not been fully explored.
- 92
Why is random hyperparameter search often preferable to grid search?
Model answer
Random search explores more distinct values of important hyperparameters, especially when performance depends strongly on only a few dimensions.
Explanation
Grid search can waste trials repeating unimportant values while missing useful regions along influential dimensions.
- 93
Which hyperparameters can be optimized in a neural network?
Model answer
Examples include learning rate, learning-rate decay schedule, update rule, regularization strength, number of hidden units, network depth, and other architectural choices.
Explanation
Hyperparameter optimization involves tuning the major training and architecture settings.
- 94
How can loss-curve shape help diagnose an unsuitable learning rate?
Model answer
An exploding curve suggests the learning rate is too high, an almost flat curve suggests it is too low, and a rapid decrease followed by a plateau can also suggest overly large steps.
Explanation
A useful learning rate typically produces a substantial, continuing decrease in loss.
- 95
What are the main practical recommendations for training neural networks from this material?
Model answer
Use ReLU activations, subtract the training mean from the data, use Xavier-style initialization, apply batch normalization, monitor training behavior, and sample hyperparameters randomly.
Explanation
These recommendations summarize the practices emphasized for stable and effective training.

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