Inferensys

Prompt

Test Case Difficulty Rating Prompt

A practical prompt playbook for using the Test Case Difficulty Rating Prompt to calibrate test suite rigor 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 apply difficulty ratings to your golden dataset and when simpler pass/fail metrics are sufficient.

ML engineers and QA leads use this prompt to move beyond flat pass/fail evaluation and understand which test cases expose the most risk. By assigning a difficulty rating to each example in a golden dataset—based on input ambiguity, required reasoning depth, and historical failure rates—teams can build weighted evaluation scoring and progressive testing gates. The output is a stratified difficulty label (easy, medium, hard, expert) that feeds directly into regression test harnesses, allowing you to prioritize fixes for the cases that matter most and avoid being flooded by failures on trivial examples.

This prompt is designed for offline dataset preparation, not real-time production routing. Run it as a batch job over your curated golden set before integrating the labels into your CI/CD evaluation pipeline. Each example should already have a known input and expected output; the prompt adds a difficulty annotation without modifying the test case itself. Wire the resulting labels into your eval harness to weight scores by difficulty, set per-tier pass thresholds, or gate promotion based on hard-case performance. For high-risk domains, always include a human review step to validate the assigned difficulty labels against domain expert judgment before the labels influence release decisions.

Do not use this prompt when the model must also generate the test case itself, or when you need real-time difficulty assessment during inference. It is not a routing classifier and should not gate live traffic. If your golden set is small or homogeneous, difficulty stratification may add complexity without value—stick to flat metrics until you have enough diversity to justify weighted scoring. After labeling, the next step is to integrate the difficulty field into your evaluation harness and monitor whether hard-case performance degrades across prompt versions.

PRACTICAL GUARDRAILS

Use Case Fit

Where the Test Case Difficulty Rating Prompt works and where it introduces risk. Use these cards to decide whether this prompt fits your QA pipeline or whether you need a different approach.

01

Good Fit: Stratified Test Suite Calibration

Use when: you have a golden dataset and need to assign difficulty labels (easy, medium, hard) to each example before running regression tests. Guardrail: The prompt produces consistent labels when you supply clear difficulty definitions and a few rated anchor examples. Run the prompt on a held-out calibration set first and compare against human labels to set your acceptance threshold.

02

Bad Fit: Real-Time Production Scoring

Avoid when: you need to rate difficulty on live user inputs at inference time. This prompt is designed for offline dataset curation, not low-latency production scoring. Guardrail: Use a pre-computed difficulty lookup or a lightweight classifier if you need runtime difficulty estimates. Reserve this prompt for batch processing your golden set during CI/CD pipeline runs.

03

Required Inputs: Golden Examples with Context

Risk: The prompt produces unreliable ratings when given only the input text without expected output, domain context, or failure history. Guardrail: Each example must include the full input, the expected output, and a brief domain note. For best results, also supply historical pass/fail rates from previous test runs so the model can calibrate difficulty against real system behavior.

04

Operational Risk: Difficulty Inflation

Risk: Without anchor examples, the model may rate everything as medium or hard, reducing the usefulness of stratification. Guardrail: Include at least three rated anchor examples (one easy, one medium, one hard) in the prompt. Validate the output distribution—if more than 60% of examples receive the same rating, flag the batch for human review and adjust your anchor set.

05

Operational Risk: Reasoning Depth Mismatch

Risk: The prompt may rate examples as hard because they require domain knowledge, even when the reasoning steps are straightforward. Guardrail: Define difficulty in terms of the model's expected reasoning path, not human domain expertise. Include a rubric that separates "requires multi-step reasoning" from "requires obscure facts." Test the prompt on examples from different domains to verify consistency.

06

Pipeline Integration: Progressive Gating

Risk: Difficulty labels are used as a pass/fail gate without considering that hard examples may legitimately fail more often. Guardrail: Use difficulty ratings to create progressive testing gates—easy examples must pass at 100%, medium at 95%, hard at 80%. Track per-difficulty pass rates separately in your eval harness. If hard-example pass rates drop below threshold, flag for human review rather than blocking the release.

PROMPT PLAYBOOK

Copy-Ready Prompt Template

Paste this template into your prompt library. Replace square-bracket placeholders with your data.

This template assigns a difficulty rating to a single test case from your golden dataset. It evaluates the example across three axes—ambiguity, required reasoning depth, and historical failure rate—and produces a stratified label (e.g., EASY, MEDIUM, HARD, EXPERT) plus a confidence score. Use it to build weighted evaluation suites where harder examples carry more signal, or to implement progressive testing gates that only promote a prompt after it passes increasingly difficult tiers.

