Ten questions to check the complete neural-network workflow.
Choose one answer per question. Read the feedback for every option, then revisit the relevant episode if the reason is unclear.
Checkpoint1 · Predictions and targets
Predictions have shape (8, 1) and regression targets have shape (8,). What should you do before subtracting them?
A
Make their shapes identical, preserving the sample axis.
Correct.
Correct: otherwise broadcasting can produce an 8-by-8 matrix of pairwise differences.
B
Multiply both by the batch size.
Not quite.
This changes values but does not correct the shape mismatch.
C
Assume subtraction automatically pairs the rows.
Not quite.
Broadcasting follows shape rules, not the scientific meaning of samples.
Checkpoint2 · Backward and step
What does loss.backward() do?
A
Calculate gradients of the loss with respect to tracked parameters.
Correct.
Correct: an optimiser step then uses these gradients to update the parameters.
B
Choose the next learning rate from the validation set.
Not quite.
That is a separate tuning or scheduling decision.
C
Update all weights to the optimum.
Not quite.
Backward calculates derivatives; it neither updates parameters nor solves the optimisation problem.
Checkpoint3 · Gradient storage
Why does an ordinary mini-batch loop clear gradients before a new update?
A
New gradients otherwise accumulate with previous gradients.
Correct.
Correct: accumulation is useful when deliberate, but differs from a fresh gradient per batch.
B
The training data must be deleted after every batch.
Not quite.
Clearing gradients does not delete the input dataset.
C
Clearing gradients resets the learned weights.
Not quite.
The weights are retained; gradient storage is cleared.
Checkpoint4 · Nonlinearity
Two affine layers are stacked without an activation. What kind of function can their composition represent?
A
Another affine function.
Correct.
Correct: the matrix products and biases can be combined into one affine transformation.
B
Every nonlinear function if enough parameters are added.
Not quite.
Width alone does not make a composition of affine maps nonlinear.
C
Only a constant function.
Not quite.
The output can still vary linearly with the input.
Checkpoint5 · Binary loss
What should be supplied to BCEWithLogitsLoss for a single binary target?
A
Raw logits and floating-point zero/one targets with matching shapes.
Correct.
Correct: the loss includes the probability transformation in a stable calculation.
B
Sigmoid probabilities that have already been rounded to zero or one.
Not quite.
Hard decisions discard information and violate the raw-logit interface.
C
Integer class indices for a four-class problem and one output.
Not quite.
A mutually exclusive four-class problem usually needs four logits and CrossEntropyLoss.
Checkpoint6 · Batch averages
Five batches contain 20 samples each and a final batch contains 3. How should you calculate the epoch mean loss from batch means?
A
Weight each batch mean by its number of samples, then divide by 103.
Correct.
Correct: every observation receives equal weight.
B
Average all six batch means equally.
Not quite.
This overweights the final three samples.
C
Keep only the final batch’s loss.
Not quite.
That does not summarise the complete training epoch.
Checkpoint7 · Evaluation mode
Which pair is appropriate for validation of a network containing dropout?
A
model.eval() together with torch.no_grad().
Correct.
Correct: one changes module behaviour, the other disables gradient tracking.
B
Only torch.no_grad(), because it disables dropout.
Not quite.
No-grad does not change dropout’s training behaviour.
C
model.train() followed by an optimiser step on the validation loss.
Not quite.
That fits the validation data and invalidates its held-out role.
Checkpoint8 · Early stopping
The selected validation checkpoint is from epoch 30, while patience expires at epoch 42. Which model should you retain?
A
The independent saved copy of epoch-30 weights.
Correct.
Correct: restore the checkpoint selected by the stated validation rule.
B
Epoch 42 because it trained longest.
Not quite.
That ignores the selection rule and may retain an overfitted model.
C
Whichever of the two scores better on the final test set.
Not quite.
This would use the test set to choose an epoch.
Checkpoint9 · Reproducibility
Which statement about a fixed seed is justified?
A
It helps repeat a run in the same environment, but does not establish robustness across seeds or environments.
Correct.
Correct: save the procedure and software versions, and assess variability separately.
B
It guarantees identical results on every future device and library version.
Not quite.
Numerical kernels and implementations can change across environments.
C
It makes a single test split an exact estimate of future performance.
Not quite.
Fixing randomness does not eliminate sampling uncertainty or distribution shift.
Checkpoint10 · Choosing the model
A network and ridge regression are close on validation RMSE. What is a defensible next step?
A
Apply a declared selection rule that considers performance and complexity, then evaluate the fixed procedure once on test data.
Correct.
Correct: a simpler model can be preferable, and the test set estimates the chosen procedure.
B
Run many network seeds on the test set and report the best one.
Not quite.
This selects on test noise and gives an optimistic estimate.
C
Choose the network because more parameters guarantee better generalisation.
Not quite.
Capacity is not evidence of usefulness on new observations.