Inferensys

Prompt

Golden Set Contamination Check Prompt

A practical prompt playbook for using the Golden Set Contamination Check Prompt in production AI workflows to verify eval integrity.
Developer doing prompt engineering on laptop, prompt variations visible on screen, casual coding session.
PROMPT PLAYBOOK

When to Use This Prompt

Use this prompt to rule out golden set contamination as the root cause before investing time in deeper eval failure diagnosis.

This prompt is designed for QA engineers and AI reliability engineers who observe an unexpected degradation in automated evaluation scores across a batch of production responses. Before diving into trace-level root-cause analysis, you need to eliminate the possibility that the evaluation itself is compromised. Contamination occurs when golden answers, eval rubrics, or expected outputs inadvertently leak into the system prompt, few-shot examples, or model training data, causing the model to memorize rather than reason. A contaminated golden set produces misleadingly high scores during development and sudden, unexplained drops when the model encounters genuinely novel inputs in production. This playbook produces a structured contamination risk report that systematically checks each potential leak vector.

You should use this prompt when you have access to the complete golden set entries, the active system prompt, any few-shot examples used in the evaluation pipeline, and the full eval rubric definitions. The prompt works by comparing linguistic patterns, key phrases, and structural similarities between the golden set and the model's instruction context. It flags cases where a golden answer appears to have been memorized rather than constructed, where rubric criteria are suspiciously echoed in the model's reasoning, or where few-shot examples overlap with evaluation cases. The output is a risk score per contamination vector and a prioritized list of golden set entries that warrant manual review. This is a diagnostic tool, not a replacement for human judgment—high-risk flags should be escalated for human verification before any golden set entries are modified or removed.

Do not use this prompt when you lack access to the full system prompt or golden set definitions, as partial data will produce unreliable risk assessments. It is also inappropriate for diagnosing individual response failures—use the Eval Failure Root-Cause Triage Prompt for single-trace investigation. If contamination is confirmed, you must quarantine the affected golden set entries, regenerate them from source material without referencing the model's instruction context, and re-run your evaluation baseline before proceeding with any prompt or model changes. Never modify golden set entries based solely on this prompt's output without human review, as false positives can silently erode your evaluation integrity over time.

PRACTICAL GUARDRAILS

Use Case Fit

Where the Golden Set Contamination Check Prompt works and where it introduces risk. Use this prompt for systematic contamination audits, not for debugging individual model outputs or live production issues.

01

Good Fit: Pre-Release QA Gates

Use when: you are about to run a regression test suite and need to verify the integrity of your golden set before trusting eval results. Guardrail: Run this check as a gating step in your CI pipeline. Block the release if contamination is detected.

02

Good Fit: After Training Data Updates

Use when: a new model version, fine-tuning run, or RAG corpus update has occurred. Guardrail: Re-run the contamination check against the updated data sources. Compare contamination scores before and after the change to isolate newly introduced leaks.

03

Bad Fit: Live Production Debugging

Avoid when: you are investigating a single production failure in real time. Contamination checks are batch-oriented and require access to the full golden set and training data. Guardrail: Use the Eval Failure Root-Cause Triage Prompt for individual incident response instead.

04

Bad Fit: No Access to Training Data

Risk: The prompt requires comparing golden answers against the actual training data, system prompts, or few-shot examples. If you cannot access these artifacts, the check produces unreliable results. Guardrail: Require explicit data access confirmation before running. If access is denied, flag the eval results as unverified for contamination.

05

Required Inputs

What you must provide: the complete golden set (questions and expected answers), the current system prompt, all few-shot examples, and a manifest of training data sources. Guardrail: Validate input completeness with a pre-flight check. Missing any of these inputs should abort the contamination check and return an INPUT_INCOMPLETE status.

06

Operational Risk: False Confidence

Risk: A clean contamination report can create false confidence if the check only scanned surface-level string matches and missed semantic leaks or paraphrased contamination. Guardrail: Always pair this prompt with semantic similarity thresholds, not just exact-match detection. Document the similarity method and threshold in the report so downstream consumers understand the detection limits.

