← 返回全部开发案例
本案例由 AI 匿名评审,尚未经过独立人工复核;请结合原稿、卡片与两边输出自行核对。
自动补全有卡片更好280 / 280 · beu-cb8593ab297330d9

On Fixing Insecure AI-Generated Code through Model Fine-Tuning and Prompting Strategies

计算机科学 · 2605.05867v1

FLOWING EVIDENCE BENCHMARK

我们怎样比较有卡片和无卡片的续写?

在同一个写作位置,我们用同一个模型分别生成有卡片和无卡片的首次结果。全部 280 组都进入整体匿名评审;一侧不续写时,评审会判断这种克制是否适合原稿。

整体结果:有卡片更好 138 次、差不多 26 次、无卡片更好 107 次、两边都不可用 5 次、评审未决 4 次。218 组双方有正文,48 组至少一侧主动不续写,14 组含无效输出。

同一段原稿 · 比较有无论文卡片

01 · 固定写作位置

论文原稿

同一处写作点位 ▌

同一原稿位置的自动补全成对比较

02 · 准备两个版本

两组共用

原稿、写作任务和生成模型

A · 有论文卡片

额外提供相关论文卡片

B · 无论文卡片

不提供论文卡片

生成模型

同一模型、同一版本

A → 首次输出

B → 首次输出

AI 匿名评审

匿名标记两份首次输出为 X、Y

按续写质量判断:准确性、任务贴合度和可用性
输出:X 更优 / 持平 / Y 更优 / 两组均不可用

交换两份答案的顺序再评一次

盲评具体怎么判?

① 匿名两份输出
AI 评审看到同一原稿和两份首次输出,但不知道哪份用了卡片。

② 比较并换序复评
根据当前任务的标准,按 X/Y、再按 Y/X 的顺序各评一次。

③ 复核分歧
两次结论不一致时再做第三次判定;未完成的评审也留在分母。

点位和卡片怎样选?

我们从 7 个学科各选取 40 个写作位置,共比较 280 次。每次比较前先确定写作位置和相关论文卡片,让有卡片和无卡片两组从同一原稿出发。

主结果保留了所有预先固定的点位,包括卡片可能无法补充有用内容的位置。这避免了根据输出筛选案例,但也意味着 49% 衡量的是整批点位的结果,不能直接解释为“证据能明显发挥作用时”的胜率。本批数据没有在生成前逐点标注这一证据机会,暂时无法可靠拆分两组。

CARD USE · 140/280

有正文且报告使用卡片的比例

模型会报告卡片是否影响了续写。280 次测试中,140 次有正文且报告使用卡片。原口径的 150 次包含 10 次无正文,已修正。

COMPARISON · 70 / 7 / 30

双方都有正文时,哪个版本更好?

在有正文且报告使用卡片、两组也都写出正文的 107 次比较中,AI 盲评认为有卡片更好 70 次、差不多 7 次、无卡片更好 30 次。

表格里的两个百分比怎么算?

有正文且报告使用卡片的比例

140有正文且报告使用
÷
280全部点位
=
50%

有卡片版本更好比例

70有卡片更好
÷
107可比较的测试
=
65%

两个百分比的分母不同:50% 看全部 280 次补全;65% 只看有正文且报告使用、且两边都有完整输出的 107 次。卡片是否被使用由生成模型报告,哪边写得更好由 AI 匿名评审。

卡片使用由生成模型自报,整体胜负由看到原稿和材料片段的 AI 匿名评审;没有独立人工评审,仍可能有材料偏好。整体结果反映这 280 个固定点位上的自动判断,不代表任意写作场景的获胜概率。

原稿写作位置

原文摘录 · 非 PDF 页面

研究论文 · 原文片段

On Fixing Insecure AI-Generated Code through Model Fine-Tuning and Prompting Strategies

body

One of the earlier efforts is LLMSecEval (developed in 2023), which provides 150 natural-language prompts tied to MITRE’s Top-25 CWEs and includes secure reference implementations, allowing model outputs to be checked against known vulnerabilities [56]. Another benchmark, CodeLMSec, was introduced in 2024. Using a dataset of 280 non-secure prompts in Python and C, models were tested with CodeQL to quantify the number of outputs that contain high-risk CWEs [24]. In our study, static code analysis is utilised. The CodeQL tool was chosen for security analysis to identify security weaknesses in code samples. 2.4 Techniques to Mitigate Vulnerabilities in AI-Generated Code As the security of AI-generated code has become a growing concern, recent research has focused on developing various mitigation strategies to remove as many security weaknesses as possible from AI-generated code. One prominent method is to train models on security-aligned code datasets. For example, a paper by Xu et al. [62] describes ProSec; a fine-tuning approach where a dataset of synthetic code snippets is

