Implement a mixed-precision loop (bf16 compute, fp32 master weights) with loss scaling on

Optimization and Training Dynamics5 / 5

Chapter 075 / 5

Optimization and Training Dynamics

Implement a mixed-precision loop (bf16 compute, fp32 master weights) with loss scaling on

Super-hard

Implement a mixed-precision loop (bf16 compute, fp32 master weights) with loss scaling on a toy MLP, including a deliberate overflow and recovery.

Target interface
forward_backward(master, x, y, loss_scale)

Complete the starter code in the editor. Any correct approach is accepted.

Hints0 / 2
Reference solution
Your own code stays in the editor.