HiRoute: Hierarchical Routed Prompt Tuning for Safety Alignment of Large Language Models

Fangzhou Chen, Shiji Zhao, Mengyang Wang, Qihui Zhu, Ranjie Duan +2 more
8/13/2026
cs.LG
lora-peft-merging

No confident code implementation found for this paper.

Abstract

Large language models (LLMs) remain vulnerable to harmful requests and jailbreak attacks. Parameter-efficient safety alignment methods based on prompt tuning typically rely on a single global prompt or externally selected prompt modules.

Show full abstract

Such static designs struggle to maintain a cross-category safety boundary while generating constructive responses tailored to specific risks and avoiding over-refusal of benign inputs. To address these limitations, we propose HiRoute, an input-adaptive hierarchical prompt-tuning framework that separates category-agnostic safety control from category-specific response guidance. HiRoute first trains a lightweight hierarchical router on representations extracted from a frozen LLM to jointly detect harmful intent and predict multi-label risk scores. It then freezes both the backbone model and the router and uses preference optimization with alternating gradient updates to learn a shared coarse-grained prompt and a set of fine-grained prompt experts as continuous embeddings. At inference time, benign inputs bypass the safety branch, whereas risky inputs are processed using the shared prompt together with a router-weighted mixture of risk-specific prompt experts. Experiments across three instruction-tuned models show that HiRoute achieves high safety rates across multiple safety benchmarks while preserving safe-response helpfulness, reducing over-refusal, and maintaining competitive performance on general-purpose tasks.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. Any repos shown below are weak matches — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{chen2026hiroute,
  title  = {HiRoute: Hierarchical Routed Prompt Tuning for Safety Alignment of Large Language Models},
  author = {Fangzhou Chen and Shiji Zhao and Mengyang Wang and Qihui Zhu and Ranjie Duan and Maoxun Yuan and Xingxing Wei},
  year   = {2026},
  eprint = {2608.12821},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2608.12821v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2608.12821.svg)](https://codeofpaper.com/paper/2608.12821)

Discussion