mlsanityData to 14 Oct 2026

An Empirical Study of Security Calibration in Large Language Models for Code

arXiv 2606.31159 ↗First posted 30 Jun 2026cs.SE cs.CR cs.LGcited by 0

Not on the map. Why?

Abstract (arXiv)

Large Language Models (LLMs) are rapidly transforming software development, yet their use in security-critical contexts raises a key question: do models know when their generated code is insecure? This property, known as calibration, measures whether a model's confidence aligns with the true correctness of its outputs. We present the first large-scale empirical study of security calibration in LLM-generated code. We evaluate GPT-4o-mini, Gemini-2.0-Flash, and Qwen3-Coder-Next across multiple temperature settings on two complementary benchmarks: self-contained security tasks and multi-language repository-level contexts. Our results suggest that overconfidence is prevalent across the evaluated LLMs. Functional calibration is consistently worse than security calibration, suggesting that models estimate security outcomes more reliably than functional correctness, potentially because functional correctness depends on complex execution behavior. We also examine whether calibration-guided automated repair can help remediate vulnerabilities in LLM-generated code, finding only limited improvements while frequently introducing functional regressions. Moreover, we study different mitigation strategies for reducing False Trust, where models assign high confidence to vulnerable code. The results show that although architectural gating improves calibration on controlled benchmarks, calibration deteriorates in realistic repository-level settings, increasing the risk of high-confidence vulnerable outputs.

Key facts. No citing papers in the map yet (data through 14 Oct 2026). Builds on 33 of its 44 references that are in the map. First posted on arXiv 30 Jun 2026.

Builds on

33 of 44 references.

References · 33

  1. 2023GPT-4 Technical Reportcited by 18,396
  2. 2022Chain-of-Thought Prompting Elicits Reasoning in Large Language Modelscited by 12,459
  3. 2021Evaluating Large Language Models Trained on Codecited by 8,320
  4. 2022Self-Consistency Improves Chain of Thought Reasoning in Language Modelscited by 5,708
  5. 2017On Calibration of Modern Neural Networkscited by 4,960
  6. 2021Program Synthesis with Large Language Modelscited by 3,637
  7. 2023SWE-bench: Can Language Models Resolve Real-World GitHub Issues?cited by 3,373
  8. 2021TruthfulQA: Measuring How Models Mimic Human Falsehoodscited by 2,975
  9. 2022Language Models (Mostly) Know What They Knowcited by 1,856
  10. 2022Competition-Level Code Generation with AlphaCodecited by 1,462
  11. 2023Is Your Code Generated by ChatGPT Really Correct? Rigorous Evaluation of Large Language Models for Code Generationcited by 1,391
  12. 2023Semantic Uncertainty: Linguistic Invariances for Uncertainty Estimation in Natural Language Generationcited by 819
21 more
  1. 2023Just Ask for Calibration: Strategies for Eliciting Calibrated Confidence Scores from Language Models Fine-Tuned with Human Feedbackcited by 812
  2. 2022Teaching Models to Express Their Uncertainty in Wordscited by 751
  3. 2019Measuring Calibration in Deep Learningcited by 446
  4. 2020How Can We Know When Language Models Know? On the Calibration of Language Models for Question Answeringcited by 445
  5. 2021Asleep at the Keyboard? Assessing the Security of GitHub Copilot's Code Contributionscited by 431
  6. 2020Calibration of Pre-trained Transformerscited by 315
  7. 2022Do Users Write More Insecure Code with AI Assistants?cited by 192
  8. 2023LLMs Cannot Reliably Identify and Reason About Security Vulnerabilities (Yet?): A Comprehensive Evaluation, Framework, and Benchmarkscited by 97
  9. 2022Lost at C: A User Study on the Security Implications of Large Language Model Code Assistantscited by 91
  10. 2024CyberSecEval 2: A Wide-Ranging Cybersecurity Evaluation Suite for Large Language Modelscited by 89
  11. 2023How Secure is Code Generated by ChatGPT?cited by 81
  12. 2026Qwen3-Coder-Next Technical Reportcited by 71
  13. 2023CodeLMSec Benchmark: Systematically Evaluating and Finding Security Vulnerabilities in Black-Box Code Language Modelscited by 55
  14. 2024Calibration and Correctness of Language Models for Codecited by 49
  15. 2023SALLM: Security Assessment of Generated Codecited by 39
  16. 2023Classifier Calibration with ROC-Regularized Isotonic Regressioncited by 19
  17. 2025SafeGenBench: A Benchmark Framework for Security Vulnerability Detection in LLM-Generated Codecited by 19
  18. 2025A.S.E: A Repository-Level Benchmark for Evaluating Security in AI-Generated Codecited by 14
  19. 2022Toward Trustworthy Neural Program Synthesiscited by 11
  20. 2026Security in the Age of AI Teammates: An Empirical Study of Agentic Pull Requests on GitHubcited by 7
  21. 2023On the Definition of Appropriate Trust and the Tools that Come with itcited by 1

Built on by

Not cited yet.