Inferensys

Prompt

Model Routing Decision Audit Prompt

A practical prompt playbook for auditing model routing decisions from production traces to verify cost, latency, and policy compliance.
Compliance officer monitoring AI compliance agent on laptop, policy dashboards visible, modern WeWork desk setup.
PROMPT PLAYBOOK

When to Use This Prompt

Understand the diagnostic job, ideal user, and boundaries of the Model Routing Decision Audit Prompt.

This prompt is a diagnostic tool for AI platform engineers and SREs who need to audit a single production trace to verify that the model routing decision was correct. The job-to-be-done is forensic: you have a trace where the system chose a specific model, and you need to determine whether that choice aligned with your routing policy. The prompt analyzes the user input, classification scores, routing rules, and selected model to determine if the cheapest or fastest appropriate model was chosen according to policy. Use this when you suspect routing logic is misconfigured, when cost anomalies appear in your inference spend, or when you need to validate that fallback and escalation paths are working as designed.

This is a trace review prompt, not a real-time routing prompt. It expects a complete trace payload containing the original user input, any classification or intent scores, the routing rules that were active at request time, the model that was selected, and the available model catalog with cost and capability metadata. The prompt does not make routing decisions—it audits decisions that have already been made. The ideal user is someone who understands the routing architecture and can supply the trace data in a structured format. If you are looking for a prompt that performs live model routing at inference time, use a prompt from the Model Routing and Fallback Prompts pillar instead.

Do not use this prompt when the trace data is incomplete or when routing rules were applied by an external system that cannot be reconstructed. The audit is only as reliable as the trace evidence provided. For high-stakes routing decisions—such as those involving regulated data, safety-critical workflows, or financial transactions—always pair this prompt's output with human review and cross-reference against your routing configuration as deployed. The prompt identifies likely misconfigurations and policy violations, but it cannot access live routing state or confirm that the trace accurately reflects production behavior. After running this audit, feed the findings into your routing rule refinement process and consider adding a continuous monitoring check that compares actual routing against expected policy across multiple traces.

PRACTICAL GUARDRAILS

Use Case Fit

Where the Model Routing Decision Audit Prompt works well and where it introduces risk. Use these cards to decide if this trace review prompt fits your current operational need.

01

Good Fit: Post-Deployment Routing Audits

Use when: You have a production trace from a model router and need to verify that the cheapest, fastest, or most appropriate model was selected according to policy. Guardrail: Feed the prompt a complete trace with classification scores, routing rules, and the selected model. The prompt compares actual routing against expected policy and flags deviations.

02

Good Fit: Cost Anomaly Investigation

Use when: A single trace shows unexpectedly high token cost or latency, and you suspect a routing error sent a simple query to an expensive model. Guardrail: Include per-model pricing and latency baselines in the trace context so the prompt can quantify the cost impact of the routing decision.

03

Bad Fit: Real-Time Routing Decisions

Avoid when: You need to make a routing decision at inference time. This prompt is designed for post-hoc audit of a completed trace, not for live request handling. Guardrail: Use this prompt in an offline analysis harness or monitoring pipeline, never in the hot path of a user-facing request.

04

Bad Fit: Router Configuration Design

Avoid when: You are designing or tuning routing rules, classification thresholds, or fallback policies. This prompt audits a single decision against existing rules; it does not propose new routing logic. Guardrail: Pair this prompt with a separate policy design workflow. Use audit findings as input to rule refinement, not as the refinement step itself.

05

Required Inputs: Complete Trace Context

Risk: Incomplete traces—missing classification scores, truncated routing rules, or absent model metadata—produce unreliable audits. Guardrail: Validate that the trace includes user input, classification output, routing rule definitions, selected model, and fallback history before running the audit prompt. Reject traces with missing segments.

06

Operational Risk: Policy Drift Over Time

