{"about":{"site":"https://codewithpapers.app","non_affiliation":"Code with Papers and Syntology are not affiliated with, endorsed by, or sponsored by Papers with Code, Meta, or the pwc-archive mirror.","licence":"CC BY-SA 4.0","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","attribution":"https://codewithpapers.app/attribution","modified":"archive material modified by Syntology; see the attribution page"},"url":"/paper/arxiv-2602-07422","title":"Secure Code Generation via Online Reinforcement Learning with Vulnerability Reward Model","arxiv_id":"2602.07422","date":"2026-02-07","proceeding":null,"authors":["Tianyi Wu","Mingzhe Du","Yue Liu","Chengran Yang","Terry Yue Zhuo","Jiaheng Zhang","See-Kiong Ng"],"abstract":"Large language models (LLMs) are increasingly used in software development, yet their tendency to generate insecure code remains a major barrier to real-world deployment. Existing secure code alignment methods often suffer from a functionality--security paradox, improving security at the cost of substantial utility degradation. We propose SecCoderX, an online reinforcement learning framework for functionality-preserving secure code generation. SecCoderX first bridges vulnerability detection and secure code generation by repurposing mature detection resources in two ways: (i) synthesizing diverse, reality-grounded vulnerability-inducing coding tasks for online RL rollouts, and (ii) training a reasoning-based vulnerability reward model that provides scalable and reliable security supervision. Together, these components are unified in an online RL loop to align code LLMs to generate secure and functional code. Extensive experiments demonstrate that SecCoderX achieves state-of-the-art performance, improving Effective Safety Rate (ESR) by approximately 10% over unaligned models, whereas prior methods often degrade ESR by 14-54%. We release our code, dataset and model checkpoints at https://github.com/AndrewWTY/SecCoderX.","url_abs":"https://arxiv.org/abs/2602.07422","url_pdf":"https://arxiv.org/pdf/2602.07422","source":{"archive":null,"snapshot":"2025-07-28","note":"not in the Papers with Code archive (frozen at the snapshot)","row_kind":"graph","title_abstract_authors_date":"arXiv metadata, CC0 1.0 (https://info.arxiv.org/help/license)"},"code_links":[],"tasks":[],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"syntology_url":"https://syntology.ai/paper/2602.07422","atlas_url":"https://app.syntology.ai/?focus=2602.07422","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2602.07422"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-25T09:33:49+00:00","read_at_is":"when the build read Syntology's graph, not when any sample ran","claim":"Per-sample execution status on synthesized fixtures; not a correctness claim about the paper. Samples come from repositories linked to the paper, official or community; repo_kind says which.","repos":[{"mentioned_in_github":null,"is_official":null,"provenance":"deterministic:regex_extraction","mentioned_in_paper":null,"url":"https://github.com/AndrewWTY/SecCoderX","reach":null}],"summary":{"unverified":10},"by_repo_kind":{"found_in_text":{"samples":10,"ran":0,"repositories":1}},"repo_kind_vocabulary":{"official":"The archive marks this repository official for the paper","named_in_paper":"The archive records that the paper mentions this repository; it is not marked official","listed":"In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper","found_in_text":"Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted","community":"Not in the archive's code links for this paper; a community repository Syntology harvested"},"n_pointer_only_for_licence":10,"samples":[{"code_sha256_prefix":"f17a43f998cfc7df","entry":"complete_code","repo":"AndrewWTY/SecCoderX","repo_kind":"found_in_text","path":"CWEval/cweval/commons.py","file_url":"https://github.com/AndrewWTY/SecCoderX/blob/HEAD/CWEval/cweval/commons.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"f17a43f998cfc7df"}},{"code_sha256_prefix":"560e4c81c5b22a2b","entry":"extract_code_from_response","repo":"AndrewWTY/SecCoderX","repo_kind":"found_in_text","path":"vul_induce_prompt_pipeline/inference_instructions_with_vllm.py","file_url":"https://github.com/AndrewWTY/SecCoderX/blob/HEAD/vul_induce_prompt_pipeline/inference_instructions_with_vllm.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"560e4c81c5b22a2b"}},{"code_sha256_prefix":"988cd7d58d646380","entry":"get_code_from","repo":"AndrewWTY/SecCoderX","repo_kind":"found_in_text","path":"CWEval/cweval/commons.py","file_url":"https://github.com/AndrewWTY/SecCoderX/blob/HEAD/CWEval/cweval/commons.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"988cd7d58d646380"}},{"code_sha256_prefix":"d2080e4b1d70bf91","entry":"get_history_filename","repo":"AndrewWTY/SecCoderX","repo_kind":"found_in_text","path":"vul_induce_prompt_pipeline/generate_instructions_batch.py","file_url":"https://github.com/AndrewWTY/SecCoderX/blob/HEAD/vul_induce_prompt_pipeline/generate_instructions_batch.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"d2080e4b1d70bf91"}},{"code_sha256_prefix":"ce1a7bb8eeeff782","entry":"get_history_filename","repo":"AndrewWTY/SecCoderX","repo_kind":"found_in_text","path":"vul_induce_prompt_pipeline/generate_scenarios_batch.py","file_url":"https://github.com/AndrewWTY/SecCoderX/blob/HEAD/vul_induce_prompt_pipeline/generate_scenarios_batch.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"ce1a7bb8eeeff782"}},{"code_sha256_prefix":"eaa7df33cf177361","entry":"load_config","repo":"AndrewWTY/SecCoderX","repo_kind":"found_in_text","path":"vul_induce_prompt_pipeline/generate_instructions_batch.py","file_url":"https://github.com/AndrewWTY/SecCoderX/blob/HEAD/vul_induce_prompt_pipeline/generate_instructions_batch.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"eaa7df33cf177361"}},{"code_sha256_prefix":"0348ea9288baf003","entry":"load_jsonl","repo":"AndrewWTY/SecCoderX","repo_kind":"found_in_text","path":"vul_induce_prompt_pipeline/inference_instructions_with_vllm.py","file_url":"https://github.com/AndrewWTY/SecCoderX/blob/HEAD/vul_induce_prompt_pipeline/inference_instructions_with_vllm.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"0348ea9288baf003"}},{"code_sha256_prefix":"95e7a771b99223f2","entry":"load_prompt_template","repo":"AndrewWTY/SecCoderX","repo_kind":"found_in_text","path":"vul_induce_prompt_pipeline/inference_instructions_with_vllm.py","file_url":"https://github.com/AndrewWTY/SecCoderX/blob/HEAD/vul_induce_prompt_pipeline/inference_instructions_with_vllm.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"95e7a771b99223f2"}},{"code_sha256_prefix":"075ea2984064fe95","entry":"load_prompts","repo":"AndrewWTY/SecCoderX","repo_kind":"found_in_text","path":"vul_induce_prompt_pipeline/generate_instructions_batch.py","file_url":"https://github.com/AndrewWTY/SecCoderX/blob/HEAD/vul_induce_prompt_pipeline/generate_instructions_batch.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"075ea2984064fe95"}},{"code_sha256_prefix":"1d423fe6d1bcc35a","entry":"run_in_subprocess","repo":"AndrewWTY/SecCoderX","repo_kind":"found_in_text","path":"CWEval/cweval/commons.py","file_url":"https://github.com/AndrewWTY/SecCoderX/blob/HEAD/CWEval/cweval/commons.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"1d423fe6d1bcc35a"}}]},"arxiv_metadata":{"licence":"arXiv metadata, CC0 1.0 (https://info.arxiv.org/help/license)","fields":["title","abstract","authors","date"],"primary_category":"cs.CL","source":"arxiv_2026.jsonl"},"syntology_extracted_results":null}