liveBook · Manning

Spotlighting

As explained in Generative AI in Action

Spotlighting is an ensemble of techniques for helping language models distinguish valid system instructions from potentially untrustworthy external input.

Spotlighting uses delimiters and data marking to help language models distinguish system instructions from untrustworthy external input. It supports enterprise applications that retrieve documents through RAG, where hidden instructions may attempt to alter system rules or gain unauthorized access. section 13.5.1

Prompt Shields applies the technique to:

  • User prompts that deliberately attempt to break or change system behavior. section 13.5.1
  • External RAG documents containing hidden instructions, role-play requests, encoding attacks, or conversation-manipulation attempts. section 13.5.1
  • Prompt and document analysis that returns an attackDetected Boolean for application workflow decisions. section 13.5.1

Shield a prompt and document set

Install azure-ai-contentsafety, submit userPrompt and documents to Azure AI Content Safety's text:shieldPrompt endpoint, and inspect the JSON response. A result can mark both userPromptAnalysis and documentsAnalysis as attackDetected: true.

How Generative AI in Action covers it

How deep it goes
Explains delimiters, data marking, attack categories, and an API response, without detailing the underlying detection model.
Examples
Uses a user question, two documents, an HTTP POST request, and attackDetected JSON results.
What you can do after
Operate Azure AI Content Safety's Prompt Shields endpoint and route workflows according to detected prompt or document attacks.
How it connects
Connects prompt injection defenses with Prompt Shields, retrieval-augmented generation, and Azure AI Content Safety.

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