Course · Autodiff & JAX internalsPhase 14 · Study guide

Which mathematical operation does the transformed program represent?

Domain Specialization · Local CPULaptop CPU4 lessons (~7.4h)

Revision v0.7.0 ·

Use internal representations to explain and verify transformations, not to memorize printed variable names. Separate primal values, tangent directions, cotangents and compiled artifacts.

Preparation: Math & optimization

Runtime: CPU

Check your starting point

A function maps an input vector to an output vector. Does a JVP multiply by the Jacobian or its transpose?

Compare your reasoning

A JVP maps an input tangent through the Jacobian. A VJP maps an output cotangent through its transpose. Check the spaces and the adjoint inner-product identity.

If this is unfamiliar, work through JVPs, VJPs, and higher-order derivatives before attempting the project.

Build in stages

1. Read and check transformed programs

Follow one jaxpr equation, compare directional derivatives independently and verify the adjoint identity at changed inputs.

2. Enforce a custom transformation boundary

Require tangent linearity and test higher-order promises. For the tiny interpreter, reject unsupported primitives rather than returning a plausible incomplete result.

Try a changed condition

Make a prediction before opening the reasoning. Keep your answer and the evidence you would collect.

A custom JVP returns the correct derivative when the tangent equals one but squares the tangent internally. Is it valid?

Compare an approach

No. Derivatives are linear maps in the direction at a fixed base point. Check multiple directions and linear combinations; agreement for one seed is insufficient.

Diagnose a likely failure

Symptom: A derivative test passes at one input but fails after a shift.

Check next: Inspect captured constants, detached values and custom rules. Compare both primal and derivative behavior at changed base points.

Decide what is ready

Use derivative-audit. Keep analytic/directional checks, the adjoint identity, supported higher-order behavior and explicit unsupported-program rejections.

Where to put your project code

Write your code in: projects/derivative-audit/my_model.py (copy projects/derivative-audit/starter/model.py first: cp projects/derivative-audit/starter/model.py projects/derivative-audit/my_model.py).

Verify your implementation: python3 projects/derivative-audit/tests/check.py --stage all --impl projects/derivative-audit/my_model.py

Run the staged project checks on your implementation in projects/derivative-audit/my_model.py and record your transfer experiment results in your portfolio.

Open Audit derivatives and a tiny transformation

What still needs further work

The tiny interpreter is intentionally incomplete. Production extension APIs, effects and full compiler transformation coverage require further targeted work.