Inferensys

Prompt

Flaky Evaluation Detection Prompt Template

A practical prompt playbook for using the Flaky Evaluation Detection Prompt Template in production AI workflows to debug unstable evaluation pipelines.
Elegant overhead shot of a polished wooden communal table in a sun-drenched WeWork lounge, laptops and tablets displaying AI workflow dashboards, plants and pendant lights in background.
PROMPT PLAYBOOK

When to Use This Prompt

Diagnose non-deterministic LLM judges and quantify score variance before trusting any eval gate.

This prompt is for platform engineers and AI quality teams who observe inconsistent scores from their LLM-as-a-judge evaluation harness. When the same prompt and test case produce different scores across multiple runs, the evaluation pipeline itself is flaky. This prompt template ingests raw eval run logs, identifies non-deterministic judges, quantifies score variance patterns, and generates root-cause hypotheses. Use it before you trust any eval gate to block a bad release or before you waste hours manually diffing eval traces.

The ideal user has access to eval run logs containing at least three repeated measurements per test case, with timestamps, judge identifiers, and raw scores. Required context includes the eval rubric used, the model serving as judge, and any sampling parameters (temperature, top_p) applied during evaluation. This prompt is strictly for debugging the measurement instrument—the judge itself—not the prompt-under-test. Do not use it when you have fewer than three runs per case, when the judge is deterministic by design (temperature=0 with fixed seed), or when you are trying to improve the prompt being evaluated rather than the evaluation harness.

Before running this prompt, ensure your eval logs are structured with consistent fields: test_case_id, run_id, judge_model, judge_temperature, raw_score, timestamp, and any per-axis breakdowns. The prompt expects variance to be measurable—if your judge always returns identical scores, you have a different problem (likely a calibration or rubric issue, not flakiness). After receiving the flakiness report, prioritize judges with coefficient of variation above 0.15 or those showing bimodal score distributions, as these are the most likely to cause false-positive or false-negative release gate decisions.

PRACTICAL GUARDRAILS

Use Case Fit

Where the Flaky Evaluation Detection Prompt Template delivers value and where it introduces risk. Use these cards to decide if this prompt fits your current pipeline maturity and operational context.

01

Good Fit: Mature Eval Harness Debugging

Use when: you already have a running eval harness with multiple judges, metrics, or rubric axes producing scores over time. Why: the prompt needs historical score variance to detect flakiness patterns. Guardrail: feed at least 10 eval runs across 3+ prompt variants to surface non-deterministic judges reliably.

02

Bad Fit: Single-Run or Ad-Hoc Evaluation

Avoid when: you have only one eval run or are evaluating a single output manually. Why: flakiness detection requires repeated measurements to distinguish noise from signal. Guardrail: run the same eval at least 5 times with identical inputs before invoking this prompt. Without repetition, the report will be speculative.

03

Required Inputs: Score History and Judge Identity

What you must provide: per-judge score distributions across runs, judge model identifiers, temperature settings, and any rubric text. Why: the prompt cannot diagnose non-determinism without knowing which judge produced which scores under what conditions. Guardrail: include judge metadata (model, temperature, seed behavior) in every eval log so this prompt has complete context.

04

Operational Risk: Overfitting to Flakiness Reports

Risk: teams may disable or replace judges flagged as flaky without verifying root cause. Guardrail: treat the flakiness report as a hypothesis, not a verdict. Require a human to review flagged judges against a golden set before removing them from the harness. A judge that varies on borderline cases may still be correct on clear passes and failures.

05

Operational Risk: Masking Real Regressions

Risk: high eval variance can hide genuine prompt regressions. If score swings are wide, a real quality drop may look like noise. Guardrail: pair flakiness detection with statistical significance checks. When variance is high, increase sample size or tighten thresholds before concluding no regression exists.

06

Bad Fit: Single-Judge Harness Without Baselines

