This prompt is designed for the data preparation stage, not the runtime inference path. Use it when you have a single, high-quality input-output example that perfectly captures a desired task pattern but need a diverse few-shot set to stabilize model behavior in production. The ideal user is an ML engineer or prompt designer who understands the target task deeply enough to validate generated variations and who faces a scaling problem: manual example creation is too slow, too expensive, or too narrow to cover the range of inputs the system will encounter in production. You should have a clear output schema, a defined task boundary, and a way to programmatically or manually review the generated examples before they ship in a prompt.
Prompt
Few-Shot Example Expansion Prompt from Single Seed

When to Use This Prompt
Identify the right conditions for expanding a single seed example into a diverse few-shot set, and recognize when this approach will fail.
This prompt works best when the seed example is structurally representative of the task but limited in surface diversity—same entities, same register, same complexity level. The expansion prompt generates variations across entities, style, register, and complexity while preserving the underlying task pattern. It is particularly effective for bootstrapping few-shot prompts for classification, extraction, structured output generation, and tool-use demonstrations where example diversity directly reduces brittle behavior. You can also use it to build evaluation suites that require coverage across difficulty levels and input types, or to generate training data for fine-tuning when you need to scale from a small set of validated examples. The prompt includes diversity metric checks and token budget awareness, so you can control how many examples you generate and how different they are from the seed.
Do not use this prompt when the seed example itself is ambiguous, incorrect, or unrepresentative of the task—garbage in, garbage out applies with full force here. Do not use it for tasks where the model must learn entirely new reasoning patterns from scratch; this prompt varies surface features, not deep task structure. Do not use it in the runtime inference path; this is an offline data preparation tool. Avoid relying on generated examples without human review or automated validation, especially in high-risk domains like healthcare, finance, or legal applications where incorrect examples can teach the model dangerous behaviors. If your task requires domain-specific terminology, regulatory constraints, or safety boundaries, pair this prompt with domain-expert review and consider using the sibling prompts for counterexample generation, edge-case sampling, and fairness attribute swapping to ensure the expanded set doesn't introduce new failure modes.
Use Case Fit
Where the Few-Shot Example Expansion Prompt delivers value and where it introduces risk. Use these cards to decide if this prompt fits your workflow before you invest in integration.
Good Fit: Seed Data Is Scarce
Use when: You have fewer than 10 high-quality input-output pairs and need to scale to 50+ diverse examples for training or evaluation. Why it works: The prompt is designed to extract the underlying pattern from a single seed and vary surface features without corrupting intent.
Bad Fit: Unstable or Undefined Output Schema
Avoid when: The seed example lacks a clear, consistent output structure or the target schema is still evolving. Risk: The model will amplify ambiguity rather than resolve it, producing variations that drift further from any usable contract. Stabilize your schema first.
Required Input: A Validated Seed Pair
Requirement: One input-output pair that has been manually reviewed for correctness, style, and schema compliance. Guardrail: Run the seed through your production validator before using it for expansion. A single malformed seed produces an entire batch of malformed examples.
Operational Risk: Semantic Drift at Scale
What to watch: As the prompt varies entities, register, and complexity, the core intent can silently shift—especially beyond 20 variations from a single seed. Guardrail: Run a semantic similarity check between each generated output and the seed output. Flag pairs below a 0.85 threshold for human review.
Operational Risk: Token Budget Overrun
What to watch: Generating 50+ variations in a single call can exceed context windows or produce truncated outputs. Guardrail: Batch generation into groups of 10-15 examples per call. Track token usage per batch and set a hard stop at 80% of the model's context limit.
Not a Replacement for Real Data Collection
Avoid when: You need examples that reflect genuine user behavior, production edge cases, or real-world distribution. Risk: Synthetic expansion from a single seed cannot invent truly novel failure modes. Use this prompt for bootstrapping and augmentation, not as a substitute for production sampling.
Copy-Ready Prompt Template
A reusable prompt that generates a diverse set of few-shot examples from a single seed input-output pair, with placeholders for your specific constraints.
This prompt template takes a single seed example—one input and its corresponding ideal output—and instructs the model to generate a set of variations. The goal is to produce a diverse few-shot example set that covers different entities, styles, registers, and complexity levels. This is useful when you have a clear pattern but limited initial data, and you need to quickly bootstrap a training or evaluation set for a prompt-driven system.
textYou are an expert example-generation assistant. Your task is to expand a single seed example into a diverse set of few-shot examples for training or evaluating an AI system. ## SEED EXAMPLE Input: [SEED_INPUT] Output: [SEED_OUTPUT] ## GENERATION INSTRUCTIONS Generate exactly [NUM_EXAMPLES] new examples. Each example must consist of an "input" and an "output" that follow the same underlying pattern and task structure as the seed example. Apply the following variation strategies, distributing them across the generated set: 1. **Entity Substitution:** Replace named entities (people, organizations, locations, dates, products) with different but realistic alternatives of the same type. 2. **Register Shift:** Vary the formality and style. Create versions in casual, professional, and technical registers. 3. **Complexity Scaling:** Create simpler versions (shorter, more direct) and more complex versions (longer, with more constraints or nuanced requirements). 4. **Lexical Variation:** Use synonyms and different phrasing while preserving the exact intent. ## CONSTRAINTS - Preserve the core task and output structure of the seed example exactly. - Do not introduce new tasks or change the fundamental relationship between input and output. - Ensure all generated outputs are factually consistent with their inputs. - If the seed output follows a specific format (JSON, XML, list, etc.), all generated outputs must conform to that same format. - Avoid generating examples that are trivial, nonsensical, or violate common sense. - [ADDITIONAL_CONSTRAINTS] ## OUTPUT FORMAT Return a single JSON object with a key "examples" containing an array of objects, each with "input" and "output" fields. ## DIVERSITY CHECK Before finalizing, review the generated set and ensure: - At least [MIN_ENTITY_VARIATIONS] distinct entities have been introduced. - At least [MIN_REGISTER_VARIATIONS] distinct registers are represented. - The examples span a range of complexity from simple to challenging.
To adapt this template, replace the square-bracket placeholders with your specific values. [SEED_INPUT] and [SEED_OUTPUT] are your single starting example. [NUM_EXAMPLES] controls the size of the generated set; start with 5-10 for initial testing. [ADDITIONAL_CONSTRAINTS] is where you can inject domain-specific rules, such as 'All dates must be in ISO 8601 format' or 'Do not use any real patient data.' The diversity check parameters ([MIN_ENTITY_VARIATIONS], [MIN_REGISTER_VARIATIONS]) let you enforce minimum coverage requirements. After generating the set, always run a validation step to confirm that every output conforms to your expected schema and that no examples have drifted from the original task intent.
Prompt Variables
Required and optional inputs for the Few-Shot Example Expansion Prompt. Each placeholder must be populated before the prompt can generate reliable, diverse variations from a single seed example.
| Placeholder | Purpose | Example | Validation Notes |
|---|---|---|---|
[SEED_INPUT] | The original user query or input text to vary | What is the return policy for international orders? | Must be non-empty string. Check length < 2000 chars to avoid token budget overrun before expansion begins. |
[SEED_OUTPUT] | The expected model response for the seed input | International orders can be returned within 30 days. The customer is responsible for return shipping and any customs fees. | Must be non-empty string. Validate that it pairs logically with [SEED_INPUT]. Null or mismatched pairs cause the model to learn incorrect patterns. |
[TASK_DESCRIPTION] | A one-sentence description of what the prompt is teaching the model to do | Answer customer questions about e-commerce return policies accurately and concisely. | Must be a single sentence under 200 chars. Overly broad descriptions produce unfocused variations. Overly narrow descriptions limit diversity. |
[VARIATION_AXES] | Comma-separated list of dimensions to vary across generated examples | entity, style, complexity, length, locale | Must contain 2-5 axes from allowed set: entity, style, complexity, length, locale, register, ambiguity. Unknown axes cause the model to invent uncontrolled variation. |
[OUTPUT_COUNT] | Number of few-shot examples to generate | 7 | Must be integer between 3 and 20. Values above 20 risk token budget overflow. Values below 3 produce insufficient diversity for reliable few-shot learning. |
[TOKEN_BUDGET] | Maximum total tokens allowed for the generated example set | 3000 | Must be integer. Validate that [OUTPUT_COUNT] * estimated tokens per example does not exceed budget. Budget overruns cause truncation and broken examples. |
[OUTPUT_SCHEMA] | Expected structure for each generated example | {"input": "string", "output": "string", "variation_notes": ["string"]} | Must be valid JSON schema string. Parse check before prompt assembly. Schema mismatch between seed and generated examples causes downstream integration failures. |
[DIVERSITY_CONSTRAINTS] | Rules preventing the model from generating near-duplicate examples | No two examples may share the same entity type. Vary sentence length by at least 30% across the set. | Must be 1-3 concrete, testable rules. Vague constraints like 'be diverse' produce clustered outputs. Test with cosine similarity check on generated inputs post-generation. |
Implementation Harness Notes
How to wire the few-shot example expansion prompt into a production data pipeline with validation, retries, and quality gates.
The Few-Shot Example Expansion Prompt is not a one-off playground utility; it is a data generation step that should be integrated into a repeatable pipeline. The prompt takes a single seed input-output pair and produces multiple diverse variants, which means the harness must manage input validation, output parsing, token budget enforcement, and downstream quality checks before any generated example enters a training or evaluation dataset. Treat this prompt as a batch processor: you will typically call it many times across different seeds, and each call must be independently verifiable.
The implementation harness should wrap the LLM call with pre-flight and post-flight checks. Before calling the model, validate that the seed example matches the expected schema—if the seed is malformed, expansion will amplify the error. After receiving the model response, parse the output into a structured list of examples and run each through a validator that checks for schema compliance, semantic drift from the original intent, and diversity metrics such as entity variation and syntactic distance. A common failure mode is the model producing near-duplicate variants; implement a deduplication step using embedding cosine similarity or token-level Jaccard distance with a threshold of 0.85 or higher. For high-stakes datasets, route a sample of generated examples to human review before they are committed to the example store.
Model choice matters here. Use a model with strong instruction-following and structured output capabilities, such as GPT-4o, Claude 3.5 Sonnet, or Gemini 1.5 Pro. Set temperature between 0.7 and 0.9 to encourage variation, but pin top_p to 0.95 to avoid degenerate outputs. Implement a retry loop with exponential backoff: if the output fails schema validation or produces fewer than the requested number of valid variants, retry up to three times with a modified prompt that includes the validation error as feedback. Log every call—seed input, generated variants, validation results, retry count, and token usage—so that drift in generation quality can be traced over time. Finally, never let generated examples flow directly into a production prompt without passing through a regression test suite that compares model behavior on the original seed versus the expanded set.
Expected Output Contract
Validate the structure and content of each generated example against this contract before accepting it into the expanded few-shot set.
| Field or Element | Type or Format | Required | Validation Rule |
|---|---|---|---|
generated_examples | Array of objects | Array length must be >= [VARIATION_COUNT]. Each element must be a valid object. | |
generated_examples[].input | String | Must differ from the seed [SEED_INPUT] by at least one entity, style, or complexity dimension. Cannot be an exact copy. | |
generated_examples[].output | String or Object (per [OUTPUT_SCHEMA]) | Must conform to [OUTPUT_SCHEMA]. If the seed output is JSON, validate with schema check. If text, check for structural parity with seed output. | |
generated_examples[].variation_type | Enum: [ENTITY_SUBSTITUTION, PARAPHRASE, STYLE_SHIFT, COMPLEXITY_INCREASE, COMPLEXITY_DECREASE, NEGATIVE_EXAMPLE] | Must be one of the allowed enum values. Distribution across types should match [VARIATION_DISTRIBUTION] if specified. | |
generated_examples[].rationale | String | If present, must not exceed 200 characters. Must not contain PII or copy verbatim from the seed input. | |
diversity_report | Object | Must contain a 'unique_entity_count' integer and a 'style_variance' score between 0.0 and 1.0. Used to gate acceptance. | |
token_usage | Object | Must contain 'total_tokens' integer. If 'total_tokens' exceeds [MAX_TOKEN_BUDGET], the set must be truncated, prioritizing diversity over count. | |
validation_warnings | Array of strings | If present, each string must describe a recoverable issue (e.g., 'Low style variance detected'). Must not include fatal errors; fatal errors should reject the entire set. |
Common Failure Modes
When expanding examples from a single seed, these failures surface first in production. Each card identifies a specific breakage pattern and the guardrail that catches it before it reaches users.
Semantic Drift in Paraphrased Variants
What to watch: The model changes the core intent or factual payload while paraphrasing. A support-ticket example about 'refund for damaged item' becomes 'refund for wrong item,' breaking downstream classification training. Guardrail: Run a semantic similarity check (cosine similarity > 0.92) between the seed output and each generated variant's output. Flag any variant below threshold for human review before inclusion in the example set.
Entity Leakage Across Variation Boundaries
What to watch: Entity substitution replaces a name, date, or value with one that violates domain constraints—like swapping 'acetaminophen' for 'ibuprofen' in a contraindication example without updating the associated warning. Guardrail: Define entity-type schemas with allowed value ranges or lookup tables. Validate every substituted entity against its type constraints programmatically before accepting the generated variant.
Schema Non-Compliance in Structured Outputs
What to watch: The model drops required fields, adds hallucinated keys, or changes enum values when varying a JSON example. A single malformed training example poisons fine-tuning data. Guardrail: Validate every generated variant against the target JSON Schema or Pydantic model. Reject variants that fail validation and feed the specific error back into a repair prompt rather than silently including them.
Difficulty Collapse in Scaled Variants
What to watch: When asked to generate 'harder' examples, the model adds irrelevant complexity—longer text, more clauses—without increasing the actual reasoning depth required. The difficulty ladder becomes a length ladder. Guardrail: Define difficulty by measurable dimensions (reasoning steps, constraint count, ambiguity level) and verify each variant's step count or constraint count against the target difficulty tier. Discard variants that only add word count.
Over-Refusal from Negative Example Contamination
What to watch: Counterexample generation creates refusal examples that are too broad, teaching the model to refuse legitimate requests near the boundary. A refusal example for 'delete all records' causes the model to also refuse 'delete my last entry.' Guardrail: Test every generated negative example against a held-out set of legitimate boundary requests. If a negative example causes false refusals on more than 5% of the boundary set, narrow its scope or add a clarifying positive counter-example.
Token Budget Overrun from Unbounded Expansion
What to watch: A single seed expands into 20 variants, each with verbose reasoning chains, blowing past the context window or cost budget when assembled into a few-shot prompt. Guardrail: Set a hard token cap for the total example set before generation. Use a token counter in the generation loop and stop adding variants when the budget is exhausted. Prioritize variants by coverage gain per token.
Evaluation Rubric
Use this rubric to evaluate the quality of expanded few-shot examples before adding them to a production prompt. Each criterion targets a specific failure mode in example generation workflows.
| Criterion | Pass Standard | Failure Signal | Test Method |
|---|---|---|---|
Intent Preservation | Expanded example preserves the original seed's task intent, output structure, and success condition | Output type changed (e.g., classification became generation) or task goal shifted | Compare output schema and task label between seed and variant; flag if task family differs |
Entity Consistency | Substituted entities match the original entity type and do not introduce impossible combinations | Person name in date field, negative quantity, or entity type mismatch | Validate entity slots against a type map; run regex checks for format violations per slot |
Schema Compliance | Variant output conforms to the target JSON schema, XML structure, or typed format | Missing required fields, extra fields, wrong types, or malformed nesting | Parse output with schema validator; reject on any validation error |
Diversity Coverage | Variant differs from seed in at least one dimension: entity, style, register, complexity, or domain | Exact duplicate or near-identical output with only whitespace changes | Compute token-level edit distance; flag if similarity exceeds 0.95 threshold |
Difficulty Calibration | Difficulty label matches actual complexity: reasoning steps, constraint count, or ambiguity level | Labeled 'hard' but requires zero reasoning steps; labeled 'easy' but has nested constraints | Count reasoning steps or constraint clauses; verify label aligns with predefined complexity bands |
Boundary Safety | Edge-case variants include null inputs, max lengths, or conflicting constraints without breaking output contract | Variant causes malformed output, empty response, or hallucinated fields under boundary conditions | Run variant through model with strict output parser; flag if parse fails or required fields are null |
Token Budget Fit | Variant fits within allocated example token budget without truncation | Example exceeds budget, forcing truncation that cuts off output section or closing tags | Tokenize variant; reject if token count exceeds budget by more than 5% |
No Hallucinated Content | Variant contains only information derivable from seed structure or explicit substitution rules | Fabricated citations, invented statistics, or unsupported factual claims appear in output | Diff variant against seed; flag any factual assertion not present in seed or substitution map |
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 frontier model (GPT-4o, Claude 3.5 Sonnet). Remove the diversity metric checks and token budget constraints. Focus on getting 5-10 varied examples quickly. Replace [DIVERSITY_METRICS] with a simple instruction: "Vary the entities, tone, and sentence length."
Watch for
- Output collapsing into near-duplicates after 3-4 examples
- Model ignoring the seed structure and inventing new formats
- No validation that generated examples are actually different from the seed

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