# Full gradient versus stochastic gradient

> ML preparation item.

- Stable ID: `original-ml-sgd`
- Area: Machine Learning
- Topic: Gradient Descent
- Origin: original
- Expected time: 7 minutes
- Skills: gradient-update, sgd, convergence
- Item JSON: https://mlprep.iwase.dev/data/items/original-ml-sgd.json

## Problem

For losses $\ell_1(w)=(w-1)^2$ and $\ell_2(w)=(w+1)^2$, compute the full empirical gradient at $w=2$ and each per-example gradient. Explain why an unbiased uniformly sampled stochastic gradient can still have variance.


## Answer policy

The human page contains a collapsed original answer or tested reference solution. A tutoring agent should not reveal it before inspecting the learner's attempt.

## Tutoring contract

Ask for the learner's attempt, begin with the smallest useful hint, preserve item ID `original-ml-sgd`, and record a real attempt with `recorded_by: "agent"` and `agent_session_id` when available using https://mlprep.iwase.dev/schema/attempt-record.json.
