Indirect Prompt Injection › Marking instruction-like content
Language AI HandbookAll chapters A mark is a cue for how cautiously to handle a record. In this exercise the cue is supplied by the fixture author. That lets us study what to do if it is right or wrong. A real signal can be calibrated against reviewed examples from the application. Deployed screening should be evaluated separately from the policy that consumes it. A good result from one layer gives no estimate of another layer's behavior.
The fixture mark and the reference outcome are separate inputs for another reason. A legitimate visitor guide can use imperative language, so an instruction-like flag need not indicate an attempt to change application behavior. If the human-reviewed task needs that guide, dropping it can break an authorized request. Our example therefore includes a benign marked row. There is also a clear row whose reference label expects a mark. It lets us show the policy's behavior when a signal is missed without embedding any instruction text.
PythonIn [6]Expand
fixtures = (
Fixture(
Evidence("catalog-map", "Map catalog", "E1", ContentMark.CLEAR), False
),
Fixture(
Evidence(
"visitor-guide", "Visitor guide", "E2", ContentMark.INSTRUCTION_LIKE
),
False,
),
Fixture(
Evidence(
"restricted-record",
"Location record",
"E3",
ContentMark.INSTRUCTION_LIKE,
),
True,
),
Fixture(
Evidence("review-fixture", "Reviewed record", "E4", ContentMark.CLEAR),
True,
),
)
assert len({fixture.evidence.source_id for fixture in fixtures}) == len(
fixtures
)All four rows model synthetic screening conditions. Their text fields contain only a title and a room code. In particular, a positive reference label carries no attack content and has no special behavior by itself.
Separate observed marks from reference judgments
The labels in the preceding cell play two roles. The input mark is the recorded observation that the policy is allowed to consume. The reference judgment is only for the reviewer who counts errors in a test. If you let the policy read reference judgments, the experiment can give it information it would not have when the system runs. That would make the observed result too optimistic. The evaluator later reads both fields to illustrate misclassification. The policy itself receives only evidence and permission.
Think about the evidence an evaluator needs for a useful review. First decide what should count as a mark and what should count as a benign use of instruction-like language. A short museum or library manual can contain legitimate procedural text. Establish whether the labeling task is about use for an application or the fact that a phrase has imperative grammar. If the reference judgments drift between the two interpretations, the two types of errors mix. The fixtures specify expected marks directly so that the decision exercise does not depend on resolving ambiguous text.
Changes in input distribution can matter even when the policy and the marker software are unchanged. A library adding guides for a new audience could expand the kinds of ordinary procedure described in retrieval. Review representative benign records from that domain before treating a change in mark frequency as evidence of a security event. Mark rates can reflect legitimate variation. Record source availability, relevance, and marking as separate summaries in the operational record so a maintainer can find which variable changed.
A missing mark and a clear mark deserve separate design consideration. The enum in this tiny exercise assumes screening has provided one of its known values. A production integration may receive a missing, failed, or unsupported screening result. The application owner needs a rule for those states and should test that a service timeout lands in the expected branch. For example, a route with a strongly typed course-location field may choose a reduced view if screening is unavailable. Another product may require review before using the source. These are decisions about a particular route's function and risk. The notebook demonstrates neither a default for all applications nor service failure handling.
Notice what we can learn without creating any adversarial strings. By supplying a clear mark for a row whose expected label is positive, we can inspect how sensitive the policy is to an incorrect decision. By supplying a benign marked row, we can inspect whether the task remains feasible. A test that focuses on labels can be repeated by a maintainer with simple inputs and a fixed interpretation. It answers questions about the policy's behavior once it receives the mark; it supplies no measure of a detector's performance.
Comments
Add to the conversation
A question, a correction, or an example from your own work.
No comments yet. Be the first to share your thoughts!