DUALGUAGE: Automated Joint Security-Functionality Benchmarking for Secure Code Generation

Abhijeet Pathak, Suvadra Barua, Dinesh Gudimetla, Rupam Patir, Jiawei Guo, Hongxin Hu, Haipeng CaiarXiv 2025 · DOI

Introduction

As developers increasingly rely on Large Language Models (LLMs) to generate code, ensuring that the resulting software is both functionally correct and secure is critical. However, current evaluation methods often treat these as separate problems, testing functionality (e.g., HumanEval) or security (e.g., SecurityEval) in silos. This approach is dangerous: a model might "fix" a vulnerability by generating code that doesn't run, or it might generate perfectly functional code that is riddled with security holes.

To address this, the authors introduce DUALGAUGE, a framework designed for the joint evaluation of code generation—testing if a single generated program can pass both functional and security tests simultaneously.

The DUALGAUGE Framework

DUALGAUGE is a fully automated, end-to-end benchmarking system that moves away from noisy static analysis (like CodeQL) and instead executes the generated code in a dynamic environment. The pipeline is structured into four distinct phases to ensure rigorous assessment.

The DUALGAUGE pipeline consists of four phases: sample generation, agentic execution, LLM-based evaluation, and metric aggregation.

The system relies on two novel components:

  1. Agentic Executor: Instead of manual environment setup, an LLM agent analyzes the generated code, configures an isolated sandbox, manages dependencies, and iteratively fixes execution errors to capture a detailed execution trace.
  2. LLM-Based Evaluator: An LLM judge analyzes the execution trace. For functional tests, it verifies output correctness; for security, it performs semantic analysis to ensure vulnerable behaviors (like unsanitized inputs) were avoided. If it encounters unfamiliar APIs, it can search the web for documentation before making a ruling.

The framework introduces the secure-pass@k metric, which measures the probability that a generated sample passes both functional unit tests and security checks.

DUALGAUGE-BENCH

Because existing datasets do not support joint runtime evaluation, the authors created DUALGAUGE-BENCH. This dataset consists of 154 language-agnostic, natural language coding prompts. Unlike previous benchmarks, every prompt is paired with both a functional test suite and a security test suite, validated through a human-AI collaborative process.

Comparison of DUALGAUGE-BENCH with existing benchmarks, highlighting its unique support for joint security (Sec), functionality (Func), and dual evaluation (Dual).

Key Insights and Experimental Results

The evaluation of state-of-the-art models using DUALGAUGE revealed several counterintuitive findings:

  • The Security-Functionality Gap: There is a massive drop-off when requiring both metrics. GPT-5 achieved a functional pass@1 of 50.65%, but its secure-pass@1 plummeted to just 11.69%. Claude-Sonnet-4.5 saw an even steeper drop from 46.10% to 4.55%.
  • Security Scaling Limits: While functionality improves with model size, security capabilities often plateau. In the Qwen3 family, security performance hit a wall between 8B and 32B parameters.
  • The "Overthinking" Problem: High reasoning levels (like Qwen3's "thinking" mode) can actually hurt security. Models may over-optimize for functional elegance, inadvertently introducing vulnerabilities. Moderate reasoning was found to be more effective for secure code.
  • Quantization Asymmetry: While quantization usually degrades performance, FP8 quantization actually improved security for Qwen3-8B, increasing its secure-pass@1 by 50% relative to the full-precision baseline.
  • Instruction Tuning Bias: Standard instruction tuning makes models better at following functional instructions but often biases them toward task completion at the expense of safety.

Conclusion and Future Work

DUALGAUGE demonstrates that current LLMs are far from being trustworthy coding assistants when both functionality and security are required. The automated pipeline proves highly reliable, with the Agentic Executor and LLM-Based Evaluator achieving 95.08% and 90.54% precision, respectively. Future work will focus on reducing the evaluator's false positive rates and developing security-aware training paradigms to bridge the gap between code that works and code that is safe.

Summary updated

BibTeX
@misc{pathak2025dualguage,
  author = {Abhijeet Pathak and Suvadra Barua and Dinesh Gudimetla and Rupam Patir and Jiawei Guo and Hongxin Hu and Haipeng Cai},
  title = {{DUALGUAGE: Automated Joint Security-Functionality Benchmarking for Secure Code Generation}},
  year = {2025},
  eprint = {2511.20709},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2511.20709},
}
Figure