Avoid when: your eval harness uses only one judge with no baseline or reference scores. Why: without multiple judges or a calibrated reference, you cannot distinguish judge instability from genuine output variation. Guardrail: deploy at least two independent judges or a reference-based metric before running flakiness detection. Single-judge setups need calibration first.

PROMPT PLAYBOOK

Copy-Ready Prompt Template

A copy-ready prompt for diagnosing non-deterministic evaluation behavior across multiple runs.

This prompt template is designed to be pasted directly into your debugging workspace. It instructs the model to act as an evaluation forensics analyst, comparing multiple eval run outputs for the same input to identify flaky judges, score variance patterns, and root-cause hypotheses. Replace every square-bracket placeholder with data from your actual eval pipeline before running.

text
You are an evaluation forensics analyst. Your task is to analyze multiple evaluation runs for the same input and determine whether the evaluation pipeline is flaky (non-deterministic).

## INPUT DATA
- Original User Input: [USER_INPUT]
- Model Output Under Evaluation: [MODEL_OUTPUT]
- Eval Run Results (JSON array of run objects): [EVAL_RUNS]
  Each run object contains:
  - run_id: string
  - judge_model: string (e.g., "gpt-4o", "claude-3.5-sonnet")
  - score: number or string
  - justification: string
  - timestamp: ISO 8601 string

## EVALUATION CONTEXT
- Metric Being Evaluated: [METRIC_NAME]
- Expected Score Range: [MIN_SCORE] to [MAX_SCORE]
- Pass Threshold: [PASS_THRESHOLD]
- Number of Runs Provided: [RUN_COUNT]

## OUTPUT SCHEMA
Return a JSON object with the following structure:
{
  "flakiness_detected": boolean,
  "flakiness_severity": "none" | "low" | "medium" | "high" | "critical",
  "score_variance": {
    "min_score": number,
    "max_score": number,
    "mean_score": number,
    "std_dev": number,
    "range": number
  },
  "pass_fail_disagreement": boolean,
  "disagreement_count": number,
  "judge_consistency": {
    "same_judge_variance": number | null,
    "cross_judge_variance": number | null,
    "notes": string
  },
  "root_cause_hypotheses": [
    {
      "hypothesis": string,
      "confidence": "low" | "medium" | "high",
      "evidence": string,
      "recommended_test": string
    }
  ],
  "repeatability_test": {
    "description": string,
    "expected_stable_output": string,
    "rerun_count_recommendation": number
  },
  "mitigation_recommendations": [string],
  "requires_human_review": boolean
}

## CONSTRAINTS
- Do not hallucinate run data. Only analyze the provided [EVAL_RUNS].
- If fewer than 3 runs are provided, set flakiness_severity to "low" and note insufficient data.
- Flag requires_human_review as true if flakiness_severity is "high" or "critical".
- For cross-judge variance, only compute if multiple judge_model values are present.
- Justifications must be compared semantically, not via exact string match.
- If score_variance cannot be computed (non-numeric scores), explain why in judge_consistency.notes.

## ANALYSIS STEPS
1. Parse all eval runs and extract scores and justifications.
2. Compute score variance statistics.
3. Check for pass/fail disagreements relative to [PASS_THRESHOLD].
4. Compare justifications across runs for semantic drift.
5. Identify whether variance is driven by judge model differences, temperature, ambiguous rubric, or input sensitivity.
6. Generate root-cause hypotheses with testable predictions.
7. Propose a repeatability test that would confirm or rule out flakiness.
8. Recommend concrete mitigations.

Adaptation guidance: Replace [EVAL_RUNS] with a JSON array of your actual eval run records. If your eval pipeline uses non-numeric scores (e.g., categorical labels), the model will note this in the output and skip numeric variance calculations. For high-stakes pipelines where flaky evals could allow regressions into production, always set requires_human_review to true when severity reaches "high" or "critical" and route the output to a human reviewer before accepting mitigation recommendations.

