This prompt is for RAG evaluation engineers who need to build a regression test suite for their query disambiguation pipeline. The job-to-be-done is generating a diverse, labeled set of ambiguous queries paired with their correct resolutions. Without a golden dataset, you cannot measure whether changes to your disambiguation logic—such as a new entity linker or a rewritten system prompt—improve or regress real-world performance. The ideal user is someone who already has a working disambiguation system and needs a structured way to test it against known ambiguity types, including entity collisions, homonyms, temporal vagueness, and underspecified constraints.
Prompt
Golden Dataset Generation Prompt for Disambiguation Testing

When to Use This Prompt
Define the job, reader, and constraints for the Golden Dataset Generation Prompt for Disambiguation Testing.
Use this prompt when you need to create a benchmark that covers multiple ambiguity categories in a single run. It is designed to produce a structured output with input queries, expected resolutions, and ambiguity type labels, making it directly usable in evaluation frameworks like custom test runners or LLM-as-judge pipelines. You should provide a [DOMAIN_CONTEXT] that describes the knowledge base or product surface your RAG system operates over, and a [SAMPLE_QUERIES] list to ground the generation in realistic user language. The prompt works best when you also supply [AMBIGUITY_CATEGORIES] to control the distribution of test cases. Do not use this prompt if you lack a clear domain definition; without it, the generated ambiguities will be generic and fail to stress-test your specific retrieval surface.
This prompt is not a replacement for production traffic sampling. It generates synthetic test cases that complement, but do not substitute for, real user queries captured from logs. After generating the dataset, you must review the outputs for plausibility and alignment with your actual knowledge base. Treat the generated dataset as a starting point for curation, not a final artifact. The next step is to run your disambiguation system against the generated queries, compare outputs to the expected resolutions, and compute per-category accuracy metrics. Avoid the mistake of using this dataset for model training; it is an evaluation artifact, and training on it would invalidate its use as an independent test set.
Use Case Fit
Where the Golden Dataset Generation Prompt for Disambiguation Testing works and where it does not.
Good Fit: Pre-Release Regression Testing
Use when: You are about to ship a new disambiguation prompt or retrieval pipeline and need a structured test suite to catch regressions. Guardrail: Run the generated dataset against your current and candidate prompts, and gate the release on precision/recall thresholds for each ambiguity type.
Good Fit: Ambiguity Coverage Audits
Use when: You need to prove that your disambiguation system handles entity collisions, homonyms, temporal vagueness, and underspecification. Guardrail: Map each generated test case to an ambiguity type label and verify that your eval suite exercises every category with a minimum sample count before signing off.
Bad Fit: Replacing Human-Annotated Benchmarks
Avoid when: You require statistically rigorous, peer-reviewed benchmarks for academic publication or regulatory submission. Guardrail: Treat LLM-generated golden datasets as a fast, scalable supplement to human annotation, not a replacement. Always validate a random sample against expert judgments and report inter-annotator agreement.
Bad Fit: Real-Time Query Disambiguation
Avoid when: You need to resolve ambiguity on live user traffic at inference time. This prompt generates offline test data, not a runtime disambiguation service. Guardrail: Use the sibling prompts for Ambiguous Entity Resolution or Clarifying Question Generation in your production path. Reserve this prompt for your eval and CI pipeline.
Required Inputs: Domain Context and Knowledge Boundaries
Risk: Without a clear description of your knowledge base scope, entity catalog, or common ambiguous terms, the generated dataset will be generic and miss domain-specific collisions. Guardrail: Always provide a [DOMAIN_CONTEXT] block describing your corpus, common entities, known homonyms, and temporal reference points. The quality of the test set depends directly on this context.
Operational Risk: Dataset Drift and Staleness
Risk: As your knowledge base, product scope, or user behavior changes, a static golden dataset becomes less representative of real ambiguity patterns. Guardrail: Schedule periodic regeneration of the dataset using updated domain context and recent production query logs. Version your test sets alongside your prompts and track coverage trends over time.
Copy-Ready Prompt Template
A reusable prompt template for generating a structured golden dataset of ambiguous queries and their correct disambiguations.
This prompt template is the core engine for generating a high-quality evaluation dataset. It instructs the model to act as a disambiguation test designer, producing diverse, realistic examples that cover the specific failure modes you need to test in your retrieval system. The output is a structured JSON array, making it immediately ingestible by your evaluation harness. The template uses square-bracket placeholders for all variable components, allowing you to control the domain, ambiguity types, and output volume without rewriting the core instruction.
textYou are a test designer creating a golden dataset for evaluating a query disambiguation system in a RAG pipeline. Your goal is to generate a diverse set of ambiguous user queries paired with their correct disambiguations. [DOMAIN_CONTEXT] Generate [NUM_EXAMPLES] examples. Each example must represent a distinct, realistic user query that is ambiguous in a way that would cause a retrieval system to return mixed or irrelevant results. For each example, you must output a JSON object with the following keys: - "ambiguous_query": The raw, ambiguous user query as a string. - "correct_disambiguation": A clear, unambiguous rewrite of the query that resolves the ambiguity. - "ambiguity_type": A label from this controlled vocabulary: [AMBIGUITY_TYPES]. - "explanation": A brief, one-sentence explanation of why the original query is ambiguous and how the rewrite resolves it. [CONSTRAINTS] - Ensure the examples cover a uniform distribution across the specified ambiguity types. - Queries must be realistic and could plausibly be asked by a user in the given domain. - The "correct_disambiguation" must be a single, definitive interpretation. Do not create examples that are still ambiguous after rewriting. - Do not include any commentary outside the JSON array. [OUTPUT_SCHEMA] Return your response as a JSON array of objects, strictly following this schema: [ { "ambiguous_query": "string", "correct_disambiguation": "string", "ambiguity_type": "string", "explanation": "string" } ]
To adapt this template, replace the placeholders with concrete values. [DOMAIN_CONTEXT] should be a detailed description of your knowledge base, user base, and typical search tasks (e.g., 'An internal knowledge base for a fintech company containing product specs, compliance docs, and HR policies.'). [AMBIGUITY_TYPES] should be a comma-separated list from your taxonomy, such as 'entity_collision, homonym, temporal_vagueness, underspecification'. [NUM_EXAMPLES] controls the dataset size. For high-risk domains, add a [RISK_LEVEL] constraint that forces the model to avoid generating examples that could lead to harmful disambiguations, and always plan for human review of the generated dataset before it gates a production system.
Prompt Variables
Required inputs for the Golden Dataset Generation Prompt. Each placeholder must be populated before the prompt is sent to the model. Validation notes describe how to verify the input is well-formed before execution.
| Placeholder | Purpose | Example | Validation Notes |
|---|---|---|---|
[DOMAIN_CONTEXT] | Describes the knowledge base, product, or corpus the ambiguous queries should be drawn from. Grounds the generated queries in realistic terminology. | An internal knowledge base for a cloud infrastructure platform covering compute, storage, and networking services. | Must be a non-empty string. Check that domain terms are specific enough to produce realistic entity collisions and homonyms. Vague domains produce generic, untestable queries. |
[AMBIGUITY_TYPES] | List of ambiguity categories the generator must cover. Controls the diversity of the test dataset. | entity_collision, homonym, temporal_vagueness, underspecification, acronym_expansion | Must be a list of 2-6 values drawn from a controlled vocabulary. Validate against allowed types: entity_collision, homonym, temporal_vagueness, underspecification, scope_ambiguity, acronym_expansion. Reject unknown types. |
[SAMPLE_COUNT] | Number of query-disambiguation pairs to generate. Controls dataset size for regression testing. | 50 | Must be an integer between 10 and 500. Values above 500 risk repetition and quality degradation. Validate as integer and enforce range. |
[OUTPUT_SCHEMA] | Describes the exact JSON structure each generated record must follow. Ensures the output is machine-readable for downstream test harnesses. | {"ambiguous_query": "string", "correct_disambiguation": "string", "ambiguity_type": "string", "disambiguation_rationale": "string"} | Must be a valid JSON Schema or example object. Parse the schema string as JSON before prompt assembly. Reject if not valid JSON. Confirm required fields include ambiguous_query, correct_disambiguation, and ambiguity_type. |
[SEED_QUERIES] | Optional set of example ambiguous queries to guide style and difficulty. Improves consistency with existing test cases. | ["What are the costs for storage?", "How do I configure the firewall?"] | If provided, must be a JSON array of strings. Each string should be under 200 characters. Null is allowed. Validate array format and string length. Empty array is acceptable. |
[DIFFICULTY_DISTRIBUTION] | Specifies the target mix of easy, moderate, and hard ambiguity cases. Prevents the generator from producing only trivial examples. | {"easy": 0.2, "moderate": 0.5, "hard": 0.3} | Must be a JSON object with keys easy, moderate, hard. Values must be floats that sum to 1.0 within a 0.01 tolerance. Validate sum and reject if any value is negative. |
[REFERENCE_TIMESTAMP] | Anchors temporal expressions like 'last quarter' or 'recently' to a fixed date. Ensures temporal disambiguations are deterministic and testable. | 2025-10-15T00:00:00Z | Must be an ISO 8601 datetime string. Parse and validate the date is not in the future relative to the knowledge base cutoff. Null is allowed if no temporal ambiguity types are requested. |
Implementation Harness Notes
How to wire the golden dataset generation prompt into a reliable, repeatable evaluation pipeline.
This prompt is designed to be called programmatically as part of an offline evaluation data generation job, not as a one-off chat interaction. The primary integration point is a script or CI step that invokes the LLM, captures the structured output, validates it against the expected schema, and appends the results to a version-controlled golden dataset file. Because the generated dataset will be used to gate retrieval pipeline changes, the harness must enforce schema compliance, deduplication, and human review of a sample before the dataset is accepted into the test suite. Treat the output as a candidate set that requires curation, not a final artifact.
Wire the prompt into a Python or TypeScript script that reads a configuration specifying the number of examples to generate per ambiguity type, the target domain context, and any seed terms to include. The script should call the model with response_format set to the JSON schema defined in the prompt template, using a low-temperature setting (0.1–0.3) to prioritize consistency over diversity within a single generation run. Implement a retry loop with exponential backoff for malformed JSON responses: if the output fails schema validation, re-invoke the model with the validation error message appended as a correction instruction. Log every generation attempt, including the raw response, validation result, and retry count, so you can audit flaky generations later. For model choice, a capable instruction-following model with strong JSON mode support (such as GPT-4o, Claude 3.5 Sonnet, or Gemini 1.5 Pro) is recommended; smaller models often struggle with the nested schema and consistent ambiguity classification.
After generation, run a deduplication pass that compares new examples against existing entries in the golden dataset using semantic similarity on the ambiguous_query field. Flag near-duplicates (cosine similarity above 0.92 on embedding vectors) for manual review rather than silently dropping them, since a superficially similar query may exercise a different disambiguation edge case. Implement a mandatory human review step: sample at least 20% of generated examples, stratified by ambiguity type, and have a domain expert verify that the expected_disambiguation is correct and unambiguous. Reject the entire batch if the error rate in the reviewed sample exceeds 5%, and adjust the prompt or domain context before regenerating. Store the accepted dataset with metadata including generation timestamp, model version, prompt version, and reviewer identity so every test case is traceable to its origin. Finally, integrate the dataset into your CI pipeline as a regression test: on every retrieval change, run the ambiguous queries through the disambiguation system and assert that the output matches the expected disambiguation within an acceptable tolerance, failing the build on regressions.
Expected Output Contract
Field-level contract for each record in the generated golden dataset. Use this to validate output before ingestion into regression test suites.
| Field or Element | Type or Format | Required | Validation Rule |
|---|---|---|---|
[ORIGINAL_QUERY] | string | Must be non-empty. Must contain at least one ambiguity marker (entity collision, homonym, temporal vagueness, or underspecification). | |
[AMBIGUITY_TYPE] | enum string | Must match one of: entity_collision, homonym, temporal_vagueness, underspecification, scope_ambiguity. Reject unknown values. | |
[CORRECT_DISAMBIGUATION] | string | Must be a fully resolved, unambiguous query string. Must differ from [ORIGINAL_QUERY] in at least one token. Must resolve the ambiguity identified in [AMBIGUITY_TYPE]. | |
[INTERPRETATION_NOTES] | string | Must explain which interpretation was chosen and why. Minimum 20 characters. Must reference the specific ambiguous term or constraint resolved. | |
[CANDIDATE_INTERPRETATIONS] | array of strings | Must contain 2-4 plausible alternative interpretations. Each entry must be a valid query string. Must include the correct disambiguation as one entry. Array length validated. | |
[DOMAIN_CONTEXT] | string or null | If provided, must describe the domain setting that makes the ambiguity plausible. Null allowed when ambiguity is domain-agnostic. | |
[DIFFICULTY_LEVEL] | enum string | Must be one of: easy, moderate, hard. Easy: single common ambiguity. Moderate: two interacting ambiguities. Hard: requires external knowledge or temporal reasoning. | |
[SOURCE_GROUNDING] | string or null | If provided, must cite a real knowledge base entry, document title, or entity description that supports the correct disambiguation. Null allowed for synthetic examples. |
Common Failure Modes
Golden dataset generation for disambiguation testing fails in predictable ways. These are the most common failure modes and how to prevent them before they corrupt your evaluation pipeline.
Surface-Only Ambiguity
What to watch: The generator produces queries with obvious homonyms and entity collisions but misses underspecification, scope ambiguity, and temporal vagueness. The resulting dataset tests only shallow disambiguation and inflates accuracy metrics. Guardrail: Require the prompt to sample evenly across a predefined ambiguity taxonomy—entity collision, homonym, underspecification, scope ambiguity, temporal vagueness, and acronym overload—and validate distribution before accepting the output.
Disambiguation Leakage into the Query
What to watch: Generated queries accidentally include disambiguating context such as 'Apple the company' or 'Java the programming language,' making the task trivial and the dataset useless for testing real retrieval pipelines. Guardrail: Add an explicit constraint in the prompt forbidding parenthetical disambiguation, and run a post-generation regex check for common leakage patterns before the dataset is accepted.
Single-Interpretation Bias
What to watch: The generator consistently picks the most common or dominant interpretation as the correct one, ignoring valid minority interpretations. This trains downstream evaluators to penalize systems that surface less popular but legitimate results. Guardrail: Require the prompt to list all plausible interpretations with a dominance flag, and spot-check that at least 20 percent of examples include a non-dominant correct interpretation.
Unrealistic Query Distribution
What to watch: Generated queries look like carefully constructed test cases rather than real user search behavior—no typos, no fragments, no conversational phrasing. A system that scores well on this dataset may still fail on production traffic. Guardrail: Inject real query log samples into the prompt as style references, and include a diversity check for query length, grammatical completeness, and noise level before finalizing the dataset.
Expected Resolution Drift
What to watch: The correct disambiguation in the golden dataset reflects the generator's assumptions rather than the actual knowledge base or retrieval corpus. Evaluations pass but production retrieval returns irrelevant results because the expected resolution doesn't match what the index contains. Guardrail: Validate each expected resolution against the target retrieval corpus or knowledge graph before accepting the example, and flag any expected resolution that returns zero results from the production index.
Label Noise in Ambiguity Type Classification
What to watch: The ambiguity type labels assigned to each example are inconsistent—temporal vagueness mislabeled as underspecification, or entity collisions labeled as homonyms. Downstream routing and analysis break when trained on noisy labels. Guardrail: Include a self-consistency check by generating each example with two independent passes and flagging examples where ambiguity type labels disagree, or run a separate classification verification prompt on the completed dataset.
Evaluation Rubric
Use this rubric to evaluate the quality of a generated golden dataset for disambiguation testing before integrating it into your regression suite. Each criterion targets a specific failure mode in dataset generation.
| Criterion | Pass Standard | Failure Signal | Test Method |
|---|---|---|---|
Ambiguity Type Coverage | Dataset contains at least one example for each required type: entity collision, homonym, temporal vagueness, underspecification. | Missing entire ambiguity category. All examples are of the same type. | Parse output labels. Assert count of unique [AMBIGUITY_TYPE] values equals expected set cardinality. |
Query-Resolution Pair Validity | Each [DISAMBIGUATED_QUERY] is a semantically correct resolution of its corresponding [AMBIGUOUS_QUERY]. | Resolution contradicts the query, introduces new constraints not implied, or resolves the wrong term. | Human spot-check on a random sample of 10 pairs. Automated check: verify [DISAMBIGUATED_QUERY] contains all non-ambiguous tokens from [AMBIGUOUS_QUERY]. |
Schema Compliance | Every record contains all required fields: [AMBIGUOUS_QUERY], [DISAMBIGUATED_QUERY], [AMBIGUITY_TYPE], [CONFIDENCE_SCORE]. | Missing fields. Extra untyped fields. [CONFIDENCE_SCORE] is a string instead of a float. | JSON Schema validation against the expected [OUTPUT_SCHEMA]. Assert no null values in required fields. |
Semantic Diversity | No two [AMBIGUOUS_QUERY] strings are near-duplicates. Queries represent distinct syntactic structures and domains. | High cosine similarity between multiple query embeddings. Repeated sentence templates with only a single word swapped. | Compute pairwise cosine similarity on [AMBIGUOUS_QUERY] embeddings. Flag pairs above 0.95 threshold for manual review. |
Confidence Score Calibration | [CONFIDENCE_SCORE] is a float between 0.0 and 1.0. High scores correspond to unambiguous resolutions; low scores to genuinely difficult cases. | All scores are 1.0. Score is inversely correlated with human-judged difficulty. | Assert all scores are within [0.0, 1.0]. Check distribution: standard deviation must be greater than 0.1. |
Entity Collision Specificity | For [AMBIGUITY_TYPE] = 'entity_collision', the [AMBIGUOUS_QUERY] contains a surface form that maps to at least two distinct real-world entities. | Entity collision example uses a unique proper noun with no known homograph. Resolution picks an implausible entity. | Manual review of entity_collision rows. Automated check: web search the ambiguous term to confirm multiple prominent entities exist. |
Temporal Vagueness Grounding | For [AMBIGUITY_TYPE] = 'temporal_vagueness', the [DISAMBIGUATED_QUERY] replaces a relative term with a concrete date range anchored to a reference timestamp. | Relative term like 'recently' is kept in the disambiguated query. Date range is missing or unanchored. | Regex check: [DISAMBIGUATED_QUERY] must contain an ISO date or explicit range. Assert no relative time words remain. |
Underspecification Severity | For [AMBIGUITY_TYPE] = 'underspecification', the [AMBIGUOUS_QUERY] lacks a constraint that would materially change retrieval results. | Missing constraint is trivial or cosmetic. Resolution adds a constraint the user would not reasonably intend. | Human review: assess whether the added constraint in [DISAMBIGUATED_QUERY] would filter out obviously irrelevant results. |
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Adapt This Prompt
How to adapt
Use the base prompt with a small hand-labeled set of 20-30 ambiguous queries. Focus on generating correct disambiguations without strict schema enforcement. Accept free-text or loosely structured JSON output and manually review each generated pair.
Simplify the prompt by removing [AMBIGUITY_TAXONOMY] and [DOMAIN_CONTEXT] placeholders. Use a single model call per query.
Prompt snippet
codeGenerate a disambiguated version of this query: [QUERY] Output the original query, the disambiguated query, and the ambiguity type.
Watch for
- Overly narrow disambiguations that pick one interpretation when multiple are plausible
- Missing edge cases like temporal vagueness or underspecification
- No systematic coverage across ambiguity types

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.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us