An ML twin: smooth a noisy training-loss curve with a rolling mean over the last w steps. From averaging every window from scratch (O(n·w)), to a running sum with a queue (O(n), O(w) memory), to an exponential moving average with bias correction (O(1) memory, what dashboards use). Then NaNs, float drift, time-based windows over irregular logs, and rolling medians.
about 10 min 4 Python examples 2 quick checks
Task. Given per-step training losses, return the rolling mean over the last w steps at every step. Before
step w, average whatever steps exist so far.
ML context. Raw per-step loss is noisy: minibatches differ, learning rates warm up, some batches are hard. Every
training dashboard smooths it so you can see the trend, decide on early stopping, or catch a divergence. The two
standard smoothers are the rolling mean (a window) and the exponential moving average (what the smoothing
slider in most dashboards does). Both need to run per step, forever, without slowing training down.
1. Step 1: Clarify
That's the preview. Modules 00–01 are free; this lesson is part of Unrolled Pro.
Staff AI & Pro Tier Lesson
Unlock "Rolling Mean of Training Loss"
The foundations are free forever. Unrolled Pro unlocks the complete lesson, production architectures, and 55 battle-tested ML system design case studies.
Everything included with Pro:
All 234+ Deep-Dive Lessons across transformer internals, inference, RAG & agents
55 Staff-Level ML & System Design Case Studies with mathematical capacity estimates
AI Engineer Sheet & Exercises with worked solutions, self-checks, and code
100 Landmark Research Papers guided walkthroughs & progress tracking
14-Day Money-Back Guarantee — 100% full refund if you aren't satisfied