GoodVibe: LLM 기반 코드 생성을 위한 보안 바이브
GoodVibe: Security-by-Vibe for LLM-Based Code Generation
February 11, 2026
저자: Maximilian Thang, Lichao Wu, Sasha Behrouzi, Mohamadreza Rostami, Jona te Lintelo, Stjepan Picek, Ahmad-Reza Sadeghi
cs.AI
초록
대규모 언어 모델(LLM)은 빠르고 비형식적인 개발 워크플로, 즉 속도와 편의성이 우선시되고 보안 요구사항이 명시적으로 제시되는 경우가 드문 '바이브 코딩(vibe coding)' 환경에서 코드 생성에 점점 더 많이 활용되고 있습니다. 이러한 환경에서 모델은 기능적으로는 정확하지만 안전하지 않은 코드를 빈번히 생성함으로써 점증하는 보안 위험을 초래하고 있습니다. 코드 보안을 개선하기 위한 기존 접근법은 전체 매개변수 미세 조정(full-parameter fine-tuning)이나 매개변수 효율적 적응(parameter-efficient adaptation)에 의존하는데, 이들은 비용이 많이 들고 치명적 망각(catastrophic forgetting)에 취약하거나, 제한된 해석 가능성과 제어력을 가진 거친 단위(coarse granularity)로 동작합니다.
본 논문에서는 코드 언어 모델의 보안을 기본적으로 개선하기 위한 뉴런 수준 프레임워크인 GoodVibe를 제시합니다. GoodVibe는 보안 관련 추론이 소수의 뉴런 하위 집합에 국한된다는 핵심 통찰에 기반합니다. 우리는 지도 보안 작업(supervised security task)의 그래디언트 기반 귀속 분석(gradient-based attribution)을 이용해 이러한 뉴런을 식별하고, 이 보안 핵심 부분 공간(security-critical subspace)만을 업데이트하는 뉴런 선택적 미세 조정(neuron-selective fine-tuning)을 수행합니다. 훈련 비용을 더욱 절감하기 위해 활성화 기반 뉴런 클러스터링(activation-driven neuron clustering)을 도입하여 최소의 오버헤드로 구조화된 업데이트를 가능하게 합니다. 우리는 C++, Java, Swift, Go를 포함한 보안 중점 프로그래밍 언어에 대해 6개의 LLM을 대상으로 GoodVibe를 평가했습니다. GoodVibe는 모델의 일반적인 유용성을 보존하면서 생성 코드의 보안을 상당히 개선하여, 기본 모델 대비 최대 2.5배 향상된 성능을 보였으며, 가변 매개변수 수를 4,700배 이상 적게 사용하여 전체 미세 조정 성능을 맞추거나 능가했고, 매개변수 효율적 기준 방법(LoRA) 대비 훈련 계산량을 3.6배 이상 감소시켰습니다. 우리의 결과는 뉴런 수준 최적화가 효율성이나 일반성을 희생하지 않으면서 코드 생성을 안전하게 만드는 효과적이고 확장 가능한 접근법을 제공함을 입증합니다.
English
Large language models (LLMs) are increasingly used for code generation in fast, informal development workflows, often referred to as vibe coding, where speed and convenience are prioritized, and security requirements are rarely made explicit. In this setting, models frequently produce functionally correct but insecure code, creating a growing security risk. Existing approaches to improving code security rely on full-parameter fine-tuning or parameter-efficient adaptations, which are either costly and prone to catastrophic forgetting or operate at coarse granularity with limited interpretability and control.
We present GoodVibe, a neuron-level framework for improving the security of code language models by default. GoodVibe is based on the key insight that security-relevant reasoning is localized to a small subset of neurons. We identify these neurons using gradient-based attribution from a supervised security task and perform neuron-selective fine-tuning that updates only this security-critical subspace. To further reduce training cost, we introduce activation-driven neuron clustering, enabling structured updates with minimal overhead. We evaluate GoodVibe on six LLMs across security-critical programming languages, including C++, Java, Swift, and Go. GoodVibe substantially improves the security of generated code while preserving general model utility, achieving up to a 2.5x improvement over base models, matching or exceeding full fine-tuning with over 4,700x fewer trainable parameters, and reducing training computation by more than 3.6x compared to the parameter-efficient baseline (LoRA). Our results demonstrate that neuron-level optimization offers an effective and scalable approach to securing code generation without sacrificing efficiency or generality.