Inferensys

Prompt

Boundary Example Selection Prompt for Ambiguous Inputs

A practical prompt playbook for using Boundary Example Selection Prompt for Ambiguous Inputs in production AI workflows.
Developer doing prompt engineering on laptop, prompt variations visible on screen, casual coding session.
PROMPT PLAYBOOK

When to Use This Prompt

Defines the job-to-be-done, ideal user, and constraints for the Boundary Example Selection Prompt.

This prompt is designed for QA engineers and ML teams who are hardening a production classifier and need to build a high-signal boundary test set. Its job is not to classify inputs, but to select the most ambiguous examples from a candidate pool—those sitting near the decision boundaries between categories where the model is most likely to fail. The ideal user has an existing classifier (or a candidate model) and a pool of unlabeled or partially labeled inputs, and they need to surface the cases that will stress-test the model's limits before release. This is a pre-release evaluation tool, not a runtime classification prompt.

Use this prompt when you have a large volume of candidate inputs and need to prioritize which ones to label and include in a regression test suite. It is particularly valuable when you suspect class overlap, when your production data contains edge cases that don't fit neatly into a single category, or when you need to measure classifier precision near decision boundaries. The prompt requires you to provide the candidate inputs, the target categories, and optionally the model's current confidence scores or predicted labels. It works best when you can supply at least 50–100 candidates per category to give the selection logic enough material to find true boundary cases. Do not use this prompt if you have fewer than 10 candidates per category, if your categories are mutually exclusive with no ambiguity, or if you need a statistically representative sample rather than a boundary-focused adversarial set.

The output is a curated list of ambiguous inputs with boundary annotations, expected behavior labels, and confidence thresholds—not a trained model or a classification result. After running this prompt, you should manually review the selected examples to confirm they genuinely represent decision-boundary cases, then integrate them into your classifier's golden test set. Avoid using this prompt as a substitute for real production traffic sampling; it selects for difficulty, not representativeness. Pair it with a separate coverage-optimized example selection prompt to ensure your test set includes both boundary cases and typical inputs.

PRACTICAL GUARDRAILS

Use Case Fit

This prompt selects examples near decision boundaries to harden classifiers. It works best when you have a working model and need to find where it breaks. It is not a replacement for broad-coverage test sets or production monitoring.

01

Good Fit: Pre-Release Classifier Hardening

Use when: you have a trained or prompted classifier and need to find ambiguous inputs before shipping. Guardrail: Run this prompt against a holdout set, not your training data, to avoid overfitting your boundary examples to known cases.

02

Bad Fit: Replacing Broad Test Coverage

Avoid when: you have no existing test set or need to measure overall accuracy. Risk: Boundary examples alone won't catch systematic failures in common cases. Guardrail: Combine boundary test sets with stratified random samples that represent production traffic.

03

Required Input: Labeled Candidate Pool

What to watch: The prompt needs a pool of inputs with known labels to identify boundary cases. Guardrail: If your candidate pool has labeling errors, boundary examples will amplify those errors. Validate labels before running boundary selection.

04

Operational Risk: Confidence Threshold Drift

What to watch: Boundary examples selected at one confidence threshold may not transfer when you change the model's decision threshold in production. Guardrail: Re-run boundary selection whenever you adjust confidence cutoffs or upgrade the underlying model.

05

Operational Risk: Token Budget Overrun

What to watch: Boundary example selection can produce too many examples for your context window, especially with multi-class problems. Guardrail: Set a hard token budget before running the prompt and use salience ranking to trim the boundary set to the most informative cases.

06

Bad Fit: Real-Time Production Selection

Avoid when: you need to select boundary examples dynamically at inference time. Risk: This prompt is designed for offline curation, not low-latency production use. Guardrail: Pre-compute boundary sets during your evaluation cycle and version them alongside your prompt.

PROMPT PLAYBOOK

Copy-Ready Prompt Template

A reusable prompt that selects boundary examples from a candidate pool to harden classifiers against ambiguous inputs near decision boundaries.

