Research Article

Empirical Study on Reducing Transformer Computational Complexity While Preserving Self-Attention Mechanism Integrity

Yuchen He*
Xi'an Innovation College of Yan'an University

* Corresponding author: [email protected]

Abstract

Transformers architecture has become a mainstream model in natural language processing due to its powerful sequencing modeling capabilities. However, its O(n²) computational complexity greatly limits its practical deployment in resource-constrained environments. In this paper, we demonstrate the potential and effectiveness of the cooperative optimization of three strategies: attention head pruning, mixed precision quantization, and hierarchical knowledge distillation, while maintaining the core structure of self-attention, to greatly reduce the computational complexity of the model. Systematic research and empirical evaluation. Through systematic compression experiments on the GLUE benchmark tasks (SST-2 and QNLI) in the BERT-base model, the proposed hybrid optimization strategy achieves 3x model compression with only 1.8% accuracy loss, and even more It has been shown to achieve a 42% latency reduction and a 51% memory usage reduction on NVIDIA Jetson Nano edge devices. Further analysis shows that this method effectively identifies and retains important semantic modeling capabilities while maintaining structural integrity of the original self-attention mechanism. Provides reliable technical support for deployment.

Keywords: Transformer; Model compression; Attention head pruning; Mixed precision quantization; Edge computing
Published: June 1, 2026
DOI: 10.54254/2755-2721/2026.AD33994
Volume: ACE Vol.212
pp. 83-91
Download PDF

References

  1. Vaswani, A., Shazeer, N., Parmar, N., Uszkoreit, J., Jones, L., Gomez, A. N., Kaiser, Ł., & Polosukhin, I. (2017). Attention is all you need.Advances in Neural Information Processing Systems,30, 5998–6008. https: //proceedings.neurips.cc/paper/2017/hash/3f5ee243547dee91fbd053c1c4a845aa-Abstract.html
  2. Tay, Y., Dehghani, M., Bahri, D., & Metzler, D. (2022). Efficient Transformers: A survey.ACM Computing Surveys,55(6), 1–28. https: //doi.org/10.1145/3530811
  3. Strubell, E., Ganesh, A., & McCallum, A. (2019). Energy and policy considerations for deep learning in NLP.Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics (ACL), 3645–3650. https: //doi.org/10.18653/v1/P19-1355
  4. Wang, S., Li, B. Z., Khabsa, M., Fang, H., & Ma, H. (2020). Linformer: Self-attention with linear complexity.arXivpreprint arXiv: 2006.04768. https: //doi.org/10.48550/arXiv.2006.04768
  5. Choromanski, K., Likhosherstov, V., Dohan, D., Song, X., Gane, A., Sarlos, T., Hawkins, P., Davis, J., Mohiuddin, A., Kaiser, Ł., Belanger, D., Colwell, L., & Weller, A. (2021). Rethinking attention with performers.International Conference on Learning Representations (ICLR). https: //openreview.net/forum?id=u0u_Y07z3Ok
  6. Hinton, G., Vinyals, O., & Dean, J. (2015). Distilling the knowledge in a neural network.arXivpreprint arXiv: 1503.02531. https: //doi.org/10.48550/arXiv.1503.02531
  7. Jacob, B., Kligys, S., Chen, B., Zhu, M., Tang, M., Howard, A., Adam, H., & Kalenichenko, D. (2018). Quantization and training of neural networks for efficient integer-arithmetic-only inference.Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2704–2713. https: //doi.org/10.1109/CVPR.2018.00286
  8. Michel, P., Levy, O., & Neubig, G. (2019). Are sixteen heads really better than one?Advances in Neural Information Processing Systems,32, 14014–14024. https: //proceedings.neurips.cc/paper/2019/hash/2c601ad9d2ff9bc8b282670cdd54f69f-Abstract.html
  9. Fan, A., Grave, E., & Joulin, A. (2020). Reducing Transformer depth on demand with structured dropout.International Conference on Learning Representations (ICLR). https: //openreview.net/forum?id=SylS8F3Fwr
  10. Kitaev, N., Kaiser, Ł., & Levskaya, A. (2020). Reformer: The efficient transformer.International Conference on Learning Representations (ICLR). https: //openreview.net/forum?id=rkgNKkHtvB
  11. Fedus, W., Zoph, B., & Shazeer, N. (2022). Switch Transformers: Scaling to trillion parameter models with simple and efficient sparsity.Journal of Machine Learning Research,23(120), 1–39. http: //jmlr.org/papers/v23/21-277.html
  12. Zafrir, O., Boudoukh, G., Izsak, P., & Wasserblat, M. (2019). Q8BERT: Quantized 8-bit BERT.Fifth Workshop on Energy Efficient Machine Learning and Cognitive Computing -NeurIPS2019. https: //doi.org/10.48550/arXiv.1910.06103
  13. Ganesh, P., Chen, Y., Lou, X., Khan, M. A., Yang, Y., Sajjad, H., Nakov, P., Chen, D., & Winslett, M. (2021). Compressing large-scale Transformer-based models: A case study on BERT.Transactions of the Association for Computational Linguistics,9, 1061–1080. https: //doi.org/10.1162/tacl_a_00413
  14. Hoefler, T., Alistarh, D., Ben-Nun, T., Dryden, N., & Peste, A. (2021). Sparsity in deep learning: Pruning and growth for efficient inference and training in neural networks.Journal of Machine Learning Research,22(241), 1–124. http: //jmlr.org/papers/v22/21-0366.html
  15. Wolf, T., Debut, L., Sanh, V., Chaumond, J., Delangue, C., Moi, A., Cistac, P., Rault, T., Louf, R., Funtowicz, M., Davison, J., Shleifer, S., von Platen, P., Ma, C., Jernite, Y., Plu, J., Xu, C., Le Scao, T., Gugger, S., ... Rush, A. M. (2020). Transformers: State-of-the-art natural language processing.Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing: System Demonstrations (EMNLP), 38–45. https: //doi.org/10.18653/v1/2020.emnlp-demos.6
  16. Sanh, V., Debut, L., Chaumond, J., & Wolf, T. (2019). DistilBERT, a distilled version of BERT: smaller, faster, cheaper and lighter.arXivpreprint arXiv: 1910.01108. https: //doi.org/10.48550/arXiv.1910.01108
  17. Jiao, X., Yin, Y., Shang, L., Jiang, X., Chen, X., Li, L., Wang, F., & Liu, Q. (2020). TinyBERT: Distilling BERT for natural language understanding.Findings of the Association for Computational Linguistics: EMNLP 2020, 4163–4174. https: //doi.org/10.18653/v1/2020.findings-emnlp.372