Computer Science ›› 2026, Vol. 53 ›› Issue (10): 384-395.doi: 10.11896/jsjkx.250700009

• Computer Software • Previous Articles     Next Articles

ExprRL:Method for Optimizing Floating-point Expression Accuracy Based on ReinforcementLearning

LIANG Junda, WANG Lei, ZHANG Xulin, NIU Mengjin, GAO Zhenqi   

  1. School of Cyberspace Security,Zhongyuan University of Technology,Zhengzhou 450007, China
  • Received:2025-07-01 Revised:2025-12-13 Published:2026-10-13
  • About author:LIANG Junda,born in 1999,postgra-duate,is a student member of CCF(No.R7609G).His main research interests include high performance computing and code security.
    WANG Lei,born in 1977,professor,is a member of CCF(No.12516M).His main research interests include research and development of high performance computingand domestic independent and controlable basic software.
  • Supported by:
    Research and Development of Basic Mathematical Library Software Based on High-Performance Computing(22001742).

Abstract: With the rapid development of numerical computing,precision optimization of floating-point programs has become a key issue in improving computational reliability.While traditional approaches,such as mixed-precision optimization,approximate rounding error correction,error detection and repair,and expression optimization rewriting,have achieved some progress,they still face limitations such as a large search space,low optimization efficiency,and reliance on expert experience.To address these issues,this paper proposes a reinforcement learning-based adaptive optimization method for floating-point expressions and implements an expression optimization tool,ExprRL.By combining reinforcement learning with a dynamic precision optimization experience library,ExprRL achieves efficient and adaptive precision optimization.ExprRL uses a Tree-LSTM model to compute embedding vectors of the symbolic,structural,and semantic features of expressions.It then uses cosine similarity to retrieve and match optimization strategies in the experience library to accelerate the optimization process.If a match fails,a reinforcement learning module is initiated,modeling the expression optimization problem as a Markov decision process.A Q-learning algorithm is used to explore the optimal rewriting action sequence and dynamically updates it to the experience library.Experiment selects 31 expressions from the FPBench standard dataset as the test set.Experimental results show that after ExprRL optimization,the average ulp error is reduced by 41.42%,and the maximum ulp error is reduced by 46.92%,which is better than traditional precision optimization tools Herbie and exprAuto.

Key words: Floating-point arithmetic, Precision optimization, Reinforcement learning, Experience repository, Similarity matching

CLC Number: 

  • TP311
