Skip to content

Prompt Injection Detection

Definition

Prompt Injection Detection is a set of methods that detect attempts to maliciously alter the behavior of an LLM by injecting instructions into user input or external data. Detection allows blocking attacks before execution.

Detection Methods

Method Description
Classifier Model that determines the maliciousness of input
Heuristics Searching for attack patterns ("ignore previous instructions")
Isolation Separation of instructions and data
LLM-as-Judge A second model checks the prompt

Levels of Protection

graph TD
    A[Input] --> B{Heuristics}
    B -- Suspicious --> C[Block]
    B -- OK --> D{Classifier}
    D -- Attack --> C
    D -- OK --> E[LLM]

See Also

← All Terms