惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

S
Secure Thoughts
雷峰网
雷峰网
罗磊的独立博客
T
The Blog of Author Tim Ferriss
阮一峰的网络日志
阮一峰的网络日志
量子位
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
云风的 BLOG
云风的 BLOG
人人都是产品经理
人人都是产品经理
GbyAI
GbyAI
Cisco Talos Blog
Cisco Talos Blog
Engineering at Meta
Engineering at Meta
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
A
About on SuperTechFans
D
Darknet – Hacking Tools, Hacker News & Cyber Security
The Cloudflare Blog
Know Your Adversary
Know Your Adversary
T
Threat Research - Cisco Blogs
Spread Privacy
Spread Privacy
D
DataBreaches.Net
T
The Exploit Database - CXSecurity.com
K
Kaspersky official blog
Cyberwarzone
Cyberwarzone
爱范儿
爱范儿
U
Unit 42
Security Latest
Security Latest
M
MIT News - Artificial intelligence
月光博客
月光博客
Scott Helme
Scott Helme
G
Google Developers Blog
有赞技术团队
有赞技术团队
T
Tor Project blog
宝玉的分享
宝玉的分享
Y
Y Combinator Blog
博客园 - Franky
H
Hackread – Cybersecurity News, Data Breaches, AI and More
aimingoo的专栏
aimingoo的专栏
The GitHub Blog
The GitHub Blog
V
V2EX
B
Blog
Apple Machine Learning Research
Apple Machine Learning Research
S
Securelist
博客园 - 三生石上(FineUI控件)
Blog — PlanetScale
Blog — PlanetScale
TaoSecurity Blog
TaoSecurity Blog
Stack Overflow Blog
Stack Overflow Blog
P
Proofpoint News Feed
腾讯CDC
D
Docker
Google Online Security Blog
Google Online Security Blog

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant Common SOC 2 Failures (Real World) Stop Vibe-Checking Your AI App: A Practical Guide to Evals How to Use SonarQube and SonarScanner Locally to Level Up Your Code Quality Your Next To-Do App Is Dead — I Replaced Mine with an OpenClaw AI Sign a Nostr event in 60 lines of Python using coincurve — no nostr-sdk, no nbxplorer, no rust toolchain ITGC Audit Explained Like You’re in Big 4 Patch Tuesday abril 2026: Microsoft parcha 163 vulnerabilidades y un zero-day en SharePoint Stop scraping everything: a better way to track competitor price changes Listing on MCPize + the Official MCP Registry while routing payments OUTSIDE the marketplace — how I kept 100% of my x402 revenue Building an AI-Powered Risk Intelligence System Using Serverless Architecture Why We Ripped Function Overloading Out of Our AI Toolchain Testing AI-Generated Code: How to Actually Know If It Works SaaS Churn Is Killing Your Business. Here Is What to Do About It (Without a Support Team) The Speed of AI Is No Longer Linear - And Self-Improving Models Are Why How to Implement RBAC for MCP Tools: A Practical Guide for Engineering Teams From Standard Quote to Persuasive Proposal: AI Automation for Arborists I built a CLI that scaffolds complete multi-tenant SaaS apps Axios CVE-2025–62718: The Silent SSRF Bug That Could Be Hiding in Your Node.js App Right Now The dashboard that ended our friendship Data Pipelines Explained Simply (and How to Build Them with Python) The Hidden Cost of AI Systems Nobody Talks About. undefined vs undeclared, and how typeof behaves Switching from file-based jobs to NATS/Kafka in Rust without changing code io_uring Adventures: Rust Servers That Love Syscalls Why Agentic AI is Killing the Traditional Database The POUR principles of web accessibility for developers and designers Quantum Neural Network 3D — A Deep Dive into Interactive WebGL Visualization How To Install Caveman In Codex On macOS And Windows Automation Pipeline Reliability: Why Your Workflow Breaks When Nobody Is Watching I Built an 'Open World' AI Coding Agent — It Works From ANY Folder From Freelancing to Product: A Tech Service Company's SaaS Transformation China's AI Giants: Adding Tencent Hunyuan & ByteDance Doubao to AI University (74 Providers) On the Vibe Coders and Their Lies clerk: Auto-Summarize Your Claude Code Sessions AI Weekly — 2026/04/10–04/17 | The Model Lockdown Is Here, but the Toolchain Is the Real Battleground AI 週報 — 2026/04/10–2026/04/17 模型封鎖潮來了,但工具鏈才是真戰場 Maybe this is how Open-Source apps are born... 🚀 Fine-Tune LLMs with LoRA and QLoRA: 2026 Guide tRPC v11 + Next.js App Router: End-to-End Type Safety Without the Boilerplate ShadCN UI in 2026: Why I Stopped Installing Component Libraries and Started Owning My Components SaaS Billing in React Server Components: Stripe + Supabase Without a Single `useEffect` Join our DEV Weekend Challenge — $1,000 in Prizes Across TEN winners! Submissions Due April 20 at 6:59 AM UTC. Implementing FSRS Spaced Repetition in Flutter + Supabase — Adding Memory Science to an AI Learning App "I Texted My Localhost From the Train — Claude Code Fixed the Bug Before I Got Home" I Built a Sales Prep AI and It Went Deeper Than Expected Design to Code #2: One JSON, Eleven Outputs Solving the 100M-Row Problem: A Summary Table Pattern for High-Volume Push Notification Logs Flutter Web With Wasm: What Actually Changes For Developers I Built 50 Royalty-Free Soundtracks for My Side Project in a Weekend Using AI Music Generation The Vibe Coding Security Checklist: 7 Things to Check Before You Ship Stop Letting Googlebot Guess Fix Your React App's SEO Right Desconstruindo o Streaming do LinkedIn: Como Criar um Engine de Extração de Vídeo de Alta Performance com HLS e FFmpeg (EDA Part-1) EDA (Exploratory Data Analysis) Explained With Real Life — Why Looking at Your Data Is the Most Important Step in Machine Learning Brand Relationship Management at Scale: Our 4-Touch Outreach System for 200+ Brands Why String.fromEnvironment() Might Return an Empty String in Dart JGuardrails 1.0.0 — Hardening Java LLM Apps Against Jailbreaks, Toxicity, and Prompt Injection Plan and Schedule a Full Week of Threads Content From One Claude Conversation Coding Cat Oran Ep3, Five Tables Changed Everything Updated: BFF Pattern I'm done watching freelancers get buried by 200 proposals. So I'm building the alternative. This is my first post BFS Algorithm in Java Step by Step Tutorial with Examples Tracking LLM Pricing Monthly: An Open Dataset for 22 AI Models How We Measure Content ROI on a Comparison Site: Revenue Attribution Without Perfect Data Introducing Nova AI Ops: The AI-Native Operating System for SRE Teams I built a free desktop video downloader for Windows — Grabbit How Talkie OCR Helps Vision-Impaired & Dyslexic Users Read the World Around Them VRCFaceTracking安装和iPhone面捕配置教程,有bug Even CrowdStrike Can't See Your Agents The Automation Gold Rush: What n8n Workflows and Claude Are Opening Up for Developers Right Now
Blog 3: Adaptive Learning Rate Methods (Part 1)
Harshil Rami · 2026-04-24 · via DEV Community

