검색증강생성 기반 거대 언어 모델의 시큐어 코드 생성 기법
Secure Code Generation Using Retrieval-Augmented Generation for Large Language Models
0
조회
0
다운로드
0
인용
0
참고문헌
키워드
초록
최근 GPT-4와 같은 거대 언어 모델이 다양한 분야에서 활발히 활용되고 있으며, 특히 코드 생성 분야에서 큰 주목을 받고 있다. 하지만 이러한 모델들은 GitHub 등의 공개 데이터로 학습되어 보안에 취약한 코드를 생성하는 문제가 있다. 이를 해결하기 위해 모델에 직접 취약점 정보를 학습시키는 방법이 제안되었으나, 이는 모델 학습을 위한 취약점이 있는 코드와 정상 코드를 정확히 분류한 데이터셋 구축이 어렵고, 상당한 컴퓨팅 자원과 시간이 필요하며 지속적인 업데이트가 어렵다는 한계가 있다. 본 연구에서는 모델을 직접 수정하는 대신 검색증강생성 기법을 활용하여 보안 취약점에 관련된 외부 지식을 기반으로 시큐어 코드를 생성하는 방법을 제안한다. 실험을 통해 모델을 직접 수정하지 않고도 검색증강생성을 활용하여 더 안전한 코드를 생성할 수 있음을 확인하였다.
Abstract
Large language models (LLMs) like GPT-4 are being widely adopted across various domains, with significant impact in code generation. However, these models, trained on public repositories such as GitHub, often generate code with security vulnerabilities. Previous attempts to address this issue through direct model training with vulnerability information have faced several limitations: the difficulty of building accurately labeled datasets distinguishing between vulnerable and secure code, the requirement for substantial computational resources and time, and the challenges of maintaining up-to-date training. In this study, we propose an alternative approach that leverages retrieval-augmented generation (RAG) to incorporate external security vulnerability knowledge without modifying the base model. Our experiments demonstrate that this RAG-based approach effectively generates more secure code without the need for model retraining.
