Indirect Prompt Injection › Comparing the three strategies
Language AI HandbookAll chapters Compare these three strategies on the same four rows with every source visible. A row counts as providing a room when the returned dictionary contains a room key. We also count title keys to show the consequence for context width. Each count has a maximum of four because a row supplies at most one key of each kind.
PythonIn [14]Expand
strategy_outputs = {
strategy: [
evaluate_row(fixture.evidence, all_visible, strategy)[1]
for fixture in fixtures
]
for strategy in Strategy
}PythonIn [15]Expand
room_counts = [
sum("room" in view for view in views) for views in strategy_outputs.values()
]
title_counts = [
sum("title" in view for view in views)
for views in strategy_outputs.values()
]
assert room_counts == [2, 4, 4]
assert title_counts == [2, 2, 0]
for strategy, rooms, titles in zip(strategy_outputs, room_counts, title_counts):
print(f"{strategy.value:16} rooms={rooms}, titles={titles}")ConsoleOut [15]Expand
Reject marked rooms=2, titles=2 Restrict marked rooms=4, titles=2 Minimize all rooms=4, titles=0
Reject marked produces two room values and two titles. Restrict marked produces four room values and two titles. Minimize all produces four room values and no titles. The extra room values in the last two strategies describe coverage of these declared fixtures. They do not measure the truth of the rooms or rate the application against live model behavior.
VisualizationOut [16]Expand

Choose the view by what the answer needs. In this fixture any strategy that keeps a room can use it to answer one location question. A later question asking for the display title needs that field from a source the reader may access. Revisit the chosen view when the task changes rather than treating omission of the title as a universal policy.
Read the field counts with their denominator
Each bar counts rows containing a named key. If a room value appears in two different rows, both rows count. The chart does not count unique rooms. It also does not score how helpful the value was to the user. One reason for plotting room and title separately is that they play different roles in this task. A policy could provide the room in every case while omitting record titles, which would be sufficient for the defined lookup fixture but incomplete for a citation feature. The full story depends on which field is required by the question.
The synthetic comparison distinguishes two policy consequences. First, the marked row drops out completely under rejection. Removing a source can reduce the number of available room values and titles. Second, projecting only room preserves one field and removes the other. Statements about a general increase or decrease in security require more information. The figure measures the model-facing field selection for this code. It holds fixed the same four eligible records and uses a preassigned mark for each.
Check reporting when the fixture size changes. Suppose the next test has zero authorized records. All returned views are empty and the counts for rooms and titles are zero. If a team also plots percentages conditional on authorized sources, the denominator is zero and the percentage is undefined. In that state report the sample count and missing percentage. A zero proportion would imply eligible observations were present but did not supply the field. This difference matters when comparing sites or versions with different access patterns.
There is a related comparison between two application versions. A stricter policy may give fewer room values at the same authorization scope. An access change may also give fewer room values while leaving policy unchanged. A view-coverage dashboard should name the denominator and identify which version made the decision. If the application does not record the eligible set for good privacy reasons, it can still use a test with controlled fixtures to check the policy and reserve production observations for questions about availability patterns.
Separate this policy view from detector evaluation. We could change the marker and keep the policy fixed, or change the policy and keep the marker fixed. The fixture comparison changes policy and uses identical labels. That choice is what allows a clean attribution of the field count differences to the view strategy. Measuring a detector would need reviewed examples and an evaluation procedure for the relevant source population. The plotted values offer no basis to infer such a measurement.
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!