When one learning rate isn't enough — per-parameter scaling and the decay problem

Momentum gave the optimizer a memory across time.
Adaptive methods give it a memory across parameters.
Both are necessary. Neither is sufficient alone.

The problem with a single learning rate

Every optimizer we've covered so far shares one architectural assumption: a single scalar η governs every parameter in the model.

This seems reasonable until you think about what parameters actually experience during training.

Consider a language model's embedding table. It contains one vector per token in the vocabulary — perhaps 50,000 vectors, each of dimension 512. In any given mini-batch of 64 sequences, you might see 2,000 unique tokens. The remaining 48,000 tokens receive zero gradient for that entire step. When they do appear, their gradient signals are sparse, noisy, and infrequent.

Now consider the final projection layer — a dense 512×50,000 matrix. Every forward pass touches every row. Gradients are dense, consistent, and arrive every single step.

Both layers are updated with the same η.

This is the problem. Parameters that receive rare, informative signal should move aggressively when that signal arrives — their updates are precious. Parameters that receive dense, consistent signal should move conservatively — there's no rush, and overshooting is costly.

A global learning rate can't serve both regimes. Set it high and the dense layers oscillate. Set it low and the sparse layers barely move.

AdaGrad's answer: let each parameter maintain its own effective learning rate, derived automatically from its gradient history.

AdaGrad: accumulate, then scale

AdaGrad (Adaptive Gradient Algorithm — Duchi, Hazan & Singer, 2011) introduces a per-parameter accumulator Gₜ that tracks the sum of squared gradients seen so far.

