计算机科学 ›› 2026, Vol. 53 ›› Issue (11A): 260300067-1046.doi: 10.11896/jsjkx.260300067

• 计算机软件&体系结构 • 上一篇    下一篇

面向昇腾人工智能平台的RWKV-7网络移植与优化

李恩泽1, 史涛1, 王富平1,2, 申澍楠1, 王兆彤1, 李璇1   

  1. 1 天津理工大学电气工程与自动化学院 天津 300380
    2 人工智能与数字经济广东省实验室(深圳)大湾区昇腾算力应用创新研究院 广东 深圳 518000
  • 出版日期:2026-11-16 发布日期:2026-11-16
  • 通讯作者: 史涛(st99@email.tjut.edu.cn)
  • 作者简介:(Eliwii_Keeya@stud.tjut.edu.cn)
  • 基金资助:
    国家青年科学基金项目(62103298);全国大学生创新创业训练计划(202410060008)

Migration and Optimization of RWKV-7 Network for Ascend AI Platform

LI Enze1, SHI Tao1, WANG Fuping1,2, SHEN Shunan1, WANG Zhaotong1, LI Xuan1   

  1. 1 School of Electrical Engineering and Automation,Tianjin University of Technology,Tianjin 300380,China
    2 Guangdong Laboratory of Artificial Intelligence and Digital Economy(Shenzhen),Greater Bay Area Ascend Computing Power Application Innovation Research Institute,Shenzhen,Guangdong 518000,China
  • Published:2026-11-16 Online:2026-11-16
  • About author:LI Enze,born in 2004,undergraduate student,is a member of CCF(No.A34716G).His main research interests include natural language processing and deep learning.
    SHI Tao,born in 1980,Ph.D,associate professor,master’s supervisor.His main research interests include bio-inspired intelligent computing and computer vision.
  • Supported by:
    This work was supported by the National Natural Science Foundation of China(62103298) and National College Students Innovationand Entrepreneurship Training Program(202410060008).

摘要: RWKV(Receptance Weighted Key Value)网络的推理过程满足并行性,并且时间复杂度为O(n)。RWKV-7为该系列的最新版本,在昇腾人工智能平台上的支持较少,制约了该架构在昇腾生态上的发展。在具体实现方面,RWKV-7包含多个相同计算式,向量与矩阵的计算混合执行。针对上述问题,基于昇腾人工智能平台,移植了RWKV-7网络,提出了一种网络调优策略,针对矢量计算设计了一种自定义融合算子。最后在昇腾910B1 NPU芯片上从多个维度进行了性能评估实验,验证了方案的有效性。结果表明,自定义算子的局部加速比达到4.81,RWKV-7-World-0.4B模型的吞吐量从15.87 token/s提升至20.12 token/s,单token latency由63.01 ms降低至49.70 ms,相比仅计算图复现,推理性能总体提升27%。与A100 GPU相比,910B1在较大批量推理时扩展性更优,极大批大小场景下吞吐量最大较A100提升121%。

关键词: Receptance Weighted Key Value, 昇腾神经网络处理单元, 自定义算子, MindSpore, 模型加速

Abstract: The inference process of the RWKV(Receptance Weighted Key Value) network satisfies parallelism and has a time complexity of O(n).RWKV-7,the latest iteration in this series,receives limited support on the Ascend AI platform,constraining the architecture’s development within the Ascend ecosystem.In terms of implementation,RWKV-7 contains multiple identical computational expressions,with vector and matrix operations executed concurrently.To address these challenges,this paper ports the RWKV-7 network to the Ascend AI platform and proposes a network tuning strategy.Specifically,it designs a custom fusion operator tailored for vector computations.Finally,multi-dimensional performance evaluation experimentsare conducted on the Ascend 910B1 NPU chip,validating the effectiveness of the proposed approach.Results demonstrate that the custom operator achieves a local acceleration ratio of 4.81.The throughput of the RWKV-7-World-0.4B model increases from 15.87 tokens per second to 20.12 tokens per second.Single-token latency decreases from 63.01 milliseconds to 49.70 milliseconds.Compared to graph reconstruction alone,overall inference performance improves by 27%.Compared to the A100 GPU,the 910B1 demonstrates superior scalability for larger batches,achieving up to 121% higher throughput than the A100 in scenarios involving extremely large batch sizes.

