Inferensys

Prompt

Multi-Turn Intent Change Detection Prompt

A practical prompt playbook for using Multi-Turn Intent Change Detection Prompt in production AI workflows.
Developer doing prompt engineering on laptop, prompt variations visible on screen, casual coding session.
PROMPT PLAYBOOK

When to Use This Prompt

Learn when to deploy the multi-turn intent change detection prompt and when to choose a different tool.

This prompt is designed for a specific job: classifying how the current user turn relates to the prior conversation. It outputs a label—new, continuation, refinement, or correction—with evidence spans from the history. Use it inside routing and analytics pipelines where downstream behavior depends on whether the user is staying on task, changing the subject, or correcting a previous instruction. The ideal user is a developer or AI engineer building a multi-turn assistant, copilot, or support bot that needs to make real-time decisions about context management, state resets, or workflow branching based on turn-to-turn intent shifts.

This is not a general intent classifier. It assumes you already have a conversation history and need to detect shifts, not assign topic categories. If you need topic-level intent classification (e.g., 'billing inquiry' vs. 'technical support'), pair this with a separate classification prompt. If you need slot-filling or entity extraction, use a dialogue slot extraction template instead. The prompt is optimized for boundary cases where users subtly shift goals—for example, moving from 'show me my balance' to 'actually, that last transaction looks wrong,' which is a correction, not a new topic. It also handles mid-turn pivots where a single user message contains both a continuation and a refinement.

Before wiring this into production, confirm that your system has access to a structured conversation history with turn-level attribution. The prompt requires at least the current user turn and the prior assistant turn to function; performance improves with more history. Do not use this prompt for single-turn classification or for sessions without a clear turn boundary. If your application operates in a high-stakes domain—such as healthcare triage or financial transaction routing—add a human review step before acting on the classification output, and log the evidence spans for auditability. For a complete implementation, pair this with the session state JSON tracking prompt to update state based on the detected shift type.

PRACTICAL GUARDRAILS

Use Case Fit

Where the Multi-Turn Intent Change Detection Prompt delivers reliable routing signals and where it introduces operational risk.

01

Good Fit: Explicit Goal Shifts

Use when: users make clear, declarative shifts such as 'Actually, I want to cancel my order instead' or 'Let's talk about billing.' Guardrail: The prompt performs best when the prior intent is well-defined. Always provide the last classified intent as context to improve detection accuracy.

02

Good Fit: Routing and Analytics Pipelines

Use when: the classification label is consumed by a downstream router, queue, or analytics dashboard, not shown directly to the user. Guardrail: Decouple the detection prompt from the response generation prompt. A misclassification here should only affect routing, not the conversational reply.

03

Bad Fit: Ambiguous Social Chat

Avoid when: the conversation is purely social, meandering, or lacks a clear task structure. Risk: The model may hallucinate intent boundaries where none exist, leading to noisy analytics and unnecessary re-routing. Guardrail: Gate the prompt behind a task-oriented conversation classifier first.

04

Required Input: Structured Prior State

What to watch: Without the previous turn's intent label and evidence spans, the model cannot reliably distinguish a continuation from a new intent. Guardrail: The prompt harness must inject the last known intent, a summary of active slots, and the raw text of the prior user turn as mandatory variables.

05

Operational Risk: Correction vs. New Intent

What to watch: Users correcting a specific detail ('No, the blue one') are often misclassified as having a new intent, causing context loss. Guardrail: The prompt must distinguish 'refinement' from 'new intent.' Validate outputs against a golden set of correction examples to tune this boundary.

06

Operational Risk: Silent Topic Drift

What to watch: Users may drift topics gradually over several turns without a single explicit shift phrase. The model may lag, classifying turns as continuations until the drift is extreme. Guardrail: Implement a secondary check that compares the current turn's semantic embedding against the session-start intent embedding to detect cumulative drift.

PROMPT PLAYBOOK

Copy-Ready Prompt Template

A reusable prompt for classifying whether the latest user turn represents a new intent, continuation, refinement, or correction relative to prior conversation history.

This prompt template is designed to be copied directly into your prompt layer and adapted with your conversation data. It compares the current user turn against the prior conversation history and outputs a structured classification label with supporting evidence spans. The prompt is built for routing and analytics systems that need to detect subtle intent shifts, not just obvious topic changes. Replace each square-bracket placeholder with your actual conversation data, schema definitions, and operational constraints before use.

text
You are an intent change detection classifier for a multi-turn conversation system. Your job is to compare the latest user turn against the prior conversation history and classify the relationship between the current turn and the preceding dialogue.

[CONSTRAINTS]

CONVERSATION HISTORY:
[HISTORY]

CURRENT USER TURN:
[CURRENT_TURN]