This prompt template is designed to be wired into a script that iterates over a candidate pool of inputs and selects those most likely to cause classification errors. It forces the model to identify examples near decision boundaries—where small changes in phrasing, context, or features flip the predicted label. The output is a curated boundary test set with expected behavior labels and confidence thresholds, ready for integration into a regression testing harness or QA pipeline. Use this when you have an existing classifier (rule-based, ML, or LLM-driven) and need to surface its brittleness before production deployment.

text
You are a QA engineer hardening a production classifier. Your task is to select boundary examples from a candidate pool that will expose classification weaknesses near decision boundaries.

## INPUT
Candidate pool of inputs with current model predictions and confidence scores:
[CANDIDATE_POOL]

## CLASSIFIER CONTEXT
- Task description: [CLASSIFIER_TASK]
- Target categories: [CATEGORIES]
- Current model type: [MODEL_TYPE]
- Known failure patterns: [KNOWN_FAILURES]

## SELECTION CRITERIA
1. Select inputs where the model's confidence score falls between [CONFIDENCE_LOWER_BOUND] and [CONFIDENCE_UPPER_BOUND].
2. Prioritize inputs where small perturbations (word substitution, negation, reordering) would flip the predicted label.
3. Include at least one example per category pair boundary (e.g., Category A vs Category B, Category B vs Category C).
4. Ensure coverage of [EDGE_CASE_TYPES] including null inputs, maximum-length inputs, and inputs with conflicting signals.
5. Exclude inputs that are trivially classified with confidence above [HIGH_CONFIDENCE_THRESHOLD] unless they represent a known blind spot.

## OUTPUT FORMAT
Return a JSON object with the following structure:
{
  "boundary_examples": [
    {
      "input": "<selected input text>",
      "current_prediction": "<current model label>",
      "current_confidence": <float 0-1>,
      "expected_behavior": "<correct label or 'ambiguous'>",
      "boundary_pair": ["<category_a>", "<category_b>"],
      "failure_rationale": "<why this input is near a decision boundary>",
      "perturbation_sensitivity": "<how small changes affect classification>"
    }
  ],
  "coverage_summary": {
    "total_selected": <int>,
    "category_pairs_covered": <int>,
    "edge_case_types_covered": ["<type1>", "<type2>"]
  },
  "selection_notes": "<any observations about gaps or biases in the candidate pool>"
}

## CONSTRAINTS
- Select no more than [MAX_EXAMPLES] examples.
- If the candidate pool lacks sufficient boundary examples, flag this in selection_notes rather than forcing low-quality selections.
- For regulated or high-risk domains, mark any example where the correct label is genuinely ambiguous as requiring human review.
- Do not fabricate inputs; only select from the provided candidate pool.

To adapt this template, replace each square-bracket placeholder with concrete values from your classification system. The [CANDIDATE_POOL] should contain at least 50–100 inputs with model predictions and confidence scores to give the selection algorithm enough material. Set [CONFIDENCE_LOWER_BOUND] and [CONFIDENCE_UPPER_BOUND] to bracket the uncertainty zone—typically 0.3 to 0.7 for binary classifiers, adjusted based on your model's calibration curve. Wire this prompt into a test harness that logs selections, runs them against your classifier, and compares actual behavior to expected behavior. For high-risk domains such as healthcare triage or financial fraud detection, route any example marked as genuinely ambiguous to a human reviewer before accepting it as a test case. Validate the output JSON against the schema before storing it in your test suite to prevent downstream parsing failures.

IMPLEMENTATION TABLE

Prompt Variables

Inputs required for the Boundary Example Selection Prompt to reliably identify and select examples near decision boundaries where the model is most likely to fail. Each variable must be validated before prompt assembly to prevent selection bias and coverage gaps.

PlaceholderPurposeExampleValidation Notes

[CANDIDATE_EXAMPLES]

Pool of labeled examples from which boundary cases will be selected

[{"text": "Refund for damaged item requested after 31 days", "label": "escalate", "confidence": 0.72}, {"text": "Customer asking for subscription downgrade with partial refund", "label": "process", "confidence": 0.68}]

