Skip to content
nonconvexcard

Simulate and compare convergence rates

CodingIntermediate⏱ 1 hourAdvanced Optimizationsimulationmomentumnesterovrates

Problem

Implement gradient descent, heavy ball, Nesterov and conjugate gradient on a quadratic with controllable κ\kappa.

  1. Verify each method's predicted rate by fitting the slope of log⁡(f(xt)−f⋆)\log(f(x_t)-f^\star).
  2. Confirm that the advantage of momentum grows as κ\sqrt\kappa versus κ\kappa.
  3. Show heavy ball diverging when η\eta is set too large, and identify the threshold.

Implement it, then check the implementation against something you can verify independently.

Write it

Solve it here8 tests · Python runs in your browser
⌘/Ctrl + ↵ to run · limit 90s · draft saved in this browser
8 tests will run against your code. The first run downloads the Python runtime — several megabytes, once per browser.

Solution

Opening this before you have a real attempt on paper is the fastest way to feel like you understand something you cannot reproduce.

Related problems

All problems
SolvedProblemFieldTypeDifficultyTime
Simulate distance contrast runClassical MLCodingBeginner30 min
Balls into bins, with one choice and with two runAI SystemsCodingIntermediate1 hour
Cache hit rates under Zipf popularity runAI SystemsCodingIntermediate1 hour
Measure anisotropy in an embedding space runRAGCodingIntermediate1 hour
Measure fan-out amplification and the value of hedging runAI SystemsCodingIntermediate1 hour