Gₜ = Gₜ₋₁ + (∇L(θₜ))²        # element-wise square, accumulated
θₜ₊₁ = θₜ − (η / √(Gₜ + ε)) · ∇L(θₜ)

Enter fullscreen mode Exit fullscreen mode

Where ε (epsilon) is a small constant (typically 1e-8) added for numerical stability — it prevents division by zero when a parameter has received no gradient.

The update is element-wise: each parameter θᵢ has its own Gᵢ, and divides its gradient by √Gᵢ. No parameter borrows from another's accumulator.

What this achieves

Sparse parameters — infrequent updates, small accumulated G. Dividing by √G yields a large effective learning rate. When signal finally arrives, AdaGrad takes a proportionally large step.

Dense parameters — frequent updates, large accumulated G. Dividing by √G yields a small effective learning rate. Updates are conservative; the optimizer doesn't overfit to any single gradient.

AdaGrad is essentially performing an automatic, online normalization of learning rates. You no longer need to hand-tune separate learning rates for different parameter groups.

Where AdaGrad shines

This mechanism is particularly powerful for:

  • Sparse features in NLP (word embeddings, bag-of-words models)
  • Recommendation systems with millions of item/user embeddings
  • Convex optimization problems where the accumulated curvature information is always relevant

In fact, for convex problems, AdaGrad has provably optimal regret bounds in the online learning setting. This theoretical grounding is part of why it was so influential.

The learning rate as a function of time

It helps to think of AdaGrad as replacing the fixed learning rate η with an effective per-parameter rate:

ηᵢ_eff(t) = η / √(Σₛ₌₁ᵗ gᵢ,ₛ²)

Enter fullscreen mode Exit fullscreen mode

This is a monotonically decreasing function of time. Every gradient update, regardless of size, increases Gᵢ, which decreases ηᵢ_eff. The learning rate can only go down. It never recovers.

That property is exactly AdaGrad's fatal flaw.

AdaGrad's fatal flaw: the dying learning rate

In practice, AdaGrad's accumulator grows without bound. After enough training steps, Gₜ becomes so large that η/√Gₜ shrinks toward zero for every parameter — including the ones that still need to learn.

This is not a tuning problem. It is structural. The accumulator is a sum, not an average, and sums only increase.

The consequences are severe:

  • Training effectively stops after a certain number of steps, even if the model hasn't converged.
  • On non-stationary loss surfaces (which all deep learning surfaces are — the loss landscape shifts as other parameters update), old gradient information from early training becomes misleading. Parameters that moved quickly early on get permanently penalized for it, even if the relevant gradients now point in a completely different direction.
  • The "optimal for convex problems" guarantee doesn't transfer to deep learning, where the curvature landscape changes throughout training.

AdaGrad is excellent for shallow, convex problems with sparse features. For deep networks trained over many epochs, it usually fails in practice.

This is exactly the problem RMSProp was designed to fix.

RMSProp: forget the distant past

RMSProp (Root Mean Square Propagation — Hinton, 2012, unpublished but widely cited from his Coursera lectures) makes one targeted change to AdaGrad: replace the cumulative sum with an exponentially weighted moving average.

Eₜ = ρ · Eₜ₋₁ + (1 − ρ) · (∇L(θₜ))²     # running average of squared gradients
θₜ₊₁ = θₜ − (η / √(Eₜ + ε)) · ∇L(θₜ)

Enter fullscreen mode Exit fullscreen mode

Where ρ (rho) is the decay coefficient — typically 0.9 or 0.99. It controls how much weight is given to recent gradients vs. historical ones.

This is the exponential moving average (EMA) pattern — the same mechanism used in momentum. The difference here is that it's applied to squared gradients rather than the gradients themselves.

Why this works

With exponential decay, the effective window of "remembered" gradient history is roughly 1/(1−ρ) steps. At ρ = 0.9, that's ~10 recent steps. At ρ = 0.99, ~100 steps.

Old gradients from many hundreds of steps ago contribute essentially nothing to Eₜ. The accumulator doesn't grow forever — it's a sliding window. When the loss landscape shifts (as it always does in deep learning), the old curvature information fades out, and new curvature information takes over.

This is the key property AdaGrad lacked: adaptability over time, not just over parameters.

The geometry being captured

The denominator √Eₜ is an estimate of the root mean square of recent gradients for each parameter — hence the name. It approximates the local gradient scale without integrating all history.

Parameters that have recently received large gradients get scaled down. Parameters that have recently been quiet get scaled up. The key word is recently — unlike AdaGrad, this estimate is always locally relevant.

