RefleXGen:The unexamined code is not worth using

2510.23674v1 cs.SE, cs.AI, cs.CR 2025-10-30
Авторы:

Bin Wang, Hui Li, AoFan Liu, BoTao Yang, Ao Yang, YiLu Zhong, Weixiang Huang, Yanping Zhang, Runhuai Huang, Weimin Zeng

Abstract

Security in code generation remains a pivotal challenge when applying large language models (LLMs). This paper introduces RefleXGen, an innovative method that significantly enhances code security by integrating Retrieval-Augmented Generation (RAG) techniques with guided self-reflection mechanisms inherent in LLMs. Unlike traditional approaches that rely on fine-tuning LLMs or developing specialized secure code datasets - processes that can be resource-intensive - RefleXGen iteratively optimizes the code generation process through self-assessment and reflection without the need for extensive resources. Within this framework, the model continuously accumulates and refines its knowledge base, thereby progressively improving the security of the generated code. Experimental results demonstrate that RefleXGen substantially enhances code security across multiple models, achieving a 13.6% improvement with GPT-3.5 Turbo, a 6.7% improvement with GPT-4o, a 4.5% improvement with CodeQwen, and a 5.8% improvement with Gemini. Our findings highlight that improving the quality of model self-reflection constitutes an effective and practical strategy for strengthening the security of AI-generated code.

Ссылки и действия

Связанные статьи

Semantic-Aware Fuzzing: An Empirical Framework for LLM-Guided, Reasoning-Driven ...

## Контекст Многочисленные проблемы безопасности в системах, таких как Интернет вещей (IoT), мобильные платформы и автом...

2025-09-26

Scrub It Out! Erasing Sensitive Memorization in Code Language Models via Machine...

## Контекст Код языковые модели (Code Language Models, CLMs) набирают популярность в сфере программирования, позволяя вы...

2025-09-19