Citation and evidence

Step

Report a problem with this article

Edit article
More

Use this article

Raw MarkdownExplore connections

Improve this page

Revision historyDiscuss this article

Topics

Training & Optimization

Cite this article

In machine learning, a step is one unit of work in a particular procedure. A training log may count each parameter update as one step, even when several mini-batches contribute to that update. An environment step in reinforcement learning counts an action and its consequences. During image generation, a diffusion model takes sampling steps while its learned parameters stay fixed. The counter and what advances it determine how to interpret a figure such as "1,000 steps." [1][2][3]

What are the different meanings of "step" in machine learning?

ContextWhat a step counts or describesExample
TrainingOne update by the optimizerFour batches can contribute gradients to one update. [1]
Reinforcement learningOne transition in an environmentAn agent takes an action and receives a reward and a new observation. [2]
Diffusion samplingOne advance along the sampling scheduleThe original DDPM sampler moved through 1,000 noise levels in reverse order. [3]
Autoregressive decodingOne extension of an output sequenceOrdinary decoding generates one token per sequence at a time. [4]
Reasoning chainsAn intermediate part of a written solutionOne line of algebra may receive its own correctness label. [5]
Software pipelineA named stage in a sequence of operationsA dimensionality-reduction step can feed a classifier. [6]
Step decayA discrete change in the learning rateA scheduler can reduce the rate by a factor of ten every 30 epochs. [7]
Step activationA function that changes value at a thresholdA binary unit can return 0 below its threshold and 1 above it. [8]

Expanded article table

What is a training step (optimizer step)?

In supervised and self-supervised learning, a typical training loop draws a batch from the training set, runs the model to compute a loss, and uses backpropagation to calculate gradients. The optimizer step applies the update rule to the model parameters. In plain stochastic gradient descent, a parameter changes by minus the learning rate times its gradient. The rate controls the step size, while the step count records how often the rule runs. [9][10]

Other optimizers have more state to maintain. Adam updates running estimates of the first and second moments of the gradients. Its bias correction depends on how many updates have taken place. AdamW also applies weight decay separately from the gradient-based part of the update. [11][12]

With gradient accumulation, the loop performs forward and backward passes on several smaller batches, or micro-batches, before applying the accumulated gradients. In PyTorch Lightning, the model's training_step handles a batch, while Trainer.global_step tracks optimizer steps across the training run. With one optimizer and accumulate_grad_batches=4, four full batches produce four batch-level calls and one optimizer update. Validation can measure the loss without advancing that update counter. [1][9][13]

How does a step differ from an epoch and an iteration?

An epoch is one pass over a training dataset. An iteration is one pass through a specified loop. In the simplest loop there is one batch and one optimizer update per iteration. With accumulation, the batch loop runs several times per update. A log indexed by batch number can therefore show several losses between successive values of the optimizer's global step. [1][9][13]

For a dataset of 32,000 examples, a batch size of 32 and one update per batch give 1,000 steps per epoch, or 10,000 over ten epochs. With four batches of 32 accumulated per update, the same epoch takes 250 optimizer steps. For a dataset of 32,001 examples, the ordinary single-worker loader instead yields 1,001 batches if it keeps the final example, or 1,000 if it drops the incomplete batch. A final incomplete accumulation group also matters when calculating the number of updates from the number of batches. [1][9][14]

In synchronous data parallelism, workers train replicas on different data and combine their gradients for the same update. For equally sized, full batches, the number of examples contributing to one update is the product of the per-worker micro-batch size, the number of micro-batches accumulated, and the number of data-parallel workers. Eight workers processing 16 examples each and accumulating four micro-batches each therefore contribute 512 examples to one global step. [13]

How do learning rate schedules use step counts?

A schedule can use the optimizer update number to set the learning rate. During linear warmup from zero to a peak rate over a fixed number of updates, the rate halfway through warmup is half the peak. Implementations in Hugging Face Transformers accept a warmup length and, for linear or cosine decay, a total number of training steps. If four micro-batches contribute to each update, a 100-update warmup spans 400 full micro-batches. [1][15]

