Optionalwrite: (i: number, p: MlxArray) => void
callback to push a replaced param back into its owner
(e.g. lw.a / lw.b). If omitted, only the internal array is
updated (the caller must read params via getParam).
Eval all optimizer state + params (call once per step after step).
Apply one AdamW update. grads[i] is dL/dparams[i]. Takes ownership of
the grads (they are disposed here).
live param arrays (e.g. flatParams(lora)).