AI GLOSSARY · AI CONCEPTS
Stochastic gradient descent (SGD)
Definition
Stochastic gradient descent (SGD) is an optimisation method that trains a model by repeatedly nudging its parameters to reduce error, using one example or a small batch of data at a time instead of the whole dataset.
Also called: SGD, SGD optimizer, SGD machine learning, mini-batch gradient descent, minibatch SGD.
In plain language
Training a model means adjusting many numbers until its errors shrink. Gradient descent does that by checking which direction lowers the error and taking a step. Stochastic gradient descent takes each step after looking at just one example or a small handful, so it is like improving a recipe after each taste instead of after cooking for the whole village. Steps are cheaper, but they are noisier, so progress wobbles. The step size and other settings must be chosen, and a poor choice can make training slow or unstable. Running it on large models costs computing time, which can mean real money.
Technical definition
SGD updates parameters using a gradient estimated from a single sample or a small mini-batch, rather than the entire training set as batch gradient descent does. According to IBM, the term SGD is loosely used for mini-batch gradient descent, strict single-sample SGD is uncommon in practice, and its convergence is noisier than full-batch gradient descent. The scikit-learn guide calls it an optimisation technique rather than a model family, and notes that it needs hyperparameters such as the regularisation parameter and number of iterations and is sensitive to feature scaling. The Keras SGD optimizer adds an optional momentum term.
Worked examples in this catalogue
Catalogue examples point at a skill, guide or coding tool listed on this site, with what to run and what you see. An example marked illustrative describes the item from its own documentation; it was not executed for this page. Platform Scores are our assessment under a published method, not a safety guarantee.
Skill by Skill Almanac · Illustrative, not executed
split-leakage-check 53/100 · Provisional, not yet measuredScored · Method v0.2 · How we score
- What you see
- The skill checks train, validation and test files for duplicates, shared groups, time and label leakage and prints JSON.
- Why it exercises the concept
- A contrast case. SGD fits a model on training data, and this skill checks that the data splits around that fit are clean. It does not train anything. The catalogue has no optimiser skills, and this is illustrative, not executed.
Skill by Skill Almanac · Illustrative, not executed
data-analysis-eda 56/100 · Provisional, not yet measuredScored · Method v0.2 · How we score
- What you see
- The skill is a fixed exploratory-analysis procedure and CSV profiler that keeps findings descriptive, evidenced and caveated.
- Why it exercises the concept
- The scikit-learn guide says SGD is sensitive to feature scaling. Profiling columns beforehand can show their ranges, though the skill does no scaling or training. This is illustrative, not executed.
Skill by Skill Almanac · Illustrative, not executed
llm-cost-estimator 56/100 · Provisional, not yet measuredScored · Method v0.2 · How we score
- What you see
- The skill turns a usage profile and your own price table into a monthly LLM cost range with cache, batch and subscription effects.
- Why it exercises the concept
- A contrast case about cost. It estimates the cost of using a model, which is a different matter from the compute cost of training one with SGD. This is illustrative, not executed.
How it shows up when you use agents
SGD shows up when an agent writes or tunes training code. If you ask Claude Code, Codex or Cursor for a classifier, the script may name an SGD optimizer, in scikit-learn's SGDClassifier or as a Keras optimizer. You will see settings such as a learning rate, a batch size and a number of epochs, and a loss value that falls unevenly from step to step.
What breaks when it is misunderstood: the settings and the data. The scikit-learn guide says SGD needs hyperparameters and is sensitive to feature scaling, and it recommends standardising features and applying the same scaling to the test data. An agent that skips scaling can produce a model that trains badly while the code runs without errors. The word SGD also hides a choice: IBM says it is often used loosely to mean mini-batch gradient descent, so check the batch size actually used.
A practical next step: ask the agent which batch size, learning rate and scaling it used, and why. See Gradient descent, Learning rate and Batch size. The catalogue has no skills that train or tune models, so the examples are contrast cases.
Common confusions
- SGD versus gradient descent. Batch gradient descent uses the entire training set for each update. SGD uses one sample or a small batch, which IBM says gives noisier convergence.
- SGD versus mini-batch. IBM says strict single-sample SGD is uncommon in practice and the term is often used for mini-batch gradient descent.
- SGD versus a model. The scikit-learn guide says SGD is an optimisation technique and does not correspond to a specific family of models. It is a way to train one.
- Myth: SGD needs no tuning. The scikit-learn guide lists hyperparameters and feature scaling among its disadvantages.
Related terms
Terms that mention Stochastic gradient descent (SGD)
5 terms mention this one
More in AI concepts
Sources
- Stochastic Gradient Descent, scikit-learn (accessed 2026-11-24)
- What is stochastic gradient descent?, IBM (accessed 2026-11-24)
- SGD optimizer, Keras (accessed 2026-11-24)
Definitions are written by Skill Almanac from these sources and were checked against them on 2026-11-25. Wikipedia is never the only source.
Review record
Last verified
Drafted by claude-sonnet-5-5; sources and example targets checked by Independent automated source review (OpenAI Codex); not human peer review on 2026-11-25. Last verified .
Change log (3)
- : Independent automated factual/example review completed. Cached US query estimate aligned to receipt; no traffic promise. Final technical gate recorded separately; publication disabled.
- : First version.
- : Automated review completed; approved for the staged public release. Search indexing is controlled by the release configuration.