After running this prompt, feed the recommended_test field back into your eval harness to confirm or rule out each hypothesis. Do not treat the model's root-cause analysis as ground truth—it is a structured starting point for your own investigation. Log the full output alongside your eval traces for auditability.

IMPLEMENTATION TABLE

Prompt Variables

Required inputs for the Flaky Evaluation Detection Prompt Template. Each variable must be populated before the prompt can produce a reliable flakiness report. Missing or malformed inputs are the most common cause of false negatives in flakiness detection.

PlaceholderPurposeExampleValidation Notes

[EVAL_RUN_LOG]

Raw evaluation run records containing judge outputs, scores, timestamps, and run identifiers across multiple executions

run_id: r7a2, judge: gpt-4o, score: 0.82, timestamp: 2025-03-15T14:22:01Z, input_id: inp_441

Must contain at least 3 runs of the same eval on the same input set. Validate that run_id, input_id, and score fields are present and non-null. Reject if fewer than 10 scored items per run.

[JUDGE_IDENTIFIER]

Unique identifier for the LLM judge or evaluation method being audited for flakiness

judge: coherence-rubric-v2

Must match a known judge in the eval registry. Validate against allowed judge list. Reject empty or generic values like 'the judge'.

[INPUT_SET_METADATA]

Description of the input set used across eval runs, including size, source, and any stratification labels

size: 200, source: production-sampled-2025-03, strata: [easy, medium, hard]

Must include input count and source identifier. Validate that input count is >= 20. Warn if no stratification labels are provided, as this limits root-cause analysis.

[SCORE_SCHEMA]

Definition of the scoring range, direction, and meaning for the eval metric under audit

range: 0.0-1.0, direction: higher-is-better, type: continuous

Must specify range, direction, and type (continuous, discrete, binary). Validate that all scores in EVAL_RUN_LOG fall within the declared range. Reject if >5% of scores are out of bounds.

[REPEATABILITY_THRESHOLD]

Maximum acceptable score variance between runs for the same input before flagging as flaky

max_std_dev: 0.15, max_range: 0.30

Must be a positive float. Validate against domain expectations: coherence rubrics typically tolerate 0.10-0.20 std dev; safety rubrics should use <=0.05. Reject if threshold is wider than half the score range.

[CONFIDENCE_LEVEL]

Statistical confidence level for flakiness classification and significance tests

0.95

Must be between 0.80 and 0.99. Validate as float. Default to 0.95 if not specified. Warn if below 0.90, as false-positive flakiness flags increase.

[OUTPUT_FORMAT]

Desired structure for the flakiness report: summary, per-input, or full trace

full-trace

Must be one of: summary, per-input, full-trace. Validate against allowed enum. Default to full-trace for debugging; use summary for pipeline gating.

PROMPT PLAYBOOK

Implementation Harness Notes

How to wire the flaky evaluation detection prompt into a production eval pipeline with validation, retries, and actionable logging.

This prompt is designed to be called programmatically as part of an automated eval health check, not as a one-off manual investigation. The harness should feed the prompt a structured payload containing eval run logs, score distributions, and judge identifiers, then parse the resulting flakiness report into a machine-readable format for downstream alerting and dashboards. The primary integration point is a scheduled CI/CD job or a monitoring cron that triggers whenever eval score variance exceeds a predefined threshold, such as a coefficient of variation above 0.15 across the last N runs on a static golden dataset.

Implement the call with a strict retry and validation wrapper. First, validate the output against a JSON schema that requires the flaky_judges array, variance_patterns object, and root_cause_hypotheses array to be present and non-null. If schema validation fails, retry once with a higher temperature (e.g., 0.4) and an explicit instruction appended to the prompt: 'The previous output failed schema validation. Ensure the response is valid JSON matching the required structure.' If the second attempt also fails, log the raw output and raise a non-blocking alert for manual review. For model choice, use a model with strong instruction-following and JSON mode support, such as gpt-4o or claude-3.5-sonnet, and set response_format to json_object where the API supports it. Log the full prompt, response, parse status, and any detected flaky judges to your observability platform (e.g., LangSmith, Datadog, or custom logging) with the eval run ID as the trace identifier.