text
You are a test suite calibration assistant. Your job is to rate the difficulty of a single test case from a golden dataset used to evaluate an AI system.

## INPUT
Test Case:
[TEST_CASE_INPUT]

Expected Output:
[EXPECTED_OUTPUT]

Domain Context:
[DOMAIN_CONTEXT]

Historical Failure Rate (if known):
[HISTORICAL_FAILURE_RATE]

## RATING CRITERIA
Rate the test case on three dimensions, each from 1 (lowest) to 5 (highest):

1. **Ambiguity**: How underspecified or open to interpretation is the input? A score of 1 means the input is precise and leaves little room for multiple valid answers. A score of 5 means the input is highly ambiguous and requires the model to make reasonable assumptions.

2. **Reasoning Depth**: How many inferential steps, domain knowledge applications, or logical operations are required to produce the expected output? A score of 1 means the answer is extractive or requires a single step. A score of 5 means the answer requires multi-step reasoning, synthesis across sources, or complex constraint satisfaction.

3. **Historical Failure Rate**: How often have previous prompt versions or models failed on this example? A score of 1 means the example is rarely failed. A score of 5 means the example is a known failure trigger. If no historical data is available, use [HISTORICAL_FAILURE_RATE] or state that you are estimating.

## OUTPUT SCHEMA
Return a single JSON object with this exact structure:
{
  "test_case_id": "[TEST_CASE_ID]",
  "difficulty_label": "EASY" | "MEDIUM" | "HARD" | "EXPERT",
  "confidence": 0.0-1.0,
  "dimension_scores": {
    "ambiguity": 1-5,
    "reasoning_depth": 1-5,
    "historical_failure_rate": 1-5
  },
  "rationale": "One-sentence explanation of the overall rating.",
  "failure_modes_expected": ["List of 1-3 likely failure modes for this example, or empty array if none are obvious."]
}

## DIFFICULTY LABEL RULES
- EASY: Average dimension score < 2.0
- MEDIUM: Average dimension score >= 2.0 and < 3.0
- HARD: Average dimension score >= 3.0 and < 4.0
- EXPERT: Average dimension score >= 4.0

## CONSTRAINTS
- Do not invent failure modes. Only list modes that are plausible given the input and expected output.
- If historical failure rate is unknown, set the score to 3 (neutral) and note this in the rationale.
- Confidence must reflect how certain you are about the label, not the model's likely performance.
- Return only the JSON object. No markdown fences, no commentary.

After pasting the template, replace every square-bracket placeholder with real data. [TEST_CASE_INPUT] and [EXPECTED_OUTPUT] are mandatory; [DOMAIN_CONTEXT] helps the model calibrate ambiguity and reasoning depth. If you lack historical failure data, set [HISTORICAL_FAILURE_RATE] to "unknown" and the model will default the score to 3. Wire the output into a post-processing step that validates the JSON schema, checks that the difficulty label matches the computed average, and logs any cases where confidence falls below 0.7 for human review. For high-stakes test suites, run this prompt across your entire golden set and stratify results before using them as weighted evaluation gates.

IMPLEMENTATION TABLE

Prompt Variables

Inputs the Test Case Difficulty Rating Prompt needs to produce calibrated difficulty labels. Each variable must be validated before the prompt runs to prevent misclassification and ensure consistent stratification.

PlaceholderPurposeExampleValidation Notes

[TEST_CASE]

The input-output pair or scenario to be rated for difficulty

{"input": "Explain quantum entanglement to a 12-year-old", "expected_output": "Imagine two coins...", "metadata": {"domain": "physics"}}

Must be a valid JSON object with input and expected_output fields. Reject if empty, malformed, or missing required fields. Schema check required.

[DOMAIN]

The knowledge domain or workflow category the test case belongs to

physics | contract_review | medical_coding | code_generation

Must match an entry in the approved domain taxonomy. Reject unknown domains. Enum check against [DOMAIN_TAXONOMY] required.

[HISTORICAL_FAILURE_RATE]

The observed failure rate for this test case or similar cases in prior test runs

0.23 | 0.78 | null

Must be a float between 0.0 and 1.0 or null if no history exists. Null allowed but triggers a confidence downgrade in the rating.

[AMBIGUITY_FLAGS]

Pre-identified ambiguity markers from edge case discovery or human review

["vague_constraints", "multiple_valid_interpretations", "domain_jargon"]

Must be an array of strings from the approved ambiguity taxonomy. Empty array allowed. Reject unknown flag values.

[REQUIRED_REASONING_DEPTH]

The expected number of reasoning steps or chain-of-thought depth needed

3 | 7 | null

Must be a positive integer or null. Values above 10 should trigger a review flag. Null allowed when depth is unknown.

