Sign inGet started
Paper · arXiv

Surgical Repair of Insecure Code Generation in LLMs

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 ...

AuthorsGustavo Sandoval, Brendan Dolan-Gavitt, Siddharth Garg
Primary categorycs.CR
Published17 April 2026
Last updated at source17 April 2026
cs.CRcs.LG
Embed this entry
<iframe src="https://silytics.si/embed/item/c23c2f22-8946-47a5-bac5-b7ade4fbbbbb" width="420" height="190" style="border:0" loading="lazy" title="Silytics entry"></iframe>

Free, no tracking. More about feeds and embeds.

Silytics shows public metadata from arXiv and links to the original. Information may be incomplete or out of date. Last refreshed 17 October 2026. Licenses and terms of the original apply to the work itself. Not financial, legal or professional advice.