CLASSIFICATION TASK:
Analyze the current user turn in the context of the conversation history. Determine whether the user's intent is:
- NEW_INTENT: The user has introduced a completely new goal, topic, or request unrelated to the prior conversation.
- CONTINUATION: The user is continuing the same intent, adding more information, or progressing the same task without changing direction.
- REFINEMENT: The user is narrowing, specifying, or adding detail to the same intent without changing the core goal.
- CORRECTION: The user is explicitly correcting, reversing, or contradicting something they or the assistant previously stated.

EVIDENCE REQUIREMENTS:
For each classification, you must provide:
1. The classification label.
2. A confidence score from 0.0 to 1.0.
3. The specific span of text from the current turn that supports your classification.
4. The specific span of text from the history that the current turn relates to, if applicable.
5. A brief rationale explaining the relationship.

[OUTPUT_SCHEMA]

[EXAMPLES]

[RISK_LEVEL]

Adapt this template by replacing [HISTORY] with the prior conversation turns formatted as speaker-labeled utterances. Replace [CURRENT_TURN] with the latest user message. The [CONSTRAINTS] placeholder should contain any domain-specific rules, such as treating certain keywords as strong correction signals or ignoring small talk when classifying intent. The [OUTPUT_SCHEMA] placeholder should define the exact JSON structure your downstream system expects. The [EXAMPLES] placeholder should include 2-4 few-shot examples covering boundary cases like subtle topic shifts, partial corrections, and multi-intent turns. The [RISK_LEVEL] placeholder should specify the operational risk context, which determines whether low-confidence classifications should be routed to human review or logged for evaluation. For high-risk routing decisions, always add a confidence threshold below which the classification is treated as UNCLEAR and escalated rather than silently routed.

IMPLEMENTATION TABLE

Prompt Variables

Required inputs for the Multi-Turn Intent Change Detection Prompt. Each variable must be populated before invoking the model. Missing or malformed inputs are the most common cause of false negatives in intent shift detection.

PlaceholderPurposeExampleValidation Notes

[CURRENT_TURN]

The latest user utterance to classify against prior history.

Actually, can you show me the pricing instead?

Must be a non-empty string. Trim whitespace. If empty or null, return an error before model invocation.

[CONVERSATION_HISTORY]

Ordered list of prior turns, each with role and content. Provides the baseline for detecting intent shifts.

[{"role": "user", "content": "I need help resetting my password."}, {"role": "assistant", "content": "I can help with that. Do you have your recovery email?"}]

Must be a valid JSON array. Minimum 1 turn. Each object must have 'role' and 'content' keys. Role must be 'user', 'assistant', or 'system'. Validate schema before prompt assembly.

[INTENT_TAXONOMY]

The set of valid intent labels the model can assign. Constrains the classification space.

["new_request", "continuation", "refinement", "correction", "topic_switch"]

Must be a non-empty JSON array of unique strings. Validate that [CURRENT_TURN] classification output maps to one of these labels. Reject unknown labels in post-processing.

[EVIDENCE_SPAN_LIMIT]

Maximum number of evidence spans the model should extract from history to justify its classification.

3

Must be a positive integer. Default to 3 if not provided. Controls output verbosity and prevents the model from citing the entire history. Validate output span count does not exceed this limit.

[CONFIDENCE_THRESHOLD]

Minimum confidence score required to accept the classification. Outputs below this threshold trigger a clarification or human review path.

0.7

Must be a float between 0.0 and 1.0. Default to 0.65 if not provided. Post-process: if model confidence is below this value, route to [FALLBACK_ACTION].

[FALLBACK_ACTION]

Instruction for what to do when confidence is below [CONFIDENCE_THRESHOLD] or the intent is ambiguous.

ask_clarification

Must be one of: 'ask_clarification', 'escalate_to_human', 'retry_with_more_context', 'label_as_ambiguous'. Validate against allowed enum. Controls downstream routing behavior.

[OUTPUT_SCHEMA]

The exact JSON schema the model must produce. Includes fields for intent label, confidence, evidence spans, and rationale.

{"intent_label": "refinement", "confidence": 0.88, "evidence_spans": ["show me the pricing instead"], "rationale": "User shifts from password reset to pricing inquiry."}

Must be a valid JSON Schema or example object. Validate model output against this schema. If output fails schema validation, trigger retry with schema error message injected into the prompt.

PROMPT PLAYBOOK

Implementation Harness Notes

How to wire the Multi-Turn Intent Change Detection prompt into a production routing or analytics pipeline.

This prompt is designed to sit between the user's latest utterance and your application's routing, analytics, or state management logic. It is not a conversational response generator—it is a classification step that must execute before the system decides what to do next. The harness should treat this prompt as a synchronous pre-processing gate: the model receives the current turn plus a compressed representation of prior turns, and it must return a structured classification before the main assistant or agent is invoked. Because the output directly controls routing decisions, the harness must validate the classification label against an allowed enum, check for evidence spans that map to real input tokens, and fall back to a safe default (typically continuation or new) if the model output is malformed or low-confidence.

