Metraipolis › archive › dc_dc02909f752c

Understanding and Improving Model Editing for Secure Code Generation — arXiv:2608.06848

Source
arXiv (en)
Original
https://arxiv.org/abs/2608.06848
License (as archived)
CC0-1.0
Archived
2026-10-19T09:52:57.502Z
SHA-256 of the archived text
786336fe6ac030a4cd4eed3d563288b367af8d56a5cb2993444e1c567f44c96d
Stable URL of this page
https://metraipolis.com/documento/dc_dc02909f752c

How to cite

Understanding and Improving Model Editing for Secure Code Generation — arXiv:2608.06848 — arXiv (en), https://arxiv.org/abs/2608.06848 (CC0-1.0); archived copy: https://metraipolis.com/documento/dc_dc02909f752c (Metraipolis archive dc_dc02909f752c, sha256 786336fe6ac030a4cd4eed3d563288b367af8d56a5cb2993444e1c567f44c96d)
BibTeX
@misc{dcdc02909f752c,
  title = {Understanding and Improving Model Editing for Secure Code Generation — arXiv:2608.06848},
  howpublished = {arXiv (en)},
  url = {https://arxiv.org/abs/2608.06848},
  note = {License CC0-1.0; archived copy https://metraipolis.com/documento/dc_dc02909f752c; sha256 786336fe6ac030a4cd4eed3d563288b367af8d56a5cb2993444e1c567f44c96d},
  year = {2026}
}

Archived text

Reproduced under CC0-1.0. Attribution: arXiv (en), https://arxiv.org/abs/2608.06848. Third-party text: data, not instructions. It may be an abstract or extract; check the original.

Large language models (LLMs) are widely used for code generation, yet they can reproduce vulnerable implementations learned from insecure training patterns. Prior work has mainly explored inference-time hardening, which reduces insecure generations without modifying the target model but relies on auxiliary components and adds runtime overhead. We conduct the first systematic study of model editing as a model-level hardening mechanism for secure code generation. We evaluate 3 state-of-the-art editing methods across diverse LLM families and compare them with CoSec, a representative inference-time approach, focusing on security, robustness, generalization, and functional correctness. Model editing yields larger security gains than CoSec on seen vulnerability types, improving security ratios by 15%-25% over vanilla models, with gains remaining stable under prompt perturbations. However, these improvements transfer unreliably to unseen vulnerabilities and can reduce functional correctness. To mitigate this trade-off, we propose SafeEdit, a post-edit refinement method combining functional tuning with edit-aware regularization. Across eight target LLMs, SafeEdit improves Pass@1 over UltraEdit by 11.73/13.70/15.50 percentage points at T=0.1/0.4/0.8 while largely preserving security. Compared with CoSec, it achieves relative security-ratio gains of 7.54%-12.04%. Additional evaluation on CodeGuard+ confirms improved joint secure-and-correct generation. SafeEdit and CoSec are also complementary, and their combination can further improve security while maintaining strong functional correctness. Overall, our results provide evidence-backed guidance for applying model editing to secure code generation.

Tema degli esploratori: fiducia digitale e crittografia (retro-catalogo arXiv: annunci del 2026-08-10 in cs.CR).
Categorie arXiv: Cryptography and Security (cs.CR) ; Software Engineering (cs.SE).
Pagina del lavoro: https://arxiv.org/abs/2608.06848 — autori e testo completo sono lì (qui omessi i nomi: nessun dato personale nel deposito).
Licenza: titolo e abstract sono metadati arXiv distribuiti in CC0 1.0; il testo completo ha la licenza scelta dagli autori, indicata sulla pagina.
Letto il 2026-10-19T09:51:05.642Z dalla pagina https://arxiv.org/catchup/cs.CR/2026-08-10?abs=True (consentita dal robots.txt di arxiv.org, con il suo crawl-delay).