GA: Using Global Memory Tokens to Fuse Global Features
Abstract
The traditional multi-head self-attention mechanism models the relationships between elements within a sequence through the interaction between queries, keys, and values, but has certain limitations in capturing global information. To address this issue, this paper proposes an improved self-attention mechanism - global self-attention mechanism, aimed at enhancing the global information capture capability and robustness of Transformer models in sequence modeling tasks. This mechanism introduces a global context vector as the fourth input variable based on the classic QKV structure, endowing the model with the ability to perceive the entire sequence state. Specifically, each query can not only focus on local information in the sequence, but also simultaneously consider the global context, thereby better capturing global dependencies. The innovation of this method lies in the introduction of a global memory token, which enables the model to integrate global information and enhance its sensitivity to long-term trends and global patterns. In summary, this method not only has strong practical value, but also is easy to implement and has a wide range of application prospects, suitable for various sequence modeling tasks.
References
- Ma, Lianwei, Yuan Zhao, Bin Wang and Feifan Shen. “A Multistep Sequence-to-Sequence Model With Attention LSTM Neural Networks for Industrial Soft Sensor Application.” IEEE Sensors Journal 23 (2023): 10801-10813.
- Vaswani, Ashish, Noam M. Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N. Gomez, Lukasz Kaiser and Illia Polosukhin. “Attention is All you Need.” Neural Information Processing Systems (2017).
- La Quatra, Moreno and Luca Cagliero. “BART-IT: An Efficient Sequence-to-Sequence Model for Italian Text Summarization.” Future Internet 15 (2022): 15.
- Liu, Yang and Jian-wei Liu. “The Time-Sequence Prediction via Temporal and Contextual Contrastive Representation Learning.” Pacific Rim International Conference on Artificial Intelligence (2022).
- Le, Hang, Loïc Vial, Jibril Frej, Vincent Segonne, Maximin Coavoux, Benjamin Lecouteux, A. Allauzen, Benoit Crabb'e, Laurent Besacier and Didier Schwab. “FlauBERT: Unsupervised Language Model Pre-training for French.” ArXiv abs/1912.05372 (2019): n. pag.
- Cho, Kyunghyun, Bart van Merrienboer, Çaglar Gülçehre, Dzmitry Bahdanau, Fethi Bougares, Holger Schwenk and Yoshua Bengio. “Learning Phrase Representations using RNN Encoder–Decoder for Statistical Machine Translation.” Conference on Empirical Methods in Natural Language Processing (2014).
- Shi, Xingjian, Zhourong Chen, Hao Wang, D. Y. Yeung, Wai-Kin Wong and Wang-chun Woo. “Convolutional LSTM Network: A Machine Learning Approach for Precipitation Nowcasting.” Neural Information Processing Systems (2015).
- Amari, Shun‐ichi. “Natural Gradient Works Efficiently in Learning.” Neural Computation 10 (1998): 251-276.
- Liu, Ze, Yutong Lin, Yue Cao, Han Hu, Yixuan Wei, Zheng Zhang, Stephen Lin and Baining Guo. “Swin Transformer: Hierarchical Vision Transformer using Shifted Windows.” 2021 IEEE/CVF International Conference on Computer Vision (ICCV) (2021): 9992-10002.
- Seo, Jaejin, Sangwon Lee and Wonik Choi. “CLS Token Additional Embedding Method Using GASF and CNN for Transformer based Time Series Data Classification Tasks.” Journal of KIISE (2023): n. pag.
- Li, Youyu, Xiaoning Song, Tianyang Xu and Zhenhua Feng. “Memory-Token Transformer for Unsupervised Video Anomaly Detection.” 2022 26th International Conference on Pattern Recognition (ICPR) (2022): 3325-3332.
- Badrinarayanan, Vijay, Alex Kendall and Roberto Cipolla. “SegNet: A Deep Convolutional Encoder-Decoder Architecture for Image Segmentation.” IEEE Transactions on Pattern Analysis and Machine Intelligence 39 (2015): 2481-2495.
- Kazemnejad, Amirhossein, Inkit Padhi, Karthikeyan Natesan Ramamurthy, Payel Das and Siva Reddy. “The Impact of Positional Encoding on Length Generalization in Transformers.” ArXiv abs/2305.19466 (2023): n. pag.
- Kong, Yunchuan and Tianwei Yu. “A graph‐embedded deep feedforward network for disease outcome classification and feature selection using gene expression data.” Bioinformatics 34 (2018): 3727–3737.
- Agarap, Abien Fred. “Deep Learning using Rectified Linear Units (ReLU).” ArXiv abs/1803.08375 (2018): n. pag.