System prompts are the crown jewels of LLM applications. They encode business logic, filtering rules, and domain expertise. Attackers want them. Existing defenses fail to protect them.

ProxyPrompt, published at ACL 2026 Findings by Bosch Research, takes a different approach. It replaces the original system prompt with an optimized proxy embedding. The proxy preserves task utility for normal users. It produces semantically unrelated output when attackers try to extract the prompt.

The Problem

System prompts require extensive testing and domain expertise to craft. They live in plain text inside the model's context window. Anyone who can query the model can attempt to extract them.

Existing defenses fall into two camps:

  • Prompt-based defenses tell the model "do not reveal the system prompt." These rely on model compliance. Attackers bypass them with creative phrasing.
  • Filter-based defenses check output for n-gram overlap with the original prompt. These miss paraphrased leaks. An attacker who rephrases the prompt passes the filter.

Both approaches share a fatal flaw. They try to prevent the model from outputting the prompt. They never question whether the prompt itself should be in the context.

How ProxyPrompt Works

ProxyPrompt shifts the defense from output filtering to input replacement. The original system prompt never enters the deployment context. A proxy prompt embedding takes its place.

The proxy is a continuous-space representation optimized for two goals simultaneously:

  • Functional preservation: The proxy produces answers matching the original prompt on benign queries. Normal users see no degradation.
  • Extraction prevention: When the model receives extraction requests, the proxy steers output toward a defender-specified unrelated target. The extracted content carries no task-relevant semantics.

The proxy lives in continuous embedding space, not in natural language tokens. This creates an inherent decoding gap. When the model tries to verbalize the proxy, the continuous-to-discrete mapping is lossy. The extracted text loses task structure during this conversion.

Training Process

The defender needs three inputs:

  • The original system prompt
  • A set of benign queries representing normal usage
  • A target semantic unrelated to the original task

The optimization minimizes two losses jointly. The first loss aligns proxy answers with original prompt answers on benign queries. The second loss pushes proxy output toward the unrelated target when extraction requests arrive.

The paper uses 100 representative benign queries per task configuration. Validation selects the proxy with the lowest validation loss.

Evaluation Results

The experiments cover three victim models: Phi-3.5-mini-instruct, Llama-3.1-8B-Instruct, and Llama-3.1-70B-Instruct. Five task categories include GSM8K math, role-playing, CoLA grammar, SST-2 sentiment, and QNLI entailment. The full evaluation spans 264 LLM and system prompt pairs.

Protection Rates

Defense Protection Rate
No defense ~0%
Filter-based 42.80%
Fake/Direct/Guard (instruction-based) Near 0%
ProxyPrompt (single-target) 81.06%
ProxyPrompt (full objective) 94.70%

ProxyPrompt protects 94.70% of prompts from extraction attacks. The next-best defense, filter-based methods, only reaches 42.80%.

Leakage Metrics

Exact-match leakage drops to zero across all tasks and models. Approx-match leakage also reaches zero. The paper introduces two semantic-level metrics that catch paraphrased leaks:

  • Semantic-Match (SM): Detects sentences in extracted content that semantically substitute for original prompt sentences.
  • Most-Similar (MS): Measures the similarity of the closest extracted segment to the original prompt.

Only 14 out of 264 configurations show any semantic-match leakage. These leakages appear in classification tasks where high-level task intent is harder to obfuscate.

Task Utility

Utility ratios range from 0.94 to 1.01 across tasks. The proxy preserves task performance within a tight band of the original prompt. GSM8K and role-playing tasks show no utility degradation. Classification tasks show minor variance.

Why Existing Defenses Fail

The paper exposes a critical blind spot in prior work. String-level metrics like Exact-Match and Approx-Match overestimate filter-based defenses. A paraphrase with zero n-gram overlap can still leak the full task logic.

An attacker who extracts a semantically equivalent prompt can reconstruct the original task. Word-level overlap misses this entirely. The semantic metrics ProxyPrompt introduces reveal that filter-based defenses protect far less than previously claimed.

Instruction-based defenses fail for a simpler reason. They depend on the model obeying system instructions during adversarial attacks. Models under extraction pressure do not reliably comply.

The Continuous-Space Advantage

Traditional system prompts are human-readable text. Once paraphrased, the entire rule set transfers to the attacker. Continuous-space proxies break this transfer path.

The proxy embedding does not sit on the natural language token manifold. The model must decode it through a lossy continuous-to-discrete mapping. Even when extracted text hits neighboring tokens, the task structure degrades. The representation format itself provides protection beyond the optimization objective.

Limitations

The approach has real constraints:

  • The defender needs access to the model's embedding layer. API-only deployments without embedding access cannot apply this method.
  • Classification tasks leak high-level task intent in some configurations. SST-2 shows SM=0.25 on Llama-3.1-70B.
  • The proxy must be trained per model and per prompt. Switching models requires retraining.
  • The paper evaluates open-weights models. Closed API models like GPT-4 or Claude are out of scope.

Practical Adoption

The GitHub repository at github.com/boschresearch/proxyprompt provides the full implementation under AGPL-3.0. The repo includes:

  • Example scripts for protecting custom prompts
  • Scripts reproducing paper results
  • Attack data from four prior extraction attack papers
  • Conda environment setup

The pipeline runs end-to-end from data collection through evaluation. Users provide their original prompt, benign queries, and a target semantic. The optimization produces the proxy embedding for deployment.

Implications for LLM Application Security

ProxyPrompt changes the threat model for system prompt protection. Instead of guarding the output, it replaces the input. The original prompt never leaves the defender's machine.

This approach is strongest for open-weights deployments where the defender controls the model. HuggingChat assistants, local LLM deployments, and self-hosted enterprise applications are prime candidates.

API-only applications remain stuck with instruction-based and filter-based defenses. The gap between 94.70% and 42.80% protection is the cost of not having embedding access.

Citation

Zhuang, Zhixiong, Maria-Irina Nicolae, Hui-Po Wang, and Mario Fritz. 2026. "ProxyPrompt: Securing System Prompts against Prompt Extraction Attacks." Findings of the Association for Computational Linguistics: ACL 2026, pages 8813-8845. San Diego, California, United States.