UniGuardian: A Unified Defense for Detecting Prompt Injection, Backdoor Attacks and Adversarial Attacks in Large Language Models

Huawei Lin, Yingjie Lao, Tong Geng, Tan Yu, Weijie Zhao
2/18/2025
cs.CLcs.AIcs.LG

No official code found. Best implementation: huawei-lin/UniGuardian (16 stars, last commit 2025-07-03). 1 more below.

Abstract

Large Language Models (LLMs) are vulnerable to attacks like prompt injection, backdoor attacks, and adversarial attacks, which manipulate prompts or models to generate harmful outputs. In this paper, departing from traditional deep learning attack paradigms, we explore their intrinsic relationship and collectively term them Prompt Trigger Attacks (PTA). This raises a key question: Can we determine if a prompt is benign or poisoned? To address this, we propose UniGuardian, the first unified defense mechanism designed to detect prompt injection, backdoor attacks, and adversarial attacks in LLMs. Additionally, we introduce a single-forward strategy to optimize the detection pipeline, enabling simultaneous attack detection and text generation within a single forward pass. Our experiments confirm that UniGuardian accurately and efficiently identifies malicious prompts in LLMs.

View on arXivView PDF

Code Implementations(2)

The implementation for paper "UniGuardian: A Unified Defense for Detecting Prompt Injection, Backdoor Attacks and Adversarial Attacks in Large Language Models".

162PythonFeb 16, 20251 years ago

The implementation for paper "UniGuardian: A Unified Defense for Detecting Prompt Injection, Backdoor Attacks and Adversarial Attacks in Large Language Models".

00PythonJan 20, 20269 months ago

Similar Papers

Cite this paper

@article{lin2025uniguardian,
  title  = {UniGuardian: A Unified Defense for Detecting Prompt Injection, Backdoor Attacks and Adversarial Attacks in Large Language Models},
  author = {Huawei Lin and Yingjie Lao and Tong Geng and Tan Yu and Weijie Zhao},
  year   = {2025},
  eprint = {2502.13141},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2502.13141v1}
}

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

Discussion