HexaCoder: Secure Code Generation via Oracle-Guided Synthetic Training DataHexaCoder: Secure Code Generation via Oracle-Guided Synthetic Training Data
AI summary
HexaCoder improves large language models' ability to generate secure code through Oracle-guided synthetic training data, reducing vulnerable code by up to 85% compared with baselines. The method uses a security Oracle to identify vulnerabilities, has an LLM fix them, generates vulnerability-fix code pairs for specific CWE types, and fine-tunes with LoRA, introducing security-related libraries at generation time. Evaluations on three benchmarks across four LLMs show that the method improves security while maintaining relatively high functional correctness.