让程序员实时干预AI生成代码,减少安全漏洞
HiLDe: Intentional Code Generation via Human-in-the-Loop Decoding

- 用户可实时查看并修改AI生成代码的关键决策
- 实验显示漏洞减少40%以上,目标对齐度显著提升
- 适合关注代码安全与可控性的开发者使用
尽管人工智能编程工具有望大幅提升程序员的能力与效率,但它们常将用户排除在关键决策之外,导致使用者过度依赖系统输出,甚至‘关闭思维’。在关键领域(如软件安全)中,这种行为可能带来严重后果。我们提出人机协同解码(Human-in-the-loop Decoding),一种新型交互方式,使用户能在代码生成过程中观察并直接干预大模型的决策,以确保输出符合个人需求。我们实现了该技术的原型HiLDe,一个代码补全助手,它会高亮模型的关键决策点,并提供局部替代方案供用户探索。在一项包含18名参与者的对照研究中,针对安全相关任务,相比传统代码补全助手,HiLDe显著减少了漏洞数量,并提升了代码生成与用户目标的一致性。
原文摘要 · Abstract (English)
While AI programming tools hold the promise of increasing programmers' capabilities and productivity to a remarkable degree, they often exclude users from essential decision-making processes, causing many to effectively "turn off their brains" and over-rely on solutions provided by these systems. These behaviors can have severe consequences in critical domains, like software security. We propose Human-in-the-loop Decoding, a novel interaction technique that allows users to observe and directly influence LLM decisions during code generation, in order to align the model's output with their personal requirements. We implement this technique in HiLDe, a code completion assistant that highlights critical decisions made by the LLM and provides local alternatives for the user to explore. In a within-subjects study (N=18) on security-related tasks, we found that HiLDe led participants to generate significantly fewer vulnerabilities and better align code generation with their goals compared to a traditional code completion assistant.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。