Wire the prompt into your application with a strict JSON schema validator. The expected output includes a classification field constrained to a closed set: new, continuation, refinement, correction, or unrelated. The harness should reject any output that does not match this enum and either retry with a more explicit constraint or default to continuation to avoid breaking the user's flow. For the evidence_spans field, validate that each span is a substring of the current user turn or a prior turn provided in the context. Spans that do not match input text indicate hallucination and should trigger a retry or a confidence downgrade. Log every classification decision with the turn ID, the raw model output, the validated output, and the fallback decision if one was used. This log becomes essential for debugging routing errors and for tuning the prompt over time. For model choice, a fast, instruction-tuned model (such as GPT-4o-mini, Claude Haiku, or Gemini Flash) is usually sufficient; the task is discriminative, not generative, and latency matters because this gate blocks the main pipeline.

If the classification is correction or refinement, the harness should flag the prior turn's state as potentially stale and trigger a state update or re-verification step before the main assistant responds. If the classification is new, the harness should reset or archive the active dialogue state and begin a fresh tracking session. For unrelated, consider whether the user has drifted into a topic your system cannot handle and route to a fallback or escalation path. Do not use this prompt in isolation for high-stakes decisions—combine it with explicit user confirmation when the detected intent change would discard work in progress or alter a transaction in flight. The next step after implementing this harness is to build a regression test suite with labeled turn pairs covering subtle shifts (e.g., 'Actually, can you also add...' versus 'Actually, I meant...') and measure classification accuracy before deploying to production routing.

IMPLEMENTATION TABLE

Expected Output Contract

Defines the required JSON fields, types, and validation rules for the Multi-Turn Intent Change Detection Prompt output. Use this contract to parse and validate the model response before routing or analytics ingestion.

Field or ElementType or FormatRequiredValidation Rule

intent_change_label

enum: [NEW, CONTINUATION, REFINEMENT, CORRECTION, UNRELATED]

Must be exactly one of the five enum values. Reject any other string.

confidence_score

float between 0.0 and 1.0

Must be a valid float. Reject if < 0.0 or > 1.0. If confidence is below [CONFIDENCE_THRESHOLD], route for human review.

current_intent_summary

string (<= 200 chars)

Must be a non-empty string summarizing the primary intent of the current user turn. Reject if length exceeds 200 characters.

prior_intent_summary

string (<= 200 chars) or null

Must be a non-empty string if prior turns exist and contain an intent; otherwise null. Reject if length exceeds 200 characters.

evidence_spans

array of objects

Each object must contain 'turn_index' (integer >= 0), 'text_snippet' (string), and 'role' (enum: [USER, ASSISTANT]). Reject if array is empty for CONTINUATION, REFINEMENT, or CORRECTION labels.

change_rationale

string (<= 500 chars)

Must be a non-empty string explaining the classification decision. Reject if length exceeds 500 characters or if it contains only generic filler text.

requires_clarification

boolean

Must be true or false. If true, the system should trigger a clarification prompt before committing the intent change.

previous_turn_reference

integer or null

Must be the turn_index of the prior turn this intent relates to, or null if label is NEW or UNRELATED. Reject if a valid integer is provided for NEW or UNRELATED labels.

PRACTICAL GUARDRAILS

Common Failure Modes

Multi-turn intent change detection fails silently in production. These are the most common failure modes and the guardrails that catch them before they corrupt routing, analytics, or user experience.

01

Subtle Intent Drift Misclassified as Continuation

What to watch: Users gradually shift goals across turns without explicit topic-change signals. The model classifies a new intent as a continuation of the prior one because the surface vocabulary overlaps. Guardrail: Require the prompt to output evidence spans from both the current turn and the prior turn that support the classification. If the evidence spans share the same entities but different actions, flag for ambiguity review.

02

Correction Classified as New Intent

What to watch: Users say 'no, I meant X' or 'change that to Y' and the model treats this as a fresh intent rather than a refinement of the existing one. This causes state resets and dropped context. Guardrail: Add explicit correction-detection heuristics in the prompt: check for negation phrases, replacement language, and direct references to prior assistant output before classifying as new intent.

03

Evidence Spans Point to Wrong Turns

What to watch: The model correctly identifies an intent change but cites evidence from the wrong turn index, making the classification unverifiable and breaking downstream audit trails. Guardrail: Post-process the output to validate that cited turn indices exist in the conversation history. If a cited turn is out of range or the quoted text doesn't match, reject the classification and retry with explicit turn-index constraints.

04

Ambiguous Intent Produces Overconfident Classification

