LongPIBench: An Evaluation Benchmark for Long-Context Prompt InjectionLongPIBench: A Long-Context Benchmark for Prompt Injection
Translation in progress — untranslated text is omitted.
Quick read
Evaluation and benchmarksBased on the paper PDF (generated by Gemini); refer to the original
The researchers propose LongPIBench, a long-context prompt injection evaluation benchmark covering four real-world scenarios: paper review, resume screening, code review, and email summarization. Each scenario includes both synthetic and real datasets, with context lengths ranging from thousands to tens of thousands of tokens. Evaluation shows that without defenses, simple heuristic attacks can achieve high attack success rates; for example, Combined Attack reaches an ASR of 100% on the synthetic paper review dataset. The authors' newly proposed Authority spoof attack achieves the highest ASR among all heuristic attacks, exceeding 0.75 on the paper review and resume screening tasks for GPT-4.1 and GPT-4o. The GCG-based optimization attack is even stronger, reaching an ASR of 1.00 on paper review and resume screening. The authors note that ASR is higher when the injection is placed in the middle or end of the document, and a single injected prompt can simultaneously achieve multiple adversarial goals. Code and data are open-sourced on GitHub.
- Existing prompt injection benchmarks mainly target short texts of tens to hundreds of tokens, which cannot reflect real deployment environments processing long documents of thousands to tens of thousands of tokens. This evaluation deficiency causes the effectiveness of existing defenses to be overestimated, and there is an urgent need to evaluate prompt injection risks in long-text scenarios.
- The authors construct the LongPIBench benchmark covering 4 long-document scenarios—paper review, resume screening, code review, and email summarization—each with synthetic and real data. The authors evaluate 6 heuristic attacks (including the proposed authority spoofing attack) and 2 GCG-based optimization attacks, and conduct tests on 9 detection and 6 prevention methods.
- Both heuristic and optimization attacks maintain high attack success rates in long texts. Defenses that perform well on short texts mostly fail on long documents; for example, MetaSecAlign 8B's ASR under long-text aggregation rises from 0.00 on the short-text OPI benchmark to 0.78; detection methods generally face an imbalance of either high FPR or high FNR.
- The benchmark focuses on static long-document tasks with single inference, and does not cover dynamic agent workflows involving multi-step reasoning, tool calls, and environment interaction. The internal mechanisms by which long texts weaken defenses have not yet been verified through attention and representation analysis; optimization attacks only evaluate GCG and its universal variant.
Measured data showing that defenses almost fail in long-context scenarios, providing a reference for teams deploying long-document processing pipelines to reassess their guardrails.
Related papers
- Post-Training Large Language Models with LLMONDefensesarXiv