PROMPT PLAYBOOK

Copy-Ready Prompt Template

A copy-ready prompt for checking whether golden-set answers or eval rubrics have leaked into training data, system prompts, or few-shot examples.

This prompt template is designed to be pasted directly into your orchestration layer or evaluation pipeline. It instructs the model to act as a contamination auditor, comparing a suspect golden-set item against all prompt surfaces that could have inadvertently exposed the answer. The goal is to produce a structured contamination risk report, not to re-evaluate the model's output quality. Before using this prompt, ensure you have isolated the specific golden answer or rubric item that is under suspicion, along with the full prompt context that was active when the eval was run.

text
You are a contamination auditor for AI evaluation datasets. Your task is to determine whether a specific golden-set answer or evaluation rubric item has leaked into the model's prompt context, creating a contamination risk that invalidates the evaluation.

## INPUTS
- Golden-Set Item: [GOLDEN_ITEM]
- Item Type: [ITEM_TYPE] (options: 'golden_answer', 'rubric_criterion', 'few_shot_example')
- Active System Prompt: [SYSTEM_PROMPT]
- Few-Shot Examples Used: [FEW_SHOT_EXAMPLES]
- Evaluation Rubric: [EVAL_RUBRIC]
- User Input That Triggered the Eval: [USER_INPUT]
- Model Output Under Evaluation: [MODEL_OUTPUT]

## INSTRUCTIONS
1. Compare the Golden-Set Item against every other input field.
2. Identify exact string matches, near-duplicate paraphrases, and semantic equivalents.
3. For each match found, classify the contamination vector:
   - `direct_leak`: The golden answer or a near-verbatim version appears in the system prompt, few-shot examples, or rubric.
   - `indirect_leak`: The golden answer's structure, key entities, or reasoning chain is strongly hinted at by the prompt context.
   - `rubric_circularity`: The evaluation rubric describes the golden answer so precisely that it effectively provides the answer.
   - `no_contamination`: No meaningful overlap detected.
4. Assess the contamination severity: `critical` (eval is invalid), `high` (likely invalid), `moderate` (requires review), `low` (minor overlap, unlikely to affect results), `none`.
5. Provide a confidence score from 0.0 to 1.0 for each finding.

## OUTPUT FORMAT
Return a valid JSON object with this exact schema:
{
  "contamination_detected": boolean,
  "overall_severity": "critical" | "high" | "moderate" | "low" | "none",
  "findings": [
    {
      "contamination_vector": "direct_leak" | "indirect_leak" | "rubric_circularity" | "no_contamination",
      "source_field": "system_prompt" | "few_shot_examples" | "eval_rubric" | "user_input",
      "matched_text_excerpt": "string excerpt showing the overlap",
      "golden_item_excerpt": "string excerpt from the golden item",
      "severity": "critical" | "high" | "moderate" | "low" | "none",
      "confidence": 0.0-1.0,
      "explanation": "Brief explanation of why this is or is not contamination"
    }
  ],
  "recommendation": "string with actionable next steps"
}

## CONSTRAINTS
- Do not evaluate the quality of the model output. Only assess contamination risk.
- If the golden item is a rubric criterion, check whether the system prompt or few-shot examples effectively teach the model to satisfy that criterion by rote rather than by capability.
- Flag near-duplicate paraphrases, not just exact string matches.
- If no contamination is found, set `contamination_detected` to false and `overall_severity` to `none`.

To adapt this template, replace each square-bracket placeholder with your actual data. The [GOLDEN_ITEM] should contain the exact text of the suspect golden answer, rubric criterion, or few-shot example. The [SYSTEM_PROMPT], [FEW_SHOT_EXAMPLES], and [EVAL_RUBRIC] fields should contain the full prompt context that was active during the evaluation run. If any field is empty, use an empty string or "N/A". After running the prompt, validate the output JSON against the schema before acting on the findings. For high-risk evaluations where contamination would invalidate a release gate, always have a human reviewer confirm the model's contamination assessment before marking the golden set as compromised.