What to watch: When the user's turn could reasonably be interpreted as either a continuation or a new intent, the model picks one with high confidence instead of signaling ambiguity. This causes downstream systems to commit to the wrong path. Guardrail: Require a confidence score in the output schema and calibrate with a threshold. When confidence is below the threshold, route to a clarification prompt or human review rather than forcing a decision.

05

Multi-Intent Turns Collapse to Single Label

What to watch: Users pack multiple intents into one turn ('Also, can you check on X while you're at it?'). The model assigns a single intent label and drops the secondary intent, causing missed actions. Guardrail: Design the output schema to support an array of intent classifications per turn, not a single label. Validate that each detected intent has its own evidence span and that no user-requested action is silently discarded.

06

Context Window Truncation Drops Prior Intent Anchors

What to watch: In long conversations, the turns that established the original intent fall out of the context window. The model loses the reference point and misclassifies continuations as new intents or vice versa. Guardrail: Maintain a persistent session-state summary that includes the active intent label and its originating turn. Inject this summary into the prompt before the conversation history so the anchor survives context pruning.

IMPLEMENTATION TABLE

Evaluation Rubric

Use this rubric to evaluate the quality of the Multi-Turn Intent Change Detection Prompt before deploying it to production. Each criterion targets a specific failure mode observed in intent classification over conversation history.

CriterionPass StandardFailure SignalTest Method

Intent Classification Accuracy

Classification label matches ground truth for 95% of test cases across new, continuation, refinement, and correction classes.

Model misclassifies a refinement as a new intent or fails to detect a correction when the user explicitly negates a prior statement.

Run against a golden dataset of 100+ multi-turn conversations with labeled intent transitions. Measure precision/recall per class.

Evidence Span Grounding

Every classification includes at least one verbatim text span from the current turn and one from the prior turn that supports the decision.

Evidence spans are hallucinated, point to non-existent text, or cite only the current turn without referencing prior context.

Parse output for evidence_spans array. Validate each span exists in the provided turn history using exact string match or fuzzy substring check.

Correction vs. Refinement Discrimination

Correction label is assigned only when the user explicitly contradicts or negates a prior stated intent. Refinement is assigned when the user adds constraints without contradiction.

Model labels a constraint addition as a correction, or labels an explicit negation as a refinement.

Curate 20 boundary cases with mixed negation and constraint addition. Measure agreement with human annotators. Target Cohen's kappa > 0.85.

Continuation Detection with Topic Drift

Continuation is correctly identified even when surface vocabulary changes, as long as the underlying goal remains the same.

Model breaks continuation when the user uses different words for the same task, or merges two distinct intents into a false continuation.

Test with paraphrased continuations and subtle topic shifts. Verify that semantic similarity alone does not drive the decision.

Null History Handling

When prior turn history is empty or null, the output defaults to 'new' with confidence >= 0.95 and evidence_spans containing only the current turn.

Model hallucinates a prior intent, assigns low confidence to 'new', or fabricates evidence spans from an empty history.

Pass empty history array and null history. Assert classification is 'new', confidence >= 0.95, and evidence_spans references only current turn indices.

Output Schema Compliance

Output is valid JSON matching the expected schema: classification, confidence, evidence_spans, rationale. All required fields present.

Output is missing required fields, contains extra unvalidated keys, or returns malformed JSON that fails parsing.

Validate output against JSON Schema. Reject any response that fails schema validation. Run 1000 automated schema checks across varied inputs.

Confidence Calibration

Confidence score reflects actual likelihood of correctness. High-confidence predictions (>0.9) are correct >90% of the time. Low-confidence predictions (<0.7) correlate with ambiguous or conflicting turns.

Model assigns high confidence to incorrect classifications or low confidence to obvious cases.

Bucket predictions by confidence decile. Plot reliability diagram. Expected calibration error (ECE) should be < 0.1 on a held-out test set.

Multi-Turn Context Window Resilience

Classification remains accurate when conversation history contains 10+ prior turns with multiple intent shifts. Model correctly identifies the most recent prior intent for comparison.

Model latches onto an older, irrelevant intent from earlier in the history or becomes confused by multiple intent shifts.

Test with long conversation histories containing 3-5 intent shifts. Verify that the comparison is always against the immediately prior turn's intent, not an earlier one.

ADAPTATION OPTIONS

Adapt This Prompt

How to adapt

Start with the base prompt and a lightweight harness. Use a simple JSON output schema with intent_change_type and evidence_spans. Skip confidence thresholds initially; log all outputs for manual review.

code
You are an intent change detector. Compare the current user turn against the prior turns.

Prior turns:
[PRIOR_TURNS]

Current turn:
[CURRENT_TURN]

Classify the intent change as one of: new, continuation, refinement, correction.
Return JSON: {"intent_change_type": "...", "evidence_spans": ["..."]}

Watch for

  • Over-classifying minor rephrasing as refinement
  • Missing correction when user says "no, I meant..."
  • No validation on output schema shape
Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.