SecInfer: Preventing Prompt Injection via Inference-time Scaling

Fuente: arXiv
Saved in:
Bibliographic Details
Main Authors: Liu, Yupei, Wang, Yanting, Jia, Yuqi, Jia, Jinyuan, Gong, Neil Zhenqiang
Format: Preprint
Published: 2025
Subjects:
Online Access:
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866908652357550080
author Liu, Yupei
Wang, Yanting
Jia, Yuqi
Jia, Jinyuan
Gong, Neil Zhenqiang
author_facet Liu, Yupei
Wang, Yanting
Jia, Yuqi
Jia, Jinyuan
Gong, Neil Zhenqiang
contents Prompt injection attacks pose a pervasive threat to the security of Large Language Models (LLMs). State-of-the-art prevention-based defenses typically rely on fine-tuning an LLM to enhance its security, but they achieve limited effectiveness against strong attacks. In this work, we propose \emph{SecInfer}, a novel defense against prompt injection attacks built on \emph{inference-time scaling}, an emerging paradigm that boosts LLM capability by allocating more compute resources for reasoning during inference. SecInfer consists of two key steps: \emph{system-prompt-guided sampling}, which generates multiple responses for a given input by exploring diverse reasoning paths through a varied set of system prompts, and \emph{target-task-guided aggregation}, which selects the response most likely to accomplish the intended task. Extensive experiments show that, by leveraging additional compute at inference, SecInfer effectively mitigates both existing and adaptive prompt injection attacks, outperforming state-of-the-art defenses as well as existing inference-time scaling approaches.
format Preprint
id arxiv_https___arxiv_org_abs_2509_24967
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle SecInfer: Preventing Prompt Injection via Inference-time Scaling
Liu, Yupei
Wang, Yanting
Jia, Yuqi
Jia, Jinyuan
Gong, Neil Zhenqiang
Cryptography and Security
Artificial Intelligence
Prompt injection attacks pose a pervasive threat to the security of Large Language Models (LLMs). State-of-the-art prevention-based defenses typically rely on fine-tuning an LLM to enhance its security, but they achieve limited effectiveness against strong attacks. In this work, we propose \emph{SecInfer}, a novel defense against prompt injection attacks built on \emph{inference-time scaling}, an emerging paradigm that boosts LLM capability by allocating more compute resources for reasoning during inference. SecInfer consists of two key steps: \emph{system-prompt-guided sampling}, which generates multiple responses for a given input by exploring diverse reasoning paths through a varied set of system prompts, and \emph{target-task-guided aggregation}, which selects the response most likely to accomplish the intended task. Extensive experiments show that, by leveraging additional compute at inference, SecInfer effectively mitigates both existing and adaptive prompt injection attacks, outperforming state-of-the-art defenses as well as existing inference-time scaling approaches.
title SecInfer: Preventing Prompt Injection via Inference-time Scaling
topic Cryptography and Security
Artificial Intelligence
url https://arxiv.org/abs/2509.24967