ConfGuard: A Simple and Effective Backdoor Detection for Large Language Models

Zihan Wang, Rui Zhang, Hongwei Li, Wenshu Fan, Wenbo Jiang +2 more
8/2/2025
cs.CRcs.CL

No official code found. Best implementation: hanbaoergogo/ConfGuard (9 stars, MIT, last commit 2025-11-11).

Abstract

Backdoor attacks pose a significant threat to Large Language Models (LLMs), where adversaries can embed hidden triggers to manipulate LLM's outputs. Most existing defense methods, primarily designed for classification tasks, are ineffective against the autoregressive nature and vast output space of LLMs, thereby suffering from poor performance and high latency. To address these limitations, we investigate the behavioral discrepancies between benign and backdoored LLMs in output space. We identify a critical phenomenon which we term sequence lock: a backdoored model generates the target sequence with abnormally high and consistent confidence compared to benign generation. Building on this insight, we propose ConfGuard, a lightweight and effective detection method that monitors a sliding window of token confidences to identify sequence lock. Extensive experiments demonstrate ConfGuard achieves a near 100\% true positive rate (TPR) and a negligible false positive rate (FPR) in the vast majority of cases. Crucially, the ConfGuard enables real-time detection almost without additional latency, making it a practical backdoor defense for real-world LLM deployments.

View on arXivView PDF

Code Implementations(1)

MIT

Official Repository of ConfGuard: A Simple and Effective Backdoor Detection for Large Language Models

91PythonNov 10, 202511 months agoMIT

Similar Papers

Cite this paper

@article{wang2025confguard,
  title  = {ConfGuard: A Simple and Effective Backdoor Detection for Large Language Models},
  author = {Zihan Wang and Rui Zhang and Hongwei Li and Wenshu Fan and Wenbo Jiang and Qingchuan Zhao and Guowen Xu},
  year   = {2025},
  eprint = {2508.01365},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2508.01365v3}
}

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

Discussion