Skip to main content
QUICK REVIEW

[논문 리뷰] An Empirical Evaluation of LLM-Based Approaches for Code Vulnerability Detection: RAG, SFT, and Dual-Agent Systems

Md Hasan Saju, Maher Muhtadi|arXiv (Cornell University)|2026. 01. 01.
Software Engineering ResearchComputer Science인용 수 0
한 줄 요약

이 논문은 RAG, SFT(QLoRA 어댑터), 및 Dual-Agent LLM 시스템을 기본 LLM과 비교하여 다섯 가지 CWE에 걸친 코드 취약점 탐지에서 RAG가 전반적인 성능에서 최고를 달성한다는 것을 보여준다.

ABSTRACT

The rapid advancement of Large Language Models (LLMs) presents new opportunities for automated software vulnerability detection, a crucial task in securing modern codebases. This paper presents a comparative study on the effectiveness of LLM-based techniques for detecting software vulnerabilities. The study evaluates three approaches, Retrieval-Augmented Generation (RAG), Supervised Fine-Tuning (SFT), and a Dual-Agent LLM framework, against a baseline LLM model. A curated dataset was compiled from Big-Vul and real-world code repositories from GitHub, focusing on five critical Common Weakness Enumeration (CWE) categories: CWE-119, CWE-399, CWE-264, CWE-20, and CWE-200. Our RAG approach, which integrated external domain knowledge from the internet and the MITRE CWE database, achieved the highest overall accuracy (0.86) and F1 score (0.85), highlighting the value of contextual augmentation. Our SFT approach, implemented using parameter-efficient QLoRA adapters, also demonstrated strong performance. Our Dual-Agent system, an architecture in which a secondary agent audits and refines the output of the first, showed promise in improving reasoning transparency and error mitigation, with reduced resource overhead. These results emphasize that incorporating a domain expertise mechanism significantly strengthens the practical applicability of LLMs in real-world vulnerability detection tasks.

연구 동기 및 목표

  • LLM 기반 방법을 사용한 코드의 취약점 탐지 개선을 유도한다.
  • Robust 평가를 위한 BigVul 및 엔터프라이즈 저장소에서 균형 잡힌 취약점 데이터셋을 큐레이션한다.
  • RAG, SFT(QLoRA 어댑터) 및 이중 에이전트 구조를 기본 모델과 비교한다.
  • 실용적 취약점 탐지에 대한 방법 선택을 안내하기 위해 성능 및 통계적 유의성을 분석한다.

제안 방법

  • BigVul 및 GlassHouse 저장소에서 다섯 가지 CWE 카테고리에 걸쳐 5000개의 학습 인스턴스와 1000개의 테스트 인스턴스를 포함하는 균형 데이터셋을 사용한다.
  • 세 가지 LLM 기반 접근법을 평가한다: Retrieval-Augmented Generation(RAG), QLoRA 어댑터를 통한 감독 미세조정(SFT), 그리고 탐지자와 검증자 에이전트가 있는 이중 에이전트 LLM 시스템.
  • 비교를 위한 기본 모델로 LLaMA 3.2-3B를 설정한다.
  • RAG에서 LLM에 MITRE CWE 데이터의 외부 도메인 지식을 보강하고 임베딩을 Chroma에 저장하여 청크 단위의 텍스트 처리를 수행한다.
  • SFT에서 30k 단계에 해당하는 설정과 8비트 AdamW 최적화를 사용한 지시-입력-출력 형식으로 미세조정한다.
  • 이중 에이전트에서 탐지자 에이전트가 초기 취약점 판단을 생성하고 검증자 에이전트가 이를 검토하고 추론을 수정한다.
Figure 2: Retrieval-Augmentation Generation Process
Figure 2: Retrieval-Augmentation Generation Process

실험 결과

연구 질문

  • RQ1RAG, SFT, 및 이중 에이전트 LLM 접근법이 여러 CWE 카테고리에 걸친 코드 취약점 탐지에서 기본 LLM과 어떻게 비교되는가?
  • RQ2도메인 지식 보강 및 매개변수 효율적 미세조정이 탐지 성능에 미치는 영향은 무엇인가?
  • RQ3이중 에이전트 아키텍처가 과도한 리소스 오버헤드 없이 추론의 투명성을 개선하고 오류를 줄일 수 있는가?

주요 결과

  • RAG는 평균 F1 점수 0.85, 모든 CWE 카테고리에 대해 정확도 0.86의 최고 전반 성능을 달성한다.
  • RAG의 CWE별 성능은: CWE-119 (F1 0.80), CWE-399 (F1 0.89), CWE-264 (F1 0.84), CWE-20 (F1 0.86), CWE-200 (F1 0.89).
  • SFT는 평균 F1 점수 0.80 및 정확도 0.81을 달성하며 CWE별 F1은 0.73에서 0.84까지 변동한다.
  • 이중 에이전트 LLM은 평균 F1 점수 0.77 및 정확도 0.78을 달성하며 CWE별 F1은 0.73에서 0.86까지 변동한다.
  • 기준 모델(증강 없음)은 평균 F1 점수 0.67 및 정확도 0.65를 나타낸다.
  • 통계적 검정(쌍 t 검정)은 세 가지 기법 모두 기본 모델보다 유의하게 우수하다고 보이며, RAG: t(4)=5.97, p=0.0042; SFT: t(4)=3.75, p=0.0195; 이중 에이전트: t(4)=2.89, p=0.0440.
Figure 3: Supervised Fine-Tuning Process
Figure 3: Supervised Fine-Tuning Process

이 논문 읽기

누빈트 뷰어에서 원문을 열고, 읽으면서 궁금한 곳을 바로 물어보세요.

누빈트에서 이 논문 읽기

이 리뷰는 AI가 논문 원문을 바탕으로 만들었습니다. 인용하기 전에 원문을 확인해 주세요.