AdaGrad vs. RMSProp: direct comparison

AdaGrad:  Gₜ = Gₜ₋₁ + g²          → cumulative sum, unbounded growth
RMSProp:  Eₜ = ρ·Eₜ₋₁ + (1−ρ)·g²  → exponential decay, bounded estimate

Enter fullscreen mode Exit fullscreen mode

The structural difference is one line. The practical difference is enormous.

Property AdaGrad RMSProp
Accumulator Cumulative sum Exponential moving average
Learning rate over time Monotonically decreasing Stationary (fluctuates around a value)
Memory of past gradients All of history, equally weighted Recent history, exponentially weighted
Suitable for Convex, sparse, shallow models Non-convex, deep networks
Long training runs Fails (LR collapses) Works
Non-stationary landscapes Fails (stale curvature) Works
Key hyperparameter η η, ρ

RMSProp became the default adaptive optimizer for deep learning before Adam existed, and many practitioners still reach for it when they want something lighter than Adam.

Implementation

# AdaGrad
G = 0
for batch in dataloader:
    grad = compute_gradient(loss_fn, model, batch)
    G = G + grad ** 2
    theta = theta - (lr / (G ** 0.5 + eps)) * grad

# RMSProp
E = 0
for batch in dataloader:
    grad = compute_gradient(loss_fn, model, batch)
    E = rho * E + (1 - rho) * grad ** 2
    theta = theta - (lr / (E ** 0.5 + eps)) * grad

Enter fullscreen mode Exit fullscreen mode

In PyTorch:

# AdaGrad
optimizer = torch.optim.Adagrad(model.parameters(), lr=0.01, eps=1e-8)

# RMSProp
optimizer = torch.optim.RMSprop(model.parameters(), lr=0.001, alpha=0.9, eps=1e-8)

Enter fullscreen mode Exit fullscreen mode

Practical hyperparameter guidance:

  • AdaGrad: η = 0.01 is a reasonable start. There's little else to tune — the accumulator handles the rest.
  • RMSProp: ρ = 0.9 is standard. Use ρ = 0.99 for more stable but slower-adapting effective LR. η typically needs to be smaller than you'd use with SGD — start at 1e-3 or 1e-4.
  • Both methods are sensitive to ε. In low-precision training (float16, bfloat16), the default 1e-8 can cause numerical issues. Try 1e-6 or 1e-5 if you see NaN losses.

What's still missing

RMSProp solves the dying learning rate. It gives us per-parameter adaptivity that stays relevant throughout training. It's a genuinely good optimizer.

But look at the update rule again:

θₜ₊₁ = θₜ − (η / √(Eₜ + ε)) · ∇L(θₜ)

Enter fullscreen mode Exit fullscreen mode

There's no velocity term. No momentum. The update is still reactive — it responds to the current gradient, scaled by recent gradient history, but it doesn't accumulate direction the way momentum does.

We now have two powerful, independent ideas:

  1. Momentum — smooth out gradient noise by accumulating velocity over time
  2. Adaptive scaling — normalize updates by per-parameter gradient magnitude

Neither knows about the other. Both help convergence. The obvious question is: what happens if you combine them?

That's Blog 4. Adam takes exactly this step — it maintains both a first-moment estimate (momentum over gradients) and a second-moment estimate (RMSProp-style scaling), applies bias corrections to both, and produces one of the most robust general-purpose optimizers ever designed. Adamax, Nadam, and AMSGrad follow as targeted improvements on specific failure modes Adam introduces.

Three things to hold onto

Concept AdaGrad RMSProp
Core idea Accumulate squared gradients EMA of squared gradients
What it fixes Uniform LR across parameters Uniform LR across parameters
What it breaks Long-run training (LR → 0) Nothing fatal — but no momentum
Best use case Convex, sparse, shallow Deep networks, non-stationary

What's next

In Blog 4, the two threads of this series converge. Adam combines the first moment (gradient direction, momentum-style) with the second moment (gradient magnitude, RMSProp-style) into a single update, then applies bias corrections to prevent cold-start distortion. Adamax extends the second moment to the L∞ norm. Nadam swaps standard momentum for Nesterov lookahead. AMSGrad addresses Adam's theoretical non-convergence issue.

Each one is a targeted answer to a specific flaw in Adam's design. By the end of Blog 4, you'll have the full picture of why AdamW — not Adam — is the default for modern LLM training.

This is Blog 3 of an 8-part series on optimization algorithms for deep learning.