IMPLEMENTATION TABLE

Prompt Variables

Required inputs for the Golden Set Contamination Check Prompt. Each placeholder must be populated before execution to ensure the contamination risk report is accurate and traceable.

PlaceholderPurposeExampleValidation Notes

[GOLDEN_SET_ENTRY]

The specific golden answer or rubric entry being checked for contamination.

{"question": "What is the refund policy?", "golden_answer": "Refunds are processed within 5-7 business days."}

Must be a single complete entry. Validate JSON structure matches the eval harness schema. Null not allowed.

[SYSTEM_PROMPT]

The full system prompt used in production when the eval failure occurred.

You are a helpful customer support assistant. Use only the provided knowledge base to answer questions.

Must be the exact deployed version. Retrieve from prompt registry by version hash. Null not allowed.

[FEW_SHOT_EXAMPLES]

All few-shot examples included in the prompt template during the evaluated request.

[{"user": "How do I reset my password?", "assistant": "You can reset your password by visiting the account settings page."}]

Array of example pairs. May be empty array if no few-shot examples were used. Validate each example has user and assistant keys.

[TRAINING_DATA_SAMPLE]

Representative sample of training data used for the model under evaluation, if accessible.

["Customer: I need a refund. Agent: Refunds are processed within 5-7 business days."]

May be null if training data is not accessible. If provided, must be an array of strings. Check for PII before loading.

[EVAL_RUBRIC]

The evaluation rubric that flagged the failure, including pass/fail criteria.

{"criterion": "factual_accuracy", "pass_standard": "All claims match golden set exactly", "failure_signal": "Any deviation from golden answer"}

Must be the exact rubric version used. Validate JSON structure. Confirm rubric version matches eval run metadata.

[TRACE_ID]

Unique identifier for the production trace where the eval failure was detected.

trace_2025-03-15_14-32-07_abc123

Must be a valid trace ID resolvable in the observability platform. Confirm trace contains retrieval steps, tool calls, and final output. Null not allowed.

[MODEL_IDENTIFIER]

The specific model version used during the evaluated request.

gpt-4o-2024-08-06

Must match the model recorded in the trace metadata. Use provider-qualified identifier. Validate against model registry. Null not allowed.

[CONTAMINATION_THRESHOLD]

Similarity threshold for flagging potential contamination.

0.85

Float between 0.0 and 1.0. Default 0.85 for exact-match detection. Lower to 0.70 for paraphrase detection. Validate as numeric and within range.

PROMPT PLAYBOOK

Implementation Harness Notes

How to wire the Golden Set Contamination Check Prompt into an automated QA pipeline with validation, retries, and human review gates.

This prompt is designed to run as a pre-investigation gate before deep-dive root-cause analysis of an eval failure. It should be triggered automatically when a production response fails against a golden-set answer, but before an engineer spends time diagnosing the model. The harness must feed the prompt three structured inputs: the golden answer, the system prompt used during generation, and the few-shot examples (if any) included in the request. The output is a structured contamination risk report that either clears the golden set for continued use or flags it for human review and potential quarantine.

Integration pattern: Wire this prompt into your eval pipeline as a conditional step. When eval_result == FAIL and eval_type == GOLDEN_SET_COMPARISON, call this prompt with the [GOLDEN_ANSWER], [SYSTEM_PROMPT], and [FEW_SHOT_EXAMPLES] fields populated from your prompt registry and eval configuration. Validation layer: Parse the JSON output and enforce the contamination_risk enum values (LOW, MEDIUM, HIGH, CRITICAL). If the output schema is malformed, retry once with a stricter schema constraint appended to the prompt. Logging: Record the contamination risk level, the flagged overlap segments, and the prompt version used for the check. This trace is essential for audit when a golden set is later found to be contaminated.