The original Transformer used 4,000 warmup steps, increasing the learning rate linearly and then decreasing it in proportion to the inverse square root of the step number. BERT used the first 10,000 of its 1 million pretraining steps for warmup to a peak learning rate of 0.0001, followed by linear decay. BERT also illustrates why step counts alone can conceal differences in cost. The researchers used sequence length 128 for the first 90% of steps and 512 for the remaining 10%. [16][17]

Step decay describes a staircase in the learning rate. For example, the PyTorch StepLR documentation shows a rate of 0.05 for the first 30 epochs, 0.005 for the next 30, and 0.0005 for the following 30. In the example, the training loop calls scheduler.step() once per epoch and the optimizer can update many times between scheduler calls. [7]

What is a step in reinforcement learning?

An environment step is one interaction in which the agent selects an action and the environment advances. In a Markov decision process, the underlying transition goes from one state to the next. The agent receives an observation, which may reveal only part of the state. [40] Gymnasium, the successor to OpenAI Gym, exposes this interaction through env.step(action). [2]

Return valueMeaning in Gymnasium
observationWhat the agent observes after taking the action. [2]
rewardThe reward the transition produced. [2]
terminatedWhether the task reached a terminal state. [2]
truncatedWhether an external condition, such as an imposed time limit, cut the episode short. [2][18]
infoAdditional information such as diagnostic quantities. [2]

Expanded article table

An episode starts with a reset and ends on termination or truncation. The flags matter for value estimation. After true termination, the return has no future reward term. After an external time limit interrupts a continuing task, a value-learning algorithm can still bootstrap from the last observation. A finite horizon built into the definition of the task is a different case and can represent true termination. [18]

CounterWhat advances it
Environment transitionsEach interaction with one environment. A call that steps eight active environments in parallel can collect eight transitions. [2][19]
Gradient stepsOptimizer updates using collected data. An off-policy algorithm can sample from experience replay several times between interactions. [20][21]
Emulator framesFrames of the simulated game, including those for which the agent repeats its previous action. [20][22]
Completed episodesEach trajectory that ends, regardless of how many transitions it contains. [2]

Expanded article table

In Atari, frame skipping can make frames and decisions differ by a factor of four. Mnih and colleagues described a DQN agent choosing an action every fourth frame. Google's later DQN Replay Dataset documented both units explicitly. Its protocol ran for 200 million emulator frames per training run and collected approximately 50 million experience tuples. A separate hyperparameter, the update-to-data ratio, measures how many gradient updates the agent makes per new interaction. This distinguishes the amount of training computation from the amount of experience collected. [20][21][22]

What is a step in a diffusion model?

In a denoising diffusion model, timestep can mean the noise level that conditions the network. In the original DDPM, the forward process added noise according to a schedule of 1,000 timesteps, with the variance increasing linearly from 0.0001 to 0.02. During training, the algorithm sampled a timestep and constructed a noisy example at that level directly. One optimizer update therefore did not require simulating the whole chain. At generation time the original sampler started from noise and made a reverse update at every timestep. [3]

MethodWhat the reported count measures
DDPMThe original sampler took 1,000 reverse updates per sample, with one denoiser evaluation per update. [3]
DDIMThe sampler can follow a shorter sequence of noise levels using the same training objective. The authors reported sampling 10 to 50 times faster than DDPM in wall-clock time in their experiments. [23]
DPM-SolverThe authors reported 10 to 20 network evaluations for their fast solver experiments. [24]
Consistency modelsThe learned mapping can generate a sample in one evaluation. Multistep sampling is also possible. [25]
Latent consistency modelsThe authors demonstrated two- to four-step inference for a distilled latent text-to-image model at 768 by 768 pixels. [26]
SDXL TurboAdversarial diffusion distillation allows one-step generation. Stability AI reported 207 milliseconds for a 512 by 512 image on an A100 in half precision, including prompt encoding and image decoding. The denoiser itself accounted for 67 milliseconds. [27][28]

Expanded article table

The number of sampling intervals, the values of the timesteps visited, and the number of times the network runs can all differ. A shorter DDIM schedule can skip many training timesteps on each update. The Heun sampler in NVIDIA's EDM implementation uses two evaluations on most intervals, then one on the final interval. Its documented 18-step configuration for CIFAR-10 takes 35 network evaluations per image. Counts labeled NFE (number of function evaluations) expose that cost directly. [23][29]

