Deep Learning
Neural Networks
Max-Pooling
Sum-Pooling
Machine Learning Techniques

Max-pooling VS Sum-pooling

Master System Design with Codemia

Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.

Introduction

In deep learning and computer vision, pooling layers play a crucial role in reducing the spatial dimensions of an input, which reduces computational costs and helps mitigate overfitting. Max-pooling and Sum-pooling are two commonly used methods. Both have their unique advantages and are selected based on specific requirements in a neural network's architecture. This article explores their technical details, use-cases, and differences.

Technical Explanations

Max-Pooling

Max-pooling is a pooling operation that extracts the maximum value from a patch of input data. It is defined by a window size, typically 2x2, which slides across the input matrix, extracting the maximum value within that window and discarding the rest. This approach effectively downsamples the input representation, focusing on the most prominent features.

Mathematically, for a window of size W×WW \times W, if the input is represented as XX, the max-pooling operation can be expressed as:

Yi,j=max(Xi:i+W1,  j:j+W1)Y_{i,j} = \max(X_{i:i+W-1, \; j:j+W-1})

where Yi,jY_{i,j} is the pooled output for a window starting at position (i,j)(i, j) on the input matrix.

Sum-Pooling

Sum-pooling aggregates the input data by computing the sum of values within a defined window rather than the maximum. This pooling method accumulates all the values in the window, capturing more information compared to max-pooling.

Formally, for a window size W×WW \times W, the sum-pooling operation can be defined as:

Yi,j=p=ii+W1q=jj+W1Xp,qY_{i,j} = \sum_{p=i}^{i+W-1} \sum_{q=j}^{j+W-1} X_{p,q}

Note that average-pooling is a normalized version of sum-pooling: Yi,javg=1W2Yi,jsumY_{i,j}^{\text{avg}} = \frac{1}{W^2} Y_{i,j}^{\text{sum}}. While sum-pooling preserves more information, it tends to be less robust to outliers compared to max-pooling, as it considers all pixel values within the pooling window.

Comprehension through Examples

Consider the following 4x4 input matrix with a 2x2 pooling window:

 
1Input:
2| 1 | 3 | 2 | 4 |
3| 5 | 6 | 1 | 2 |
4| 7 | 8 | 3 | 0 |
5| 1 | 2 | 1 | 3 |

Max-Pooling Result (2x2 window, stride 2):

  • Top-left window [1, 3, 5, 6]: maximum is 6
  • Top-right window [2, 4, 1, 2]: maximum is 4
  • Bottom-left window [7, 8, 1, 2]: maximum is 8
  • Bottom-right window [3, 0, 1, 3]: maximum is 3

Result: [[6, 4], [8, 3]]

Sum-Pooling Result (2x2 window, stride 2):

  • Top-left window [1, 3, 5, 6]: sum is 15
  • Top-right window [2, 4, 1, 2]: sum is 9
  • Bottom-left window [7, 8, 1, 2]: sum is 18
  • Bottom-right window [3, 0, 1, 3]: sum is 7

Result: [[15, 9], [18, 7]]

Notice that max-pooling selects only the strongest activation, while sum-pooling reflects the total energy in each region.

When to Use Each

Max-Pooling Use Cases

  • Image recognition tasks where prominent features like edges or shapes need to be identified.
  • Reducing computational load by decreasing dimensions without significant loss of important features.
  • Tasks where translation invariance is important, since the maximum value is preserved regardless of its exact position within the window.

Sum-Pooling Use Cases

  • Tasks where the overall intensity or accumulation of activations across a region is relevant.
  • Audio processing applications where the aggregate energy in frequency bands is of interest.
  • Bag-of-words style architectures where total feature presence matters more than the single strongest activation.

Comparison Table

AspectMax-PoolingSum-Pooling
OperationTakes maximum value in windowSums all values in window
Information RetainedStrongest activation onlyTotal activation
Sensitivity to OutliersLow (ignores small values)High (all values contribute)
Output MagnitudeSame scale as inputGrows with window size
Common VariantWidely used in CNNsAverage-pooling (normalized sum) more common
Gradient FlowOnly to the max elementTo all elements in the window

Summary

Max-pooling emphasizes the strongest signal in each region, making it ideal for feature detection tasks. Sum-pooling captures the aggregate signal, providing a holistic view of the activation landscape. In practice, max-pooling is the default choice in most CNN architectures for image classification, while sum-pooling (often in its normalized form, average-pooling) finds use in tasks where total feature presence is more informative than the peak activation. The choice between them depends on whether your task benefits from detecting the most prominent feature or from measuring overall activity in each spatial region.


Course illustration
Course illustration

All Rights Reserved.