LLM捉鬼敢死队:通过自适应遗忘实现精准幻觉抑制 LLM Ghostbusters: Surgical Hallucination Suppression via Adaptive Unlearning 预印本

⚠️ 本文为 预印本(arXiv 公开版本),尚未经过正式同行评审。作者自发公开,结论未经期刊审稿验证,阅读时请知悉。
发布时间:2026-05-01
👁️ 预览文献
💡 AI 中文简介
大语言模型在生成代码时常会编造不存在的软件包名,攻击者可抢注这些虚构包名并植入恶意代码,形成“slopsquatting”供应链攻击。本文提出自适应遗忘(AU)框架,在模型部署后通过混合token级目标同时强化正确输出、抑制幻觉输出,并配合自适应发现循环自动挖掘新的幻觉触发场景。实验表明,AU将包幻觉率降低81%,大幅缩小攻击面,同时保持标准编码基准性能,且无需人工标注、可跨领域泛化。
领域大语言模型安全与可信AI
适合谁读需要一定专业背景(了解LLM训练与安全攻防)
核心贡献1. 提出自适应遗忘(AU)后部署框架,用混合token级目标同时强化有效输出并抑制幻觉输出;2. 设计无监督自适应发现循环,持续挖掘新的幻觉诱导上下文,实现对未见提示和幻觉的泛化。
关键数据包幻觉率降低81%;标准编码基准性能基本保持;分布变化集中在包相关生成,通用编码行为几乎不受影响;完全基于模型生成数据,无需人工标注。
推荐理由如果你关心大模型写代码时“一本正经胡说八道”带来的真实安全风险,这篇论文给出了一个不用重训、不用标注就能把幻觉砍掉八成的实用方案。
关键词["大语言模型", "机器遗忘", "包幻觉", "幻觉缓解", "软件安全"]

原文摘要

查看英文原文摘要

Hallucinations, outputs that sound plausible but are factually incorrect, remain an open challenge for deployed LLMs. In code generation, models frequently hallucinate non-existent software packages, recommending imports and installation commands for fictional libraries. This creates a critical supply-chain vulnerability: an attacker can proactively register such packages on public registries with malicious payloads that are subsequently installed and executed by developers or autonomous agents, a class of package confusion attack known as slopsquatting. Once a model is deployed, mitigating this failure mode is difficult: full retraining is costly, and existing approaches either cause severe degradation of model utility or rely on a pre-specified forget-set, an assumption that does not apply to the unbounded space of hallucinations. To address this problem, we present Adaptive Unlearning (AU), a post-deployment framework that surgically suppresses hallucinations while preserving general model utility. AU introduces a hybrid token-level objective that simultaneously reinforces valid outputs and suppresses hallucinated ones. Combined with an adaptive discovery loop that continuously surfaces new hallucination-inducing contexts without human supervision, AU enables generalization to unseen prompts and hallucinations. We demonstrate that AU reduces package hallucination rates by 81%, corresponding to a substantial reduction in slopsquatting attack surface, while maintaining performance on standard coding benchmarks. Our analysis shows that distributional changes are concentrated on package-related generations, leaving general coding behavior largely unaffected and confirming that AU's effect is isolated to the targeted distribution. AU operates entirely on model-generated data, requires no human annotation, and generalizes across domains.