Robust Noise Attenuation via Adaptive Pooling of Transformer Outputs

Greyson Brothers

Transformers have become the standard architecture for processing sets of data, from image patches in computer vision to entities in reinforcement learning (RL) environments. However, a standard Transformer encoder produces as many output vectors as it receives input vectors. To perform a downstream task—like choosing an action or classifying an image—these $N$ vectors must be condensed into a single representation. This critical step is known as pooling.

This paper identifies a major bottleneck in standard pooling methods: they fail when the input contains many "distractor" or noise tokens. The authors introduce AdaPool, an attention-based pooling mechanism that dynamically filters out noise to retain the core signal, providing theoretical error bounds and superior performance across diverse tasks.

The Problem: Fluctuating Signal-to-Noise Ratios

The primary challenge in pooling arises when the "Signal-to-Noise Ratio" (SNR) fluctuates. In many real-world scenarios, only a small subset of inputs (the signal) is relevant to the task, while the rest are distractors (noise).

Standard methods have inherent inductive biases that make them vulnerable:

  • AvgPool (averaging all tokens) gets "washed out" by noise in low-SNR environments.
  • MaxPool (taking extreme values) can be easily fooled by high-magnitude distractors.
Comparison of standard Pooling and AdaPool architectures.

Experiments show that MaxPool performs best when the signal is extremely sparse (low SNR), while AvgPool performs best when the signal is abundant (high SNR). AdaPool is designed to bridge this gap, outperforming both across the entire spectrum. The paper argues that the choice of pooling method is not an arbitrary design choice, but a critical implementation detail with massive ramifications for noise robustness.

AdaPool: Adaptive Pooling via Cross-Attention

The paper frames pooling through the lens of Vector Quantization, treating the operation as a form of lossy compression to measure "Signal Loss." The core contribution, AdaPool, replaces fixed operations with a dynamic, attention-based approach.

The Mechanism

Instead of a static operation, AdaPool uses cross-attention with a single query vector to aggregate the Transformer's outputs. It computes a weighted average of the output tokens, where the weights are determined by the similarity (dot product) between a query and each token.

The AdaPool mechanism utilizes cross-attention with a single query vector to compute a weighted average of the input set.

Because AdaPool acts as cross-attention with only one query, its computational complexity is $O(n \cdot d)$ rather than the $O(n^2)$ of standard self-attention. This makes it highly efficient and comparable to standard pooling in practice.

The Query Strategy

Crucially, the authors argue against using a learned, static ClsToken (common in Vision Transformers). Instead, they propose selecting a query from the "signal" subset itself. For example, in an RL environment, the token representing the "self" agent is used; in an image, a central patch might be selected. This "signal-rich" query allows the model to attend to relevant entities regardless of how many distractors are added.

Theoretical Proofs

The paper proves that AvgPool and MaxPool are actually special cases of AdaPool. Furthermore, it derives explicit error bounds showing that AdaPool can approximate a "signal-optimal" quantizer for any SNR, provided there is a sufficient "margin" between signal and noise relation scores.

Experimental Validation and Results

The authors validated AdaPool across four distinct domains, demonstrating significant improvements in robustness:

  1. Synthetic KNN-Centroid: In a custom dataset isolating the SNR problem, AdaPool achieved signal loss an order of magnitude lower than AvgPool or ClsToken in low-SNR regimes (SNR < 0.25).
  2. Multi-Particle Environment (MPE): In RL benchmarks like "Simple Tag" (predator-prey), adding distractor obstacles caused AvgPool and ClsToken rewards to drop by over 70%. AdaPool's performance remained significantly more stable, dropping only ~50% and maintaining the highest absolute reward.
  3. BoxWorld: Tested on relational reasoning tasks requiring agents to find keys, AdaPool succeeded on both clean "entity-level" data and noisy "pixel-level" data.
  4. CIFAR-10/100: On standard image classification, "Ada-Focal" (querying the center of the image) outperformed the standard ClsToken approach (61.22% vs 55.56% accuracy on CIFAR-100), proving that smarter pooling helps even in standard vision tasks.

Limitations and Future Directions

While highly effective, AdaPool's success relies heavily on the designer's ability to identify a "signal-rich" query. In domains where it isn't obvious which token represents the "signal," the method's advantage might diminish. Additionally, while theoretically a special case, AdaPool did not perfectly replicate MaxPool in experiments, likely because the necessary "infinite" weights are difficult to reach via standard gradient descent.

Future work may explore Multi-Head AdaPool, allowing the model to pool different subspaces (e.g., one head for position, one for velocity) in parallel, presenting a promising direction for handling complex, multi-modal data.

Summary updated

BibTeX
@inproceedings{brothers2025robust,
  author = {Greyson Brothers},
  title = {{Robust Noise Attenuation via Adaptive Pooling of Transformer Outputs}},
  booktitle = {International Conference on Machine Learning},
  year = {2025},
  url = {https://openreview.net/forum?id=8JGwoZceQs},
}
Figure