Prompt Injection Mitigation
Definition
Prompt Injection Mitigation — a combination of architectural, software, and operational measures applied to protect LLM applications from manipulation of the model's behavior through malicious instructions injected into user input or external data.
Levels of Protection
| Level | Methods |
|---|---|
| Input | Filtering, sanitization, injection detection |
| Prompt | Separation of instructions and data, escaping |
| Model | Robustness training, instruction hierarchy |
| Output | Validation, guardrails, monitoring |
Practices
- Use system prompts with clear boundaries.
- Apply special delimiters for user input.
- Validate output data against expected format.
- Limit privileges of tools available to the model.