CLEAR: Continuous Latent Adapter Routing for Utility-Preserving LLM Safety Alignment
Organizations: Siebel School of Computing and Data Science, University of Illinois at Urbana-Champaign · Computer Science, Stanford University
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.
Figures & tables
| Model | Method | HB ASR | Unsafe Ref. | Safe OR | GSM8K | MMLU | TQA MC1 | TQA MC2 |
| Llama-3-8B-Instruct | Base | 32.25 | 88.50 | 2.80 | 75.06 | 66.76 | 37.33 | 52.47 |
| SFT | 2.00 | 94.00 | 10.80 | 66.34 | 63.86 | 32.93 | 48.28 | |
| LoRA | 0.00 | 82.50 | 6.40 | 66.72 | 64.18 | 34.88 | 50.46 | |
| CLEAR | 0.50 | 92.50 | 4.80 | 73.46 | 63.62 | 36.96 | 52.63 | |
| Gemma-2-2B-it | Base | 9.50 | 48.50 | 4.80 | 46.47 | 56.68 | 37.09 | 53.13 |
| SFT | 0.00 | 90.00 | 5.20 | 38.06 | 55.48 | 32.31 | 47.99 |
| Family | Model | HB ASR | Unsafe Ref. | Safe OR | GSM8K | MMLU | TQA MC1 | TQA MC2 |
| Llama-3 | Llama-3-8B ( Grattafiori et al. 2024 ) | 32.25 | 88.50 | 2.80 | 75.06 | 66.76 | 37.33 | 52.47 |
| Llama-3-8B-RR ( Zou et al. 2023 ) | 15.50 | 88.00 | 2.40 | 76.35 | 66.21 | 37.33 | 52.49 | |
| CLEAR | 0.50 | 92.50 | 4.80 | 73.46 | 63.62 | 36.96 | 52.63 | |
| Alpaca | Alpaca-7B ( PKU-Alignment 2023 ) | 42.00 | 9.00 | 1.20 | 6.37 | 39.92 | 25.83 | 39.56 |
| SACPO ( Wachi et al. 2024 ) | 21.75 | 21.50 | 4.80 | 5.61 | 39.32 | 38.31 | 54.65 | |
| P-SACPO ( Wachi et al. 2024 ) | 22.50 | 26.00 | 2.00 | 5.99 | 40.08 | 39.05 | 54.56 |
| Guard / Detector | Detector Parameters |
| CLEAR internal gate | 664,129 |
| PromptGuard ( Meta 2024 ) | 278,811,651 |
| Llama Guard 3 8B ( Inan et al. 2023 ) | 8,030,261,248 |
| Safety and Utility Evaluation | Gate Separability Diagnostics | ||||||||||
| Model | Method | HB ASR | Unsafe Ref. | Safe OR | GSM8K | MMLU | TQA MC1 | TQA MC2 | ROC-AUC | PR-AUC | Margin |
| Qwen-0.5B | Base | 22.50 | 86.50 | 46.80 | 31.46 | 46.92 | 26.81 | 41.86 | – | – | – |
| CLEAR | 0.25 | 95.00 | 51.60 | 32.60 | 45.81 | 27.29 | 42.02 | 0.7795 | 0.7475 | 0.0875 | |
| Qwen-1.5B | Base | 6.25 | 95.50 | 48.80 | 51.40 | 60.26 | 31.21 | 46.70 | – | – | – |
| CLEAR | 0.25 | 95.50 | 48.00 | 51.71 | 59.95 | 31.09 | 46.69 | 0.8800 | 0.8286 | 0.0749 | |
| Qwen-3B | Base | 15.50 | 78.00 | 16.40 | 63.23 | 66.35 | 42.23 | 58.83 | – | – | – |
Appendix figures & tables6 assets
Supplementary material from the paper’s appendix.
Appendix
| Hyperparameter | SFT | LoRA | CLEAR |
| Training data | Same | Same | Same |
| Epochs | 1 | 1 | 1 |
| Micro-batch size | 4 | 16 | 4 |
| Gradient accumulation | 16 | 4 | 16 |
| Effective batch size | 64 | 64 | 64 |
| Learning rate |
| Backbone | Gate Input Layers |
| Gemma-2-2B-it | |
| Llama-3-8B-Instruct | |
| Qwen2.5-0.5B-Instruct | |
| Qwen2.5-1.5B-Instruct | |
| Qwen2.5-3B-Instruct | |
| Qwen2.5-7B-Instruct |
| Family | Model | Method | Training Time | Memory Usage (bytes) | Trainable Params | GPU |
| Llama-3 | Llama-3-8B-Instruct | SFT | 5:08:14 | 1 NVIDIA GH200 120GB | ||
| Llama-3 | Llama-3-8B-Instruct | LoRA | 3:18:25 | 1 NVIDIA GH200 120GB | ||
| Llama-3 | Llama-3-8B-Instruct | CLEAR | 5:08:55 | 1 NVIDIA GH200 120GB | ||
| Gemma | Gemma-2-2B-it | SFT | 2:49:47 | 1 NVIDIA GH200 120GB | ||
| Gemma | Gemma-2-2B-it | LoRA | 1:48:26 | 1 NVIDIA GH200 120GB | ||
| Gemma | Gemma-2-2B-it | CLEAR | 3:54:34 | 1 NVIDIA GH200 120GB |
| Gate | HB ASR | Unsafe Ref. | Safe OR | GSM8K | MMLU | TQA MC1 | TQA MC2 |
| MLP-16 | 0.25 | 94.00 | 11.60 | 34.42 | 55.48 | 37.21 | 53.10 |
| MLP-12/16/20 | 0.00 | 93.50 | 14.40 | 41.93 | 55.58 | 37.21 | 53.14 |
| Transformer-16 | 1.50 | 83.00 | 6.00 | 33.13 | 55.51 | 37.21 | 53.14 |
| Transformer-12/16/20 | 1.00 | 94.00 | 9.60 | 39.88 | 55.62 | 36.84 | 53.04 |
| Variant | HB ASR | Unsafe Ref. | Safe OR | GSM8K | MMLU | TQA MC1 | TQA MC2 |
| LoRA | 1.00 | 88.50 | 4.40 | 38.21 | 54.52 | 31.21 | 47.16 |
| BCE-only | 3.25 | 83.50 | 14.40 | 36.85 | 55.57 | 36.96 | 53.04 |
| CLEAR | 0.00 | 96.00 | 9.60 | 41.62 | 55.40 | 36.84 | 53.19 |
| CLEAR w/o LoRA | 0.50 | 96.00 | 10.40 | 40.26 | 55.31 | 36.96 | 53.08 |