liveBook · Manning

Adversarial input

As explained in LLMs in Production

The study and use of inputs or models designed to manipulate, evade, or expose weaknesses in machine-learning systems.

A tiny change to an input can produce a large change in a model’s answer. An image may look unchanged to a person yet be misclassified after its pixels are altered; a slightly changed LLM prompt can likewise produce a different response. Adversarial inputs exploit this gap between what people perceive and how models respond. section 6.3.6

For LLMs, prompt injection is a practical concern: a user crafts an input to make the model ignore its instructions and produce unwanted content. The stakes extend beyond an odd answer when an application gives a model access to company data, secrets, code execution, or a file system. A model may also invent a plausible-looking secret, so an apparent disclosure is not proof that the secret was real. section 3.2.9

Adversarial pressure can reach a model in several ways:

  • An attacker can send many candidate prompts, collect responses, and use that dataset to predict which prompts are likely to get a desired output. section 6.3.6
  • With data poisoning, an attacker instead places malicious examples in training data to change later model behavior. section 6.3.6
  • A detector for AI-generated writing faces an adversarial loop: if its decisions can reliably distinguish generated text, a new model can be developed to evade it. section 12.2.1

Input restrictions involve trade-offs, not automatic fixes. Rejecting prompts outside supported languages sacrifices usability and requires safeguards for each supported language; a multilingual prompt may also bypass a detector that identifies only one language. Flagging unsupported-language prompts for closer monitoring is another option. section 6.3.6

How LLMs in Production covers it

How deep it goes
Defines adversarial attacks and sketches prompt probing and data poisoning, without a detailed defense procedure.
Examples
Uses altered image pixels, repeated prompt queries, and attempts to extract secrets from an LLM.
What it assumes
Assumes familiarity with ML models and LLM prompts while defining adversarial attacks in plain language.
What you can do after
Diagnose/debug with it when small input changes cause surprising outputs or prompts appear to bypass instructions.
How it connects
Connects prompt injection, data poisoning, image misclassification, and AI-generated-text detection.

Also explained in

Compare how 5 books explain adversarial input →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of LLMs in Production. The section links point to the parts of the book it draws on.