ChatPaper.aiChatPaper

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)は、高速で非公式な開発ワークフローにおけるコード生成にますます利用されており、これはしばしば「バイブコーディング」と呼ばれ、速度と利便性が優先され、セキュリティ要件が明示されないことが多い。このような環境では、モデルは機能的には正しいが安全でないコードを頻繁に生成し、増大するセキュリティリスクを生み出している。コードのセキュリティを向上させる既存のアプローチは、全パラメータのファインチューニングまたはパラメータ効率型適応に依存しているが、これらはコストが高く破滅的忘れを起こしやすいか、あるいは粗い粒度で動作し解釈性と制御性が限られている。 本論文では、コード言語モデルのセキュリティをデフォルトで改善するニューロンレベルのフレームワークであるGoodVibeを提案する。GoodVibeは、セキュリティに関連する推論がごく一部のニューロンのサブセットに局在しているという重要な洞察に基づいている。我々は、教師ありセキュリティタスクからの勾配ベースの帰属分析を用いてこれらのニューロンを特定し、このセキュリティ批判的部分空間のみを更新するニューロン選択的ファインチューニングを実行する。トレーニングコストをさらに削減するため、活性化駆動型ニューロンクラスタリングを導入し、最小限のオーバーヘッドで構造化された更新を可能にする。GoodVibeを、C++、Java、Swift、Goを含むセキュリティ批判的プログラミング言語にわたる6つのLLMで評価した。GoodVibeは、生成コードのセキュリティを大幅に改善しながらモデルの一般的な有用性を維持し、ベースモデルに対して最大2.5倍の改善、フルファインチューニングと同等かそれを上回る性能を訓練可能パラメータ数47,000分の1以下で達成し、パラメータ効率型ベースライン(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.
PDF12February 13, 2026