Computer Science ›› 2026, Vol. 53 ›› Issue (6A): 250800005-9.doi: 10.11896/jsjkx.250800005

• Computer Software & Architecture • Previous Articles     Next Articles

PID-Dynamic LSTM Generation Model for MCU Driver Code Based on Dynamically-tuned Cross-entropy Loss

LIU Zixuan1,2, TANG Xiaoyong1   

  1. 1 School of Computer and Communications Engineering,Changsha University of Science & Technology,Changsha 410114,China
    2 Shanghai ThinkTech Information Technology Co.,Ltd.,Changsha 410005,China
  • Online:2026-06-16 Published:2026-06-12
  • About author:LIU Zixuan,born in 1999,M.S.candidate.His main research interests include deep learning,MCU-driven code generation,and research on code genera-tion models combined with control theory,etc.
    TANG Xiaoyong,born in 1973,Ph.D,professor,is a premium member of CCF(No.33420S).His main research in-terests include parallel distributed computing and big data,etc.
  • Supported by:
    National Natural Science Foundation of China(62372064,62472151).

Abstract: To address the issues of model overfitting and training instability caused by noisy data in deep learning,this paper introduces,for the first time,a dynamic error compensation mechanism from control theory into code generation tasks.It proposes a code generation model named PID-Dynamic LSTM,based on a dynamically-tuned cross-entropy loss function(PID-CE Loss).Traditional cross-entropy loss is vulnerable to interference from anomalous samples under noisy conditions,leading to deviations in gradient updates and reduced convergence speed.To mitigate this,it integrates proportional(P),integral(I),and derivative(D) control terms to construct a dynamic error compensation mechanism.1)Proportional term preserves the immediate error response characteristic of cross-entropy.2)Integral term incorporates exponential moving average(EMA) differentialto capture long-term trends in loss variation,thereby correcting accumulated bias.3)Derivative term suppresses prediction fluctuations induced by noise by constraining the mean squared error(MSE) of probability distributions between adjacent training steps.Experimental results demonstrate that during 500 epochs of noisy training,the proposed method achieves an 96.28% validation accuracy on the test dataset(+3.42% improvement over baselines).Critically,it reduces the number of epochs required to first reach 80% accuracy by 31.7%(from 224 to 153 epochs).Furthermore,it reduces the overfitting gap by 6.4% and decreases loss fluctuation by 18.5%.Ablation experiment further verifies the key role and parameter characteristics of PID-CE in noise suppression.This method establishes a theoretically interpretable and engineering-friendly paradigm for noise-robust optimization,demonstrating significant application potential in noise-sensitive scenarios.

Key words: PID control, Deep learning, Cross-entropy loss, PID-CE Loss, PID-Dynamic LSTM, MCU driver code generation, TTA8

CLC Number: 

  • TP311
