CommentInject v2: A Matched-Pair Benchmark for Separating Criterion Shifts from Discrimination Loss When Code Comments Mislead LLM Vulnerability Detectors

Large language models (LLMs) are used to review code for security flaws, and the code they review often contains comments written by whoever submitted it. Earlier studies show that adversarial comments can lower the rate at which LLMs flag vulnerable code. A study that tests vulnerable code alone cannot say whether a comment makes a model worse at telling vulnerable from fixed code, or only less willing to flag anything. We built CommentInject v2 to separate the two. Each vulnerable Python function is paired with a minimally fixed twin, and every comment is applied to both. The core set has 27 pairs, 13 CWE classes and 756 cases; an extended set has 30 pairs, 14 CWE classes and 840 cases. Each pair appears under 14 conditions: no comment, one neutral purpose comment, and 12 fixed adversarial comment strategies. We evaluated four local open-weight models in one run at temperature 0 (seed 0), with selective re-runs, and analysed the verdicts with signal detection theory: discrimination (d′) and decision criterion (c), with two-way bootstrap intervals over pairs and strategies. In the exploratory primary analysis, adversarial comments made qwen3.5:4b and deepseek-coder:6.7b more lenient, with unadjusted 95% confidence intervals for Δc excluding zero. For qwen3.5:4b, the reduction in discrimination was not statistically established under the documented primary analysis. On the 30-pair extended set, a secondary pair-level analysis produced a confidence interval excluding zero. However, the discrimination inference is sensitive to the analysis method, clustering and inclusion of revised pairs. No change in discrimination was established for the other models; failure to establish a discrimination loss is not evidence that discrimination is unchanged. A static-analysis control (Bandit, default configuration) changed 0 of 702 core and 0 of 780 extended verdicts under the tested comments. All labels are author-adjudicated, and six fixed twins were revised after outcome data were available. Independent label review has been requested but not completed. These revised results are exploratory, based on a single-seed evaluation with selective re-runs of revised cases, on four small local models. Status of results: author-adjudicated; exploratory; one run at temperature 0 (seed 0), with selective re-runs of revised cases; independent label review requested, not completed. Not peer reviewed. Disclosure of AI assistance: see Section 12 of the PDF (Claude Code, Anthropic; ChatGPT, OpenAI). Dataset: https://doi.org/10.5281/zenodo.24694365

Authors

Institutions

Publication Details

Journal
Zenodo (CERN European Organization for Nuclear Research)
Published
2026-12-01
DOI
https://doi.org/10.5281/zenodo.24722324
Primary Topic
Adversarial Robustness in Machine Learning
Type
preprint
Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
NOV
preprint

CommentInject v2: A Matched-Pair Benchmark for Separating Criterion Shifts from Discrimination Loss When Code Comments Mislead LLM Vulnerability Detectors

Sunny Chokshi
Zenodo (CERN European Organization for Nuclear Research)
Adversarial Robustness in Machine Learning
preprint

CommentInject v2: A Matched-Pair Benchmark for Separating Criterion Shifts from Discrimination Loss When Code Comments Mislead LLM Vulnerability Detectors

Sunny Chokshi
preprint en

Abstract

Large language models (LLMs) are used to review code for security flaws, and the code they review often contains comments written by whoever submitted it. Earlier studies show that adversarial comments can lower the rate at which LLMs flag vulnerable code. A study that tests vulnerable code alone cannot say whether a comment makes a model worse at telling vulnerable from fixed code, or only less willing to flag anything. We built CommentInject v2 to separate the two. Each vulnerable Python function is paired with a minimally fixed twin, and every comment is applied to both. The core set has 27 pairs, 13 CWE classes and 756 cases; an extended set has 30 pairs, 14 CWE classes and 840 cases. Each pair appears under 14 conditions: no comment, one neutral purpose comment, and 12 fixed adversarial comment strategies. We evaluated four local open-weight models in one run at temperature 0 (seed 0), with selective re-runs, and analysed the verdicts with signal detection theory: discrimination (d′) and decision criterion (c), with two-way bootstrap intervals over pairs and strategies. In the exploratory primary analysis, adversarial comments made qwen3.5:4b and deepseek-coder:6.7b more lenient, with unadjusted 95% confidence intervals for Δc excluding zero. For qwen3.5:4b, the reduction in discrimination was not statistically established under the documented primary analysis. On the 30-pair extended set, a secondary pair-level analysis produced a confidence interval excluding zero. However, the discrimination inference is sensitive to the analysis method, clustering and inclusion of revised pairs. No change in discrimination was established for the other models; failure to establish a discrimination loss is not evidence that discrimination is unchanged. A static-analysis control (Bandit, default configuration) changed 0 of 702 core and 0 of 780 extended verdicts under the tested comments. All labels are author-adjudicated, and six fixed twins were revised after outcome data were available. Independent label review has been requested but not completed. These revised results are exploratory, based on a single-seed evaluation with selective re-runs of revised cases, on four small local models. Status of results: author-adjudicated; exploratory; one run at temperature 0 (seed 0), with selective re-runs of revised cases; independent label review requested, not completed. Not peer reviewed. Disclosure of AI assistance: see Section 12 of the PDF (Claude Code, Anthropic; ChatGPT, OpenAI). Dataset: https://doi.org/10.5281/zenodo.24694365

Zenodo (CERN European Organization for Nuclear Research)
University of the Cumberlands (US)
Adversarial Robustness in Machine Learning
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.

Laika access coming soon