[OUTPUT_CONTRACT_COMPLEXITY]

A measure of how complex the expected output schema is

simple_text | nested_json_with_enums | multi_field_with_citations

Must match an entry in the approved complexity scale. Reject unknown values. Default to simple_text if not provided.

[PRIOR_DIFFICULTY_LABEL]

The previously assigned difficulty label, if this is a re-rating

hard | medium | easy | null

Must be one of the approved label values or null. If present, the new rating should explain any deviation from this label.

PROMPT PLAYBOOK

Implementation Harness Notes

How to wire the difficulty rating prompt into a test suite calibration workflow with validation, retries, and human review gates.

The difficulty rating prompt is not a one-off labeling tool—it is a calibration component inside a larger test suite management pipeline. When you wire it into an application, treat each rating as a structured artifact that must pass validation before it enters the golden dataset. The harness should accept a batch of test cases, call the prompt for each, validate the returned difficulty labels against the expected enum values (easy, medium, hard, extreme), and attach the rating plus the model's rationale to the test case metadata. Do not silently accept ratings that fall outside the enum or omit the required rationale field.

Build the harness with three layers: validation, retry, and review. Validation checks that the output is parseable JSON, that difficulty is one of the allowed enum values, and that rationale is a non-empty string. If validation fails, retry once with the same input plus the validation error message appended as a [CORRECTION_HINT]. If the retry also fails, flag the test case for human review rather than assigning a default difficulty. Log every rating decision with the model version, prompt version, input hash, and validation status so you can trace rating drift when the model or prompt changes. For high-stakes test suites where difficulty ratings gate release decisions, require a human reviewer to spot-check a stratified sample—at least 10% of cases from each difficulty tier—before the ratings are committed to the golden dataset.

Model choice matters here. Use a model with strong reasoning capabilities for difficulty rating, as the task requires judging ambiguity, reasoning depth, and historical failure patterns. Avoid lightweight or speed-optimized models that may produce inconsistent ratings across similar cases. If you are rating hundreds of test cases, batch them in groups of 20–30 and shuffle the order to reduce position bias. Store the ratings alongside the test case in your dataset management system with a schema that includes difficulty, rationale, rater_model, rater_prompt_version, rating_timestamp, and human_reviewed fields. This schema lets you later query for rating consistency, identify cases where human reviewers disagreed with the model, and recalibrate the prompt when rating distributions drift. The next step after wiring this harness is to run a calibration pass: rate a known set of cases, compare against human-assigned difficulty labels, and tune the prompt's [DIFFICULTY_CRITERIA] placeholder until inter-rater agreement reaches your target threshold.

IMPLEMENTATION TABLE

Expected Output Contract

Validate every difficulty rating response against this contract before accepting it into the golden dataset or evaluation harness.

Field or ElementType or FormatRequiredValidation Rule

test_case_id

string

Must match the [INPUT_TEST_CASE_ID] exactly; non-empty and no whitespace-only values

difficulty_rating

string enum

Must be one of: easy, medium, hard, expert; case-sensitive exact match

difficulty_score

number

Integer between 1 and 10 inclusive; must align with difficulty_rating band (easy:1-3, medium:4-6, hard:7-9, expert:10)

ambiguity_level

string enum

Must be one of: none, low, moderate, high; case-sensitive exact match

required_reasoning_depth

string enum

Must be one of: surface, single-hop, multi-hop, domain-expert; case-sensitive exact match

historical_failure_rate

number

Float between 0.0 and 1.0 when present; null allowed if no historical data exists

rationale

string

Non-empty; minimum 20 characters; must reference at least one specific characteristic of the test case input

confidence

number

Float between 0.0 and 1.0; values below 0.7 should trigger human review before acceptance into golden set

PRACTICAL GUARDRAILS

Common Failure Modes

When difficulty ratings drift, your test gates become unreliable. Here's what breaks first and how to prevent it.

01

Difficulty Inflation Over Time

What to watch: Raters unconsciously raise difficulty scores as they become more familiar with the test suite, causing 'hard' to become the new 'medium.' This makes progressive testing gates useless. Guardrail: Anchor ratings with canonical examples for each difficulty tier and periodically re-rate a holdout set to detect drift.

02

Ambiguity Misclassification

What to watch: The model confuses inherent task ambiguity with poor prompt design. A poorly worded prompt that causes failures gets rated as a 'hard' test case instead of being flagged as a prompt bug. Guardrail: Include a separate prompt_quality flag in the rating schema. If a case is rated hard primarily due to unclear instructions, route it to prompt debugging, not the test suite.

03

Historical Failure Rate Contamination

