NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

SecureVibe: Making Vibe Coding More Secure

Danqing Wang, Baolin Peng, Zhepei Wei, Isadora White, Wenlin Yao, Hao Cheng, Qianhui Wu, Minseon Kim, Xingdi Yuan, Lei Li, Jianfeng GaoarXiv 2026

TL;DR

SECUREVIBE is a novel training framework designed to bridge the "security gap" in AI coding agents—where code is functionally correct but dangerously vulnerable. By explicitly training agents to plan for hidden risks and test their own implementations, SECUREVIBE significantly improves security pass rates across multiple benchmarks and even boosts general coding performance on SWE-bench Verified.

What Problem Does This Paper Address?

We are entering the era of "vibe coding," where developers describe a feature in natural language and let an LLM agent handle the implementation. While these agents are becoming remarkably good at passing functional tests, they often ignore implicit security requirements. A patch might correctly implement a template substitution feature but inadvertently leave the door open for a code injection attack (CWE-94).

The authors discovered a critical behavioral difference: secure agents are more than twice as likely to conduct effective security planning and security testing compared to insecure ones. Current training methods mostly focus on functional completion, leaving agents "blind" to the hidden security risks inherent in a task description.

Figure 1: SECUREVIBE: making vibe coding more secure by enhancing security capabilities via a mixture of security tasks and post-training.

Methods

SECUREVIBE introduces a two-stage training recipe to instill "security awareness" into coding agents:

  1. Cold Start (Security Suite SFT): Instead of just showing the model secure code, the authors curated a "Security Suite" consisting of four distinct tasks:
  2. Functionality-Focused Coding: Standard feature implementation.
  3. Security-Focused Coding: Implementation guided by explicit vulnerability metadata (e.g., CWE IDs).
  4. Security Planning: Identifying potential risks before writing code.
  5. Security Testing: Synthesizing test cases designed to break a vulnerable implementation.
  6. Post-Training (Refining Behavior): The authors explored two paths to further sharpen the agent:
  7. SECUREVIBE_rl: Uses Reinforcement Learning (specifically GRPO) to learn from executable feedback. The agent gets higher rewards for passing both functional and security test suites.
  8. SECUREVIBE_hg: A "hint-guided" self-distillation approach (OPSD). The model acts as its own teacher, but the "teacher" version is given privileged security hints (like attack vectors) to guide the "student" version's output distribution.

Datasets

The study utilizes a mix of existing and curated benchmarks for a comprehensive evaluation:

  • Training: AutoBaxBench (backend tasks from scratch) and PatchEval-Gen (real-world repository implementation).
  • Cross-Domain Evaluation: SusVibes (76 CWE categories in Python) and BaxBench (multi-language backend security).
  • General Coding: SWE-bench Verified to ensure security training doesn't break the agent's ability to solve general software engineering issues.

Key Insights and Ideas

  • Security is a Process, Not Just a Result: The most striking finding is that planning and testing behaviors are highly correlated with secure outcomes. As shown in the paper's analysis, secure solutions exhibit target-aligned planning and testing much more frequently than insecure ones.
  • Supervision Structure Matters: Simply adding more secure coding examples is less effective than diversifying training to include planning and testing tasks. This structured supervision "activates" security behaviors that otherwise remain dormant.
  • The Reward Density Problem: Reinforcement learning (SECUREVIBE_rl) is powerful but requires the agent to succeed occasionally to get a signal. In cases where the agent rarely produces secure code (sparse rewards), hint-guided distillation (SECUREVIBE_hg) provides a necessary "nudge" by using privileged information to show the model what success looks like.
Figure 3: GPT 5.6 Sol and Qwen 3.5 35B on shared functionally correct tasks. GPT 5.6 Sol exhibits target- aligned security planning, coding, and testing more frequently than Qwen 3.5 35B.

Key Results

  • Security Gains: SECUREVIBE improved the security pass rate (SecPass@1) by 6.9 points on BaxBench and 10.9 points on SusVibes.
  • Generalization: The model showed a 11.5 point improvement on "unseen" CWE categories—vulnerabilities it never encountered during training.
  • General Coding Boost: Surprisingly, security training improved performance on the generic SWE-bench Verified by up to 4.1 points, suggesting that thinking about security makes an agent a better coder overall.
  • CWE Specifics: As seen in the radar chart below, the RL approach (GRPO) excelled at common issues like SQL injection and XSS, while the hint-guided approach (OPSD) was significantly stronger for complex logic like path traversal (CWE-22).
Per-CWE performance changes, showing the complementary strengths of RL and hint-guided methods.

Limitations and Future Work

  • The Security-Functionality Trade-off: The authors noted that SECUREVIBE_hg (hint-guided) sometimes caused the model to over-focus on security at the expense of functional correctness. Finding the perfect balance remains an open challenge.
  • Teacher Dependency: The hint-guided method relies on a high-quality "teacher" (in this case, GPT-5.6-Sol) to generate the initial hints and trajectories.
  • Future Directions: The authors suggest exploring how these security capabilities scale to even larger, multi-file repository edits and investigating more automated ways to generate high-fidelity security hints without human-in-the-loop or oracle metadata.

Summary updated

BibTeX
@misc{wang2026securevibe,
  author = {Danqing Wang and Baolin Peng and Zhepei Wei and Isadora White and Wenlin Yao and Hao Cheng and Qianhui Wu and Minseon Kim and Xingdi Yuan and Lei Li and Jianfeng Gao},
  title = {{SecureVibe: Making Vibe Coding More Secure}},
  year = {2026},
  eprint = {2609.38606},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2609.38606},
}
Figure