Key words: Receptance Weighted Key Value, Ascend neural network processing unit, Custom operator, Mindspore, Model acceleration

中图分类号: 

  • TP391.1
[1] KHURANA D,KOLI A,KHATTER K,et al.Natural languageprocessing:state of the art,current trends and challenges[J].Multimedia tools and applications,2023,82(3):3713-3744.
[2] XU M,DU H,NIYATOD,et al.Unleashing the power of edge-cloud generative AI in mobile networks:A survey of AIGC services[J].IEEE Communications Surveys & Tutorials,2024,26(2):1127-1170.
[3] CHENG J,KANG H,SHAO Y,et al.Survey on Efficient Large Language Models:Principles,Algorithms,Applications,and Open Issues[J].IEEE Transactions on Neural Networks and Learning Systems,2026,37(5):2025-2045.
[4] VASWANI A,SHAZEER N,PARMAR N,et al.Attention isAll you Need[C]//Advances in Neural Information Processing Systems.Curran Associates,Inc.,2017.
[5] PENG B,ALCAIDE E,ANTHONYQ G,et al.RWKV:Reinven-ting RNNs for the Transformer Era[C]//The 2023 Conference on Empirical Methods in Natural Language Processing.2023:14048-14077.
[6] LIU Z,DESAI A,LIAO F,et al.Scissorhands:Exploiting thePersistence of Importance Hypothesis for LLM KV Cache Compression at Test Time[C]//OH A,NAUMANN T,GLOBERSON A,et al.Advances in Neural Information Processing Systems:Vol.36.Curran Associates,Inc.,2023:52342-52364.
[7] CHEN T,MOREAU T,JIANG Z,et al.TVM:An Automated End-to-End Optimizing Compiler for Deep Learning[C]//13th USENIX Symposium on Operating Systems Design and Implementation(OSDI 18).Carlsbad,CA:USENIX Association,2018:578-594.
[8] ZHENG L,JIA C,SUN M,et al.Ansor:Generating High-Per-formance Tensor Programs for Deep Learning[C]//14th USENIX Symposium on Operating Systems Design and Implementation(OSDI 20).USENIX Association,2020:863-879.
[9] JIANG X,WANG H,CHEN Y,et al.MNN:A Universal and Efficient Inference Engine[C]//Proceedings of Machine Learning and Systems.2020:1-13.
[10] LI M,LIU Y,LIU X,et al.The Deep Learning Compiler:A Comprehensive Survey[J].IEEE Transactions on Parallel and Distributed Systems,2021,32(3):708-727.
[11] ZHENG Q,XIA X,ZOU X,et al.CodeGeeX:A Pre-Trained Model for Code Generation with Multilingual Benchmarking on HumanEval-X[C]//Proceedings of the 29th ACM SIGKDD Conference on Knowledge Discovery and Data Mining.New York,NY,USA:Association for Computing Machinery,2023:5673-5684.
[12] ZENG W,REN X,SU T,et al.PanGu-α:Large-scale Auto-regressive Pretrained Chinese Language Models with Auto-parallel Computation[EB/OL].(2021-04-26) [2026-02-04].https://arxiv.org/abs/2104.12369.
[13] PENG B,ZHANG R,GOLDSTEIN D,et al.RWKV-7“Goose” with Expressive Dynamic State Evolution[C]//Second Conference on Language Modeling.2025.https://openreview.net/forum?id=ayB1PACN5j.
[14] GHEISARI M,EBRAHIMZADEH F,RAHIMI M,et al.Deeplearning:Applications,architectures,models,tools,and frameworks:A comprehensive survey[J].CAAI Transactions on Intelligence Technology,2023,8(3):581-606.
[15] SHUVO M H,ISLAM S K,CHENG J,et al.Efficient Acceleration of Deep Learning Inference on Resource-Constrained Edge Devices:A Review[J].Proceedings of the IEEE,2023,111(1):42-91.
[16] NGUYEN G,DLUGOLINSKY S,BOBAK M,et al.Machine Learning and Deep Learning frameworks and libraries for large-scale data mining:a survey[J].Artificial Intelligence Review,2019,52(1):77-124.
[17] TAYE M M.Understanding of Machine Learning with DeepLearning:Architectures,Workflow,Applications and Future Directions[J].Computers,2023,12(5):91.
[18] FLORIDI L,CHIRIATTI M.GPT-3:Its Nature,Scope,Limits,and Consequences[J].Minds and Machines,2020,30(4):681-694.
[19] DEVLIN J,CHANG M W,LEEK,et al.BERT:Pretraining of Deep Bidirectional Transformers for Language Understanding[C]//BURSTEIN J,DORAN C,SOLORIO T.Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics:Human Language Technologies,Volume 1(Long and Short Papers).Minneapolis,Minnesota:Association for Computational Linguistics,2019:4171-4186.
[20] ROMBACH R,BLATTMANN A,LORENZD,et al.High-Resolution Image Synthesis With Latent Diffusion Models[C]//Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition(CVPR).2022:10684-10695.
[21] DEEPSEEK-AI,GUO D,YANG D,et al.DeepSeek-R1:In-centivizing Reasoning Capability in LLMs via Reinforcement Learning[EB/OL].(2026-01-04) [2026-02-04].https://arxiv.org/abs/2501.12948.
[22] YANG A,LI A,YANG B,et al.Qwen3 Technical Report[EB/OL].(2025-05-14) [2026-02-04].https://arxiv.org/abs/2505.09388.
[23] ZENG A,XU B,WANG B,et al.ChatGLM:A Family of Large Language Models from GLM-130B to GLM-4 All Tools[EB/OL].(2024-01-30) [2026-02-04].https://arxiv.org/abs/2406.12793.
[24] DUAN Y,WANG W,CHEN Z,et al.Vision-rwkv:Efficient and scalable visual perception with rwkv-like architectures[C]//International Conference on Learning Representations.2025,2025:83166-83182.
[25] YANG Z,LI J,ZHANG H,et al.Restore-RWKV:Efficient and Effective Medical Image Restoration With RWKV[J].IEEE Journal of Biomedical and Health Informatics,2026,30(1):513-526.
[26] FEI Z,FAN M,YU C,et al.Diffusion-RWKV:Scaling RWKV-Like Architectures for Diffusion Models[EB/OL].(2024-04-06) [2026-02-04].https://arxiv.org/abs/2404.04478.
[27] LU W Z,ZHANG F,HE Y X,et al.Evaluation and Optimization for Huawei Ascend Neural Network Accelerator[J].Chinese Journal of Computers,2022,45(8):1618-1637.
[28] GE H B,WANG D X,ZHENG T,et al.Study on Model Migration of Natural Language Processing for Domestic Deep Learning Platform[J].Computer Science,2024,51(1):50-59.
[29] LUO J,WANG H,ZHU Y J,et al.Optimization and Deployment of a Lightweight Traffic Sign Recognition System Based on YOLOv8n[EB/OL].Computer Applications and Software,1-11(2025-12-11) [2026-02-04].https://link.cnki.net/urlid/31.1260.TP.20251210.1431.006.
[30] ZHAO D D,LAI L,CHEN P,et al.Design and implementation of edge-based human action recognition algorithm based on ascend processor[J].Opto-Electronic Engineering,2024,51(6):240072.
[31] LIAO H,TU J,XIA J,et al.Ascend:a Scalable and Unified Architecture for Ubiquitous Deep Neural Network Computing:Industry Track Paper[C]//2021 IEEE International Symposium on High-Performance Computer Architecture(HPCA).2021:789-801.
[32] OH C S,CHUN K C,BYUN Y Y,et al.22.1 A 1.1V 16GB 640GB/s HBM2E DRAM with a Data-Bus Window-Extension Technique and a Synergetic On-Die ECC Scheme[C]//IEEE International Solid-State Circuits Conference(ISSCC 2020).2020:330-332.
[33] HE J X,LI Y W,LI R,et al.Design and Implementation of FFTOperator for Neural Network Processor-Taking Ascend910 as an Example[J].Telecommunication Engineering,2025,65(12):2160-2172.
Viewed
Full text


Abstract

Cited

  Shared   
  Discussed   
No Suggested Reading articles found!