Bring the mental model from Adam Optimizer; this page will reuse it instead of restarting from zero.
Loss Landscapes, Sharpness & Flat Minima
How 2D loss slices, Hessian curvature, SAM-style neighborhood loss, and a toy 2/eta stability line expose local sensitivity during optimization.
01
Intuition
Build the mental picture first so the rest of the page has something to attach to.
Training is "roll downhill on a surface", but for neural nets that surface lives in a space with millions (or billions) of dimensions.
So when people show a 2D loss landscape, it is not the landscape. It is a slice: a tiny window into how loss changes along a couple of directions in parameter space.
Even so, those slices teach something real:
- Sharp minima: a tiny weight perturbation makes loss jump. These are useful local sensitivity diagnostics, but their meaning depends on the chosen perturbation scale and parameterization.
- Flat minima: you can wiggle weights a bit and loss barely changes. Flatter regions are often studied as generalization correlates, not as universal guarantees.
SAM makes one version of this bias explicit: optimize for low loss in a small neighborhood, not just at one point. Other optimizer tricks are often discussed through similar flatness intuitions, but they need their own sources before becoming checked claims here.
Copy-only prompts — each action copies a page-grounded prompt to your clipboard. Nothing is sent by this site.
02
Math
Translate the story into symbols, assumptions, and a derivation you can inspect.
Let L(w) be the training loss for parameters w. Near a point w, a quadratic approximation is:
where H(w)=∇2L(w) is the Hessian (curvature).
A common proxy for "sharpness" is how much loss can increase under a small perturbation. SAM turns that local-neighborhood idea into an objective:
Here Δρ is the local loss-increase proxy. SAM optimizes the worst-case training loss in the ρ-neighborhood, and in practice approximates the inner maximizer with a single step in the gradient direction before updating from the perturbed weights ∇L(w+ϵ^(w)).
Copy-only prompts — each action copies a page-grounded prompt to your clipboard. Nothing is sent by this site.
03
Code
Keep the implementation aligned with the notation so the algorithm is legible.
import numpy as np
# Anisotropic quadratic: sharp along x (large curvature), flat along y (small curvature).
a, b = 20.0, 1.0 # Hessian eigenvalues
lam_max = max(a, b)
def L(w): return 0.5 * (a * w[0] ** 2 + b * w[1] ** 2)
def grad(w): return np.array([a * w[0], b * w[1]])
print("stable if eta < 2/lambda_max =", round(2.0 / lam_max, 3))
for eta in [0.02, 0.08, 0.12]:
w = np.array([1.0, 1.0])
ok = True
for _ in range(60):
w = w - eta * grad(w)
if not np.isfinite(L(w)) or np.linalg.norm(w) > 1e6:
ok = False; break
print("eta =", eta, "final L =", round(L(w), 6), "status =", "ok" if ok else "diverged")
Copy-only prompts — each action copies a page-grounded prompt to your clipboard. Nothing is sent by this site.
04
Interactive Demo
Use direct manipulation to connect the explanation to a moving system.
Live Concept Demo
Explore Loss Landscapes, Sharpness & Flat Minima
The stage is code-native and interactive. Use it to test the explanation against the mechanism.
Manipulate one control and predict the visible change.
Choose what to inspect in Loss Landscapes, Sharpness & Flat Minima. This shared fallback is an observation guide, not evidence of learning.
This notebook page now has two focused stages:
- Stage 1: a 2D loss slice with local Hessian curvature through a λmax sharpness proxy, SAM's perturbation ball, and a prediction check comparing SGD and SAM endpoint sharpness in the toy.
- Stage 2: a toy stability-line demo that asks whether a sharpness trace stays safely below the local quadratic GD line 2/η, hovers near this toy threshold, or crosses into divergence.
The 3D surface remains a separate legacy exploration and should receive its own rollout slice later.
Copy-only prompts — each action copies a page-grounded prompt to your clipboard. Nothing is sent by this site.
Concept: Loss Landscapes, Sharpness & Flat Minima
What is the smallest example that makes Loss Landscapes, Sharpness & Flat Minima click without losing the math?
Object contextOptimization
concept:optimization/loss-landscapesLoss Landscapes, Sharpness & Flat Minima
What is the smallest example that makes Loss Landscapes, Sharpness & Flat Minima click without losing the math?
Start with the prediction checkpoint, then compare the reveal to the mental model.
Take this moveStudy modes
Keep the object fixed; change the lens.Route back through the notebook
Carry the same object through intuition, math, code, and demo.
How 2D loss slices, Hessian curvature, SAM-style neighborhood loss, and a toy 2/eta stability line expose local sensitivity during optimization.
The next edge should feel earned: use the demo prediction here before following Overparameterization & Generalization (Double Descent).
After The First Pass
Turn the concept into an inspected object.
The lower panels are one second act: keep the object fixed, inspect it visually, check source boundaries, practice transfer, then attach the research question.Mechanism Storyboard
See the idea move before the page explains it
How 2D loss slices, Hessian curvature, SAM-style neighborhood loss, and a toy 2/eta stability line expose local sensitivity during optimization.

