acceptodds
Under review as a conference paper at ICLR 2027

Hierarchical Runtime Alignment for Safe Long-Context Agents

Abstract

Long-context agents require safety controls that remain effective as model state, retrieved context, and cache state change over time. We introduce hierarchical run- time alignment, a deployment-time framework that combines three coupled layers: L1 parametric safety adaptation, L2 contextual policy evidence, and L3 cache-level safety preservation. Using matched vanilla/abliterated pairs from Qwen3-8B and Llama-3.2-3B, we show that runtime safety is a state-dependent calibration prob- lem rather than a single guardrail problem. Our experiments yield three findings. First, contextual policy substantially reduces harmful compliance in the tested abliterated models. Its false-refusal cost varies with model state and policy strength. Second, the tested safety–utility operating point depends on model state. Third, matched benign controls distinguish cache-allocation effects from uniform preci- sion reduction. Generic INT4 changes harmful and benign behavior together. The Qwen allocation control changes which signals retain precision. Key comparisons use three seeds, paired uncertainty, two independent semantic judges, and a prevali- dated fixed-subset LongSafetyBench evaluation. Across factorial sweeps, agent tasks, adaptive attacks, many-shot jailbreaks, RULER, and LongSafetyBench, the results support joint, model-state-aware calibration rather than a universal all-on configuration.

Primary area:
alignment, fairness, safety, privacy, and societal considerations
Keywords:
Alignment, Safety

Reviews

Among:
Shape:
1234this paper, Bottom 9%
Figure 1. Mean review rating of the reviewed papers at ICLR 2027. This paper averages 1.50 over 2 reviews, above 9% of the others.
Reviewer_1ZfZOpenReview ↗
Rating
2
Confidence
3
Informativeness
1
Presentation
2
Soundness
2
Read review
Paper summary

The paper targets an important problem: agents are expected to maintain their safety controls as the model state, context and cache contents change over long conversations. The paper presents a three-layer deployment-time framework. The first layer targets parametric adaptation. The second adds contextual policy evidence to the prompt from retrieved or inserted safety documents. The third explores how shrinking the KV cache affects safety. The evaluation uses JailbreakBench, AgentHarm and LongSafetyBench, reports results on many-shot jailbreaks, and includes ablations.

Critical strengths
  1. The paper evaluates its safety controls on two versions of each model (original and abliterated) and along two axes: answering harmful requests (CVR) and refusing harmless ones (FPR). This supports more informed conclusions about how effective the controls are. For example, L2 (adding safety instructions to the prompt) helps the abliterated model but hurts the original model (Table 1).

  2. The paper does not present capability degradation as a safety gain. For example, applying INT4 lowers the many-shot jailbreak success rate. The paper correctly attributes this drop to the model’s loss of in-context learning ability rather than to improved safety. Anyone evaluating KV-cache compression on safety benchmarks could reuse this control.

Critical weaknesses
  1. The paper is motivated by agents that use tools and face prompt injection over many turns, but the experimental setups do not reflect this setting. The long-context datasets test long inputs, but none of them is multi-turn. AgentHarm is run single-turn, without tool execution and without its benign tasks. Finally, no indirect prompt-injection benchmark (e.g., AgentDojo or InjecAgent) is used.

  2. The abstract mentions three seeds and paired uncertainty estimates, but the tables report neither per-seed results nor intervals. Moreover, one of the paper’s main claims, “calibrated operating points beat strict policies” (Sec. 3.2), does not hold for the abliterated Llama model. In Table 3, the best calibrated Llama setting has a combined score (CVR + FPR, lower is better) of 0.17. Under the strict policy with the adapter at strength 0.7, the abliterated Llama model scores 0.15 (Table A.8). So on this model, calibration provides no improvement over the strict policy.

Questions for authors

Please see the Critical Weaknesses section.

1 comment

We thank the reviewer for recognizing the paired checkpoint-state evaluation and the benign controls for cache-induced capability degradation. We address the two concerns with additional experiments and clearer reporting.

C1. Multi-turn tool execution and indirect prompt injection

We added native AgentDojo evaluation with actual multi-turn tool execution, indirect injections through tool responses, and environment-state verification of benign completion and attacker success. The banking study covers ten held-out tasks, two injection goals, three seeds, and 19 configurations (1,140 records). Configurations are selected using separate calibration data. Fixed attacks are supplemented by a defense-aware attacker using target feedback for up to four trials.

