Lune

ICML2024顶会

Instruction Tuning for Secure Code Generation

Jingxuan He, Mark Vero, Gabriela Krasnopolska, Martin T. Vechev

摘要

Modern language models (LMs) have gained widespread acceptance in everyday and professional contexts, particularly in programming. An essential procedure enabling this adoption is instruction tuning, which substantially enhances LMs' practical utility by training them to follow user instructions and human preferences. However, existing instruction tuning schemes overlook a crucial aspect: the security of generated code. As a result, even the state-of-the-art instruction-tuned LMs frequently produce unsafe code, posing significant security risks. In this work, we introduce SafeCoder to address this gap. SafeCoder performs security-centric fine-tuning using a diverse and high-quality dataset that we collected using an automated pipeline. We integrate the security fine-tuning with standard instruction tuning, to facilitate a joint optimization of both security and utility. Despite its simplicity, we show that SafeCoder is effective across a variety of popular LMs and datasets. It is able to drastically improve security (by about 30%), while preserving utility.

问 Lune

几分钟读透这篇 Paper,不用再花一下午。

Lune 能读完全文,也能读引用它的顶会 Paper,讲清它的结论、证据和局限,每一点都注明出自哪篇 Paper。不用硬啃,也不靠猜。

已有 31 篇顶会 Paper 引用了它。别等审稿人问起,先弄清它们发现了什么。

可以从这些问题问起

Lune 可以查阅

全文 · 引用它的顶会 Paper · 相关的 Paper

获取答案

免费开始,无需绑卡

脉络

  • LoRA: Low-Rank Adaptation of Large Language Models 引用了 Language Models are Few-Shot Learners
  • INDICT: Code Generation with Internal Dialogues of Critiques for Both Security and Helpfulness 引用了 Language Models are Few-Shot Learners
  • INDICT: Code Generation with Internal Dialogues of Critiques for Both Security and Helpfulness 引用了 Training language models to follow instructions with human feedback
  • Multitask Prompted Training Enables Zero-Shot Task Generalization 引用了 Language Models are Few-Shot Learners
  • RESCUE: Retrieval Augmented Secure Code Generation 引用了 INDICT: Code Generation with Internal Dialogues of Critiques for Both Security and Helpfulness
  • TruthfulQA: Measuring How Models Mimic Human Falsehoods 引用了 Training language models to follow instructions with human feedback
  • Training language models to follow instructions with human feedback 引用了 TruthfulQA: Measuring How Models Mimic Human Falsehoods
  • PurpCode: Reasoning for Safer Code Generation 引用了 Training language models to follow instructions with human feedback
  • Exploiting LLM Quantization 引用了 TruthfulQA: Measuring How Models Mimic Human Falsehoods
  • Exploiting LLM Quantization 引用了 Language Models are Few-Shot Learners
  • Exploiting LLM Quantization 引用了 Training language models to follow instructions with human feedback
  • Training language models to follow instructions with human feedback 引用了 Multitask Prompted Training Enables Zero-Shot Task Generalization
  • Training language models to follow instructions with human feedback 引用了 Language Models are Few-Shot Learners
它引用的引用它的从左到右按年份排列,引用越多,位置越高。

引用它的顶会 Paper31

  1. Exploiting LLM QuantizationKazuki Egashira, Mark Vero, Robin Staab, Jingxuan He 等NeurIPS 2024 · 104 次引用
  2. PurpCode: Reasoning for Safer Code GenerationJiawei Liu, Nirav Diwan, Zhe Wang, Haoyu Zhai 等NeurIPS 2025 · 20 次引用
  3. RESCUE: Retrieval Augmented Secure Code GenerationJiahao Shi, Tianyi ZhangICLR 2026 · 15 次引用
  4. INDICT: Code Generation with Internal Dialogues of Critiques for Both Security and HelpfulnessHung Le, Doyen Sahoo, Yingbo Zhou, Caiming Xiong 等NeurIPS 2024 · 12 次引用
  5. Training Language Models to Generate Quality Code with Program Analysis FeedbackFeng Yao, Zilong Wang, Liyuan Liu, Junxia Cui 等NeurIPS 2025 · 11 次引用

它引用的 Paper15

  1. Language Models are Few-Shot LearnersTom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah 等NeurIPS 2020 · 64,255 次引用
  2. Training language models to follow instructions with human feedbackLong Ouyang, Jeffrey Wu, Xu Jiang, Diogo Almeida 等NeurIPS 2022 · 24,707 次引用
  3. LoRA: Low-Rank Adaptation of Large Language ModelsEdward J. Hu, Yelong Shen, Phillip Wallis, Zeyuan Allen-Zhu 等ICLR 2022 · 18,833 次引用
  4. TruthfulQA: Measuring How Models Mimic Human FalsehoodsStephanie Lin, Jacob Hilton, Owain EvansACL 2022 · 3,228 次引用
  5. Multitask Prompted Training Enables Zero-Shot Task GeneralizationVictor Sanh, Albert Webson, Colin Raffel, Stephen H. Bach 等ICLR 2022 · 1,976 次引用

相关 Paper

  1. ProSec: Fortifying Code LLMs with Proactive Security AlignmentXiangzhe Xu, Zian Su, Jinyao Guo, Kaiyuan Zhang 等ICML 2025
  2. Safety-Tuned LLaMAs: Lessons From Improving the Safety of Large Language Models that Follow InstructionsFederico Bianchi, Mirac Suzgun, Giuseppe Attanasio, Paul Röttger 等ICLR 2024 · 373 次引用
  3. CoSec: On-the-Fly Security Hardening of Code LLMs via Supervised Co-decodingDong Li, Meng Yan, Yaosheng Zhang, Zhongxin Liu 等ISSTA 2024 · 10 次引用
  4. Safety Fine-Tuning at (Almost) No Cost: A Baseline for Vision Large Language ModelsYongshuo Zong, Ondrej Bohdal, Tingyang Yu, Yongxin Yang 等ICML 2024 · 140 次引用
  5. WaveCoder: Widespread And Versatile Enhancement For Code Large Language Models By Instruction TuningZhaojian Yu, Xin Zhang, Ning Shang, Yangyu Huang 等ACL 2024
黄昏的海面,两侧是细线勾勒的悬崖