What is a decoding step in LLM inference?

During ordinary autoregressive decoding, a large language model extends a single sequence one token at a time. A decoder-only model first processes the prompt and produces the distribution for the first output token. Each subsequent decode iteration uses the preceding token and can reuse a KV cache containing earlier attention keys and values. A batch can advance several requests on the same iteration. [4][30]

For a response streamed one token at a time, the time until the final token arrives equals the time to first token plus the sum of the intervals between successive tokens. If 51 tokens arrive with a mean inter-token interval of 20 milliseconds, the final token arrives one second after the first. Time to first token can also include queueing, network time and prompt processing. These quantities describe the latency of an individual response. Throughput counts the tokens the serving system produces across requests per unit of time. [30]

In speculative decoding, a smaller draft model proposes multiple tokens and the target model scores them together. The exact sampling algorithm accepts a prefix using probabilities from both models. If it rejects a proposal, it samples a correction from an adjusted distribution. If all proposals pass, it can emit one more target-model token. The number of output tokens per target-model pass therefore varies, and the algorithm preserves the target model's output distribution. Leviathan and colleagues measured a two- to threefold speedup with T5-XXL against standard T5X decoding. AWS also benchmarked this technique on Trainium with vLLM and reported up to threefold acceleration for decode-heavy workloads. [4][31]

What is a reasoning step?

In chain-of-thought prompting, a reasoning step is part of the written path to an answer, such as substituting a value into an equation. One step can contain many tokens. Its boundaries depend on how the solution is written or how an annotation protocol divides it. For example, in Let's Verify Step by Step, the researchers prompted a language model to put each step on a separate line so human annotators could evaluate it. [5][32]

The OpenAI study compared two ways of training a reward model to rank candidate solutions to math problems. An outcome-supervised model received feedback about the completed solution. A process reward model received feedback on individual steps. The researchers collected approximately 800,000 step-level labels for the PRM800K dataset. [5][33]

Selection methodAccuracy when choosing among 1,860 solutions per problem
Majority vote over candidate answers69.6% [5]
Outcome-supervised reward model72.4% [5]
Process-supervised reward model78.2% [5]

Expanded article table

These figures describe a ranking experiment on 500 held-out MATH problems. Each problem had a pool of candidate solutions generated in advance. The score measures whether the selected answer was correct. Generating and scoring that pool took many more decoding steps than the number of lines in the selected solution. [5][33]

How do step counts relate to scaling laws?

Scaling laws for language models often express training budgets in tokens and floating-point operations. With a constant global batch of fully occupied sequences, tokens per optimizer step equal the number of sequences per update times their length. With variable lengths or batch sizes, the total is the sum of the tokens actually processed in each update. Kaplan and colleagues used the approximation C ≈ 6 × N × D, where N is the number of non-embedding parameters, D is the number of training tokens and C is the estimated training compute in floating-point operations. Their estimate for dense transformers omits context-dependent attention costs that were small for the configurations studied. [17][34]

Chinchilla had 70 billion parameters and trained on 1.4 trillion tokens, about 20 tokens per parameter. As a worked conversion, a hypothetical fixed batch of 1,024 full sequences of length 2,048 contains 2,097,152 tokens. Consuming 1.4 trillion tokens at that batch size would take roughly 668,000 optimizer steps. The Chinchilla researchers doubled the batch size midway through their actual run. [35]

The choice of budget depends on the goal. The Chinchilla study examined how to allocate a given training compute budget between parameters and tokens. The LLaMA researchers also considered inference costs and trained smaller models on more tokens than the training-only optimum would suggest. Even at fixed model size, a count of additional steps becomes a count of additional tokens only after the effective batch size and sequence lengths are known. [34][35][36]

What is the step (Heaviside) activation function?

The Heaviside step function is an activation function that jumps at a threshold. A binary perceptron can classify an input by applying the function to a weighted sum plus bias. One convention assigns the upper class at equality, giving H(x) = 1 for x >= 0 and H(x) = 0 for x < 0. The value at zero is a convention. NumPy's implementation lets the caller choose it. [8][37]

