Lesson 4.5 — Confidence Thresholds & Escalation Logic

Introduction: Quantifying Uncertainty

In our previous lesson, we discussed the importance of handling ambiguity and failure in our routing system. We explored strategies like clarification prompts and human escalation, but we left a crucial question unanswered: How does the system know when it should be uncertain? How does it decide when to ask for help?

The answer lies in confidence thresholds and escalation logic. When an intent classification model processes a user query, it doesn't just output a single intent; it outputs a list of possible intents, each with an associated confidence score. This score, typically a number between 0 and 1, represents the model's confidence that the query belongs to that particular intent. By using these scores, we can build a much more nuanced and intelligent routing system.

This lesson will explore how to use confidence thresholds to quantify uncertainty and how to build sophisticated escalation logic that uses these thresholds to make smarter routing decisions.

Understanding Confidence Scores

When you send a query to an intent classification model, the output might look something like this:

  • intent: order.track, confidence: 0.85

  • intent: order.status, confidence: 0.10

  • intent: returns.initiate, confidence: 0.05

This tells us that the model is 85% confident that the user wants to track their order, but there is a small chance they might be asking about the general status of their order or wanting to initiate a return.

A simple routing system might just take the top intent (order.track) and proceed. A more sophisticated system, however, will use the full spectrum of these scores to make a more informed decision.

Setting Confidence Thresholds

A confidence threshold is a pre-defined value that we use to determine our level of certainty. We can set multiple thresholds to trigger different actions.

Threshold
Confidence Score
Action

High Confidence

> 0.90

Proceed directly with the top intent. The model is very sure.

Medium Confidence

0.70 - 0.90

Proceed with the top intent, but perhaps offer a quick confirmation: "Are you looking to track your order?"

Low Confidence

< 0.70

Do not proceed. The model is uncertain. Trigger a conflict resolution strategy, such as a clarification prompt.

These thresholds are not set in stone; they should be tuned and adjusted based on the performance of your model and the specific needs of your application. For a high-stakes application, you might set a very high threshold for proceeding directly.

Designing Escalation Logic

Escalation logic is the set of rules that determines what to do when the confidence score falls below a certain threshold. This logic can be as simple or as complex as necessary.

Simple Escalation Logic

A simple escalation path might look like this:

  1. If confidence > 0.90, then route to the primary data source for the top intent.

  2. Else if confidence > 0.70, then ask the user to confirm the top intent.

  3. Else, escalate to a human agent.

Advanced Escalation Logic

A more advanced system might consider the difference between the top two intents:

  1. If confidence_top > 0.90, then route to the primary data source.

  2. Else if (confidence_top - confidence_second) > 0.50, then proceed with the top intent (even if it's below the high confidence threshold, it's still much more likely than the next best option).

  3. Else, present the user with the top two or three intents and ask them to choose.

The Ultimate Escalation: Handing Off to a Human

No matter how sophisticated your AI agent is, there will always be situations where it is unable to help. A well-designed escalation path to a human agent is a critical component of any enterprise-grade system. This handoff should be as seamless as possible.

Best Practices for Human Escalation

  • Preserve Context: When the conversation is transferred to a human agent, the full history of the conversation, including the AI's attempts to resolve the issue, should be provided to the human agent.

  • Be Transparent: The user should be clearly informed that they are being transferred to a human.

  • Set Expectations: If there is a wait time to connect with a human agent, the user should be informed.

Conclusion: From Confidence to Competence

Confidence thresholds and escalation logic are the mechanisms that allow our AI agent to reason about its own uncertainty. By quantifying this uncertainty, we can build a system that is not only more accurate but also more resilient and user-friendly. An agent that knows when to ask for help is an agent that can be trusted.

In the next lesson, we will explore hybrid retrieval, a powerful technique that combines the strengths of traditional keyword search with modern vector search to create an even more robust and accurate retrieval system.

Last updated