Groundedness detection in Azure AI Content Safety - Azure AI services (original) (raw)

Groundedness detection in Azure AI Content Safety helps you ensure that large language model (LLM) responses are based on your provided source material, reducing the risk of non-factual or fabricated outputs.

Ungroundedness refers to instances where LLMs produce information that is non-factual or inaccurate from what was present in the source materials.

Groundedness detection requires document embedding and formatting.

To understand groundedness detection, it's helpful to be familiar with these core concepts:

Key terms

Detection modes

Groundedness detection offers two modes to balance speed with interpretability:

Choose Non-Reasoning mode for real-time applications where latency matters. Use Reasoning mode during development and debugging to understand why content is flagged.

Domain selection

Choose a domain to optimize detection for your use case:

Domain selection tunes the detection model's sensitivity and correction behavior for domain-specific terminology and patterns.

Task specification

Specify the task type to optimize detection:

Task selection adjusts detection sensitivity and correction logic for task-specific patterns.

Groundedness correction (preview)

The groundedness detection API includes an optional correction feature that not only detects ungrounded content but automatically corrects it based on your grounding sources. This is useful for:

User scenarios

Groundedness detection supports text-based Summarization and QnA tasks to ensure that the generated summaries or answers are accurate and reliable.

Summarization tasks:

QnA tasks:

Below, see several common scenarios that illustrate how and when to apply these features to achieve the best outcomes.

Summarization in medical contexts

You're summarizing medical documents, and it’s critical that the names of patients in the summaries are accurate and consistent with the provided grounding sources.

Example API Request:

{
  "domain": "Medical",
  "task": "Summarization",
  "text": "The patient name is Kevin.",
  "groundingSources": [
    "The patient name is Jane."
  ],
}

Expected outcome:

The correction feature detects that Kevin is ungrounded because it conflicts with the grounding source Jane. The API returns the corrected text: "The patient name is Jane."

Question and answer (QnA) task with customer support data

You're implementing a QnA system for a customer support chatbot. It’s essential that the answers provided by the AI align with the most recent and accurate information available.

Example API Request:

{
  "domain": "Generic",
  "task": "QnA",
  "qna": {
    "query": "What is the current interest rate?"
  },
  "text": "The interest rate is 5%.",
  "groundingSources": [
    "As of July 2024, the interest rate is 4.5%."
  ],
}

Expected outcome:

The API detects that 5% is ungrounded because it doesn't match the provided grounding source 4.5%. The response includes the correction text: "The interest rate is 4.5%."

Content creation with historical data

You're creating content that involves historical data or events, where accuracy is critical to maintaining credibility and avoiding misinformation.

Example API Request:

{
  "domain": "Generic",
  "task": "Summarization",
  "text": "The Battle of Hastings occurred in 1065.",
  "groundingSources": [
    "The Battle of Hastings occurred in 1066."
  ],
}

Expected outcome:

The API detects the ungrounded date 1065 and corrects it to 1066 based on the grounding source. The response includes the corrected text: "The Battle of Hastings occurred in 1066."

Internal documentation summarization

You're summarizing internal documents where product names, version numbers, or other specific data points must remain consistent.

Example API Request:

{
  "domain": "Generic",
  "task": "Summarization",
  "text": "Our latest product is SuperWidget v2.1.",
  "groundingSources": [
    "Our latest product is SuperWidget v2.2."
  ],
}

Expected outcome:

The correction feature identifies SuperWidget v2.1 as ungrounded and updates it to SuperWidget v2.2 in the response. The response returns the corrected text: "Our latest product is SuperWidget v2.2."

Limitations

Language availability

Currently, groundedness detection supports English language content only. While the API doesn't restrict non-English submissions, accuracy and quality are optimized for English.

Text length limitations

Maximum text length varies by mode. See Input requirements for current limits.

Region availability

Groundedness detection is available in specific Azure regions. See Region availability for supported regions.

Rate limitations

Default query rate limits apply. For higher throughput requirements, contact Content Safety support.

Groundedness detection options

The following options are available for Groundedness detection in Azure AI Content Safety:

Groundedness correction

The groundedness detection API includes a correction feature that automatically corrects any detected ungroundedness in the text based on the provided grounding sources. When the correction feature is enabled, the response includes a corrected Text field that presents the corrected text aligned with the grounding sources.

Best practices

Adhere to the following best practices when setting up RAG systems to get the best performance out of the groundedness detection API:

Next step

Follow the quickstart to get started using Azure AI Content Safety to detect groundedness.