Frank Rosenblatt's 1957 perceptron report described units that fire when the total input exceeds a threshold. [41] The function is constant on either side of the threshold, so its ordinary derivative there is zero. At the threshold the derivative does not exist. This explains the difficulty of propagating a useful gradient through the hard decision itself. The perceptron can still learn from mistakes. Scikit-learn, for example, implements its perceptron as stochastic gradient descent on perceptron loss. Widrow and Hoff's ADALINE trained its weights by measuring the error in the linear signal before thresholding the output. [8][37][38]

What is a step in a scikit-learn pipeline?

In scikit-learn, a Pipeline is built from an ordered list of (name, estimator) pairs. Each pair is a step. Intermediate estimators transform the data and the final estimator must support fitting. Its capabilities determine what the completed pipeline can do, such as predicting a class or returning transformed features. Setting an intermediate stage to "passthrough" skips the transformation. [6]

from sklearn.pipeline import Pipeline
from sklearn.decomposition import PCA
from sklearn.svm import SVC

estimators = [("reduce_dim", PCA()), ("clf", SVC())]
pipe = Pipeline(estimators)

The pipeline has two steps named reduce_dim and clf. Calling pipe.fit(X, y) fits principal component analysis, transforms the features, and trains a support vector machine on the result. Prediction applies the already fitted transformation to new data. The classifier is accessible by name as pipe.named_steps["clf"], and a parameter search can refer to its regularization parameter as clf__C. When the entire pipeline is cross-validated, each fold fits the transformation on its own training partition, preventing data leakage from fitting PCA on the held-out data. The pipeline still has two steps regardless of how many iterations its classifier takes to fit. [6][39]

Related entries appear in the glossary of machine learning terms.

Continue reading

More to read

Topics:Training & Optimization