Do not treat this prompt's output as the final word on whether an eval is production-ready. The flakiness report is a diagnostic signal, not an automated gate. Use the mitigation_recommendations field to generate tickets or runbook items, but require a human to approve changes to judge prompts, thresholds, or model versions. The highest-risk failure mode is a false negative where the prompt reports low flakiness but a judge is silently drifting. Mitigate this by pairing this detection prompt with a periodic inter-rater reliability check against a held-out human-labeled calibration set, and by tracking the stability of the flakiness report itself over time—if the report's conclusions oscillate wildly between runs, the detection harness itself may need recalibration.

IMPLEMENTATION TABLE

Expected Output Contract

Fields, types, and validation rules for the flakiness report generated by the Flaky Evaluation Detection Prompt Template. Use this contract to parse, validate, and gate the output before it enters downstream dashboards or CI/CD pipelines.

Field or ElementType or FormatRequiredValidation Rule

report_id

string (UUID v4)

Must match UUID v4 regex. Generate if missing.

eval_pipeline_id

string

Must match [PIPELINE_ID] input exactly. Fail on mismatch.

analysis_window

object

Must contain start_time and end_time in ISO 8601. start_time must be before end_time.

total_eval_runs

integer

Must be >= 1. Parse check: integer only, no floats.

flaky_judges

array of objects

Each object must have judge_id (string), flakiness_score (float 0.0-1.0), variance_pattern (enum: high_variance, bimodal, drift, intermittent), and evidence_runs (array of run_ids). Array must not be empty if overall_flakiness_detected is true.

overall_flakiness_detected

boolean

Must be true or false. If true, flaky_judges array must contain at least one entry with flakiness_score > [FLAKINESS_THRESHOLD].

root_cause_hypotheses

array of strings

Each string must be <= 500 characters. Array must contain 1-5 entries. Null entries not allowed.

mitigation_recommendations

array of objects

Each object must have recommendation (string <= 1000 chars), priority (enum: critical, high, medium, low), and expected_impact (enum: high, medium, low). Array must contain 1-5 entries.

repeatability_test_results

object

If present, must contain rerun_count (integer >= 3), score_stability (float 0.0-1.0), and consistent_pass_fail (boolean). Null allowed if repeatability test not run.

PRACTICAL GUARDRAILS

Common Failure Modes

Flaky evaluations undermine regression testing. These cards identify the most common failure modes in LLM-based eval harnesses and provide concrete guardrails to stabilize your measurement infrastructure.

01

Non-Deterministic Judge Output

What to watch: The same input-output pair receives different scores across multiple runs, often due to temperature settings or inherent model variability. Guardrail: Pin temperature to 0, run each evaluation at least 3 times, and flag any rubric item with a score variance above 0.5 for manual review or judge replacement.

02

Position Bias in Pairwise Comparisons

What to watch: The judge consistently favors the first or second candidate regardless of quality, inflating or deflating scores for specific prompt variants. Guardrail: Implement swap-test validation by running every pairwise comparison twice with reversed order. Flag any judge that disagrees with itself on more than 10% of swaps.

03

Length Bias in Scoring

What to watch: Longer outputs receive systematically higher scores on completeness or thoroughness rubrics, even when the extra content is irrelevant or repetitive. Guardrail: Add a conciseness axis to your rubric that penalizes verbosity, and normalize scores by output length in post-processing before computing final aggregates.

04

Rubric Ambiguity Drift

What to watch: Evaluators interpret vague rubric terms like 'good quality' or 'sufficient detail' inconsistently over time, causing score drift even when output quality is stable. Guardrail: Anchor every rubric level with 2-3 concrete examples of what qualifies. Re-calibrate judges weekly against a holdout set of scored examples and track inter-rater agreement trends.