Must be valid JSON array with text, label, and confidence fields. Minimum 20 examples across at least 2 classes. Reject if any confidence field is missing or outside 0.0-1.0 range.

[TARGET_CLASSES]

The classification categories the model must distinguish between

["auto_resolve", "escalate", "needs_clarification"]

Must contain 2-5 distinct string labels. Reject if only one class provided or if class names contain special characters that could confuse parsing. Validate against [CANDIDATE_EXAMPLES] labels for coverage.

[CONFIDENCE_THRESHOLD]

The confidence range that defines the boundary zone where examples are most ambiguous

{"min": 0.45, "max": 0.75}

Must be a JSON object with numeric min and max fields. Min must be less than max. Both values must be between 0.0 and 1.0. Reject if threshold range captures fewer than 3 examples or more than 80% of the candidate pool.

[MAX_OUTPUT_COUNT]

Maximum number of boundary examples to return, constrained by token budget

15

Must be a positive integer between 3 and 50. Validate that selected count does not exceed available boundary candidates. Reject if set to 0 or exceeds token budget estimate for the target model.

[OUTPUT_SCHEMA]

Expected structure for each selected boundary example in the response

{"fields": ["text", "true_label", "predicted_label", "confidence", "boundary_rationale"]}

Must be a valid JSON schema definition. Each field must have a type declaration. Reject if schema omits required fields for downstream evaluation. Validate that schema is compatible with evaluation harness expectations.

[DIVERSITY_CONSTRAINTS]

Rules for ensuring selected examples span different failure modes and input patterns

{"min_classes": 2, "max_per_class": 8, "require_balanced": true, "min_length_variation": true}

Must be a JSON object with at least min_classes specified. If require_balanced is true, validate that output respects per-class limits. Reject if constraints are mathematically impossible given available boundary candidates.

[EXCLUSION_RULES]

Criteria for filtering out examples that should not appear in the boundary set

["exclude_if_contains_pii", "exclude_if_duplicate_text", "exclude_if_confidence_below_0.3"]

Must be a JSON array of string rule identifiers. Each rule must be implementable as a boolean check. Validate that exclusion rules do not eliminate all candidates. Reject if rules reference undefined fields or operations.

[EVAL_CRITERIA]

Metrics and checks used to validate the quality of the selected boundary set

{"min_boundary_precision": 0.6, "require_class_coverage": true, "max_duplicate_ratio": 0.1}

Must be a JSON object with numeric thresholds where applicable. Validate that criteria are measurable from the output. Reject if criteria conflict with diversity constraints or if thresholds are set to 0.0 or 1.0 without justification.

PROMPT PLAYBOOK

Implementation Harness Notes

How to wire the Boundary Example Selection Prompt into a production QA pipeline with validation, retries, and human review gates.

The Boundary Example Selection Prompt is designed to be called programmatically as part of a classifier hardening workflow, not as a one-off manual prompt. The typical integration pattern is a Python script or microservice that loads a candidate example pool from a database or file, injects it into the prompt template along with the target classifier's description and known failure categories, and then parses the structured output to populate a boundary test set. The prompt expects a JSON output schema, so your harness must validate that the model returned valid JSON, that all required fields are present, and that the selected examples actually exist in the input pool before accepting the result.

Validation and retry logic is critical here because the model may occasionally return malformed JSON, invent example IDs not present in the input, or produce confidence thresholds outside the 0.0-1.0 range. Implement a validation layer that checks: (1) the output is parseable JSON matching the expected schema, (2) every example_id in the output exists in the input pool, (3) confidence_threshold values are floats between 0 and 1, and (4) expected_behavior labels match the classifier's output categories. On validation failure, retry up to two times with the same prompt, appending the specific validation error message to the retry request. If all retries fail, log the failure and route to a human review queue rather than silently accepting a partial or incorrect boundary set.

