ML Systems: From Weights to Work. Lesson 2. Trace a neural network update. This educational session uses fictional healthcare operations examples. This session uses AI narration. A network is a parameterized calculation A neural network composes numerical transformations. For this lab, two inputs feed one hidden ReLU unit and then a linear output. The hidden preactivation is z equals w one times x one, plus w two times x two, plus b. The hidden activation h is the larger of zero and z. The prediction is v times h plus c. The five trainable parameters are w one, w two, b, v and c. This is deliberately small enough to inspect every dependency. Use x one equal to one, x two equal to one-half, w one equal to 0.6, w two equal to minus 0.2, b equal to 0.1, v equal to 0.8 and c equal to 0.05. The forward pass gives z of 0.6, h of 0.6 and a prediction of 0.53. With a target of one and loss equal to one-half of squared error, the loss is 0.11045. These are exercise quantities, not probabilities of a clinical outcome. Follow the derivative through the graph The derivative of the loss with respect to the prediction is the prediction minus the target: minus 0.47. The derivative with respect to v is that error times h, or minus 0.282. Because the ReLU is active, the derivative with respect to w one is error times v times x one, or minus 0.376. Backpropagation applies this chain rule through the computation graph; it does not search randomly for an explanation of the mistake. Gradient descent subtracts the learning rate times each gradient. All gradients in this one step must be evaluated at the same original parameter values. If you update v first and then use the new v to calculate another gradient, you have changed the algorithm. With a rate of 0.1, the simultaneous update yields a prediction of about 0.66399 and a loss of about 0.05645. A numerical finite-difference check can catch an incorrectly implemented derivative. Why nonlinearity and scale matter Without nonlinearities, stacked linear layers collapse to another linear transformation, even if the factorization changes optimization. A ReLU adds a piecewise boundary. If its input is negative, its incoming-weight gradient is zero for that example. In our lab, moving b to minus one turns the hidden unit off. The output bias c can still learn, so a lower loss does not prove the hidden representation is improving. At exactly zero, a framework chooses a subgradient convention; this lab uses zero. Feature scaling, initialization, learning rate, normalization and optimizer choice affect whether gradients produce useful progress. Very large steps can raise loss or cross activation boundaries. A minibatch averages or sums losses over examples according to the implementation; changing batch size without understanding that reduction can change the update scale. Accumulating gradients across microbatches can reproduce a larger effective batch only when scaling and stateful behavior are handled consistently. Training progress is not generalization The network sees the target during training because the loss needs it. At inference, that target is absent. An optimizer can reduce training loss by fitting accidental patterns or memorizing examples. Evaluate on held-out data, inspect subgroup errors and calibration where relevant, and compare the loss you optimize with the decision the system will actually support. For a fictional claim-priority predictor, a tiny loss reduction is not enough to recommend a release. The loss function might penalize every error equally while the workflow treats an unsupported high-priority recommendation as much more costly. Separate the differentiable training objective, the held-out metrics and the operating decision. Each answers a different question, and none substitutes for the others. Your decision exercise. Use the supplied network and a learning rate of 0.1. An engineer reports dL/dw₁ = −0.376 and dL/dv = −0.282, then updates v before recomputing the gradient for w₁. A second engineer computes all five gradients from the original forward pass. Both show a smaller loss on this example. Which result matches the defined single gradient-descent step? Option 1. Both are the same step because any loss decrease validates the implementation. Option 2. The sequential recomputation is required because gradients should always use the newest parameter values. Option 3. The simultaneous update is the defined step; a loss decrease alone does not validate the other implementation. Pause here and commit to a choice. Name the decisive evidence and one limitation before continuing. Reference analysis. The second engineer follows the specified computation graph and update rule. With the default active ReLU, the loss after the simultaneous update is approximately 0.05645. Reusing an updated v for only some derivatives is an order-dependent procedure, even if it happens to help this example. Check the forward values, gradients and update separately. Then set the hidden bias to minus one: incoming gradients vanish, while the output bias still changes. That counterexample shows why an improving total loss does not establish that every layer learned a useful representation. Now change one fact. Increase the learning rate until the one-step loss rises, then move the hidden bias below the ReLU boundary. Explain which parameters still receive gradients and why one example cannot establish the best learning rate. Without the screen, reconstruct the five-parameter graph aloud. Explain the difference between a parameter, an activation, a target and a gradient. Then describe a finite-difference test for one parameter: perturb it slightly in both directions, recompute the loss, and compare the slope with backpropagation. State why the perturbation should avoid crossing the ReLU kink when checking this particular derivative.