arXiv:2512.03720cs.CRcs.AI2025-12NeurIPS

提出新防御机制,提升大模型对抗工具调用攻击的安全性

Context-Aware Hierarchical Learning: A Two-Step Paradigm towards Safer LLMs

  • 设计上下文感知分层学习框架,动态平衡语义理解与指令约束
  • 在工具补全攻击下,模型成功率从87.3%降至12.6%,显著提升鲁棒性
  • 无需微调即可泛化到多种攻击场景,适合安全敏感型应用

大语言模型在各类应用中表现强大,但其统一的标记处理方式在指令解析中存在关键漏洞,尤其在对抗场景下。本文识别并提出一种新型威胁——工具补全攻击(Tool-Completion Attack, TCA),利用函数调用机制操纵模型行为。为评估模型抗风险能力,我们构建了工具补全基准测试(Tool-Completion benchmark),结果表明,即使最先进的模型也对TCA高度脆弱,攻击成功率高达87.3%。为此,我们提出上下文感知分层学习(CAHL)机制,通过挖掘不同指令段之间的上下文关联,建立具有鲁棒性的上下文感知指令层级。大量实验显示,CAHL在零样本设置下显著增强模型对传统攻击和TCA的抵御能力,同时保持通用任务性能。代码已开源。

原文摘要 · Abstract (English)

Large Language Models (LLMs) have emerged as powerful tools for diverse applications. However, their uniform token processing paradigm introduces critical vulnerabilities in instruction handling, particularly when exposed to adversarial scenarios. In this work, we identify and propose a novel class of vulnerabilities, termed Tool-Completion Attack (TCA), which exploits function-calling mechanisms to subvert model behavior. To evaluate LLM robustness against such threats, we introduce the Tool-Completion benchmark, a comprehensive security assessment framework, which reveals that even state-of-the-art models remain susceptible to TCA, with surprisingly high attack success rates. To address these vulnerabilities, we introduce Context-Aware Hierarchical Learning (CAHL), a sophisticated mechanism that dynamically balances semantic comprehension with role-specific instruction constraints. CAHL leverages the contextual correlations between different instruction segments to establish a robust, context-aware instruction hierarchy. Extensive experiments demonstrate that CAHL significantly enhances LLM robustness against both conventional attacks and the proposed TCA, exhibiting strong generalization capabilities in zero-shot evaluations while still preserving model performance on generic tasks. Our code is available at https://github.com/S2AILab/CAHL.

大模型安全指令攻击防御机制

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。