EUVIMEDEUVIMED entdecken
Open Access · CC BY 4.0

Research on Optimization of Large Model Code Generation Based on Improved RAG in Embedded Environments

Xin Xia, Jing Cheng

Journal of Computer Science and Frontier Technologies · 2025

DOI: 10.63313/jcsft.2002 ↗

Kurz gefasst

Fachartikel in der Zeitschrift Journal of Computer Science and Frontier Technologies, 2025. Verfasst von Xin Xia und 1 weiteren Autor:innen. Die Arbeit nennt 20 Literaturangaben. Der Volltext ist frei zugänglich (Open Access, CC BY 4.0).

AbstractBibliografische AngabenZitierenVerwandte Studien

Abstract (Originalsprache)

In embedded environments, large model code generation faces a series of issues such as high response latency, memory overflow, and poor adaptability of gen-erated code due to limited computing power and tight memory resources. To address these problems, this paper proposes an improved RAG architecture (EmbedCode-RAG) based on fine-grained compression and dual-dimensional retrieval. Firstly, the architecture utilizes Abstract Syntax Tree (AST)-guided code snippet segmentation and lightweight block embedding compression technology to reduce the volume of reference code by 16-32 times. Subsequent-ly, a "task-situation" dual-dimensional retrieval mechanism is designed to inte-grate code function similarity and embedded hardware constraint features. Fi-nally, a dynamic knowledge base update module is incorporated to achieve pro-gressive accumulation of generation experience. We conducted experiments on two hardware platforms: ARM Cortex-M7 and NVIDIA Jetson Nano. The dataset used is a self-constructed embedded code corpus, including MCU drivers, IoT protocols, and other related tasks. Experimental results show that compared with the traditional RAG method, EmbedCode-RAG achieves an 8.3% improve-ment in the CodeBLEU score of generated code [20], reduces the Time to First Token (TTFT) by 82.6%, and decreases memory usage by 79.2%. Furthermore, the proposed method operates without crashes on low-power hardware. This research provides a new solution for realizing efficient and reliable code gener-ation in embedded scenarios.

Zitieren

APA

Xia, X., & Cheng, J. (2025). Research on Optimization of Large Model Code Generation Based on Improved RAG in Embedded Environments. Journal of Computer Science and Frontier Technologies. https://doi.org/10.63313/jcsft.2002

Vancouver

Xia X, Cheng J. Research on Optimization of Large Model Code Generation Based on Improved RAG in Embedded Environments. Journal of Computer Science and Frontier Technologies. 2025. doi:10.63313/jcsft.2002

BibTeX
@article{Xia2025,
  author = {Xia, Xin and Cheng, Jing},
  title = {Research on Optimization of Large Model Code Generation Based on Improved RAG in Embedded Environments},
  journal = {Journal of Computer Science and Frontier Technologies},
  year = {2025},
  doi = {10.63313/jcsft.2002}
}
Kostenlos starten →