CheckpointBenign completion: baseline → selectedAdaptive ASR: baseline → selectedPaired ASR change [95% interval], pp
Qwen vanilla70% → 60%25% → 25%0 [0, 0]
Qwen abliterated70% → 50%25% → 5%−20 [−40, 0]
Llama vanilla50% → 60%10% → 5%−5 [−15, 0]
Llama abliterated50% → 20%5% → 0%−5 [−15, 0]

For abliterated Qwen, this is an 80% relative reduction in adaptive attack success, alongside a 28.6% relative reduction in benign completion. The table reports both outcomes so safety changes can be interpreted together with task capability. For abliterated Llama, the larger benign-completion loss likewise matters when interpreting its low ASR. We also froze model-specific selections on a separate 48-cell banking development grid and evaluated transfer to 78 fresh workspace/travel/Slack tasks, collecting 1,404 records across 27 executable conditions. Analysis uses native outcomes, task-clustered uncertainty, and bounds for 28 unknown outcomes. These experiments directly address the missing tool-use and indirect-injection setting. We will distinguish multi-turn sandbox evidence from the original long-input evaluations; benign utility is measured by successful task execution.

C2. Per-seed uncertainty and the strict-policy Llama comparison

The reviewer is correct that 0.15 is better than 0.17 under CVR+FPR. We will replace “calibrated operating points beat strict policies” with the more precise conclusion: calibration identifies checkpoint- and objective-specific operating points, and strict policy can itself be the preferred setting. We added per-seed summaries and direct paired comparisons on shared held-out prompts for seeds 42/123/456. The following fresh abliterated-Llama comparison evaluates strict policy against the historical selected configuration:

Metric (lower is better)Strict minus selected [95% paired interval]
CVR + FPR−0.0833 [−0.1333, −0.0350]
J = semantic CVR + (1 − strict IFEval accuracy)+0.0033 [−0.0683, +0.0733]

Strict policy performs better on CVR+FPR, consistent with the reviewer's objection. The instruction-accuracy-based objective gives a near-zero point difference with an interval spanning zero. This separates refusal behavior from successful instruction following and explains why the calibration objective must be explicit. The fresh protocol is a matched follow-up, rather than a numerical reproduction of the original 0.17/0.15 table. Intervals use 4,000 paired prompt-clustered bootstrap resamples, retaining all three seeds within each prompt; agent intervals similarly retain goals and seeds within task clusters. We will place intervals alongside the main results and provide per-seed tables, making the checkpoint-specific conclusions directly inspectable.

Reviewer_nxPfOpenReview ↗
Rating
1
Confidence
3
Informativeness
1
Presentation
1
Soundness
2
Read review
Paper summary

This paper studies runtime safety alignment for long-context LLM agents, focusing on how safety interventions interact across model states, policy contexts, and KV-cache configurations. The authors introduce a hierarchical framework comprising three levels: LoRA-based parametric safety adaptation, retrieved or inserted safety-policy context, and KV-cache quantization or compression. Experiments on vanilla and abliterated variants of Qwen3-8B and Llama-3.2-3B evaluate harmful compliance, benign refusal, jailbreak robustness, and long-context performance. The results suggest that contextual policies can reduce harmful compliance in abliterated models but increase false refusals in already aligned models, while cache interventions can affect both safety and benign capabilities. The authors argue for model-state-dependent calibration of these interventions rather than a universally optimal configuration.

Critical strengths
  1. The paper considers the problem: maintaining agent safety as model weights, policy context, and KV-cache configurations change during deployment.
  2. The evaluation covers both vanilla and abliterated models from two model families and considers harmful compliance alongside benign refusal.
