arXiv:2610.11634cs.CROct 2026

Manuscript Offprint

arXiv:2610.11634

LTBD: Learnable Trust-Boundary Delimiters for Prompt Injection Defense

Luman Zhao, Minghui Xu, Yue Zhang, Yijun Yang

ABSTRACT

Large language models (LLMs) perform remarkably well on complex tasks, yet remain highly vulnerable to prompt injection attacks, where malicious instructions embedded in external data can override user intent. Existing defenses remain limited by model fine-tuning requirements, vulnerability to adaptive attacks, or reliance on brittle handcrafted prompts. We argue that a fundamental source of this vulnerability is the lack of an explicit representation of trust provenance. To address this, we introduce Learnable Trust-Boundary Delimiters (LTBD), a lightweight defense that explicitly encodes trust boundaries in the input while keeping the LLM parameters unchanged. LTBD uses a small number of learnable delimiters to distinguish trusted user instructions from untrusted external data, enabling the model to better respect the intended trust hierarchy. Experimental results show that LTBD substantially outperforms inference-time defenses and performs competitively with training-based approaches, while preserving benign-task utility and introducing negligible inference overhead. In particular, LTBD achieves 0.00% ASR on AlpacaFarm and only 0.11–0.19% ASR on TaskTracker. LTBD also remains effective under adaptive attacks, where adversaries have full knowledge of the defense and explicitly attempt to bypass it.

Index Terms— Prompt Injection; LLM Safety

1. INTRODUCTION

Large language models (LLMs) have achieved remarkable performance across a wide range of complex tasks [1, 2, 3, 4, 5], yet remain brittle when handling security boundaries [6, 7, 8, 9]. In particular, prompt injection attacks embed malicious instructions into external data, causing the model to deviate from the user's intended task [7, 10, 11, 12]. A key challenge is that current LLMs lack an explicit mechanism for representing trust provenance: trusted instructions and potentially adversarial external content are processed within the same input sequence, despite carrying fundamentally different behavioral authority.

Existing defenses approach this problem from different directions, but each has limitations. Prompting-based methods, such as Reminder [13] and Sandwich [14], instruct the model to ignore malicious content, but can remain vulnerable to strong attacks [15, 12]. Training-based methods, such as StruQ [11], explicitly separate instructions from data and fine-tune the model to respect this boundary, but require modifying the underlying model parameters, which is often infeasible for closed-source models and may alter the model's original behavior. More recently, DefensiveToken [16] keeps the base model frozen and learns defensive token embeddings, but these tokens act as global control signals rather than explicitly modeling the boundary between trusted and untrusted regions.

These observations motivate a natural question:

Research Question. Can we teach an LLM where to trust, rather than merely telling it what to ignore, without modifying the LLM itself?

We answer this question with Learnable Trust-Boundary Delimiters (LTBD). LTBD associates a small number of learnable delimiter tokens directly with the boundaries of trusted instructions and untrusted external data, while keeping the base LLM fully frozen. Through defensive training, these delimiters learn trust-aware roles that help the model preserve the authority of trusted instructions while suppressing competing instructions embedded in untrusted data. In this way, LTBD combines the explicit structural separation of training-based defenses with the lightweight deployment of parameter-efficient defenses.

We evaluate LTBD across diverse prompt injection benchmarks and compare it with both inference-time and training-based defenses. LTBD achieves 0.00% ASR on AlpacaFarm [15] and only 0.11–0.19% ASR on TaskTracker [17], while preserving benign-task utility and introducing negligible inference overhead. Overall, LTBD substantially outperforms existing inference-time defenses and remains competitive with training-based approaches, suggesting that explicitly learning trust boundaries provides an effective and lightweight defense against prompt injection.

Our main contributions are threefold:

• Trust-provenance perspective. We identify explicit trust boundaries as an important missing signal in prompt-injection defense.

• Lightweight plug-and-play defense. We propose LTBD, which learns a small number of trust-boundary delimiters while keeping the base LLM fully frozen.

• Strong security–utility trade-off. LTBD substantially outperforms inference-time defenses and achieves competitive robustness with training-based methods, with minimal utility loss and negligible overhead.

References (27)