Convexity and Numerical Optimization through Adam

ECE 57000 — October 5, 2026

David I. Inouye

Friday connected model, loss, and objective shape

  • OLS gives an optimal training fit; redundant features can make coefficients nonunique.
  • Logistic regression maps a linear score to a probability and fits it with log loss.
  • Convexity means the loss at an averaged input lies below the average endpoint loss.

Today: use that definition to understand optimality, then compute useful updates.

A convex domain contains every segment between its points

A set \(\mathcal D\subseteq\mathbb R^d\) is convex if \[\forall\boldsymbol u,\boldsymbol v\in\mathcal D,\quad\forall t\in[0,1],\quad (1-t)\boldsymbol u+t\boldsymbol v\in\mathcal D.\]

Visual segment test: the entire segment must stay inside the domain for every pair.

Definition: a convex function lies below every chord

\(J\) is convex on a convex domain if, for every \(\boldsymbol{u},\boldsymbol{v}\) in the domain and \(0\le t\le1\),

\[{\color{#27847f}{J\big(}}{\color{#b8872f}{(1-t)}}{\color{#2f6b8a}{\boldsymbol{u}}}+{\color{#b8872f}{t}}{\color{#756486}{\boldsymbol{v}}}{\color{#27847f}{\big)}} \le {\color{#b8872f}{(1-t)}}{\color{#2f6b8a}{J(\boldsymbol{u})}}+{\color{#b8872f}{t}}{\color{#756486}{J(\boldsymbol{v})}}.\]

Loss at the averaged input ≤ average of the endpoint losses.

Convexity makes every local minimum global

Proof by contradiction. Let \(J\) be convex on a convex domain \(\mathcal D\).

Local minimality at \(\boldsymbol u\) means: for some \(r>0\), \[J(\boldsymbol x)\ge J(\boldsymbol u)\quad\text{whenever }\boldsymbol x\in\mathcal D,\ \|\boldsymbol x-\boldsymbol u\|<r.\]

Suppose \(\boldsymbol u\) is not global: some \(\boldsymbol v\in\mathcal D\) has \(J(\boldsymbol v)<J(\boldsymbol u)\).

Choose \(0<t<\min\{1,r/\|\boldsymbol v-\boldsymbol u\|\}\) and set \(\boldsymbol x_t=(1-t)\boldsymbol u+t\boldsymbol v\).

The segment stays in \(\mathcal D\), and \(\|\boldsymbol x_t-\boldsymbol u\|=t\|\boldsymbol v-\boldsymbol u\|<r\).

\[J(\boldsymbol x_t)\le(1-t)J(\boldsymbol u)+tJ(\boldsymbol v)\quad\text{(convexity)}\]

\[\phantom{J(\boldsymbol x_t)}< (1-t)J(\boldsymbol u)+tJ(\boldsymbol u)=J(\boldsymbol u)\quad\text{(strictly lower loss, }t>0\text{)}.\]

Contradiction: a lower value lies inside the local-minimum neighborhood. Thus \(\boldsymbol u\) is global.

For a twice differentiable function, convexity means nonnegative curvature

Let \(J\) be twice continuously differentiable on an open convex domain.

Parameters Equivalent criterion for convexity
One scalar \(\theta\) \(J''(\theta)\ge0\) everywhere
A vector \(\boldsymbol{\theta}\) \(H(\boldsymbol{\theta})=\nabla^2J(\boldsymbol{\theta})\succeq0\) everywhere

The Hessian is the matrix of second partial derivatives: \(H_{jk}=\frac{\partial^2J}{\partial\theta_j\partial\theta_k}\).

Positive semidefinite (PSD) means \(\boldsymbol{v}^{\mathsf T}H\boldsymbol{v}\ge0\) for every direction \(\boldsymbol{v}\). Equivalently, all eigenvalues of \(H\) are \(\ge0\): no eigenvector direction curves downward; zero allows a flat direction at that point.

Local quadratic approximations reveal the sign of curvature

Near any point \(\theta_0\), with \(h=\theta-\theta_0\), \[J(\theta_0+h)=\underbrace{J(\theta_0)+J'(\theta_0)h+\tfrac12J''(\theta_0)h^2}_{\text{local quadratic approximation}}+o(h^2).\]

  • Logistic loss: \(J''(\theta)=\sigma(\theta)(1-\sigma(\theta))>0\) at every finite score.
  • Cubic: \(J''(\theta)=6\theta<0\) when \(\theta<0\); therefore it is not convex on \(\mathbb R\).

OLS and logistic log loss have nonnegative directional curvature

Append the intercept to \(\widetilde X\) and the coefficients to \(\boldsymbol{\theta}\).

Objective Hessian \(H=\nabla^2J\)
OLS \(\frac1n\widetilde X^{\mathsf T}\widetilde X\)
Logistic log loss \(\frac1n\widetilde X^{\mathsf T}W\widetilde X\), with \(W_{ii}=a_i(1-a_i)\ge0\)

For logistic loss, \(\ell(z,y)=\log(1+e^z)-yz\) gives \(\ell'=\sigma(z)-y\) and \(\ell''=a(1-a)\).

\[\boldsymbol{v}^{\mathsf T}H\boldsymbol{v} =\frac1n\sum_i a_i(1-a_i)(\widetilde{\boldsymbol{x}}_i^{\mathsf T}\boldsymbol{v})^2\ge0.\]

For OLS, replace the weights by 1. Both objectives are convex in the coefficients.

Convexity makes a local optimum globally meaningful

  • Local minimum → global minimum. Zero gradient also certifies a global minimum for a differentiable convex objective.
  • Uniqueness needs more: strict convexity excludes multiple minimizers, if a minimizer exists.
  • Existence needs more: a convex loss can approach its infimum without attaining it.

Next: a useful shape does not itself tell us how to compute the solution.

Fitting models with local information

A well-behaved shape still requires a numerical route to the solution

OLS: solve linear normal equations.

Logistic regression: repeatedly evaluate and improve the coefficients.

The objective is convex; our next task is to turn local information into useful steps.

Logistic loss has flatter tails than squared error

  • Each curve is the loss for one example, with its label fixed at \(y=0\) or \(y=1\).
  • Squared error has constant curvature; log loss flattens toward a confident correct prediction.
  • For \(y=1\), log loss decreases as the score grows; for \(y=0\), it decreases as the score falls.

A derivative predicts the effect of a small parameter change

First-order Taylor expansion centered at \(\theta\), for a small change \(\Delta\):

\[J(\theta+\Delta)\approx J(\theta)+J'(\theta)\Delta.\]

  • If \(J'(\theta)>0\), a small negative change reduces the objective.
  • If \(J'(\theta)<0\), a small positive change reduces it.
  • This is a local approximation, not a prediction for an arbitrary step.

A gradient collects the partial derivatives

Bundle the parameters into \(\boldsymbol{\theta}=(w_1,\ldots,w_d,b)^{\mathsf T}\).

\[ \nabla J(\boldsymbol{\theta})= \begin{bmatrix} \partial J/\partial w_1 & \cdots & \partial J/\partial w_d & \partial J/\partial b \end{bmatrix}^{\mathsf T}. \]

For a small vector change \(\boldsymbol{\Delta}\):

\[J(\boldsymbol{\theta}+\boldsymbol{\Delta}) \approx J(\boldsymbol{\theta})+\nabla J(\boldsymbol{\theta})^{\mathsf T}\boldsymbol{\Delta}.\]

The gradient has one component per parameter.

Moving against the gradient gives local descent

For \(\alpha>0\), choose \(\boldsymbol{\Delta}=-\alpha\nabla J(\boldsymbol{\theta})\).

\[ \nabla J(\boldsymbol{\theta})^{\mathsf T}\boldsymbol{\Delta} =-\alpha\|\nabla J(\boldsymbol{\theta})\|_2^2\le0. \]

This motivates the repeated update

\[\boldsymbol{\theta}_{t+1}=\boldsymbol{\theta}_t-\alpha\nabla J(\boldsymbol{\theta}_t).\]

Next: inspect what these finite steps do when we can see only the local slope.

Small steps follow the local downhill direction

Same objective, same starting point. Learning rate: \(\alpha=2.0\).

Parameter θObjective J(θ)Full unregularized logistic loss — revealed last

The algorithm sees this point and this slope.

A negative-gradient step uses that local information.

Gold segments show only the slopes we have evaluated.

The objective falls; the slope keeps its sign.

Three steps approach the minimum.

What happens after this larger step?

Same objective, same starting point. Learning rate: \(\alpha=6.0\).

Parameter θObjective J(θ)Full unregularized logistic loss — revealed last

After the next update, what happens?

A. Objective decreases; slope keeps its sign.
B. Objective decreases; slope reverses sign.
C. Objective increases; slope keeps its sign.
D. Objective increases; slope reverses sign.

B. The objective falls, but the slope reverses: we jumped across the valley.

Three steps approach the minimum.

What happens when we take an even larger step?

Same objective, same starting point. Learning rate: \(\alpha=12.0\).

Parameter θObjective J(θ)Full unregularized logistic loss — revealed last

After the next update, what happens?

A. Objective decreases; slope keeps its sign.
B. Objective decreases; slope reverses sign.
C. Objective increases; slope keeps its sign.
D. Objective increases; slope reverses sign.

D. The objective rises and the slope reverses: we jumped too far.

Continuing these updates settles into an oscillation instead of reaching the minimum.

The gradient is an average of example contributions

If \(J(\boldsymbol{\theta})=\frac1n\sum_i\ell_i(\boldsymbol{\theta})\), then

\[\nabla J(\boldsymbol{\theta})=\frac1n\sum_i\nabla\ell_i(\boldsymbol{\theta}).\]

Update Examples used for one gradient estimate
Full-batch GD All \(n\) examples
Single-example SGD One randomly sampled example
Mini-batch SGD A small randomly sampled group \(B\)

All use \(\boldsymbol{\theta}_{t+1}=\boldsymbol{\theta}_t-\alpha_t\boldsymbol{g}_t\).

Sampling trades exact direction for cheaper, noisy updates

For uniform sampling at the current parameters:

\[\boldsymbol{g}_B=\frac1{|B|}\sum_{i\in B}\nabla\ell_i(\boldsymbol{\theta}), \qquad \mathbb E_B[\boldsymbol{g}_B\mid\boldsymbol{\theta}]=\nabla J(\boldsymbol{\theta}).\]

  • One stochastic step can increase the full training objective.
  • Larger batches usually reduce gradient noise but cost more per update.
  • Compare runs by examples processed or time, not only update count.

A fixed learning rate can leave persistent fluctuations near the minimum.

Adam averages directions and adapts each coordinate scale

For the current gradient estimate \(\boldsymbol{g}_t\):

\[\boldsymbol{m}_t=\beta_1\boldsymbol{m}_{t-1}+(1-\beta_1)\boldsymbol{g}_t, \qquad \boldsymbol{v}_t=\beta_2\boldsymbol{v}_{t-1}+(1-\beta_2)\boldsymbol{g}_t^2.\]

The hats correct the initial bias from \(\boldsymbol m_0=\boldsymbol v_0=\boldsymbol 0\): \[\widehat{\boldsymbol m}_t=\frac{\boldsymbol m_t}{1-\beta_1^t},\qquad \widehat{\boldsymbol v}_t=\frac{\boldsymbol v_t}{1-\beta_2^t}.\]

\[\boldsymbol{\theta}_{t+1}=\boldsymbol{\theta}_t- \alpha\frac{\widehat{\boldsymbol{m}}_t}{\sqrt{\widehat{\boldsymbol{v}}_t}+\epsilon}.\]

Average the recent directions; rescale coordinates with large recent squared gradients.

The base learning rate still matters. Adaptation is not a convergence guarantee.