References

  1. ^1 ^2 ^3 ^4 ^5 ^6Lightning AI. Trainer. PyTorch Lightning documentation, `accumulate_grad_batches` and `global_step`.
  2. ^1 ^2 ^3 ^4 ^5 ^6 ^7 ^8 ^9 ^10Farama Foundation. Env. Gymnasium API reference.
  3. ^1 ^2 ^3 ^4Jonathan Ho, Ajay Jain and Pieter Abbeel. Denoising Diffusion Probabilistic Models. NeurIPS, 2020, Algorithms 1 and 2 and Section 4.
  4. ^1 ^2 ^3Yaniv Leviathan, Matan Kalman and Yossi Matias. Fast Inference from Transformers via Speculative Decoding. ICML, 2023.
  5. ^1 ^2 ^3 ^4 ^5 ^6 ^7Hunter Lightman and colleagues. Let's Verify Step by Step. 2023, Sections 2 and 3, Figure 3 and Appendix A.
  6. ^1 ^2 ^3Scikit-learn developers. Pipeline. API reference.
  7. ^1 ^2PyTorch developers. StepLR. Learning-rate scheduler API reference.
  8. ^1 ^2 ^3NumPy developers. numpy.heaviside. NumPy reference.
  9. ^1 ^2 ^3 ^4PyTorch developers. Optimizing Model Parameters. Learn the Basics.
  10. ^Leon Bottou. Large-Scale Machine Learning with Stochastic Gradient Descent. COMPSTAT, 2010.
  11. ^Diederik P. Kingma and Jimmy Ba. Adam: A Method for Stochastic Optimization. ICLR, 2015.
  12. ^Ilya Loshchilov and Frank Hutter. Decoupled Weight Decay Regularization. ICLR, 2019.
  13. ^1 ^2 ^3Lightning AI. Optimization. PyTorch Lightning documentation, automatic optimization and gradient accumulation.
  14. ^PyTorch developers. Data loading utilities. PyTorch reference, `DataLoader` and `BatchSampler`.
  15. ^Hugging Face. Optimization. Transformers documentation, learning-rate schedules.
  16. ^Ashish Vaswani and colleagues. Attention Is All You Need. NeurIPS, 2017, Section 5.3.
  17. ^1 ^2Jacob Devlin, Ming-Wei Chang, Kenton Lee and Kristina Toutanova. BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding. NAACL, 2019, Appendix A.2.
  18. ^1 ^2Farama Foundation. Handling Time Limits. Gymnasium documentation.
  19. ^Farama Foundation. Vectorize. Gymnasium vector environment API.
  20. ^1 ^2 ^3Volodymyr Mnih and colleagues. Human-level control through deep reinforcement learning. Nature, 2015, Methods.
  21. ^1 ^2Xinyue Chen, Che Wang, Zijian Zhou and Keith Ross. Randomized Ensembled Double Q-Learning: Learning Fast Without a Model. ICLR, 2021.
  22. ^1 ^2Google Research. DQN Replay Dataset. Offline Reinforcement Learning on Atari, dataset and collection protocol.
  23. ^1 ^2Jiaming Song, Chenlin Meng and Stefano Ermon. Denoising Diffusion Implicit Models. ICLR, 2021.
  24. ^Cheng Lu and colleagues. DPM-Solver: A Fast ODE Solver for Diffusion Probabilistic Model Sampling in Around 10 Steps. NeurIPS, 2022.
  25. ^Yang Song, Prafulla Dhariwal, Mark Chen and Ilya Sutskever. Consistency Models. ICML, 2023.
  26. ^Simian Luo, Yiqin Tan, Longbo Huang, Jian Li and Hang Zhao. Latent Consistency Models: Synthesizing High-Resolution Images with Few-Step Inference. 2023.
  27. ^Axel Sauer, Dominik Lorenz, Andreas Blattmann and Robin Rombach. Adversarial Diffusion Distillation. 2023.
  28. ^Stability AI. Introducing SDXL Turbo: A Real-Time Text-to-Image Generation Model. November 28, 2023.
  29. ^Tero Karras and colleagues. Elucidating the Design Space of Diffusion-Based Generative Models. Official implementation and sampling configurations, NeurIPS, 2022.
  30. ^1 ^2NVIDIA. Metrics. NIM Benchmarking documentation, time to first token, inter-token latency and throughput.
  31. ^Yahav Biran and Truong Pham. Accelerating decode-heavy LLM inference with speculative decoding on AWS Trainium and vLLM. AWS Machine Learning Blog, April 15, 2026.
  32. ^Jason Wei and colleagues. Chain-of-Thought Prompting Elicits Reasoning in Large Language Models. NeurIPS, 2022.
  33. ^1 ^2OpenAI. PRM800K. Step-level annotations and evaluation data.
  34. ^1 ^2Jared Kaplan and colleagues. Scaling Laws for Neural Language Models. 2020, Section 2.1.
  35. ^1 ^2Jordan Hoffmann and colleagues. Training Compute-Optimal Large Language Models. NeurIPS, 2022.
  36. ^Hugo Touvron and colleagues. LLaMA: Open and Efficient Foundation Language Models. 2023.
  37. ^1 ^2Scikit-learn developers. Perceptron. Linear model API reference.
  38. ^Bernard Widrow and Marcian E. Hoff. Adaptive Switching Circuits. WESCON Convention Record, 1960.
  39. ^Scikit-learn developers. Common pitfalls and recommended practices. User guide, inconsistent preprocessing and data leakage.
  40. ^OpenAI. Part 1: Key Concepts in RL. Spinning Up, states and observations.
  41. ^Frank Rosenblatt. The Perceptron: A Perceiving and Recognizing Automaton. Cornell Aeronautical Laboratory, Report 85-460-1, January 1957.

Improve this article

Add missing citations, update stale details, or write a clearer explanation. Anyone can edit: changes go live when you publish, and every edit is checked by an editor.

7 revisions · v7 · 3,373 words · full history

Fact-checks are independent of edits: a reviewer re-verifies the article against its sources and stamps the date. How we verify

Research and drafting on this wiki are AI-assisted, under named human editorial standards. How AI is used here

Cite this page: AI Wiki. "Step." aiwiki.ai, updated 1 Dec 2026. CC BY 4.0. https://aiwiki.ai/wiki/step

Edit article