One Cache, Two Houses

BackpropagationMedium+20 XP+20

One Cache, Two Houses

A hand-written network reads two numbers about a house, x1x_1x1​ and x2x_2x2​, and predicts its price. It has two hidden ReLU neurons and one output neuron with no activation:

hidden neuronweight from x1x_1x1​weight from x2x_2x2​bias
1111111000
2111−1-1−1000

prediction=1×(hidden 1’s output)+2×(hidden 2’s output)−1\text{prediction} = 1 \times (\text{hidden 1's output}) + 2 \times (\text{hidden 2's output}) - 1prediction=1×(hidden 1’s output)+2×(hidden 2’s output)−1

That makes nine parameters: four hidden weights, two hidden biases, two output weights and the output bias. The loss on one house is (prediction−price)2(\text{prediction} - \text{price})^2(prediction−price)2.

Like most hand-written networks, it keeps a cache. Every forward pass saves its inputs, each hidden neuron's weighted sum and output, and the prediction, overwriting whatever the previous forward pass saved. Whenever the backward pass needs a value from the forward pass, it reads it from the cache.

A training script does three things, in this order:

  1. It runs the forward pass on house A, with x1=2x_1 = 2x1​=2, x2=1x_2 = 1x2​=1 and a price of 333. It computes A's loss and A's output error signal, 2(prediction−price)2(\text{prediction} - \text{price})2(prediction−price), and holds on to that number.
  2. It runs the forward pass on house B, with x1=1x_1 = 1x1​=1 and x2=3x_2 = 3x2​=3, just to print a sample prediction to the log.
  3. It runs the backward pass for house A, starting from A's output error signal.

Nothing crashes, and nine gradients come back.

Which of them are correct for house A?

Hints

Solve it to unlock the solution

Once you get it right, the reasoning behind the answer shows up here.

Select all that apply.