Human review gate: If contamination_risk is HIGH or CRITICAL, the harness must quarantine the golden-set entry and create a review ticket for a QA engineer. Do not automatically discard the golden answer—manual verification is required to distinguish genuine contamination from coincidental phrasing. For MEDIUM risk, log the finding but allow the golden set to remain active with a warning flag. Model choice: Use a model with strong instruction-following and JSON output discipline (e.g., GPT-4o, Claude 3.5 Sonnet). Avoid small or fast models for this check because false negatives in contamination detection can silently corrupt your eval benchmarks for weeks. What to avoid: Do not run this check on every successful eval—only on failures. Running it indiscriminately wastes tokens and creates noise. Also, never feed the production model's response into this prompt; it only needs the golden answer, system prompt, and few-shot examples to detect leakage at the source.

IMPLEMENTATION TABLE

Expected Output Contract

Fields, format, and validation rules for the contamination risk report. Use this contract to parse and validate the model output before accepting it into downstream systems or human review queues.

Field or ElementType or FormatRequiredValidation Rule

contamination_verdict

enum: clean | suspect | contaminated

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

risk_score

float (0.0 - 1.0)

Must parse as a float between 0.0 and 1.0 inclusive. Reject if null or out of range.

contaminated_items

array of objects

Must be a JSON array. If empty, contamination_verdict must be clean. Each item must have item_id, item_type, and evidence fields.

item_id

string

Must match the ID format from [GOLDEN_SET_IDS]. Reject unknown IDs.

item_type

enum: golden_answer | eval_rubric | few_shot_example

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

evidence

array of strings

Each string must be a non-empty sentence describing the overlap found. Minimum 1 evidence string per contaminated item.

overlap_type

enum: exact_match | near_duplicate | semantic_overlap | structural_similarity

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

source_location

string

Must identify where the contamination was found using one of: system_prompt, few_shot_examples, training_data_citation, or tool_description. Reject unrecognized locations.

recommended_action

enum: remove_from_golden | quarantine_item | regenerate_variant | escalate_for_review | no_action

Must be one of the five enum values. If contamination_verdict is clean, must be no_action.

confidence

float (0.0 - 1.0)

Must parse as a float between 0.0 and 1.0 inclusive. If below 0.7, escalate_for_review must be included in recommended_action for any suspect or contaminated verdict.

human_review_required

boolean

Must be true if contamination_verdict is suspect or contaminated and confidence is below 0.9. Otherwise may be false.

PRACTICAL GUARDRAILS

Common Failure Modes

What breaks first when checking golden sets for contamination and how to prevent false confidence in your eval pipeline.

01

Memorization Masquerading as Generalization

What to watch: The model scores well on golden-set evals not because it generalizes, but because the golden answers or near-duplicates were in its training data. This produces inflated eval scores that collapse on novel inputs. Guardrail: Run a contamination check before trusting any eval benchmark. Compare golden answers against known training corpora, and flag any exact or near-duplicate matches for exclusion or separate reporting.

02

Leakage Through Few-Shot Examples

What to watch: Golden-set answers inadvertently included as few-shot demonstrations in the system prompt or message history teach the model to regurgitate rather than reason. The model copies patterns from contaminated examples instead of solving the task. Guardrail: Audit all few-shot examples against the golden set before deployment. Use a separate holdout set for demonstrations that has no overlap with eval data.

03

System Prompt Contamination

What to watch: Golden answers or eval rubrics embedded in system instructions as formatting guidance, output examples, or policy rules leak the expected answer structure to the model. The model conforms to the leaked pattern rather than producing genuine output. Guardrail: Scan system prompts for any strings, patterns, or structural hints that match golden-set entries. Treat system prompts as part of the contamination surface, not just training data.

04

Near-Duplicate Blind Spots

What to watch: Exact-match checks miss semantically identical content that differs by paraphrasing, reordering, or synonym substitution. The model still benefits from contamination while the check reports a clean result. Guardrail: Use embedding-based similarity search with a threshold tuned to your domain. Flag pairs above 0.85 cosine similarity for human review, and document the threshold rationale in your contamination report.

05

Cross-Contamination Across Splits