Risk: Routing policies change as teams add models, adjust cost targets, or modify fallback rules. An audit against stale policy definitions produces false positives. Guardrail: Always pass the current routing policy as part of the trace context. Version your policy definitions and include the policy version in the audit output for traceability.

PROMPT PLAYBOOK

Copy-Ready Prompt Template

A reusable prompt for auditing a single production trace to verify that the model routing decision was optimal according to policy.

This template is designed to be copied directly into your observability tool, notebook, or automated audit harness. It accepts a structured trace payload and a routing policy document, then produces a deterministic audit report. The prompt forces the model to compare the actual routing decision against the expected policy, not to generate a plausible-sounding justification for whatever happened. Use it when you need to answer one question: 'Did the router pick the right model for this request?'

text
You are an AI platform auditor. Your task is to review a single production trace and determine whether the model routing decision was correct according to the provided routing policy.

## INPUT

### Trace Data
```json
[TRACE_DATA]

Routing Policy

text
[ROUTING_POLICY]

INSTRUCTIONS

  1. Extract the following from the trace:

    • The user's original input.
    • Any classification scores, intents, or features used for routing.
    • The model that was actually selected.
    • The routing rule that was applied (if recorded).
  2. Apply the routing policy to the extracted features. Determine which model should have been selected according to the policy.

  3. Compare the actual model against the expected model. If they differ, identify the specific policy rule that was violated or misapplied.

  4. Classify the routing decision as one of:

    • CORRECT: The actual model matches the expected model.
    • SUBOPTIMAL: A cheaper or faster model could have been used without violating policy constraints.
    • OVERRIDE: The actual model is more expensive or slower than the expected model, and no policy exception is recorded.
    • POLICY_VIOLATION: The actual model violates an explicit policy constraint (e.g., data residency, capability requirement).
    • INDETERMINATE: The trace lacks sufficient information to apply the policy.
  5. If the decision is not CORRECT, estimate the cost and latency impact of the deviation. Use the pricing and latency baselines provided in the policy. If baselines are absent, note that impact cannot be calculated.

OUTPUT SCHEMA

Return a JSON object with this exact structure:

json
{
  "trace_id": "string",
  "timestamp": "string or null",
  "extracted_features": {
    "input_summary": "string",
    "classification_scores": {},
    "routing_signals_used": []
  },
  "actual_model": "string",
  "expected_model": "string",
  "applied_rule": "string or null",
  "decision": "CORRECT | SUBOPTIMAL | OVERRIDE | POLICY_VIOLATION | INDETERMINATE",
  "deviation_detail": "string or null",
  "estimated_impact": {
    "cost_delta_usd": "number or null",
    "latency_delta_ms": "number or null",
    "impact_notes": "string"
  },
  "audit_notes": "string"
}

CONSTRAINTS

  • Do not invent missing trace data. If a signal is absent, mark it as null and classify as INDETERMINATE.
  • Do not justify the actual decision. Report what the policy requires.
  • If the policy is ambiguous, describe the ambiguity in audit_notes and classify as INDETERMINATE.
  • Never recommend a model that violates data residency, compliance, or capability constraints stated in the policy.
  • If the trace contains multiple routing steps, evaluate the final model selection only.

EXAMPLES

[EXAMPLES]

To adapt this template, replace [TRACE_DATA] with the full JSON trace object from your observability system. Replace [ROUTING_POLICY] with your organization's routing rules in plain text, including model tiers, cost baselines, latency targets, and any hard constraints like data residency. The [EXAMPLES] placeholder should contain 2-3 few-shot examples showing correct audit outputs for known routing scenarios. Before deploying this prompt in an automated pipeline, validate its output against a golden set of 20-30 traces where you know the correct routing decision. Run the audit on traces from each decision category to confirm the model isn't biased toward classifying everything as CORRECT.

IMPLEMENTATION TABLE

Prompt Variables

Each placeholder must be populated from trace data before sending the Model Routing Decision Audit Prompt. Missing or malformed variables will cause the audit to fail or produce unreliable results.

PlaceholderPurposeExampleValidation Notes

[TRACE_ID]

Unique identifier for the production trace being audited

trace_4a8c2f1b_2025-03-15T14:22:10Z

Must match a valid trace UUID or timestamped ID from observability platform. Null not allowed.

[USER_INPUT]

The original user query or request that triggered routing

Summarize the quarterly earnings report for Q3 2024

Must be the raw input string captured at trace entry. Empty string allowed only if request was system-initiated.

[ROUTING_CLASSIFICATION_SCORES]

The classification confidence scores assigned to each candidate model or tier

{"fast_model": 0.92, "accurate_model": 0.08}

Must be a valid JSON object with model labels as keys and float scores between 0.0 and 1.0. Sum should approximate 1.0.

[ROUTING_RULES_APPLIED]

The routing policy rules that were evaluated for this request

["complexity_below_threshold", "latency_sensitive_user_tier"]

Must be a JSON array of rule identifiers matching the deployed routing configuration. Empty array indicates default routing.

[SELECTED_MODEL]

The model that was actually selected and invoked by the router

gpt-4o-mini

Must be a valid model identifier from the production model registry. Null if routing failed before model selection.

[EXPECTED_ROUTING_POLICY]

The reference routing policy that defines correct behavior for comparison

Route to cheapest model when classification confidence exceeds 0.85 for fast_model

Must be a string describing the expected routing decision logic. Should match the policy version active at trace timestamp.

[TRACE_TIMESTAMP]

The UTC timestamp when the routing decision was made

2025-03-15T14:22:10Z

Must be ISO 8601 UTC format. Used to determine which policy version was active and to correlate with deployment events.

[MODEL_LATENCY_MS]

The measured inference latency for the selected model in milliseconds

245

Must be a positive integer. Used to verify that latency constraints were met. Null if model was not invoked.

PROMPT PLAYBOOK

Implementation Harness Notes

How to wire the Model Routing Decision Audit Prompt into an automated trace review pipeline with validation, retries, and human escalation.

The Model Routing Decision Audit Prompt is designed to be called programmatically as part of an automated trace review pipeline, not as a one-off manual check. In a production harness, this prompt should be invoked for a statistically sampled subset of traces—such as 5% of all routed requests or 100% of traces where the selected model exceeded a cost or latency threshold. The harness must supply the prompt with a structured trace payload containing the original user input, the classification scores, the routing rules that were active at the time, the selected model, and the available model catalog with cost and latency metadata. Without this structured input, the prompt cannot perform a meaningful audit.

The implementation should follow a strict validation-and-retry loop. After the LLM returns its audit result, the harness must validate the output against a defined schema: a JSON object containing a routing_decision_correct boolean, a recommended_model string, a cost_delta number, a latency_delta number, and an array of violations with rule_id and description fields. If validation fails, the harness should retry the prompt once with the validation error appended as a [CONSTRAINTS] update. If the second attempt also fails validation, the trace should be flagged for human review rather than silently accepted. For high-risk domains where routing errors could cause regulatory or safety issues, every audit result should require human approval before any routing policy change is deployed.

The harness should also log the full audit result alongside the trace ID, the prompt version, the model used for the audit itself, and the timestamp. This creates an evidence trail for governance reviews and allows trend analysis over time—for example, detecting that a specific routing rule is consistently flagged as suboptimal. Avoid wiring this prompt directly into the routing decision path in real time; it is an offline audit tool, not a synchronous gate. Adding it to the critical path would introduce latency and a new failure mode. Instead, use the audit output to update routing rules, adjust model weights, or tune classification thresholds in a subsequent deployment cycle.

IMPLEMENTATION TABLE

Expected Output Contract

Fields, data types, and validation rules for the JSON output of the Model Routing Decision Audit Prompt. Use this contract to parse, validate, and store the audit result before surfacing it in a dashboard or alert.

Field or ElementType or FormatRequiredValidation Rule

audit_id

string (UUID v4)

Must parse as valid UUID v4. Reject if missing or malformed.

trace_id

string

Must match the [TRACE_ID] input exactly. Reject on mismatch.

routing_decision

object

Must contain selected_model, routing_rule_applied, and classification_scores sub-objects.

routing_decision.selected_model

string

Must be a non-empty string matching a model identifier from the [MODEL_CATALOG] schema.

routing_decision.routing_rule_applied

string

Must be a non-empty string matching one of the rule names defined in [ROUTING_POLICY].

routing_decision.classification_scores

object

Must be a map of string keys to float values between 0.0 and 1.0. At least one key required.

policy_compliance

object

Must contain compliant (boolean) and violations (array of strings).

policy_compliance.compliant

boolean

Must be true or false. Null not allowed.

policy_compliance.violations

array of strings

If compliant is false, array must contain at least one non-empty string describing the violation. If compliant is true, array must be empty.

cost_optimality

object

Must contain cheapest_eligible_model (string) and actual_cost_rank (integer >= 1).

cost_optimality.cheapest_eligible_model

string

Must be a non-empty string matching a model identifier from [MODEL_CATALOG] that satisfies [ROUTING_POLICY] constraints.

cost_optimality.actual_cost_rank

integer

Must be an integer >= 1 representing the selected model's position in the cost-sorted eligible model list.

latency_optimality

object

If present, must contain fastest_eligible_model (string) and actual_latency_rank (integer >= 1). Validate against [LATENCY_SLA] if provided.

audit_summary

string

Must be a non-empty string between 50 and 500 characters summarizing the routing decision and any violations.

recommended_action

string

Must be one of: no_action, review_policy, update_routing_rules, investigate_model_performance, escalate.

evidence

array of objects

Must contain at least one evidence item. Each item must have source (string) and reference (string) fields, both non-empty.

PRACTICAL GUARDRAILS

Common Failure Modes

What breaks first when auditing model routing decisions in production traces and how to guard against it.

01

Routing Policy Drift

What to watch: The routing logic in the trace no longer matches the current routing policy because rules, model availability, or cost thresholds changed after deployment. The audit prompt may flag a correct routing decision as a violation simply because it compares against stale policy. Guardrail: Always inject the current routing policy document as [ROUTING_POLICY] into the prompt context. Version the policy and include the effective date so the audit can flag policy-version mismatches before evaluating correctness.

02

Classification Score Ambiguity

What to watch: The trace contains classification scores that are borderline or have low confidence, but the audit prompt treats the routing decision as binary correct/incorrect. This produces false positives when the model legitimately chose a fallback or higher-capability model due to uncertainty. Guardrail: Include a [CONFIDENCE_THRESHOLD] parameter in the audit prompt. When classification scores fall within a gray zone, the prompt should flag the decision as 'review required' rather than 'violation,' and surface the score distribution for human judgment.

03

Missing Cost Attribution Context

What to watch: The audit prompt declares a routing decision suboptimal because a cheaper model could have handled the request, but the trace lacks information about rate limits, model availability at request time, or latency SLOs that forced the router to select a more expensive model. Guardrail: Require the trace to include [ROUTING_METADATA] such as model availability status, active rate limits, and latency budget remaining. The audit prompt should treat missing metadata as an incomplete trace rather than a routing failure, and flag it for trace quality improvement.

04

Fallback Over-Triggering

What to watch: The trace shows a fallback model was activated, but the primary model's failure was transient (timeout, single retryable error) rather than a capability gap. The audit prompt may incorrectly endorse the fallback as necessary, masking routing instability. Guardrail: Add a [RETRY_POLICY] check to the audit prompt. Before validating a fallback decision, the prompt must verify that retry exhaustion was reached or that the error was non-retryable. Flag fallbacks that occurred on the first transient error as potential routing misconfiguration.

05

Input Complexity Mismatch

What to watch: The audit prompt evaluates routing based only on explicit classification labels or intent, but the actual input complexity (token length, multi-step reasoning required, domain specificity) demanded a more capable model that the classification missed. The audit incorrectly flags the routing as wasteful. Guardrail: Include an [INPUT_COMPLEXITY_SIGNAL] in the trace and audit prompt. This signal should capture token count, instruction complexity markers, and domain indicators. The audit prompt must weigh complexity signals alongside classification labels before judging routing appropriateness.

06

Audit Prompt Blindness to Business Rules

What to watch: The audit prompt applies a pure cost-optimization lens and flags every routing decision that didn't use the absolute cheapest model. In reality, business rules may require specific models for certain customers, regions, or compliance boundaries regardless of cost. Guardrail: Supply a [BUSINESS_RULES] block in the audit prompt that defines mandatory model assignments, customer-tier routing, and compliance constraints. The prompt must check business rules first and only evaluate cost optimization for requests not covered by mandatory routing.

IMPLEMENTATION TABLE

Evaluation Rubric

Use this rubric to test the Model Routing Decision Audit Prompt before integrating it into your audit workflow. Each criterion targets a specific failure mode that can cause incorrect routing decisions or incomplete audit reports.

CriterionPass StandardFailure SignalTest Method

Routing Rule Identification

All routing rules applied in the trace are correctly identified and matched to the routing configuration

Missing rules, misidentified rules, or rules listed that were not actually evaluated

Compare extracted rules against a golden trace with known routing configuration; require 100% rule recall

Classification Score Extraction

All classification scores from the trace are extracted with correct values and labels

Missing scores, incorrect score values, or scores attributed to wrong classification dimensions

Parse extracted scores against trace metadata; validate numeric precision and label matching

Model Selection Justification

The selected model is correctly identified and the justification references specific routing rules and scores

Model name mismatch, vague justification without rule references, or justification that contradicts trace evidence

Check model identifier against trace; verify justification contains at least one specific rule reference

Policy Compliance Assessment

Correctly determines whether the routing decision complied with the stated cost or latency policy

False positive compliance claims when policy was violated, or false negative when routing was correct

Test against 5 traces with known compliance outcomes; require 100% accuracy on compliance determination

Alternative Model Recommendation

Recommends an alternative model only when a cheaper or faster model meets all routing constraints

Recommending alternatives that violate constraints, missing viable alternatives, or recommending the same model

Validate alternative against routing rules and constraints; confirm alternative differs from selected model when recommended

Cost and Latency Comparison

Accurately compares cost and latency between selected model and recommended alternative using trace data

Incorrect cost or latency values, missing comparison dimensions, or unsupported claims about savings

Cross-reference comparison values against model pricing and latency data from trace; require numeric accuracy

Audit Report Completeness

Output contains all required fields: routing rules, scores, selected model, justification, compliance, alternative, comparison

Missing required fields, null values where data exists in trace, or fields present but empty

Schema validation against output contract; check all required fields are present and non-null when trace data is available

Edge Case Handling

Correctly handles traces with missing scores, ambiguous routing, or fallback activations without crashing or hallucinating

Hallucinated scores, incorrect fallback attribution, or failure to flag missing data

Test against traces with injected gaps: missing classification scores, fallback triggers, and ambiguous rule matches

ADAPTATION OPTIONS

Adapt This Prompt

How to adapt

Use the base prompt with a single trace and a simplified routing policy. Replace the full [ROUTING_POLICY] with a short ruleset (e.g., 'Route to GPT-4o-mini for classification, Claude 3.5 Sonnet for reasoning'). Skip the cost-attribution harness and focus on the core question: 'Was the cheapest appropriate model chosen?'

Watch for

  • Overly broad routing rules that produce ambiguous audit results
  • Missing classification-score thresholds, causing false positives
  • No validation that the trace actually contains routing metadata
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.