Skip to main content
AI / MLTraining & TuningDiagramBeginner

Gradient Descent

KO: 경사하강법·EN: Gradient Descent·JA: 勾配降下法

The foundational iterative optimization algorithm in deep learning that updates model weights in the opposite direction of the loss function's gradient to minimize error

Table of Contents

Structure Diagram

Loss Convergence by Learning Rate Schedule
Optimization Steps →Loss
(60, 20)Steady Convergence
Quick Answer

What is Gradient Descent?

The foundational iterative optimization algorithm in deep learning that updates model weights in the opposite direction of the loss function's gradient to minimize error. It is a core concept in Training & Tuning within AI / ML.

Core Principles

Gradient Descent minimizes a loss function $L(\theta)$ by iteratively stepping opposite to its gradient: $\theta \leftarrow \theta - \eta \nabla L(\theta)$, where $\eta$ is the learning rate.

Deep learning scales this via Mini-batch Stochastic Gradient Descent (SGD) and adaptive momentum optimizers like AdamW, which maintain per-parameter moving averages for fast, stable convergence.

Practical Takeaways

  • Pair Warmup with Cosine Decay: Ramping the learning rate up over the first 3–5% of steps prevents early instability, while cosine decay settles smoothly into a sharp minimum.
  • Use Gradient Clipping and Accumulation: Clip gradient norms (max_grad_norm=1.0) to prevent loss spikes, and accumulate micro-batches to simulate large effective batch sizes on limited VRAM.
  • Budget for AdamW optimizer states: Standard AdamW stores two FP32 moments per trainable parameter; switch to 8-bit AdamW or LoRA when GPU memory is tight.

Notable Examples

  • LLM Pre-training & SFT: Uses AdamW with warmup + cosine learning-rate decay as the universal baseline.
  • LoRA Fine-Tuning: Typically requires ~10× higher learning rates (1e-4–2e-4) than full fine-tuning (1e-5).
  • Distributed FSDP / ZeRO Training: Averages mini-batch gradients across GPUs while sharding optimizer states.