What to watch: Using past failure rates as a difficulty input creates a feedback loop. A case that fails due to a now-fixed bug retains a high difficulty score, permanently skewing the stratification. Guardrail: Recompute difficulty scores after every major prompt version change and weight recent failure data more heavily than historical data.

04

Surface-Level vs. Reasoning-Deep Mismatch

What to watch: The prompt rates a case as 'easy' because it requires simple extraction, but the case actually demands multi-hop reasoning that the model consistently gets wrong. Guardrail: Require the prompt to output separate scores for surface_complexity and reasoning_depth. Flag cases where these scores diverge significantly for human review.

05

Over-Reliance on a Single Model's Judgment

What to watch: Using a single frontier model to rate difficulty bakes that model's specific strengths and weaknesses into your test stratification. Cases hard for GPT-4 might be trivial for Claude, and vice versa. Guardrail: Cross-validate difficulty ratings using at least two model families. Flag cases with high inter-model disagreement for manual calibration.

06

Edge Case Normalization

What to watch: Truly adversarial or bizarre edge cases get rated as 'medium' difficulty because the rater normalizes them against the distribution of other edge cases, not against the full test suite. Guardrail: Always include a set of 'normal' baseline cases in the rating batch. This forces the model to calibrate against typical inputs rather than only comparing edge cases to each other.

IMPLEMENTATION TABLE

Evaluation Rubric

Use this rubric to test the quality of difficulty ratings before shipping them to your regression suite. Each criterion targets a specific failure mode observed in LLM-generated difficulty labels.

CriterionPass StandardFailure SignalTest Method

Label Format Compliance

Output contains exactly one valid label from the allowed set: [EASY], [MEDIUM], [HARD], or [EXPERT]

Missing label, multiple labels, or label outside the allowed enum

Regex match against allowed enum values; assert exactly one match per output

Ambiguity Sensitivity

Test cases with 3+ valid interpretations receive [HARD] or [EXPERT]; cases with 1 clear interpretation receive [EASY] or [MEDIUM]

High-ambiguity case rated [EASY] or low-ambiguity case rated [EXPERT]

Run on 10 pre-labeled ambiguity pairs; assert Spearman correlation >= 0.7 between ambiguity count and difficulty rank

Reasoning Depth Alignment

Multi-hop cases requiring 3+ inference steps receive [HARD] or [EXPERT]; single-step cases receive [EASY] or [MEDIUM]

Multi-hop case rated [EASY] or single-step case rated [EXPERT]

Run on 10 pre-labeled reasoning-depth pairs; assert Spearman correlation >= 0.7 between hop count and difficulty rank

Historical Failure Rate Calibration

Cases with known failure rate > 20% in prior test runs receive [HARD] or [EXPERT]; cases with failure rate < 5% receive [EASY] or [MEDIUM]

High-failure case rated [EASY] or low-failure case rated [EXPERT]

Join output against historical failure rate data; assert monotonic relationship between failure rate and difficulty label

Stratification Balance

No single difficulty label accounts for > 50% of the golden dataset; each label appears at least once

All cases receive the same label, or one label dominates with > 50% share

Count label distribution across full golden set; assert max label share <= 50% and min label count >= 1

Justification Presence

Every rating includes a non-empty [RATIONALE] field with at least one concrete reason referencing the test case content

Missing [RATIONALE] field, empty string, or generic justification with no case-specific detail

Assert [RATIONALE] field exists, length > 20 characters, and contains at least one term from the input test case

Inter-Rater Consistency

Re-running the same test case 3 times produces the same difficulty label in >= 2 of 3 runs

All 3 runs produce different labels, or label flips between [EASY] and [EXPERT] across runs

Run 10 cases 3 times each at temperature=0; assert mode label appears in >= 2 runs for >= 8 of 10 cases

Edge Case Detection

Cases containing known edge-case markers (negation, counterfactuals, nested conditions) receive [HARD] or [EXPERT]

Edge-case-laden input rated [EASY]

Run on 10 pre-labeled edge-case pairs; assert recall >= 0.8 for [HARD]+[EXPERT] on edge-case inputs

ADAPTATION OPTIONS

Adapt This Prompt

How to adapt

Use the base prompt with a frontier model (GPT-4o, Claude 3.5 Sonnet). Remove the [OUTPUT_SCHEMA] constraint and ask for a simple JSON object with difficulty and rationale fields. Accept free-text rationales without structured [FACTORS] breakdown.

Watch for

  • Inconsistent difficulty labels across runs ("medium" vs "moderate")
  • Rationales that drift into test case critique instead of difficulty assessment
  • No calibration against your actual historical failure rates
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.