Critical weaknesses
  1. I cannot grasp the motivation and core idea from the introduction. The authors merely list several factors affecting agent security, such as long contexts, weight editing, guardrails, and KV caches, but what problem does this paper aim to address? What are the limitations of existing work? These background issues are not explained, making the introduction difficult to follow and understand.
  2. The paper defines L1, L2, and L3 in an agent security system, but why is this division necessary, what is its rationale, and what advantages does it offer? The paper lacks an intuitive or quantitative explanation for this division.
  3. The proposed approach is incremental: it is merely a combination of LoRA safety alignment, prompt-based safety policies, and KV-cache mechanisms. No technical details—not even the safety-policy prompts—are provided, and no new techniques are proposed.
  4. The experimental section does not explain the specific goal of each experiment, making it difficult for the reader to understand what the experiments are intended to demonstrate.
  5. Based on these results, I strongly suspect that this paper was generated by an automated research system. Its quality, especially its writing, is very poor and falls far below ICLR’s bar.
Questions for authors

Please refer to Weaknesses.

2 comments

We thank the reviewer for recognizing the deployment problem and the paired evaluation across model families and checkpoint states. We apologize that the introduction and experimental organization did not communicate our motivation and contribution clearly. We address C1–C5 below.

C1. Motivation and core idea

The deployment question is: when model weights, policy context, or cache configuration changes, does the previously calibrated safety–utility operating point still hold? Studying each component separately does not answer how their effects transfer across checkpoint states and combinations. This joint assessment is the gap our study targets. In particular, KV-cache quantization/compression may appear to be only a memory-efficiency choice, yet it also changes the representation used during inference and can affect harmful compliance and benign capability. Likewise, the same policy can reduce harmful compliance in abliterated checkpoints while increasing benign refusal in aligned checkpoints. Our core idea is therefore to evaluate these influences together and calibrate the operating point for the deployed model state. We will reorganize the introduction around this concrete question, the limitation of isolated component evaluation, and the resulting empirical findings.

C2. Rationale for L1–L2–L3

The division follows where an intervention acts, rather than an assumed ranking of effectiveness:

LayerIntervention locationDeployment variable
L1Model parametersSafety-LoRA strength
L2Input policy contextPolicy wording/insertion/retrieval
L3Cached inference representationKV precision/compression/allocation

This organization provides a controlled experimental interface: vary one location, measure combinations, and select checkpoint-specific settings. We added complete eight-cell actual L1–L2–L3 factorials for all four checkpoint states and separate retrieved-policy/compression factorials. In the latter, the policy-by-compression IFEval interaction is positive across states (approximately +0.198 to +0.420), illustrating how policy context can buffer utility loss under compression. The framework supports measuring such effects rather than presuming that every combination helps.

C3. Contribution and implementation details

We agree that LoRA, policy prompting, and cache mechanisms are established components. The contribution is their controlled, model-state-dependent safety–utility characterization and calibration, not a new LoRA or quantization algorithm. Matched vanilla/abliterated checkpoints, constituent comparisons, benign controls, and held-out evaluation distinguish component effects from checkpoint dependence and capability loss. We will make the implementation self-contained by including exact policy prompts, adapter strengths, insertion/retrieval procedures, cache settings, calibration rules, data splits, and attack budgets. The added experiments use two independent semantic judges, official strict IFEval scoring, and native tool-task verification, with paired uncertainty and recorded memory/time costs.

C4. Purpose of each experiment

We will introduce each experiment with its question and comparison:

ExperimentQuestion answered
Paired checkpoint statesDoes the same intervention transfer across refusal behaviors?
Constituents and held-out calibrationWhich components and combinations define useful operating points?
Cache and benign controlsHow do cache changes affect harmful behavior and task capability?
Common-protocol LongSafetyBenchHow do safety decisions and answer-format reliability change?
Native tools and adaptive attacksHow do calibration-selected settings behave during multi-step execution?

This question–comparison–result structure will replace the current fragmented presentation.

C5. Writing quality and research process

We apologize for the writing and presentation problems and take responsibility for correcting them. The work was completed with human involvement throughout the research process. We will clarify the contribution, improve organization, and provide reproducible methodological details. We respectfully ask that the scientific assessment focus on the methods, evidence, and conclusions; an impression about automated authorship is not itself evidence of technical invalidity.

Thanks for the authors’ response. After reading the responses, I think this paper still needs a major reformulation, so I will keep my score.

Comments on the paper

1 comment

We thank the reviewer for recognizing checkpoint-dependent calibration and the distinction between capability degradation and safety.

C1. Contribution and hierarchy

