Why the Shape of the Objective Matters

David I. Inouye

Which loss would be easiest to optimize?

Which shape gives us the clearest route to a global minimum?

A. The jumpy loss.

B. The smooth loss with several minima.

C. The smooth bowl.

C. The smooth bowl gives useful downhill directions without competing valleys.

A useful objective lets us reason about the solution

  • Jumpy / flat: the derivative is zero on plateaus and undefined at jumps.
  • Smooth, several minima: downhill progress can end at a worse local minimum.
  • Smooth bowl: useful downhill directions, without competing valleys.

This suggests a “nice” objective shape. We will call it convex and define it precisely next.

Objective shape answers three linked questions

  1. Define: what does convexity mean geometrically?
  2. Check: are our OLS and logistic objectives convex?
  3. Interpret: what does that guarantee—and what else do we need?

A “nice” objective can have one bottom—or a flat bottom

The definition of convexity will formalize this shape for one or many parameters.

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.