Skip to content

Constrained Decoding for Secure Code GenerationConstrained Decoding for Secure Code Generation

arXiv· arXiv:2405.00218· Yanjun Fu, Ethan Baker, Yu Ding, Yizheng Chen·Indexed by this site · 25 days ago· Originally publishedDefenses
AI summary

The paper proposes a constrained decoding method for secure code generation, which during the decoding stage makes code generated by Code LLMs satisfy both security and functional correctness. The authors also release the CodeGuard+ benchmark and two metrics to measure the security and correctness of code generation, and on this basis point out that the previous best-performing defense, prefix tuning, generates secure code but sacrifices functional correctness. Evaluations on eight SOTA Code LLMs show that constrained decoding is more effective than prefix tuning and does not require a dedicated training dataset; the authors state that it outperforms GPT-4.

Read originalarxiv.org