[1] LIU K,YIN C,ZHAO H,et al.Prediction of sand body thickness based on a mixed density network constrained by a spatially approximated probability[J].Geophysical Prospecting for Petroleum,2020,59(4):596-606,615.
[2] AO B Q,JIANG X J,LIU X Y,et al.Design of Unmanned Surface Vehicle Control System Based onNeural Network-PID Control[J].Control Engineering of China,2024,31(7):1178-1184.
[3] QIN D H,LI Z T,BAI F B,et al.A Review of Parameter-Efficient Fine-Tuning Technology for Large Language Models[J].Computer Engineering and Applications,2025,61(16):38-63.
[4] TIPIRNENI S,ZHU M,REDDY C K.Structcoder:Structure-aware transformer for code generation[J].ACM Transactions on Knowledge Discovery from Data,2024,18(3):1-20.
[5] FARHADI A,MIRZAREZAEE M,SHARIFI A,et al.Domain adaptation in reinforcement learning:a comprehensive and systematic study[J].Frontiers of Information Technology & Electronic Engineering,2024,25(11):1446-1465.
[6] LE H,WANG Y,GOTMARE A D,et al.CodeRL:Mastering code generation through pretrained models and deep reinforcement learning[J].arXiv:2207.01780,2022.
[7] ZHANG T Y,YU T,HASHIMOTO T B,et al.Coder reviewer reranking for code generation[J].arXiv:2211.16490,2022.
[8] HUANG Y,GU H,YU Z,et al.Enhancing low-resource cross-lingual summarization from noisy data with fine-grained reinforcement learning[J].Frontiers of Information Technology & Electronic Engineering,2024,25(1):121-134.
[9] XU F F,JIANG Z B,YIN P C,et al.Incorporating externalknowledge through pre-training for natural language to code generation[C]//Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics.Association for Computational Linguistics,2020:6045-6052.
[10] YIN P C,NEUBIG G.TRANX:A transition-based neural abstract syntax parser for semantic parsing and code generation[C]//Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing:System Demonstrations.Association for Computational Linguistics,2018:7-12.
[11] SOW D,WOISETSCHLÄGER H,BULUSU S,et al.Dynamic Loss-Based Sample Reweighting for Improved Large Language Model Pretraining[J].arXiv:2502.06733,2025.
[12] TERVEN J,CORDOVA-ESPARZA D M,RAMIREZ-PEDRAZA A,et al.Loss functions and metrics in deep learning[J].ar-Xiv:2307.02694,2023.
[13] CIAMPICONI L,ELWOOD A,LEONARDI M,et al.A survey and taxonomy of loss functions in machine learning[J].arXiv:2301.05579,2023.
[14] DUAN F,WANG H M,ZHANG C.Cauchy Non-negative Matrix Factorization for Data Representation[J].Computer Science,2021,48(6):96-102.
[15] GONG Z Y.Robust Principal Component Analysis Based onWelsch Loss and Half-Quadratic Optimization[C]//2024 International Conference on Wavelet Analysis and Pattern Recognition(ICWAPR).IEEE,2024.
[16] PERETS K,OLEKSII K.Assessment of the impact of sparsity and geman-mcclure regularization on signal reconstruction accuracy[J].Management,Training and Communication System,2025,2:239-243.
[17] TERVEN J,CORDOVA-ESPARZA D M,RAMIREZ-PEDRAZA A,et al.Loss functions and metrics in deep learning[J].ar-Xiv:2307.02694,2023.
[18] WEN W,HU Z X,HAO Z F.Deep Exponential Moving Ave-rage Learning Method for Sequential Recommendation [J].Journal of Frontiers of Computer Science and Techno,2025,19(3):774-786.
[19] CHU Y L,ZHENG H,HOU X P.Chinese semantic similarity calculation based on dynamic semantic coding Bi-Directional LSTM[J].Computer Applications and Software,2020,37(6):224-229.
[20] XIAO S L,QIANG Z X,LI D Y,et al.Pedestrian detection combining fine-grained feature and attention mechanism[J].Computer Applications and Software,2025,42(4):166-173,207.
[21] QI Q R L G,SI Q T,WANG S G L.A Survey of Automatic Text Summarization Based on Deep Learning [J].Computer Engineering and Applications,2025,61(18):24-40.
[1] CHEN Di, YIN Jibin. Dynamic Adjustment Technology of Eye Movement Input Based on TCN-AttnRNN Model [J]. Computer Science, 2026, 53(6A): 250300095-7.
[2] WANG Baohui, TAN Yingjie , CHEN Jixuan. Occlusion Head Pose Estimation Algorithm Based on Riemann Optimization [J]. Computer Science, 2026, 53(6A): 250300109-9.
[3] CHU Chunyu, JIANG Feilong. Water Meter Reading Recognition Based on Deep Learning and Prior Correction [J]. Computer Science, 2026, 53(6A): 250300143-7.
[4] WU Xiaoxiao, WU Xinglong. Prenatal Diagnosis of Fetal Cerebellum Based on Brain Anatomical Structures [J]. Computer Science, 2026, 53(6A): 250400049-7.
[5] ZHANG Xiaozhu, CHEN Hongyou, QU Lingfeng, WANG Yuechenjia, TIAN Baodan, FAN Yong. Carbon Emission Prediction Algorithm Based on TransLSTM-GAN Model [J]. Computer Science, 2026, 53(6A): 250400146-11.
[6] FU Yue, SHI Wei. Social Text MBTI Personality Feature Recognition Method Based on Data Fusion and Deep Learning [J]. Computer Science, 2026, 53(6A): 250500101-8.
[7] SU Ye, XU Xin, ZHAO Longlong, LI Xiaoli, CHEN Pan, CHEN Jinsong. LitchiNet:Lightweight Litchi Variety Recognition Network with Fused Multi-scale Gated Attention and Class Imbalance Awareness [J]. Computer Science, 2026, 53(6A): 250600127-8.
[8] LI Siyu, QIAN Wenhua. HCKD:Lightweight Skin Lesion Classification Method Based on Dermoscopic Images [J]. Computer Science, 2026, 53(6A): 250600143-9.
[9] CHEN Nuo, ZHAO Peng, HUAN Haisheng. Review of Small Object Detection Based on Deep Learning [J]. Computer Science, 2026, 53(6A): 250700022-9.
[10] LI Qin, WU Siyuan, YANG Haoyuan, DU Qin, LING Xu, XIAO Guoqing. Conjugate Gradient Preconditioner Adaptive Selection Algorithm via Deep Learning [J]. Computer Science, 2026, 53(6A): 250900126-6.
[11] WANG Yipin, CAI Chenghuan, XU Jiabin, ZHOU Xuegong, ZHANG Fengzhe, CAO Wei, ZHANG Fan, YU Xinsheng. Study on Compilation Technology of Neural Network Accelerator Based on RISC-V InstructionExtension [J]. Computer Science, 2026, 53(6): 128-136.
[12] LI Xiuying, CHEN Xuesong, LI Haoze, LIAO Hongwei, HAN Jiameng, DUAN Xiaoyi. MambaCS:Mamba-based Image Compressed Sensing Algorithm [J]. Computer Science, 2026, 53(6): 232-241.
[13] MA Ning, CHANG Xia, YUAN Lingyu. Pansharpening Method Based on Double-side Guided Filtering and Multi-feature Recalibration [J]. Computer Science, 2026, 53(6): 270-280.
[14] CHEN Yuansheng, CHEN Shunjue, MO Xuan, WU Weigang, LI Jialun. Deep Learning Training Time Prediction Algorithm Integrating Multi-dimensional Operator Features [J]. Computer Science, 2026, 53(5): 129-136.
[15] GUO Jingchen, YANG Kuiwu, DING Mengdi, WEI Jianghong. Survey of Adversarial Sample Attacks for Vision Transformer [J]. Computer Science, 2026, 53(5): 404-418.
Viewed
Full text


Abstract

Cited

  Shared   
  Discussed   
No Suggested Reading articles found!