Model choice and temperature settings matter for this workflow. Use a model with strong JSON-following capabilities (GPT-4o, Claude 3.5 Sonnet, or equivalent) and set temperature to 0 or very low (0.0-0.1) to maximize deterministic example selection. The prompt is performing a curation and analysis task, not creative generation, so higher temperatures introduce unnecessary variance in which examples are selected and how confidence thresholds are assigned. If you're processing large candidate pools that exceed context windows, implement a pre-filtering step that scores examples by predicted ambiguity using a cheaper model before passing the top-N candidates to this prompt for final boundary selection.

Logging and observability should capture the full prompt input, the raw model output, the validated output, and any validation failures. Store these in a versioned evaluation database so you can track how boundary test sets evolve as your classifier changes. Include metadata: the classifier version, the candidate pool source, the model used, the timestamp, and the validation pass/fail status. This audit trail is essential when debugging why a classifier's production accuracy degraded—you can check whether the boundary test set still reflects current decision boundaries or whether the example selection itself introduced blind spots.

Human review gates are recommended before the boundary test set is used to gate a classifier release. Even with validation passing, a QA engineer should spot-check the selected examples to confirm they genuinely represent ambiguous cases near the decision boundary, not obvious misclassifications or trivial examples. The prompt's output includes a selection_rationale field for each example—use this to speed up human review by highlighting why the model believes each example is boundary-relevant. If more than 20% of selected examples are rejected during human review, consider refining the prompt's boundary criteria or increasing the diversity of the candidate pool before re-running the selection.

Integration with CI/CD is the final step. Once the boundary test set is validated and reviewed, store it as a versioned artifact in your test suite. Your classifier evaluation pipeline should run against this boundary set on every pull request that modifies the classifier or its prompt, failing the build if boundary accuracy drops below a defined threshold. This closes the loop: the Boundary Example Selection Prompt produces the test set, and your CI/CD system enforces that the classifier doesn't regress on the cases where it's most likely to fail.

IMPLEMENTATION TABLE

Expected Output Contract

Validate the structure and content of the boundary example set before integrating it into a test harness or evaluation pipeline.

Field or ElementType or FormatRequiredValidation Rule

boundary_examples

Array of objects

Array length must be >= 5 and <= [MAX_EXAMPLES]. Schema check on each item.

boundary_examples[].input

String

Non-empty string. Must not exactly match any training example in [REFERENCE_SET].

boundary_examples[].expected_label

String from [LABEL_SET]

Must be a valid entry in the provided [LABEL_SET] enum. No free text.

boundary_examples[].confidence_threshold

Number (0.0-1.0)

Must be a float between 0.0 and 1.0. A value below [MIN_CONFIDENCE] triggers a review flag.

boundary_examples[].rationale

String

Non-empty string explaining why this input is a boundary case. Must not be a generic placeholder.

boundary_examples[].source_ambiguity

String

Must be one of: 'lexical_overlap', 'insufficient_context', 'conflicting_signals', 'out_of_distribution', 'adversarial'.

metadata.test_set_id

String (UUID v4)

Must match the regex pattern for UUID v4. Used for traceability in regression tests.

metadata.generation_timestamp

String (ISO 8601)

Must parse as a valid ISO 8601 datetime string. Used for drift detection.

PRACTICAL GUARDRAILS

Common Failure Modes

Boundary example selection fails silently. The model picks easy examples, misses the decision edge, or produces a test set that looks valid but never stresses the classifier. These cards cover what breaks first and how to guard against it.

01

Homogeneous Example Collapse

What to watch: The model selects examples clustered in a single region of the input space, ignoring the actual decision boundary. The resulting test set is easy to pass but reveals nothing about production brittleness. Guardrail: Require the prompt to output a diversity justification per example and validate that selected examples span at least two distinct input clusters or difficulty tiers.

02

Boundary Avoidance

What to watch: The model picks clear-cut examples far from the decision boundary instead of the ambiguous inputs you asked for. The test set passes with high confidence but the classifier still fails on real edge cases. Guardrail: Add explicit boundary-seeking instructions with a confidence range target (e.g., 0.4–0.6) and post-process to reject examples where the model's own confidence exceeds that range.