↓ 此处生成下一段续写

黄色标出写作点位附近的原文;本页根据评测输入重排文本,不是原始 PDF 截图。

同一写作位置的成对对照全样本 AI 评审:有卡片更好

两组使用同一模型、同一写作任务和原稿上下文,仅比较是否提供检索文献片段。下方展示评测记录中的首次输出。

查看全样本 AI 评审理由(英文)

A = 有卡片 · B = 无卡片

Both outputs complete the sentence about ProSec appropriately, but Output A is significantly more useful. The draft has established a pattern of substantive, source-grounded descriptions (LLMSecEval with '150 natural-language prompts tied to MITRE's Top-25 CWEs,' CodeLMSec with '280 non-secure prompts in Python and C'). Output A matches this scope by specifying that the synthetic code snippets are 'generated from Common Weakness Enumerations (CWEs)' and that alignment occurs 'through preference learning'—both details directly supported by the ProSec source snippet, which mentions 'synthesizing error-inducing coding scenarios from Common Weakness Enumerations (CWEs)' and 'advanced preference learning objectives.' Output B is factually correct but overly generic ('used to fine-tune a model so that it generates more secure code'); it adds no specific information beyond what 'ProSec; a fine-tuning approach' already conveys. Output A fits the draft's informational density and argumentative style, continuing the pattern of concrete technical detail that makes the survey useful.

Evidence

同一模型与写作位置 · 提供检索文献片段 · 首次输出

盲评更优

generated from Common Weakness Enumerations (CWEs) and used to align the model with secure coding practices through preference learning.

提供给 Evidence 版本的文献片段

卡片 1 · ProSec: Fortifying Code LLMs with Proactive Security Alignment

In this paper, we propose PROSEC, a novel proactive security align- ment approach designed to align code LLMs with secure coding practices. PROSEC systematically exposes the vulnerabilities in a code LLM by syn- thesizing error-inducing coding scenarios from Common Weakness Enumerations (CWEs), and…

展开完整文献摘录

In this paper, we propose PROSEC, a novel proactive security align- ment approach designed to align code LLMs with secure coding practices. PROSEC systematically exposes the vulnerabilities in a code LLM by syn- thesizing error-inducing coding scenarios from Common Weakness Enumerations (CWEs), and generates fixes to vulnerable code snippets, allow- ing the model to learn secure practices through advanced preference learning objectives

卡片 2 · Emergent Abilities in Large Language Models: A Survey

Large Language Models (LLMs) are leading a new technological revolution as one of the most promising research streams toward artificial general intelligence. The scaling of these models, accomplished by increasing the number of parameters and the magnitude of the training datasets, has been linked t…

展开完整文献摘录

Large Language Models (LLMs) are leading a new technological revolution as one of the most promising research streams toward artificial general intelligence. The scaling of these models, accomplished by increasing the number of parameters and the magnitude of the training datasets, has been linked to various so-called emergent abilities that were previously unobserved. These emergent abilities, ranging from advanced reasoning and in-context learning to coding and problem-solving, have sparked an intense scientific debate: Are they truly emergent, or do they simply depend on external factors, such as training dynamics, the type of problems, or the chosen metric? What underlying mechanism causes them? Despite their transformative potential, emergent abilities remain poorly understood, leading to misconceptions about their definition, nature, predictability, and implications. In this work, we shed light on emergent abilities by conducting a comprehensive review of the phenomenon, addressi …

卡片 3 · MoE-LLaVA: Mixture of Experts for Large Vision-Language Models

Recent advances demonstrate that scaling Large Vision-Language Models (LVLMs) effectively improves downstream task performances. However, existing scaling methods enable all model parameters to be active for each token in the calculation, which brings massive training and inferring costs. In this wo…

展开完整文献摘录

Recent advances demonstrate that scaling Large Vision-Language Models (LVLMs) effectively improves downstream task performances. However, existing scaling methods enable all model parameters to be active for each token in the calculation, which brings massive training and inferring costs. In this work, we propose a simple yet effective training strategy MoE-Tuning for LVLMs. This strategy innovatively addresses the common issue of performance degradation in multi-modal sparsity learning, consequently constructing a sparse model with an outrageous number of parameters but a constant computational cost. Furthermore, we present the MoE-LLaVA, a MoE-based sparse LVLM architecture, which uniquely activates only the top-k experts through routers during deployment, keeping the remaining experts inactive. Extensive experiments show the significant performance of MoE-LLaVA in a variety of visual understanding and object hallucination benchmarks. Remarkably, with only approximately 3B sparsely a …

卡片 4 · Towards Efficient Mixture of Experts: A Holistic Study of Compression Techniques

Scaling large language models has driven remarkable advancements across various domains, yet the continual increase in model size presents significant challenges for real-world deployment. The Mixture of Experts (MoE) architecture offers a promising solution by dynamically selecting and activating o…

展开完整文献摘录

Scaling large language models has driven remarkable advancements across various domains, yet the continual increase in model size presents significant challenges for real-world deployment. The Mixture of Experts (MoE) architecture offers a promising solution by dynamically selecting and activating only a subset of experts during inference, thus substantially reducing computational costs while preserving high performance. Despite these benefits, MoE introduces new inefficiencies, such as excessive parameters and communication overhead. In this work, we present a holistic study of compression techniques for Mixture of Experts to enhance both efficiency and scalability. While recent efforts have focused on Expert Trimming, which reduces the number of experts, these approaches still suffer from considerable communication and computational costs. To address this, we propose more aggressive strategies, such as Layer Drop, which removes entire MoE layers, and Block Drop, which eliminates tran …

卡片 5 · Improving Multi-Step Reasoning Abilities of Large Language Models with Direct Advantage Policy Optimization

The role of reinforcement learning (RL) in enhancing the reasoning of large language models (LLMs) is becoming increasingly significant. Despite the success of RL in many scenarios, there are still many challenges in improving the reasoning of LLMs. One challenge is the sparse reward, which makes op…

展开完整文献摘录

The role of reinforcement learning (RL) in enhancing the reasoning of large language models (LLMs) is becoming increasingly significant. Despite the success of RL in many scenarios, there are still many challenges in improving the reasoning of LLMs. One challenge is the sparse reward, which makes optimization difficult for RL and necessitates a large amount of data samples. Another challenge stems from the inherent instability of RL, particularly when using Actor-Critic (AC) methods to derive optimal policies, which often leads to unstable training processes. To address these issues, we introduce Direct Advantage Policy Optimization (DAPO), an novel step-level offline RL algorithm. Unlike standard alignment that rely solely outcome rewards to optimize policies (such as DPO), DAPO employs a critic function to predict the reasoning accuracy at each step, thereby generating dense signals to refine the generation strategy. Additionally, the Actor and Critic components in DAPO are trained i …

模型报告的实际卡片作用

卡片 1 · fact

影响的输出:generated from Common Weakness Enumerations (CWEs) and used to align the model with secure coding practices through preference learning.

模型说明:The row supplies the concrete facts that ProSec's synthetic snippets are derived from CWEs and that alignment is achieved via preference learning, which completes the unfinished clause about Xu et al.'s ProSec.

无 Evidence

同一模型与写作位置 · 不提供检索文献片段 · 首次输出

本次未获偏好

used to fine-tune a model so that it generates more secure code.

原卡片使用口径的记录

以下是此前仅比较“报告使用卡片且双方有正文”案例的诊断记录,口径与上方全样本 AI 评审不同。

模型盲评判定“有卡片更好”。下方保留评审原始理由(英文),供核对判断依据。

查看模型评审原始理由(英文)

Both outputs complete the sentence conservatively and are source-grounded. Output A is preferable because it directly incorporates specific, accurate details from the ProSec source: (1) the dataset is 'generated from Common Weakness Enumerations (CWEs)' — matching 'synthesizing error-inducing coding scenarios from Common Weakness Enumerations (CWEs)', and (2) it uses 'preference learning' — matching 'advanced preference learning objectives'. Output A also captures the 'align the model with secure coding practices' purpose stated in the source. Output B is more generic ('fine-tune a model so that it generates more secure code') and loses the specific mechanisms (CWEs, preference learning) that distinguish ProSec's approach. Output A requires less editing to be publication-ready while preserving the draft's scope and meaning.

文献片段是输入材料;出现于此不代表输出使用了它,也不代表它能够支持全部主张。原文与检索片段经过截取;页面没有展示模拟分数或模拟 PDF。