c18 · E2

Derive: Getting Gradients From a Computer

c18.E2.1E2 · expression

Recursive halving splits a chain of blocks in half, keeps the midpoint, and solves each half the same way. Count a call as one block evaluation during the backward phase, including recomputations; the original forward pass is not counted. For a power of two, the schedule obeys

(a) Solve the two recurrences and show that and .

(b) Storing everything makes calls in slots. Derive the work ratio and the memory ratio .

(c) Show that approaches , and compute and at , and , to two decimal places.

(d) Say which two sections this makes precise, and name the assumption about a block that the schedule needs for the gradient to stay correct.

This tier asks for a derivation, so there is no automatic checker. Write your answer, then open the worked solution and compare.

c18.E2.2E2 · expression

Let be at .

(a) Write the Jacobian .

(b) Forward mode needs one pass for each input. Give the two Jacobian-vector products and , and say how many passes return the whole .

(c) Reverse mode needs one pass for each output. Give the three vector-Jacobian products for the seeds , and , and say how many passes return the whole .

(d) Explain why this is a counterexample to the claim that reverse mode is always the cheaper direction. State the rule in terms of the output count and the input count .

This tier asks for a derivation, so there is no automatic checker. Write your answer, then open the worked solution and compare.

c18.E2.3E2 · expression

Take at . In exact arithmetic the centred quotient with step returns Suppose each evaluation of carries absolute error at most , and the two errors can add, so the subtraction can contribute up to . After dividing by the roundoff bound is . Use .

(a) Verify the expansion and derive the total error model .

(b) Minimize over . Show that and that .

(c) Compute and to three significant figures, and give .

(d) Explain the edge case: at its best step the centred quotient is not accurate to machine precision. What does that say about a gradient check at a fixed step?

This tier asks for a derivation, so there is no automatic checker. Write your answer, then open the worked solution and compare.

Other tiers

E1 Practise · E3 Open

Every hint opened, solution viewed and answer checked is recorded in this browser only. See Progress to export or delete it.