Introduction
As Retrieval-Augmented Generation (RAG) systems become the standard for enterprise chatbots, they face an increasingly sophisticated security threat: jailbreaking. In a traditional RAG pipeline, the system retrieves relevant documents and feeds them into a Large Language Model (LLM) alongside the user’s raw query. This direct exposure to untrusted user input creates a fundamental vulnerability. If a query contains a "jailbreak"—a prompt engineered to bypass safety filters—the LLM may generate offensive content, leak sensitive data, or be hijacked to perform unauthorized tasks.
Existing defenses, such as input classifiers or system prompt hardening, are probabilistic and often easily bypassed. This paper introduces Highlight & Summarize (H&S), a new design pattern that eliminates prompt injection by architectural design. By "air-gapping" the generation process, H&S ensures the generative model never sees the user's original question, effectively neutralizing the threat of model hijacking while maintaining high accuracy.
The H&S Architecture
The core innovation of H&S is splitting the RAG process into two distinct, isolated stages:
- The Highlighter: This component receives both the user’s question and the retrieved documents. Its sole responsibility is to identify and extract contiguous passages of text relevant to the answer. To prevent attackers from "stitching" together malicious messages word-by-word, the authors implement a
min_wordsconstraint (e.g., 5+ words per highlight). - The Summarizer: This component receives only the highlighted passages. It is tasked with synthesizing these fragments into a cohesive answer. Because the summarizer has no access to the user's prompt, it cannot be manipulated by jailbreak attempts embedded within it.
Security by Design
By removing the user's prompt from the final generation step, H&S moves from detecting attacks to preventing them through structural isolation. The authors provide a formal theoretical analysis, including a proof in the Lean theorem prover, demonstrating that H&S exponentially reduces an attacker's ability to control model output compared to standard RAG.
This architecture specifically thwarts "Return-Oriented Programming" (ROP) style attacks in LLMs. In traditional software security, ROP uses small snippets of existing code to perform malicious actions. An attacker might try to trick a highlighter into selecting specific words to form a jailbreak; however, the min_words parameter makes this "digital ROP" virtually impossible to execute.
As shown in the experimental results against the LLMail-Inject benchmark, vanilla RAG was successfully jailbroken 81% of the time, whereas the H&S approach achieved a 0% success rate for attackers.
Performance and Accuracy
Despite the strict security constraints, H&S does not sacrifice performance. Evaluation across diverse datasets—including RepliQA (fictitious events) and BioASQ (biomedical QA)—shows that H&S often meets or exceeds the accuracy of vanilla RAG. On the RepliQA dataset, a "Two-Step" H&S implementation achieved a correctness score of 95%, compared to 94% for standard RAG.
This performance boost is attributed to an Implicit Chain-of-Thought. By forcing the system into a multi-step reasoning process—first identifying evidence, then synthesizing it—H&S mimics effective prompting techniques that improve LLM reasoning capabilities. The system remained robust even with a min_words parameter as high as 10, preserving 99% of relevant text extracts.
Limitations and Future Directions
While highly effective for standard QA, H&S faces challenges with tasks requiring complex cross-document logic or mathematical reasoning (e.g., summing values across multiple documents). Since the summarizer lacks the specific user intent (like "calculate the total"), it may only report individual values found in the highlights.
Future work aims to optimize the highlighter to reduce the latency and token costs associated with multiple LLM calls. Additionally, the authors are exploring ways to pass "safe" signals—such as the type of question being asked—to the summarizer to improve reasoning without compromising the security air-gap.
Summary updated