paper-with-me

Papers

Surgical Repair of Insecure Code Generation in LLMs

2026-04-17 · Gustavo Sandoval, Brendan Dolan-Gavitt, Siddharth Garg arxiv

Large language models write production code, and yet they routinely introduce well-known vulnerabilities. We show that this is not a knowledge deficit: the same models that generate insecure code, correctly identify and explain the vulnerability when asked directly, this is a gap we call the Format-Reliability Gap. Mechanistic analysis reveals the cause: security representations are encoded from the earliest layers but remain computationally inert until the final layer, where format-compliance demands compete with them. Because the failure is localized to a single layer, per-vulnerability steering vectors reduce insecure generation by up to 74% with negligible overhead. The mechanism and the fix generalize across five models, three architecture families, and six vulnerability types, suggesting insecure code generation is an interpretability problem, not a training artifact.

📄 PDF Abstract BibTeX arXiv:2604.16697

Code (0)

등록된 구현이 없습니다.

Tasks

Code Generation

Similar Papers 제목 키워드 기반

Secure Code Generation at Scale with Reflexion

2025-11-05 · Arup Datta, Ahmed Aljohani, Hyunsook Do arxiv

Large language models (LLMs) are now widely used to draft and refactor code, but code that works is not necessarily secure. We evaluate secure code generation using the Instruct Prime, which eliminated compliance-require…

Code Generation

Can You Really Trust Code Copilots? Evaluating Large Language Models from a Code Security Perspective

2025-05-15 · Yutao Mou, Xiao Deng, Yuxiao Luo, Shikun Zhang 외

Code security and usability are both essential for various coding assistant applications driven by large language models (LLMs). Current code security benchmarks focus solely on single evaluation task and paradigm, such …

Code CompletionCode GenerationVulnerability Detection

How Well Do Large Language Models Serve as End-to-End Secure Code Agents for Python?

2024-08-20 · Jianian Gong, Nachuan Duan, Ziheng Tao, Zhaohui Gong 외

The rapid advancement of large language models (LLMs) such as GPT-4 has revolutionized the landscape of software engineering, positioning these models at the core of modern development practices. As we anticipate these m…

Examining Zero-Shot Vulnerability Repair with Large Language Models

2021-12-03 · Hammond Pearce, Benjamin Tan, Baleegh Ahmad, Ramesh Karri 외

Human developers can produce code with cybersecurity bugs. Can emerging 'smart' code completion tools help repair those bugs? In this work, we examine the use of large language models (LLMs) for code (such as OpenAI's Co…

Code Completion

Is Your AI-Generated Code Really Safe? Evaluating Large Language Models on Secure Code Generation with CodeSecEval

2024-07-02 · Jiexin Wang, Xitong Luo, Liuwen Cao, Hongkui He 외

Large language models (LLMs) have brought significant advancements to code generation and code repair, benefiting both novice and experienced developers. However, their training using unsanitized data from open-source re…

Code GenerationCode Repair