Start with the picture, metaphor, or geometric mechanism.
Before reading further, choose the kind of change Loss Landscapes, Sharpness & Flat Minima should make visible.
Visual Inquiry
Make the image answer a mathematical question
How 2D loss slices, Hessian curvature, SAM-style neighborhood loss, and a toy 2/eta stability line expose local sensitivity during optimization.
Which visible object should carry the first intuition?
Pick the cue that should make Loss Landscapes, Sharpness & Flat Minima easier to reason about before the page gives the answer.
Source Grounding
Canonical references for the mechanism on this page.
What is the smallest example that makes Loss Landscapes, Sharpness & Flat Minima click without losing the math?
concept:optimization/loss-landscapessources: li-2017-loss-landscape-visualization, keskar-2016-sharp-minima, foret-2020-sam
Open the closest source note before trusting the local explanation.
3 selected-object sources shown first; 3 references total.
Audit the claim boundary, then ask from the same selected object.
Grounds 2D loss-slice visualization and filter-normalized landscape comparisons.
Li supports 1D/2D slices and filter-wise normalization caveats. Keskar supports sharp/flat minima as perturbation-sensitivity diagnostics tied to generalization, while using an imperfect...
Does not source edge-of-stability theory, 2/eta stability code, Stage 2 EdgeOfStabilityViz wording, real-network Hessian spectra beyond cited context, universal flat-minima guarantees, pa...
Grounds the sharp-vs-flat minima discussion and its connection to generalization.
Li supports 1D/2D slices and filter-wise normalization caveats. Keskar supports sharp/flat minima as perturbation-sensitivity diagnostics tied to generalization, while using an imperfect...
Does not source edge-of-stability theory, 2/eta stability code, Stage 2 EdgeOfStabilityViz wording, real-network Hessian spectra beyond cited context, universal flat-minima guarantees, pa...
Grounds SAM-style neighborhood loss as an optimization objective that penalizes local sharpness.
Li supports 1D/2D slices and filter-wise normalization caveats. Keskar supports sharp/flat minima as perturbation-sensitivity diagnostics tied to generalization, while using an imperfect...
Does not source edge-of-stability theory, 2/eta stability code, Stage 2 EdgeOfStabilityViz wording, real-network Hessian spectra beyond cited context, universal flat-minima guarantees, pa...
Claim Review
How 2D loss slices, Hessian curvature, SAM-style neighborhood loss, and a toy 2/eta stability line expose local sensitivity during optimization.
What is the smallest example that makes Loss Landscapes, Sharpness & Flat Minima click without losing the math?
concept:optimization/loss-landscapessources: li-2017-loss-landscape-visualization, keskar-2016-sharp-minima, foret-2020-sam
Treat every claim as provisional until source support and a local witness agree.
1 structured claim check on this concept.
Run the prediction or practice transfer before asking for a grounded review.
Publisher-side editorial review is not independent replication. Claims without it still need exact source-support review. 3 references and 3 local witnesses are available for inspection.
Li supports 1D/2D slices and filter-wise normalization caveats. Keskar supports sharp/flat minima as perturbation-sensitivity diagnostics tied to generalization, while using an imperfect epsilon-scale-depend...
Does not source edge-of-stability theory, 2/eta stability code, Stage 2 EdgeOfStabilityViz wording, real-network Hessian spectra beyond cited context, universal flat-minima guarantees, parameterization-invar...
Li supports low-dimensional 1D/2D slices and filter-normalized comparisons. Keskar supports sharp/flat minima as perturbation-sensitivity diagnostics tied to generalization but with an imperfect epsilon-dependent metric. Foret supports SAM's worst-case neighborhood objective and first-order perturbation approximation. Reviewed scope excludes edge-of-stability, the 2/eta code, Stage 2, real-network Hessian spectra beyond cited context, universal flat-minima guarantees, and parameterization-invariant sharpness.
Reviewer: codex+oracle; reviewed 2026-05-07Practice notebook
Use the idea, then test it somewhere new
How 2D loss slices, Hessian curvature, SAM-style neighborhood loss, and a toy 2/eta stability line expose local sensitivity during optimization.
What is the smallest example that makes Loss Landscapes, Sharpness & Flat Minima click without losing the math?
concept:optimization/loss-landscapessources: li-2017-loss-landscape-visualization, keskar-2016-sharp-minima, foret-2020-sam
Use one state from Loss Landscapes, Sharpness & Flat Minima to explain what changes, why it changes, and which assumption the explanation needs.
No learner move yet; no learning state is inferred.
Write first, use only the help you need, then try a new case without it.
Use one state from Loss Landscapes, Sharpness & Flat Minima to explain what changes, why it changes, and which assumption the explanation needs.
Reveal when your model needs a nudge.
Reveal when your model needs a nudge.
Reveal when your model needs a nudge.
Write an attempt before asking the companion.
0 of 3 progressive hints opened.
This draft and any AI response do not establish mastery; a later unassisted case can.
- ObjectConceptLoss Landscapes, Sharpness & Flat Minima
- PredictBefore revealLoss Landscapes, Sharpness & Flat Minima prediction
- WitnessCompare codeLoss Landscapes, Sharpness & Flat Minima code witness 1
- RoomAsk groundedChecking local snapshot
Research Room
Attach the question to an exact object
Pick the concept, equation, source, code witness, claim, misconception, or demo state before asking for help. The handoff stays grounded to that object.Open the draft below to save one note and next action in this browser.
Loss Landscapes, Sharpness & Flat Minima
What is the smallest example that makes Loss Landscapes, Sharpness & Flat Minima click without losing the math?
These are fixed, deterministic perspectives derived from the selected object. They do not represent people, community contributions, or independent review.
Source ids li-2017-loss-landscape-visualization, keskar-2016-sharp-minima, foret-2020-sam must support the exact object, not just the surrounding topic.
Treat this as a mechanism object: connect the definition to one equation, code witness, or demo before broadening the discussion.
Ask the learner to perturb one representation, then check whether the same invariant survives in math, code, and demo.
The learner can state the mechanism in their own words
Local action draftNo local draft saved yetExpand only when ready to capture one local next action
This draft stays locally in this browser for concept:optimization/loss-landscapes.
- Source ids to inspect: li-2017-loss-landscape-visualization, keskar-2016-sharp-minima, foret-2020-sam
- Definition, prerequisite, and contrast concept links
- The equation or code witness that makes the concept operational
- One demo state that shows the invariant instead of a slogan
- The learner can state the mechanism in their own words
- The learner can name the prerequisite that would repair confusion
- The learner can predict how the mechanism changes under one perturbation
I am working in Continuous Function's research reading room. Object: concept - Loss Landscapes, Sharpness & Flat Minima Object key: concept:optimization/loss-landscapes Context: Optimization Anchor id: concept/concept-notebook/optimization/loss-landscapes Open question: What is the smallest example that makes Loss Landscapes, Sharpness & Flat Minima click without losing the math? Evidence to inspect: - Source ids to inspect: li-2017-loss-landscape-visualization, keskar-2016-sharp-minima, foret-2020-sam - Definition, prerequisite, and contrast concept links - The equation or code witness that makes the concept operational - One demo state that shows the invariant instead of a slogan Deterministic role lenses for this object: - Boundary: fixed perspectives, not people, community contributions, or independent review - Source-checking summary: Treat this as a mechanism object: connect the definition to one equation, code witness, or demo before broadening the discussion. - Proposed experiment: Ask the learner to perturb one representation, then check whether the same invariant survives in math, code, and demo. - Teach/transfer move: Turn the mechanism into one sentence that predicts a neighboring concept. - Assumptions: - Source ids li-2017-loss-landscape-visualization, keskar-2016-sharp-minima, foret-2020-sam must support the exact object, not just the surrounding topic. - The stable content-object key lets local drafts, prompts, and route memory attach without changing the source page. - The concept explanation is local atlas prose until checked against its math, code, and source support. - Prerequisite gaps should become a repair route, not a reason to leave the object vague. - Role-lens requests: - Learner: ask for "Ask what would make "Loss Landscapes, Sharpness & Flat Minima" feel predictable rather than familiar." | assumption: Source ids li-2017-loss-landscape-visualization, keskar-2016-sharp-minima, foret-2020-sam must support the exact object, not just the surrounding topic. | next action: The learner can state the mechanism in their own words - Researcher: ask for "Source ids to inspect: li-2017-loss-landscape-visualization, keskar-2016-sharp-minima, foret-2020-sam" | assumption: The stable content-object key lets local drafts, prompts, and route memory attach without changing the source page. | next action: The learner can name the prerequisite that would repair confusion - Experimenter: ask for "Choose one variable or condition to perturb before asking for an explanation." | assumption: The concept explanation is local atlas prose until checked against its math, code, and source support. | next action: The learner can predict how the mechanism changes under one perturbation - Professor: ask for "Find the smallest transferable rule a learner could reuse without the AI." | assumption: Prerequisite gaps should become a repair route, not a reason to leave the object vague. | next action: Teach or transfer: Turn the mechanism into one sentence that predicts a neighboring concept. What would resolve this: - The learner can state the mechanism in their own words - The learner can name the prerequisite that would repair confusion - The learner can predict how the mechanism changes under one perturbation Answer as a careful research tutor: stay source-grounded, separate verified evidence from assumptions, name the relevant math objects, and end with one next action. Current deterministic role lens for this object: - Role lens: Learner - Evidence request: Ask what would make "Loss Landscapes, Sharpness & Flat Minima" feel predictable rather than familiar. - Assumption to keep visible: Source ids li-2017-loss-landscape-visualization, keskar-2016-sharp-minima, foret-2020-sam must support the exact object, not just the surrounding topic. - Proposed experiment: Ask the learner to perturb one representation, then check whether the same invariant survives in math, code, and demo. - Next action: The learner can state the mechanism in their own words
concept/concept-notebook/optimization/loss-landscapes
concept:optimization/loss-landscapes