Does Teaming-Up LLMs Improve Secure Code Generation? A Comprehensive Evaluation with Multi-LLMSecCodeEval

Bushra Sabir, Shigang Liu, Seung Ick Jang, Sharif Abuadbba, Yansong Gao, Kristen Moore, SangCheol Kim, Hyoungshick Kim, Surya NepalarXiv 2026

TL;DR

This paper introduces MULTI-LLMSecCodeEval, a framework for systematically evaluating how combining multiple Large Language Models (LLMs) can improve secure code generation, vulnerability detection, and patching. They found that hybrid approaches, integrating LLMs with static analysis tools, significantly outperform individual LLMs and LLM-only collaborations, demonstrating that robust security arises from careful system design rather than just model scale.

What Problem Does This Paper Address?

The increasing use of LLMs for software development, including security-critical tasks, is hampered by their persistent unreliability in generating secure code. Despite advances in LLMs, they often produce code with subtle vulnerabilities, miss semantic defects, and fail to generalize to real-world scenarios. This unreliability poses significant risks, potentially leading to data breaches and financial losses. The core problem this paper addresses is how to mitigate these LLM shortcomings and achieve more dependable secure code generation by exploring multi-LLM strategies and their integration with traditional security tools.

Methods

The authors developed MULTI-LLMSecCodeEval, a fully automated framework designed to evaluate LLMs across the entire vulnerability management lifecycle: code generation, vulnerability detection, and automated patching. Their framework orchestrates LLMs through three stages:

  1. Code Generation: Natural language prompts are used to generate code.
  2. Vulnerability Detection: This stage combines static analysis tools (like CodeQL) with LLM reasoning.
  3. Automated Patching: Detected vulnerabilities are addressed by LLMs, followed by re-evaluation.

They implemented ten distinct pipelines, categorized into single-model, ensemble, collaborative, and hybrid designs, to systematically compare different coordination mechanisms. A key novelty is the integration of static analysis tools within these multi-LLM pipelines, moving beyond LLM-only approaches. They also emphasize reproducible prompt design and strict output formats.

Datasets

The paper utilizes two primary datasets for evaluation:

  • SecLLMEval: Constructed from SecEval and LLMSecEval, this dataset contains NL prompts mapped to MITRE's top 25 CWEs. It was filtered to 112 challenging samples (38 in C, 74 in Python) known to cause LLMs to generate insecure code, verified using CodeQL. This dataset focuses on high-risk CWEs and difficult cases.
  • SecLLMHolmes: Derived from Holmes, this dataset contains real-world vulnerable code snippets converted into NL prompts. It yielded 106 samples (69 in C, 37 in Python) after excluding CVE-linked cases. SecLLMHolmes is used for both code generation and detection/patching tasks, representing more authentic and complex vulnerabilities.

Key Insights and Ideas

  • Orchestration over Scale: The study strongly suggests that the way LLMs are orchestrated and combined is more critical for security than the sheer scale of individual models. Smaller, specialized models, when part of a well-designed hybrid system, can outperform larger monolithic LLMs.
  • Static Analysis is Crucial: Integrating static analysis tools (like CodeQL) into LLM pipelines significantly boosts security performance. LLM-only detection strategies, while showing some improvement, fall far short of hybrid approaches that leverage the deterministic nature of static analyzers.
  • Hybrid is King: The most effective approach identified is a hybrid pipeline that combines ensemble generation, static analysis for filtering, and cross-LLM verification for refinement and patching. This multi-faceted approach tackles vulnerabilities from various angles.
  • Task-Specific Prompting: Prompt diversity impacts LLM performance differently across tasks. Secure code generation and patching are relatively robust to prompt variations, but vulnerability detection suffers significantly, requiring consistent and task-specific prompts for reliable results.
  • Complexity Matters: Task complexity directly correlates with vulnerability rates. While LLMs handle easy tasks well, medium and hard tasks expose systematic semantic failures, highlighting the need for advanced techniques beyond simple prompt engineering.

Key Results

  • Ensemble Gains: Pipelines combining LLMs with static analysis (P2-P5) improved secure code generation by up to 47.3% on SecLLMEval and 19.3% on SecLLMHolmes compared to single-LLM baselines.
  • Hybrid Dominance: The proposed hybrid pipeline (P10) achieved the highest security rates, reaching 97.32% on SecLLMEval and 99.06% on SecLLMHolmes. This outperformed the best ensemble baseline (P5) by 1.78-4.72% and collaborative baselines (P7) by 19.81-26.78%.
  • LLM-Only Limitations: Purely LLM-based collaborative pipelines showed smaller gains (8.9-22.3%) and were significantly inferior to SAT-augmented ensembles.
  • Patching vs. Detection: Single LLMs are significantly more effective at patching vulnerabilities (around 70% success) than at detecting or classifying them (often with low precision/recall).
  • Language Differences: Python code is consistently more vulnerable than C/C++, with C/C++ exhibiting up to 30% higher security rates.

Limitations and Future Work

  • Static Analysis Reliance: The study's reliance on static analysis tools (SAT) means its findings are limited by the coverage and accuracy of these tools. Certain complex semantic issues or rare CWEs might be missed.
  • Dataset Scope: The evaluation primarily uses C and Python benchmarks. Future work could extend this to cover more programming languages, larger codebases, and a wider range of CWEs.
  • LLM Evolution: The rapid pace of LLM development means current findings reflect only the current generation of models. The framework is designed to be modular for re-evaluation with new models.
  • Functional Correctness: The current work focuses on security. Future research could jointly assess security and functional correctness for a more holistic evaluation.
  • Scalability and Cost: While the pipelines are relatively fast, static analysis dominates runtime. Future work could explore optimizations like selective queries or parallelizing SAT calls. The authors also suggest techniques like Retrieval-Augmented Generation (RAG) and agentic frameworks for further improvement and addressing residual vulnerabilities.

Summary updated

BibTeX
@misc{sabir2026does,
  author = {Bushra Sabir and Shigang Liu and Seung Ick Jang and Sharif Abuadbba and Yansong Gao and Kristen Moore and SangCheol Kim and Hyoungshick Kim and Surya Nepal},
  title = {{Does Teaming-Up LLMs Improve Secure Code Generation? A Comprehensive Evaluation with Multi-LLMSecCodeEval}},
  year = {2026},
  eprint = {2603.22717},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2603.22717},
}
Figure