Our contribution is model-state-specific safety–utility calibration. The hierarchy organizes interventions—weights, policy context, and cache representation—for controlled comparisons and checkpoint-specific selection. Actual-cache factorials and held-out calibration (Q1) quantify composition effects. Quantization experiments measure harmful compliance and benign accuracy together; selective degradation is an additional mechanism question.

C2. Measurement and agent-safety scope

New experiments use two independent semantic judges, official strict IFEval accuracy, and native AgentDojo tool execution with environment-state verification. These measure harmfulness, instruction accuracy, benign completion, and harmful multi-step actions, separately from historical proxies. EPFL characterizes the original attack setting; Q3 adds defense-aware adaptive attacks against tool-executing agents.

Q1. Matched constituents, held-out calibration, and cache allocation

We added complete eight-cell actual L1–L2–L3 factorials for all four checkpoint states, plus separate retrieved-policy/compression factorials. Evaluation uses 100 held-out harmful and 100 official IFEval prompts across three paired seeds. Reports include peak VRAM, elapsed time, and 95% intervals from 4,000 prompt-clustered bootstrap resamples. For J = semantic CVR + (1 − strict IFEval accuracy), lower is better:

CheckpointJoint minus independent J [95% paired interval]
Qwen vanilla+0.0250 [−0.0333, +0.0817]
Qwen abliterated+0.0617 [−0.0250, +0.1517]
Llama vanilla−0.0050 [−0.0550, +0.0483]
Llama abliterated+0.1417 [+0.0800, +0.2050]

Three intervals include zero; abliterated Llama favors independent composition. Actual-cache combined-score interaction intervals also include zero, motivating checkpoint-specific constituent selection rather than uniform activation. Cache allocation uses eight fresh cells of 1,800 records, matched budgets, and BF16 position controls. Protected-policy minus quantized-policy harmful-compliance differences are −4.00 percentage points [−7.50, −0.75] for vanilla Qwen and −2.67 [−4.83, −0.75] for abliterated Qwen. Subtracting BF16 position effects gives +0.58 [−2.33, +3.67] and −2.00 [−4.50, +0.25]. These contrasts separate allocation from position effects; benign controls measure capability costs.

Q2. Common LongSafetyBench protocol

We reran all checkpoints on one frozen 54-item common-feasibility subset, using identical direct-letter prompting, greedy decoding, a 24,000-token total limit, and a strict parser. Invalid answers score zero in the fixed denominator.

CheckpointSafe answers: baseline → policyValid parses: baseline → policy
Qwen vanilla31/54 → 41/5454 → 54
Qwen abliterated22/54 → 27/5454 → 54
Llama vanilla18/54 → 22/5452 → 46
Llama abliterated14/54 → 24/5452 → 49

BF16 and INT4 have identical counts under this protocol; the historical Qwen gain does not reproduce. The subset covers seven subtasks. Llama's lower capability may contribute to format difficulty. Safe-answer scores improve despite fewer valid parses. With invalid answers scored zero and the denominator fixed, this reflects more correctly formatted safe answers, not exclusion of invalid outputs: improved measured safety alongside format-reliability costs.

Q3. Multi-turn tools and policy-aware adaptive attacks

We added native AgentDojo sandbox execution, measuring benign completion and harmful actions through actual tools and environment-state verifiers. A defense-aware attacker uses target feedback for up to four trials, alongside fixed attacks and matched controls. Banking evaluation: 1,140 records, 19 configurations, ten held-out tasks. For abliterated Qwen:

MetricBaseline → selectedRelative changePaired change [95% interval], pp
Adaptive attack success25% → 5%−80.0%−20 [−40, 0]
Benign task completion70% → 50%−28.6%−20

Attack success declines proportionally more than benign completion; the table reports the operating-point benefit, utility cost, and uncertainty. Separately, we froze selections on a 48-cell banking development grid and collected 1,404 records across 27 executable conditions on 78 fresh workspace/travel/Slack tasks. Analysis uses native task outcomes, task-clustered uncertainty, and bounds for 28 unknown outcomes. These results evaluate transfer beyond banking; Llama's low benign completion (0–30%) calls for interpreting its ASR together with task capability. Together, these provide held-out evaluation with multi-turn sandbox tools, benign verification, and policy-aware adaptive attacks.

From OpenReview, CC BY 4.0. Authors as signed there; shown unedited.

Related papers

Loading the map…

Discussion (0)

Sign in to comment.