[1] ZOU D,GU Y,SHI Y,et al.Oracle-free repair synthesis for floating-point programs[J].Proceedings of the ACM on Programming Languages,2022,6(OOPSLA2):957-985.
[2] FOUSSE L,HANROT G,LEFÈVRE V,et al.MPFR:A multiple-precision binary floating-point library with correct rounding[J].ACM Transactions on Mathematical Software,2007,33(2):1-15.
[3] ZURAS D,COWLISHAW M,AIKEN A,et al.IEEE Standard for Floating-Point Arithmetic[S].IEEE Std 754-2008.
[4] GOLDBER G,DAVI D.What every computer scientist shouldknow about floating-point arithmetic[J].ACM Computing Surveys,1991,23(1):5-48.
[5] ASHOK P,CHATTERJEE K,DACA P,et al.Value Iteration for Long-run Average Reward in Markov Decision Processes[C]//LNCS.Cham:Springer,2017:201-221.
[6] CHAPMAN D,KAELBLING L P.Input Generalization in Delayed Reinforcement Learning:An Algorithm and Performance Comparisons[C]//Proceedings of the 12th International Joint Conference on Artificial Intelligence-Volume 2.1991.
[7] JANG B,KIM M,HARERIMANA G,et al.Q-learning Algo-rithms:A Comprehensive Classification and Applications[J].IEEE Access,2019,7:133653-133667.
[8] YI J,JIALU F,TIANYOU C,et al.Data-Driven Flotation Industrial Process Operational OptimalControl Based on Reinforcement Learning[J].IEEE Transactions on Industrial Informatics,2018,14(5):1974-1989.
[9] KHAN G S,HERRMANN G,LEWIS L F,et al.Reinforcement learning and optimal adaptive control:An overview and implementation examples[J].Annual Reviews in Control,2012,36(1):42-59.
[10] MOERLAND T M,BROEKENS J,JONKER C M.Emotion in Reinforcement Learning Agents and Robots:A Survey[J].Machine Learning,2017,107(2):1-38.
[11] YU Z,CAO R,TANG Q,et al.Order Matters:Semantic-AwareNeural Networks for Binary Code Similarity Detection[C]//Association for the Advancement of Artificial Intelligence.2020:1145-1152.
[12] LI T,WANG J.Binary code similarity detection based on attention mechanism and Child-Sum Tree-LSTM[J].Cybersecurity and Data Governance,2023,42(11):8-14,34.
[13] ZHAO G,HUANG J.DeepSim:deep learning code functionalsimilarity[C]//Proceedings of the 2018 26th ACM Joint Meeting on European Software Engineering Conference and Symposium on the Foundations of Software Engineering.2018:141-151.
[14] CHOWDHARY S,NAGARAKATTE S.Fast shadow execution for debugging numerical errors using error free transformations[J].Proceedings of the ACM on Programming Languages.2022,6(OOPSLA2):1845-1872.
[15] YI X,CHEN L,MAO X,et al.Efficient automated repair of high floating-point errors in numerical libraries[J].Proceedings of the ACM on Programming Languages,2019,3(POPL):1-29.
[16] HOU M,GUO S Z,WANG P J,et al.Mixed precision optimization method based on sensitivity[J].Journal of Information Engineering University,2022,23(6):718-723.
[17] HAO J G,ZHOU B,XU J C,et al.Mixed precision optimization method using multi-precision basis functions[J].Journal of Information Engineering University,2024,25(6):703-709.
[18] ARZELIER D,BREHARD F,JOLDES M.Exchange Algorithm for Evaluation and Approximation Error-Optimized Polynomials[C]//2019 IEEE 26th Symposium on Computer Arithmetic,IEEE,2019.
[19] AANJANEYA M,LIM J P,NAGARAKATTE S.Progressive polynomial approximations for fast correctly rounded math libraries[C]//Proceedings of the 43rd ACM SIGPLAN International Conference on Programming Language Design and Implementation.2022:552-565.
[20] LIM J P,NAGARAKATTE S.High performance correctlyrounded math libraries for 32-bit floating point representations[C]//Proceedings of the 42nd ACM SIGPLAN International Conference on Programming Language Design and Implementation.2021:359-374.
[21] PANCHEKHA P,SANCHEZ-STERN A,WILCOX J R,et al.Automatically improving accuracy for floating point expressions[J].ACM Sigplan Notices,2015,50(6):1-11.
[22] WANG X,WANG H,SU Z,et al.Global optimization of numerical programs via prioritized stochastic algebraic transformations[C]//2019 IEEE/ACM 41st International Conference on Software Engineering(ICSE).IEEE,2019:1131-1141.
[23] DAMOUCHE N,MARTEL M.Salsa:An Automatic Tool toImprove the Numerical Accuracy of Programs[C]//AFM@ NFM.2017:63-76.
[24] WANG Y Z,WANG L,XU F J,et al.Floating point program precision defect repair method based on program rewriting[J].Journal of Computer Applications,2023,43(S1):177-181.
[25] HAO J W,YANG H R,XIA Y Y,et al.Floating-point expression precision optimization method based on multi-type calculation rewriting[J].Computer Science,2024,51(4):86-94.
[26] LI Z,DONG X X,HUANG C C,et al.Floating-point expression design space exploration method based on heuristic search[J].Computer Applications,2020,40(9):2665-2669.
[27] XIAO A X,ZHANG S X,TANG E Y,et al.An empirical library-guided floating-point programoptimization acceleration strategy [J].Chinese Journal of Computers,2022,45(9):2014-2028.
[28] XIAO Y,AHMED N K.A Graph-Based Learning Framework for Compiler Loop Auto-Vectorization[J].Intelligent Computing,2025,4:0113.
[29] LI J,ZHENG Q.Reinforcement Learning for Automated Pragma-Based Loop Optimization[C]//2025 IEEE 8th Information Technology and Mechatronics Engineering Conference(ITOEC).IEEE,2025:1643-1647.
[30] WEI A,SURESH T,TAN H,et al.Improving Assembly Code Performance with Large Language Models via Reinforcement Learning[J].arXiv:2505.11480,2025.
[1] WEI Debin, WANG Xinrui, YANG Li, PAN Chengsheng. DTD3-AQM:Satellite Network Queue Management Algorithm Based on Information Timeliness [J]. Computer Science, 2026, 53(9): 375-384.
[2] XIA Bin, SU Jinya, CAO Junmin, XIAO Junwen, SUN Guozi. Research on Log Anomaly Prediction Method for Log Sequence Graph Construction Guided byReinforcement Learning [J]. Computer Science, 2026, 53(9): 405-413.
[3] LIAN Zhaoyang, SI Bailu. Optimization in Cross-field of Manufacturing and Transportation by Combining Reinforcement Learning and Artificial Hummingbird Algorithm [J]. Computer Science, 2026, 53(8): 307-315.
[4] HE Yulin, XIAO Youqi, YANG Zhenyu, HUANG Zhexue, CUI Laizhong. Adaptive Frequency Tuning Approach for Spark Clusters [J]. Computer Science, 2026, 53(8): 71-84.
[5] WANG Hongguang, JIANG Yiming, LIU Xiajun, BAI Luxin. Self-adaptive Load Balancing Strategy Based on Reinforcement Learning for SDSN [J]. Computer Science, 2026, 53(7): 336-342.
[6] SHANG Kefeng, ZHANG Dan, ZHUAN Sunying, LI Dandan, LIU Yan, ZHU Kaige. Multi-party Inter-satellite Collaborative Computing Offloading Algorithm for Time-varying Topologies and Dynamic Heterogeneous Resources [J]. Computer Science, 2026, 53(7): 354-362.
[7] DUAN Mengyao, XU Jinchen, YANG Hongru, ZHANG Jianing, ZHANG Tao, LI Fei, ZHOU Bei. Characterizing Floating-point Errors [J]. Computer Science, 2026, 53(6): 408-415.
[8] GONG Jing, YANG Yufa, ZHENG Yifan, SUN Zhixin. Multi-objective Intelligent Warehousing Path Planning Based on Conflict Free Path Algorithm [J]. Computer Science, 2026, 53(4): 88-100.
[9] LIU Jiaqi, WANG Yujie, XIANG Guodu, YU Kui, CAO Fuyuan. Long-term Causal Effect Estimation Based on Deep Reinforcement Learning [J]. Computer Science, 2026, 53(4): 235-244.
[10] PAN Jiahao, FENG Xiang, YU Huiqun. SM-PHT:Robust,Scalable,and Efficient Method for Multi-task Reinforcement Learning [J]. Computer Science, 2026, 53(4): 366-376.
[11] ZHENG Cheng, BAN Qingqing. Knowledge-assisted and Reinforced Syntax-driven for Aspect-based Sentiment Analysis [J]. Computer Science, 2026, 53(4): 406-414.
[12] ZHAI Jie, LI Yanhao, CHEN Lexuan, GUO Weibin. Dynamic Recommendation of Personalized Hands-on Learning Materials Based on LightweightEducational LLMs [J]. Computer Science, 2026, 53(2): 48-56.
[13] LI Fang, YUAN Baochun, SHEN Hang, WANG Tianjing, BAI Guangwei. Deep Reinforcement Learning-based Aircraft Task Offloading in Low Earth Orbit Satellite Networks [J]. Computer Science, 2026, 53(2): 406-415.
[14] ZHOU Xin, CAO Lei, CHEN Xiliang, CAO Yuqing. Review of Research on Large Language Model-empowered Reinforcement Learning Agents [J]. Computer Science, 2026, 53(10): 254-267.
[15] SHANG Bingnan. Survey on Reinforcement Learning Techniques for Large Language Models [J]. Computer Science, 2026, 53(10): 268-276.
Viewed
Full text


Abstract

Cited

  Shared   
  Discussed   
No Suggested Reading articles found!