CoSEFA: An LLM-Based Programming Assistant for Secure Code Generation via Supervised Co-Decoding

Xuan He, Dong Li, Hao Wen, Yueheng Zhu, Chao Chin Liu, Meng Ling Yan, Hongyu Zhang · 2025

Programming assistants based on Large Language Models (LLMs) assist developers in code generation and improve efficiency. These LLM-based programming assistants are prone to generate code with vulnerabilities. To mitigate security risk, existing approaches retrain an LLM with crafted data without vulnerabilities. However, retraining requires enormous computational costs and the accessible LLMs' internal representation, often unavailable for LLMs deployed as distributed online services. Our previous work, CoSec, proposed a supervised co-decoding approach using base LLMs alongside a small-scale security-focused LLM fine-tuned with code changes before and after vulnerability fixing.

Read the paper · More papers on PaperTik