Manuscript Offprint

arXiv:2608.21278

CLEAR: Continuous Latent Adapter Routing for Utility-Preserving LLM Safety Alignment

Chengxiao Wang, Enyi Jiang, Xiaojing Liao, Sanmi Koyejo

Abstract

Improving the safety of large language models (LLMs) often comes at the expense of utility, as globally applied safety tuning may affect model responses to both harmful and benign inputs. We propose Continuous LatEnt Adapter Routing (CLEAR), a conditional safety adaptation framework that uses a lightweight hidden-state gate to continuously control the activation strength of a safety low-rank adapter. CLEAR aims to reduce harmful completions while avoiding unnecessary changes to the frozen backbone that could degrade performance on benign prompts. Experiments on widely used safety and utility benchmarks show that CLEAR improves robustness on HarmBench while reducing the utility degradation observed with globally applied safety tuning such as SFT or standard low-rank adaptation (LoRA). On Llama-3-8B-Instruct, CLEAR reduces HarmBench ASR from 32.3% to 0.5%, while retaining most of the base model’s utility and achieving up to 7.1 percentage points higher GSM8K accuracy than globally applied SFT or LoRA. These results suggest that CLEAR is a promising mechanism for improving the safety–utility trade-off in LLM alignment.

Introduction

Large language models (LLMs) have demonstrated remarkable capabilities across reasoning (Wei et al. 2022), coding (Nam et al. 2024), and instruction-following tasks (Zeng et al. 2024), enabling deployment in increasingly open-ended real-world settings. However, these capabilities also introduce significant safety risks (Qi et al. 2025), including susceptibility to jailbreak attacks (Peng et al. 2024; Chao et al. 2024; Zhou et al. 2024), harmful content generation (Welbl et al. 2021; Wen et al. 2023), and adversarial prompt manipulation (Xie et al. 2025; Yi et al. 2025). To mitigate such risks, modern alignment pipelines primarily rely on supervised fine-tuning (SFT) (Sun 2024; Zhang et al. 2025), reinforcement learning (Bai et al. 2022; Ji et al. 2023; Ji et al. 2024; Wachi et al. 2024), or representation engineering (Zou et al. 2023; Arditi et al. 2024), which encourage models to reject unsafe requests and adhere to safety policies.

Despite their effectiveness, existing alignment methods typically apply safety tuning globally across the entire model, using the same aligned parameters for harmful, benign, and safety-adjacent inputs alike. As a result, improving refusal behavior on unsafe prompts can unintentionally alter responses to benign prompts that merely resemble harmful requests, leading to unnecessary over-refusal or degraded reasoning performance. This tension between safety and utility, commonly referred to as the alignment tax, motivates alignment mechanisms that selectively apply safety interventions only when harmful intent is detected, while preserving the base model’s original behavior on benign inputs.

Figure

Figure 1: Overview of CLEAR, a continuous latent adapter routing framework for utility-preserving LLM safety alignment. Given an input prompt, the frozen base LLM first produces hidden representations, from which selected latent states are extracted and passed to a lightweight safety gate. The gate predicts a continuous routing score g(x)∈[0,1]g(x)\in[0,1], which controls the strength of a safety LoRA adapter. For benign prompts, the routing score remains low and the model behaves close to the frozen backbone; for harmful or adversarial prompts, the score increases and the safety adapter is activated to steer generation toward aligned refusal behavior.

To address this problem, we propose CLEAR (Continuous LatEnt Adapter Routing), a lightweight and modular framework for utility-preserving LLM safety alignment, as illustrated in Figure 1. CLEAR decouples safety intervention from the core reasoning capability of the base model by freezing the backbone LLM and introducing a safety-specific Low-Rank Adapter (LoRA) (Hu et al. 2022) whose strength is continuously controlled by a learned latent gate. Unlike standard safety fine-tuning, which globally modifies model behavior, CLEAR performs input-conditioned adapter routing: benign prompts receive little or no adapter intervention, preserving the original model behavior, while harmful or adversarial prompts receive stronger safety-adapter activation to encourage refusal-style responses. Formally, given a latent prompt representation, the gate predicts a continuous routing score g∈[0,1]g\in[0,1], and the model applies the adapter as h′=(W+gΔW)h.h^{\prime}=(W+g\Delta W)h. This mechanism provides finer-grained control, avoiding applying safety adaptation uniformly to all inputs.

A key distinction of CLEAR is that the latent gate is not an external filter or post-hoc moderation module. Instead, the gate is jointly optimized with the safety adapter and directly controls the strength of safety intervention during generation. To improve discrimination between harmful and benign prompts, we introduce subtype-aware gate weighting together with a hard pairwise margin objective that explicitly separates harmful and benign prompts in the latent gating space. This transforms safety alignment from a globally applied parameter update into a conditional latent routing mechanism: safety behavior is activated only when harmful intent is detected, while benign prompts largely preserve the behavior of the frozen backbone model.

We evaluate CLEAR on HarmBench and XSTest for safety, and GSM8K, MMLU, and TruthfulQA for utility. Across our main settings on Llama-3-8B-Instruct and Gemma-2-2B-it, CLEAR reduces HarmBench ASR to almost zero while preserving stronger utility than globally applied SFT and standard LoRA. In particular, on Llama-3-8B-Instruct, CLEAR retains 73.46% GSM8K accuracy, which is about 7 percentage points higher than SFT and standard LoRA; on Gemma-2-2B-it, it improves GSM8K from around 38% under SFT/LoRA to 42%, and TruthfulQA MC2 from around 47% to 53%. Compared with existing safety-aligned variants in the Llama-3 and Alpaca model families, CLEAR further reduces HarmBench ASR to 0.50%, whereas the other aligned variants remain between 15.50% and 24.00%, while maintaining competitive utility. In addition, the learned hidden-state gate provides a favorable XSTest routing trade-off using fewer than one million parameters, making it substantially smaller than external guard models. These results suggest that continuous latent adapter routing is an effective mechanism for improving safety–utility trade-offs in LLM alignment compared with related baselines.

References (41)