Pooling compresses many activations into fewer values, helping a convolutional neural network summarize whether a learned pattern appears in text. Max pooling selects the strongest response; average pooling computes the mean. section 7.5.2 section 7.2.1
In a word-based CNN, convolution produces one value for each possible kernel position. Pooling reduces that sequence to a compact representation, often a single value per filter, so variable-length text can become a fixed-size encoding when padding and clipping control the input length. section 7.4.1 section 7.2.1
Common pooling choices include:
- Max pooling keeps the largest convolution response and emphasizes the strongest detected match. section 7.5.2 section 7.2.1
- Average pooling takes the mean of values in a window and can represent patterns distributed across several positions. section 7.5.2 section 7.2.1
- Other possible reduction statistics include minimum, standard deviation, and sum. section 7.5.2
Whole-sequence max pooling in PyTorch
After a convolution, calculate its output sequence length and use that length as the MaxPool1d kernel size. For example, a length-40 input with kernel lengths 2 through 6 produces convolution lengths 39, 38, 37, 36, and 35; pooling each complete sequence reduces each branch to length 1. Concatenating five branches yields five pooled outputs before classification.
Figure 7.1 A real-life stencil
Use the stencil figure to visualize convolution as scanning for a pattern and pooling as selecting or averaging its responses. section 7.2.1







