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

Source: [Context-Aware Hierarchical Learning: A Two-Step Paradigm towards Safer LLMs](<https://www.sota2.com/research/paper/69311580d6b0dd3342933b0d>)

Collection index: [llms.txt](<https://www.sota2.com/research/llms.txt>)

Data updated: 2025-12-05T05:03:13.504Z

Authors: Tengyun Ma, Jiaqi Yao, Daojing He, Shihao Peng, Yu Li, Shaohui Liu, Zhuotao Tian

Published: 2025-12-03T12:10:21.000Z

## Abstract

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.

## Recorded benchmark results

A research result applies to its stated dataset, split, metric and evaluation configuration. Compare like-for-like settings, preserve the metric's unit and direction, and distinguish paper-reported results from independent reproduction. The best result recorded here is not a claim of exhaustive, current global coverage.

- [Prompt Injection Attack on Tool-Completion (TCA)](<https://www.sota2.com/research/sota/prompt-injection-attack-on-tool-completion-tca.md>): Prompt Injection Attack; Tool-Completion (TCA); ASR: 0.12.

- [Structured Query Instruction Following on StruQ clean](<https://www.sota2.com/research/sota/structured-query-instruction-following-on-struq-clean.md>): Structured Query Instruction Following; StruQ clean; Capability: 78.89.

- [Prompt Injection Attack on Tool-Completion TCA-e](<https://www.sota2.com/research/sota/prompt-injection-attack-on-tool-completion-tca-e.md>): Prompt Injection Attack; Tool-Completion TCA-e; ASR: 56.

- [Prompt Injection Attack on Tool-Completion Naive-e](<https://www.sota2.com/research/sota/prompt-injection-attack-on-tool-completion-naive-e.md>): Prompt Injection Attack; Tool-Completion Naive-e; ASR: 15.

- [Prompt Injection on GCG Clean](<https://www.sota2.com/research/sota/prompt-injection-on-gcg-clean.md>): Prompt Injection; GCG Clean; ASR: 37.02.

- [Tool Completion on Tool-Completion Adv](<https://www.sota2.com/research/sota/tool-completion-on-tool-completion-adv.md>): Tool Completion; Tool-Completion Adv; Capability: 81.35.

- [Instruction Adherence and Security Robustness on StruQ 1.0 (Adversarial)](<https://www.sota2.com/research/sota/instruction-adherence-and-security-robustness-on-struq-1-0-adversarial.md>): Instruction Adherence and Security Robustness; StruQ 1.0 (Adversarial); Capability Score: 83.79.

- [Tool Completion on Tool-Completion Clean](<https://www.sota2.com/research/sota/tool-completion-on-tool-completion-clean.md>): Tool Completion; Tool-Completion Clean; Capability: 77.12.

- [Instruction Adherence and Security Robustness on StruQ Clean 1.0](<https://www.sota2.com/research/sota/instruction-adherence-and-security-robustness-on-struq-clean-1-0.md>): Instruction Adherence and Security Robustness; StruQ Clean 1.0; Capability Score: 83.6.

## Original sources and implementation

[Original paper](<https://arxiv.org/abs/2512.03720>)

[PDF](<https://arxiv.org/pdf/2512.03720.pdf>)
