Frequency-Domain Latent Attention Gating for Cross-Domain Token Aggregation

Kewei Li, Rongying Zhang, Xueli Wang, Xiwen Gong, Zhongjian Wang, Lan Huang, Ruochi Zhang, Fengfeng ZhouarXiv 2026

TL;DR

FLaG is a novel, domain-agnostic token pooling module that operates in the frequency domain using the Real Fast Fourier Transform (rFFT), learnable latent queries, and channel-wise gating. By shifting the representation basis to spectral coordinates, it avoids representation collapse and delivers significant performance gains across diverse domains—including protein property prediction and image classification—especially when model capacity is constrained.

What Problem Does This Paper Address?

Modern deep learning models for text, images, and proteins share a common bottleneck: they must compress a variable-length sequence of token representations into a single, fixed-length vector before making a final prediction. This step is known as token pooling.

Standard pooling methods (like mean pooling, max pooling, or attention pooling) operate entirely within the original token domain. Mean pooling often causes "representation collapse," making token representations too homogeneous and erasing fine-grained sequence information. While domain-specific pooling methods exist—such as EvoPool for proteins—they often rely on external evolutionary anchors like Multiple Sequence Alignments (MSAs), which are unavailable in non-protein domains or sparse in many real-world scenarios.

The authors introduce FLaG (Frequency-Domain Latent Attention Gating) to provide an internal, domain-agnostic coordinate system that captures sequence-level structures without relying on external anchors.

Methods

FLaG acts as a plug-in aggregation module consisting of four main stages:

  1. Frequency Transformation: The input token sequence is transformed along the sequence dimension using the Real Fast Fourier Transform (rFFT). The complex spectrum is represented by concatenating its real and imaginary parts, preserving both magnitude and phase information in a format standard neural network layers can process.
  2. Latent Attention: A set of learnable latent queries performs multi-head cross-attention over the frequency tokens. These queries act as compact "frequency detectors" to extract task-relevant spectral patterns.
  3. Frequency Gating: The latent summaries are averaged to generate a channel-wise gate via a Multi-Layer Perceptron (MLP). This gate modulates the frequency amplitudes using a residual connection ($1 + \text{gate}$), allowing the model to amplify critical frequency components while preserving the underlying signal.
  4. Time-Domain Reconstruction & Pooling: The modulated frequency tokens are converted back to complex form, mapped back to the time domain via the inverse FFT (iFFT), and finally aggregated using standard pooling (such as max pooling).
Architecture of FLaG

Datasets

The authors evaluated FLaG across three distinct domains:

  • Antimicrobial Peptide (AMP) Activity Prediction: Evaluated using the ESM2 protein language model (8M and 35M parameter variants) on E. coli and S. aureus datasets from the AMPCliff benchmark, utilizing an activity-cliff-aware split.
  • Image Classification: Tested using a ResNet18 backbone on the CIFAR-10 and CIFAR-100 datasets, where spatial feature maps were reshaped into token sequences.
  • Language Classification: Evaluated using RoBERTa-base on the IMDB sentiment analysis dataset and three classification tasks from the GLUE benchmark (MNLI, QNLI, and SST-2).

Key Insights and Ideas

  • The Frequency Domain as an Internal Reference: Every frequency component inherently depends on the entire time-domain sequence. This global dependency makes the frequency domain an excellent alternative coordinate system for summarizing sequences before reduction.
  • Low-Frequency Dominance: Through spectral band-knockout probes, the authors discovered that low-frequency bands contribute the most to final predictions across tasks, while higher-frequency bands capture highly sample-specific variations.
  • Broad Spectral Amplification: Rather than acting as a narrow band-pass filter, the learned gating mechanism broadly amplifies the spectrum while maintaining the original low-frequency dominance.
  • Preservation of Localized Information: Unlike mean pooling, which flattens position-wise variation, FLaG preserves highly differentiated residue-response profiles, ensuring that localized features (like critical amino acid residues) survive the pooling bottleneck.

Key Results

FLaG demonstrated its strongest advantages in lower-capacity model regimes and structure-sensitive tasks:

  • Protein Activity Prediction: On the ESM2-8M backbone, FLaG achieved the lowest Root Mean Squared Error (RMSE) on both E. coli (0.562) and S. aureus (0.545), outperforming all baseline pooling methods. It also achieved the highest Recall@50 for E. coli (18.6).

AMP prediction results on E. coli AMP prediction results on S. aureus and larger models

  • Image Classification: On CIFAR-100, FLaG achieved the highest top-1 accuracy (77.20%), outperforming the strongest baseline (mean pooling at 76.78%) while cutting prediction variance roughly in half (std of 0.139 vs 0.307).
  • Language Benchmarks: FLaG performed as a "high-floor" alternative on text, matching the best baseline accuracy on IMDB (94.08%) and remaining within 0.32 percentage points of the top-performing methods across GLUE tasks.

Limitations and Future Work

  • Regular Sampling and Padding Artifacts: FLaG assumes regularly sampled token sequences. Applying the FFT to zero-padded batches can introduce padding-dependent spectral artifacts when sequence lengths vary drastically. Incorporating a Non-uniform FFT could alleviate this issue.
  • Computational Overhead: The rFFT and iFFT blocks introduce an $O(T \log T)$ computational cost. While manageable, a thorough cross-domain efficiency study is left for future work.
  • Perturbation Sensitivity: FLaG's performance can degrade under specific data corruptions; for instance, mean pooling proved more robust under motion blur and contrast shifts in image data.

Summary updated

BibTeX
@misc{li2026frequency,
  author = {Kewei Li and Rongying Zhang and Xueli Wang and Xiwen Gong and Zhongjian Wang and Lan Huang and Ruochi Zhang and Fengfeng Zhou},
  title = {{Frequency-Domain Latent Attention Gating for Cross-Domain Token Aggregation}},
  year = {2026},
  eprint = {2606.08191},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2606.08191},
}
Figure