liveBook · Manning

Prompt injection

As explained in The Art of AI Product Development

An attack that manipulates a generative model by inserting instructions intended to override or redirect its intended behavior.

Prompt injection manipulates a generative model by embedding unexpected or malicious instructions in user inputs or data the model consumes. The attack is also called jailbreaking. section 11.1.3

The risk extends beyond an incorrect answer: an integrated LLM may produce unsafe recommendations that damage business operations, finances, or connected data. section 11.1.3

Distinguish the attack paths:

  • Direct prompt injection places harmful instructions in the attacker’s prompt, such as commands to ignore guardrails or recommend unsafe actions. section 11.1.3
  • Indirect prompt injection places harmful instructions in a data source, such as a web page, which the LLM later incorporates into its prompt. section 11.1.3

Operational recommendation failure

In a retail scenario, injected instructions could cause an LLM to recommend overstocking products or halting a critical operation. A mental-health chatbot was also described as being tricked into supporting a patient’s suicidal intent. section 11.1.3

Figure 11.3 In direct prompt injection, harmful instructions are provided directly as part of the prompt.

Diagram of harmful instructions supplied directly in the prompt. section 11.1.3

Figure 11.4 In indirect prompt injection, harmful instructions are injected from a data source used by the LLM.
A blue rectangular object with white text

AI-generated content may be incorrect.

Diagram of harmful instructions entering through a data source used by the LLM. section 11.1.3

How The Art of AI Product Development covers it

How deep it goes
Distinguishes direct and indirect attacks and traces harmful recommendations to malicious instructions, but does not enumerate defenses.
Examples
Uses retail overstocking, halted operations, a mental-health chatbot, web pages, and injected user commands as examples.
What it assumes
Assumes an LLM exposed to users or connected to external data sources, then distinguishes the two injection paths.
What you can do after
Evaluate injection risk by distinguishing direct from indirect attacks in LLM-integrated systems.
How it connects
Connects prompt injection with jailbreaking, adversarial inputs, guardrails, data sources, and LLM vulnerabilities.

Also explained in

Compare how 9 books explain prompt injection →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of The Art of AI Product Development. The section links point to the parts of the book it draws on.