Higher-Order Derivatives in Modern AI
Training faster, opening the model, and tracing its data
Vishnu Boddeti
\(J_f(x)=[\partial f_i/\partial x_j]\)
One row per output; one column per input.
Which input directions move the representation?
\(H_f(\theta)=\nabla_\theta^2 f(\theta)\)
It measures how the gradient changes as parameters move.
Which parameter directions are sharp or flat?
\(Jv,\quad u^\top J,\quad Hv\)
Automatic differentiation applies these maps without storing the full matrix.
Ask for the product you need.
Example 1
A single learning rate cannot adapt to strongly different curvatures across billions of parameters.
Across the reported GPT-2 and GPT-NeoX runs, Sophia reaches the same validation loss in about half as many steps as AdamW.
The second-order information is deliberately incomplete: Sophia trades a full Hessian for an inexpensive diagonal estimate refreshed only every few steps.
Example 2
The weak form moves high-order derivatives away from the learned field and turns repeated automatic differentiation into reusable matrix operations.
The task is system identification: recover the beam's hidden parameter fields from observed motion. The figure shows runtime, stiffness recovery, and damping recovery.
The model still learns unknown functions, but it no longer asks automatic differentiation to repeatedly construct the highest-order spatial derivatives of the measured field.
Example 3
The full model is nonlinear, but its input-specific linear map exposes rank, sensitive directions, and semantic features for that prediction.
Freeze the prompt-dependent gates during differentiation: the resulting Jacobian reconstructs the output embedding and can be decomposed with SVD.
\(f(x+\Delta x)\approx f(x)+J_x\Delta x\)
\(J_x=U\Sigma V^\top\)
The linearization is tied to one prompt and one point in embedding space.
Example 4
Gradient similarity alone ignores how parameter perturbations propagate through the fitted model; inverse-Hessian information corrects that geometry.
The most influential examples share the requested transformation or reasoning pattern; the least influential examples do not.
For style and subject generation, the highest-ranked training images visibly match the requested output.
The formula is a local approximation around the fitted parameters. DataInf exploits LoRA's low-dimensional structure to avoid forming or inverting the full Hessian.
Each scenario hides a mathematical structure from this lecture. Identify the structure, justify it, and work through the resulting problem.
Training stops at a point where the gradient is zero. That sounds promising, but the local surface may be a mountain pass rather than a valley. Should the optimizer settle there or escape?
$L(w_1,w_2)=w_1^2+4w_1w_2+w_2^2$.
A prediction head processes a whole batch at once, and the optimizer wants one matrix-shaped gradient. Computing a separate scalar derivative for every entry would miss the structure hiding in the matrix expression.
$F(W)=\frac12\|WX-Y\|_F^2$, $W=\begin{bmatrix}1&0\end{bmatrix}$, $X=\begin{bmatrix}1&0\\1&2\end{bmatrix}$, and $Y=\begin{bmatrix}2&1\end{bmatrix}$.
Near equilibrium, a generator tries to lower a local objective while a discriminator tries to raise it. Their parameters are coupled, so an ordinary “both directions should curve upward” test tells the wrong story.
$V(\theta,\phi)=\theta^2+\theta\phi-\phi^2$.