AI Glossary / AI and machine learning / Intermediate
Stride
Definition
Stride is the distance a sliding operation moves between successive positions in an input. In convolution and pooling, it determines how closely neighboring regions are sampled and influences the size of the resulting output.
What it means
Imagine an image being examined through a small window. The window can move one pixel at a time, producing many overlapping views, or jump several pixels before looking again. Stride specifies that movement.
For a two-dimensional image, the horizontal and vertical strides may be set separately. A larger movement generally produces fewer output positions. It can reduce calculation and memory use, but also changes which local patterns the system preserves.
The term describes movement, not window size. A three-pixel-wide filter can move by one pixel or by two pixels. Those choices have different effects even though the filter itself is unchanged.
For business users, stride matters indirectly when discussing image resolution, response speed and the ability to recognize small details. A faster inspection model may save processing time while becoming less sensitive to a narrow scratch. That trade-off should be tested rather than inferred from the setting alone.
How it works
The operation begins at a defined position, processes the local region, then advances according to the stride. It repeats until it reaches the input boundary, following the configured padding rules.
With an input length N, filter width K, padding P on each side and stride S, an ordinary undilated convolution has floor((N + 2P - K) / S) + 1 output positions. The formula applies separately along each spatial dimension. Different padding conventions can alter how the boundaries are handled.
A strided convolution calculates learned combinations at those positions. A pooling operation instead summarizes each region, perhaps taking its maximum. Both can use stride, but they do different calculations.
Architects usually choose stride before training. They evaluate its effect together with filter size, padding and later layers, because the overall network determines how much information remains useful for the task.
Three practical examples
- Factory inspection: a vision model processes product photographs at several spatial resolutions, balancing throughput against detection of tiny surface defects.
- Audio analysis: a one-dimensional operation moves across sound samples or time frames, reducing the number of intermediate positions processed later.
- Document recognition: a model extracts image features from scanned pages, where aggressive downsampling may make small characters harder to distinguish.
Think of it this way
Think of checking a long fence while stopping every meter compared with every three meters. Larger steps mean fewer stopping points, but the views are different.
The analogy has a limit. A convolutional filter examines a region at each stop, so a larger stride does not necessarily mean every intervening pixel is ignored. Coverage depends on both the filter width and its movement. Information can still be compressed even when regions overlap.
Worked example
Counting positions in a small image
Suppose an invented example uses a seven-by-seven image and a three-by-three filter, with no padding. At stride one, the filter fits in five positions across and five positions down. The output therefore contains 25 spatial positions.
At stride two, there are three positions across and three down, giving nine output positions. The count falls by 16, or 64% of the original 25.
This does not establish a 64% reduction in the complete application's running time. Loading images, other layers and result handling also take time. Nor does it tell us whether a small defect remains detectable.
The useful follow-up is a controlled comparison using representative images, including the smallest defects that matter. Keep the acceptance criteria and timing procedure fixed while comparing configurations.
Illustrative case study
A fictional packaging company accelerates an image-inspection prototype by increasing the stride in an early layer. Large label-placement errors remain easy to identify, but reviewers notice more missed hairline tears.
The team separates results by defect size instead of relying only on overall accuracy. It experiments with retaining finer resolution early in the network and reducing resolution later. It also checks photographs taken under different lighting conditions.
The lesson is that fewer intermediate positions can change the evidence available to later processing. A speed improvement needs to be judged against the actual inspection requirement, not only the average result across easy examples.
Common misconceptions and mistakes
- Stride is the filter's width. Width describes the region examined; stride describes movement between regions.
- A larger stride always improves efficiency by the same factor. Whole-system performance includes other operations and hardware effects.
- Training will automatically recover discarded detail. Later layers cannot reliably recreate information that earlier processing has removed.
Business use
Stride is relevant to conversations with teams building vision, audio and other convolutional systems. Managers normally specify required accuracy, detail and response time rather than selecting this parameter themselves.
Ask for results broken down by the size or duration of important signals. Compare end-to-end speed on the intended device. The most useful configuration is one that meets operational requirements at an acceptable cost, with failures understood.
People also ask
Can stride differ by direction?
Yes. Horizontal and vertical movement can be configured separately where the operation supports it.
Is stride learned from data?
In standard convolutional layers, it is a chosen architectural setting rather than a trained weight.
Does stride two always halve output width?
Approximately in many common arrangements, but filter size, padding and rounding determine the exact result.
Check your understanding
A seven-pixel-wide input uses a three-pixel filter, no padding and stride two. How many horizontal positions fit?
Answer: Three. The starting positions can be zero, two and four. A fourth start at six would extend beyond the input.
Related terms
Learn next
Read convolution and pooling. Sketch a small input grid, move the same window using two strides, and count the valid positions before comparing speed or accuracy claims.
More in AI and machine learning
- Stochastic program - A stochastic program is a statistical model expressed as a procedure that makes random draws.
- Stochastic variance reduction - Stochastic variance reduction is a collection of optimization techniques that reduce randomness in estimated gradients while retaining much of the...
- Streaming Feature Pipeline - A streaming feature pipeline continuously processes incoming events into features that machine-learning systems can use.
- Struc2vec - Struc2vec is a graph representation learning method designed to place nodes with similar structural roles near one another in a vector space.
- Structural equation modeling - Structural equation modeling, or SEM, is a statistical framework for representing and estimating relationships among variables through linked equations.
- Structured sparsity regularization - Structured sparsity regularization encourages a model to use a limited set of parameters in patterns that reflect known relationships.
Sources
Google, Machine Learning Glossary, stride: https://developers.google.com/machine-learning/glossary#stride. Core definition consulted. All scenarios and numerical examples are original teaching material.
Previous: Strict dominance Next: String grammar