03

Label Leakage in Example Descriptions

What to watch: The prompt accidentally reveals the expected label or behavior in the example description, making the test trivial. The model selects examples that telegraph the answer rather than testing classification skill. Guardrail: Audit the prompt for label-indicative language. Use a separate validation pass that strips labels and checks whether a blinded model can still guess the correct class above chance.

04

Confidence Threshold Miscalibration

What to watch: The prompt asks for boundary examples but doesn't specify what confidence range defines the boundary. The model applies its own internal threshold, which may not match your production risk tolerance. Guardrail: Define explicit confidence bands in the prompt (e.g., "examples where the correct label is uncertain between 0.35 and 0.65"). Validate output confidence scores against a held-out calibration set.

05

Token Budget Starvation

What to watch: The prompt allocates too many tokens to instructions and too few to actual examples, producing a boundary set too small to be statistically useful. Three examples near the boundary won't catch systematic failures. Guardrail: Set a minimum example count in the output schema and enforce it with a post-generation validator. If the count is below threshold, retry with compressed instructions or a higher token allocation.

06

Drift Between Selection and Production

What to watch: The boundary examples are selected against a static dataset that no longer matches production input distributions. The test set tests the wrong boundary. Guardrail: Include a freshness check in the prompt that compares example characteristics against recent production samples. Log the selection date and trigger a refresh when production distribution shift exceeds a defined threshold.

IMPLEMENTATION TABLE

Evaluation Rubric

Criteria for evaluating the quality and safety of a boundary example set before integrating it into a production classification or triage prompt.

CriterionPass StandardFailure SignalTest Method

Boundary Precision

Selected examples are within a defined similarity or confidence threshold of the decision boundary

Examples are trivially easy or are clear-cut cases far from any boundary

Measure cosine similarity to a centroid of known boundary cases; flag if distance exceeds threshold

Label Correctness

All selected examples have a ground-truth label assigned by a subject-matter expert

Disagreement between two human reviewers or between a reviewer and an authoritative source

Inter-annotator agreement check on a random sample of 20% of the set

Ambiguity Representation

At least 30% of examples contain overlapping features from multiple classes

All examples are prototypical instances of a single class with no conflicting signals

Manual review by a prompt engineer to classify each example as prototypical or ambiguous

Confidence Threshold Alignment

Each example is paired with an expected model confidence score below [HIGH_CONFIDENCE_THRESHOLD]

An example is labeled as a boundary case but has an expected confidence above 0.9

Run a baseline model on the set; flag any example where top-token probability exceeds the threshold

False Negative Coverage

The set includes examples that a baseline model misclassifies with high confidence

The baseline model achieves 100% accuracy on the selected set

Execute a baseline evaluation run; require a minimum 10% error rate on the boundary set

Token Budget Compliance

The total token count of all formatted examples is under [MAX_EXAMPLE_TOKENS]

The serialized example block exceeds the allocated token budget

Use the target model's tokenizer to count tokens after applying the prompt template

Noise Resistance

Examples include minor typos, synonyms, or formatting variations if present in production data

All examples are perfectly clean and do not reflect real-world input imperfections

Inject one typo or synonym variant into a copy of the set; confirm the model's label does not flip

Overlap with Training Data

No example is a verbatim copy of a public benchmark or known training sample

An exact string match is found in a canary dataset or public eval set

Perform fuzzy deduplication against [CANARY_DATASET] and flag matches above a similarity threshold

ADAPTATION OPTIONS

Adapt This Prompt

How to adapt

Use the base prompt with a small hand-picked candidate pool (10–20 examples). Replace [INPUT_SET] with a flat list of labeled examples. Remove the confidence threshold field and ask for a simple ranked list instead. Skip the eval harness; manually spot-check boundary selections.

Watch for

  • Over-selection: the model returns all examples as boundary cases
  • Missing expected behavior labels when the prompt is too loose
  • Token waste if the candidate pool is too large for the model's context window
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.