What to watch: Golden answers from the test split appear in the training split of the same dataset, or eval examples leak into fine-tuning data used for a custom model. The contamination is internal to your own pipeline, not external training data. Guardrail: Run deduplication across all splits before using any dataset for eval or training. Maintain a content hash registry that tracks which examples appear where, and version it alongside your prompts.

06

Tool-Output and Retrieval Contamination

What to watch: Golden answers stored in retrieval indices, knowledge bases, or tool response caches are surfaced to the model during eval runs. The model reads the answer from retrieved context rather than generating it, producing a false pass. Guardrail: Audit retrieval sources and tool response corpora for golden-set overlap. Run contamination checks against your vector database and tool schemas, not just prompt text and training data.

IMPLEMENTATION TABLE

Evaluation Rubric

Use this rubric to test the contamination check prompt's output quality before relying on it in production. Each criterion targets a specific failure mode of contamination detection.

CriterionPass StandardFailure SignalTest Method

Contamination Verdict Accuracy

Correctly identifies contaminated items with >95% precision and recall against a labeled test set of 20 known-clean and 20 known-contaminated golden-set items

False positives on clearly original items or false negatives on items with verbatim overlap from training data

Run prompt against a curated golden set with ground-truth contamination labels; compare verdicts to labels

Evidence Citation Completeness

Every contamination verdict includes at least one specific, verifiable citation to the source of contamination (system prompt, few-shot example, or training data snippet)

Verdicts that state contamination risk without pointing to the specific source or location of the leaked content

Parse output for verdict-citation pairs; flag any verdict with null or empty citation field

False Positive Rate on Novel Inputs

Zero contamination flags on 10 novel test items written after the model's training cutoff date and never included in any prompt context

Any contamination risk score above 0.1 for items known to be novel and absent from all prompt layers

Inject 10 post-cutoff test items; verify contamination_score <= 0.1 and verdict is clean or null

System Prompt Leak Detection

Correctly flags golden-set items that appear verbatim in the system prompt with contamination source labeled as system_prompt

Misses verbatim system prompt content or misattributes it to training_data or few_shot_examples

Embed 3 golden-set items verbatim in system prompt; verify all 3 are flagged with source=system_prompt

Few-Shot Example Leak Detection

Correctly flags golden-set items that appear in few-shot examples with contamination source labeled as few_shot_examples

Misses few-shot example overlap or misattributes it to system_prompt or training_data

Include 3 golden-set items as few-shot examples; verify all 3 are flagged with source=few_shot_examples

Training Data Overlap Confidence Calibration

Confidence scores for training data contamination correlate with overlap severity: verbatim overlap >0.9, near-paraphrase 0.5-0.8, no overlap <0.2

High confidence scores for clearly unrelated items or low confidence for verbatim matches

Score 10 items with known overlap levels; verify confidence score ordering matches overlap severity

Output Schema Compliance

Output is valid JSON matching the expected schema with all required fields present and no extra fields

Missing required fields, malformed JSON, or additional unexplained fields in the output

Validate output against JSON Schema; reject any response that fails structural validation

Edge Case: Empty Golden Set Handling

Returns an empty results array with a summary message indicating no items to check, without errors or hallucinated findings

Returns fabricated contamination findings, errors, or non-empty results when input golden set is empty

Submit request with empty golden_set_items array; verify results array is empty and no contamination flags present

ADAPTATION OPTIONS

Adapt This Prompt

How to adapt

Add strict JSON output schema validation, retry logic for malformed outputs, structured logging of each contamination check, and a set of known-clean and known-contaminated test cases for eval gating.

Prompt modification

Add [OUTPUT_SCHEMA] with required fields: contamination_risk, risk_category, evidence_citation, affected_golden_items, recommended_action. Add [CONSTRAINTS] requiring exact field presence and enum values for risk_category.

Watch for

  • Silent format drift in nested JSON fields
  • False negatives when contamination is indirect (paraphrased golden answers)
  • Missing human review step before acting on contamination flags
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.