A Lightweight Explainable Guardrail for Prompt Safety

Md Asiful Islam, Mihai Surdeanu
1/24/2026
cs.CLcs.AI

No confident code implementation found for this paper.

Abstract

We propose a lightweight explainable guardrail (LEG) method for the classification of unsafe prompts. LEG uses a multi-task learning architecture to jointly learn a prompt classifier and an explanation classifier, where the latter labels prompt words that explain the safe/unsafe overall decision. LEG is trained using synthetic data for explainability, which is generated using a novel strategy that counteracts the confirmation biases of LLMs. Lastly, LEG's training process uses a novel loss that captures global explanation signals and combines cross-entropy and focal losses with uncertainty-based weighting. LEG obtains equivalent or better performance than the state-of-the-art for both prompt classification and explainability, both in-domain and out-of-domain on three datasets, despite the fact that its model size is considerably smaller than current approaches. If accepted, we will release all models and the annotated dataset publicly.

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{islam2026lightweight,
  title  = {A Lightweight Explainable Guardrail for Prompt Safety},
  author = {Md Asiful Islam and Mihai Surdeanu},
  year   = {2026},
  eprint = {2602.15853},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2602.15853v1}
}

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/2602.15853.svg)](https://codeofpaper.com/paper/2602.15853)

Discussion