05

Hallucinated Justifications

What to watch: The judge fabricates evidence or misquotes the output when explaining its score, making the evaluation appear rigorous while masking real failures. Guardrail: Require the judge to quote the exact text segment supporting each score. Run a secondary verification prompt that checks whether the quoted text actually exists in the original output.

06

Silent Refusal or Truncation

What to watch: The judge model hits a content filter, context limit, or safety refusal mid-evaluation and returns an incomplete or default score without signaling an error. Guardrail: Validate that every expected rubric axis is present in the output and that scores fall within the defined range. Set a maximum token limit well above expected response length and monitor for truncated JSON.

IMPLEMENTATION TABLE

Evaluation Rubric

Criteria for detecting flaky evaluations in your eval harness. Use this rubric to test whether your LLM judges produce stable, repeatable scores before shipping prompt changes.

CriterionPass StandardFailure SignalTest Method

Score Repeatability

Same input + same judge produces identical score across 5 independent runs

Score variance exceeds 0.5 on a 1-5 scale or 10% on a 0-100 scale across runs

Run [EVAL_PROMPT] 5 times on [GOLDEN_INPUT]; compute standard deviation of scores

Order Invariance

Score for output A vs B is consistent regardless of which appears first in pairwise comparison

Position swap causes score difference > 0.3 or flips pass/fail outcome

Run pairwise judge on [OUTPUT_A] and [OUTPUT_B] in both orders; check for swap-test consistency

Temperature Sensitivity

Score remains within ±0.2 when model temperature varies from 0 to 0.3

Score shifts by more than 0.3 or pass/fail boundary flips at different temperatures

Run [EVAL_PROMPT] at temperature 0, 0.1, 0.2, 0.3; track score drift

Rubric Interpretation Stability

Judge applies same rubric anchor to same output across 3 paraphrased versions of the rubric

Score changes by more than 0.4 when rubric wording is paraphrased without semantic change

Rewrite [RUBRIC_TEXT] 3 ways preserving meaning; score [GOLDEN_OUTPUT] with each

Edge Case Consistency

Judge assigns consistent scores to borderline outputs near pass/fail threshold

Same borderline output flips between pass and fail across runs

Select [BORDERLINE_OUTPUTS] within 5% of threshold; run 5 times each; count flip rate

Length Bias Resistance

Score does not correlate with output length (Pearson r < 0.3)

Longer outputs systematically receive higher or lower scores

Score [OUTPUT_SET] with varied lengths; compute Pearson correlation between length and score

Confidence Calibration

Judge confidence score correlates with actual correctness (ECE < 0.1)

High-confidence scores on incorrect judgments or low confidence on correct ones

Compare judge [CONFIDENCE_SCORE] against ground-truth correctness on [CALIBRATION_SET]; compute ECE

Cross-Model Stability

Same eval prompt produces scores within ±0.3 across [MODEL_A] and [MODEL_B]

Score difference exceeds 0.3 between models on same input-output pair

Run [EVAL_PROMPT] on both models against [GOLDEN_SET]; compute per-sample score delta

ADAPTATION OPTIONS

Adapt This Prompt

How to adapt

Use the base prompt with a single LLM judge and a small sample of eval runs. Focus on detecting obvious score variance before building full infrastructure. Replace [EVAL_RUNS] with 10-20 repeated evaluations of the same input set. Simplify the output schema to a variance score and a plain-language summary.

Prompt modification

  • Remove multi-judge comparison sections.
  • Replace [JUDGE_MODELS] with a single model name.
  • Set [STATISTICAL_TESTS] to ["basic variance", "range check"].
  • Drop the root-cause hypothesis section; keep only the flakiness score and top-3 unstable inputs.

Watch for

  • Small sample sizes producing false confidence.
  • Judge self-consistency issues masquerading as prompt flakiness.
  • Missing baseline: you need at least one stable eval to compare against.
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.