This prompt is a design tool for AI quality engineers, domain experts, and platform teams who need to define a new evaluation metric for a task where standard metrics like accuracy, BLEU, or generic helpfulness rubrics are insufficient. The job-to-be-done is producing a structured, repeatable scoring specification that captures domain-specific quality signals, handles edge cases explicitly, and can be calibrated against known good and bad outputs. You are not running an evaluation here; you are designing the measurement instrument that an LLM judge or code-based validator will later execute. The ideal user understands the task deeply enough to articulate what 'good' looks like in ways a general-purpose evaluator cannot, and needs to encode that judgment into a reusable artifact that survives team handoff and prompt version changes.
Prompt
Custom Metric Definition Prompt Template

When to Use This Prompt
Defines the job-to-be-done, ideal user, and boundaries for the Custom Metric Definition Prompt Template.
Use this prompt when you face a task where surface-level correctness masks deeper quality dimensions—for example, a customer support reply that is factually accurate but tone-deaf, a code review that catches syntax errors but misses architectural risks, or a summarization that is concise but omits critical safety information. The prompt template forces you to define the scoring function, specify edge-case handling rules, and provide calibration examples that anchor the metric to real outputs. It is particularly valuable when you need to align multiple stakeholders on what 'good' means before building an automated eval harness, or when you are migrating from spot-check human review to a systematic, model-graded evaluation pipeline. The output is a specification document, not a runtime prompt, so you should expect to iterate on it with domain experts before handing it off to an LLM judge prompt or a code-based validator.
Do not use this prompt when a standard metric already captures the quality dimension you care about—if BLEU or ROUGE suffices for your translation task, or if exact-match accuracy works for your classification problem, you do not need a custom metric. Avoid this prompt when you lack access to domain experts who can define edge cases and calibrate examples; the metric will only be as good as the judgment encoded into it. This prompt is also not a substitute for human evaluation in high-risk domains like healthcare or legal review—it produces a specification for an automated judge, but the judge itself must still be validated against human raters and subject to governance controls. Finally, do not use this prompt to define metrics for tasks you cannot provide concrete examples for; without calibration anchors, the resulting metric will drift and produce unreliable scores in production.
Use Case Fit
Where this prompt works and where it does not. Understand the operational boundaries before embedding it in a production eval harness.
Good Fit: Domain-Specific Quality Standards
Use when: You need to define a metric that captures task-specific quality (e.g., 'medical coding accuracy' or 'legal clause completeness') that standard rubrics miss. Guardrail: Always pair the generated metric spec with a calibration run against 20+ human-labeled examples before trusting it in a release gate.
Bad Fit: Simple Binary Correctness
Avoid when: The task has a single correct answer that can be checked with string matching or schema validation. Guardrail: Use a deterministic validator or a simple reference-based eval instead. Adding an LLM judge to a deterministic problem introduces unnecessary latency, cost, and flakiness.
Required Inputs: Task Spec and Labeled Examples
Risk: Without a clear task definition and at least 10–20 examples of good and bad outputs, the generated metric will be vague and uncalibratable. Guardrail: Require a structured task brief and a labeled calibration set as mandatory inputs before running this prompt. Reject incomplete inputs.
Operational Risk: Metric Drift Over Time
Risk: A custom metric defined today may silently become misaligned as the product, data distribution, or user expectations change. Guardrail: Schedule a quarterly metric review that re-runs the calibration examples and checks inter-rater reliability against a fresh human-labeled sample. Flag any metric with a Cohen's kappa drop below 0.7.
Operational Risk: Overfitting to the Calibration Set
Risk: The prompt may produce a scoring function that perfectly matches the provided examples but fails on new edge cases. Guardrail: Reserve 30% of labeled examples as a holdout set. The metric is only approved if it maintains performance on the holdout set. Automate this check in the eval pipeline.
Bad Fit: High-Stakes Autonomous Decisions
Avoid when: The metric's output directly triggers a financial transaction, clinical action, or legal filing without human review. Guardrail: Custom LLM-defined metrics are advisory tools, not autonomous decision-makers. Always route outputs scored near the pass/fail boundary to a human reviewer, and log the metric's justification for audit.
Copy-Ready Prompt Template
A copy-ready prompt template for defining a custom evaluation metric with scoring logic, edge cases, and calibration examples.
This prompt template is designed to help domain experts and AI quality engineers define a structured, repeatable evaluation metric for a specific task. Unlike generic rubrics, a custom metric definition captures the nuanced scoring logic, edge-case handling, and calibration examples that make an eval harness reliable. The output is a complete metric specification that can be handed directly to an LLM judge, used to guide human annotators, or implemented as a programmatic scoring function. Replace every square-bracket placeholder with your task-specific details before use.
textYou are an expert evaluation designer. Your task is to define a precise, repeatable scoring metric for evaluating AI-generated outputs for the following task. ## TASK DESCRIPTION [TASK_DESCRIPTION] ## METRIC NAME [METRIC_NAME] ## WHAT THIS METRIC MEASURES [MEASUREMENT_GOAL] ## SCORING SCALE Define a [SCALE_TYPE] scale from [MIN_SCORE] to [MAX_SCORE]. For each score level, provide: - The score value - A clear, behavioral description of what that score represents - At least one concrete example of an output that would receive that score ## EDGE CASES AND BOUNDARY RULES Describe how to handle the following situations: - [EDGE_CASE_1] - [EDGE_CASE_2] - [EDGE_CASE_3] ## CALIBRATION EXAMPLES Provide [NUMBER] calibration examples. For each example, include: - The input context - The AI-generated output - The correct score - A brief justification referencing the scoring scale ## OUTPUT FORMAT Return a JSON object with the following schema: { "metric_name": "string", "measurement_goal": "string", "scale": { "type": "string (e.g., likert, binary, continuous)", "min": number, "max": number, "levels": [ { "score": number, "label": "string", "description": "string", "example": "string" } ] }, "edge_case_rules": [ { "case": "string", "rule": "string" } ], "calibration_examples": [ { "input_context": "string", "output": "string", "score": number, "justification": "string" } ] } ## CONSTRAINTS [CONSTRAINTS]
After pasting this template, the most critical step is populating the calibration examples. These examples anchor the metric in concrete behavior and are the single most effective defense against judge drift and inter-rater disagreement. Choose examples that sit near score boundaries, not just clear-cut cases. For high-stakes evaluation workflows, run the completed metric definition through a validation step: have two independent LLM judges or human raters score the same calibration examples using your new metric and measure their agreement. If agreement is below your threshold, refine the level descriptions and boundary rules before deploying the metric into your eval harness.
Prompt Variables
Every placeholder the Custom Metric Definition Prompt needs to produce a reliable, executable metric spec. Fill these in before execution and validate each value against the notes below.
| Placeholder | Purpose | Example | Validation Notes |
|---|---|---|---|
[TASK_DESCRIPTION] | Defines the AI task being evaluated so the metric targets the right behavior | Summarize a customer support ticket into a 3-sentence handoff note for the next shift | Must be a single, concrete task. Reject if it describes multiple tasks or contains evaluation criteria mixed with the task definition |
[QUALITY_DIMENSIONS] | Lists the independent axes of quality the metric must score, with weights | Factual accuracy (0.4), Completeness of key details (0.3), Conciseness (0.2), Tone appropriateness (0.1) | Each dimension must have a non-negative weight. Weights must sum to 1.0. Reject if dimensions overlap or are vague |
[GOOD_OUTPUT_EXAMPLE] | Provides a canonical example of a high-quality output for calibration | Customer reports login failure after password reset. Escalated to identity team. No workaround available. Customer is VIP tier. | Must be a realistic example matching the task. Reject if it contains annotations or scoring commentary embedded in the example |
[BAD_OUTPUT_EXAMPLE] | Provides a canonical example of a low-quality output with known failure modes | Customer had a problem. We fixed it. They are happy now. | Must exhibit specific failures the metric should catch. Reject if the example is ambiguous or could reasonably be considered acceptable |
[SCORING_FUNCTION_TYPE] | Specifies the mathematical approach for converting judgments into scores | 5-point Likert scale per dimension, then weighted sum | Must be one of: Likert scale, binary pass/fail, pairwise preference, continuous 0-1 regression, or categorical label. Reject if the function type cannot be implemented programmatically |
[EDGE_CASE_EXAMPLES] | Provides boundary inputs that stress the metric's discrimination ability | Ticket with no actionable information; Ticket in a language the model partially understands; Ticket with conflicting severity signals | Each edge case must isolate a specific scoring ambiguity. Reject if edge cases are trivial or duplicate the good/bad examples |
[CALIBRATION_ANCHORS] | Provides scored examples that fix the meaning of each score level on the scale | Score 5: All key facts present, no hallucinations, appropriate urgency. Score 3: Most facts present, one minor omission, acceptable tone. Score 1: Critical facts missing or fabricated. | Each anchor must include both the score and the behavioral description. Reject if anchors are inconsistent with the good/bad examples or if score gaps are undefined |
[OUTPUT_SCHEMA] | Defines the exact JSON structure the metric definition must produce when executed | { "metric_name": string, "dimensions": [{ "name": string, "weight": number, "score": number, "justification": string }], "aggregate_score": number, "failure_flags": [string] } | Must be a valid JSON Schema or TypeScript interface. Reject if the schema cannot be validated by a standard parser |
Implementation Harness Notes
How to wire the custom metric definition prompt into an eval harness or CI/CD pipeline.
This prompt is not a one-off query; it is a specification generator that must be validated before it becomes part of your evaluation infrastructure. The output is a structured metric definition—scoring function, edge-case rules, calibration examples—that downstream eval runners will execute. Treat the generated spec as code: it needs schema validation, behavioral testing against known outputs, and version control before it gates any release decision.
Wire the prompt into a two-stage pipeline. Stage 1 (Generation): Send the prompt with the domain expert's task description, example good/bad outputs, and any existing rubric fragments. Collect the structured JSON output and validate it against a strict schema that requires at minimum metric_name, scoring_function (with clear logic or pseudocode), edge_cases (an array of scenarios and expected behavior), and calibration_examples (at least three scored pairs with justification). Reject and retry if the schema fails. Stage 2 (Verification): Run the generated metric against a small, held-out golden set of 10–20 output pairs that the domain expert has pre-scored. Compare the metric's scores to the expert's scores. If the correlation is below a threshold (e.g., Spearman's ρ < 0.8), flag for human review. Log the metric spec, the verification results, and the reviewer's decision to an audit trail. Use a model with strong instruction-following and structured output support (e.g., GPT-4o, Claude 3.5 Sonnet) and set temperature=0 for deterministic spec generation.
Do not deploy a generated metric directly to a release gate without this verification loop. The most common failure mode is a metric that looks plausible but mis-scores edge cases the domain expert would catch immediately. If the task is high-risk (e.g., healthcare, finance, legal), require human sign-off on the metric definition before it enters any automated eval pipeline. Store the approved metric spec in a version-controlled registry alongside the prompt version that generated it, so you can trace regressions in the metric itself back to changes in the definition prompt.
Expected Output Contract
Field-level validation rules for the structured metric specification produced by the Custom Metric Definition prompt. Use this contract to parse, validate, and reject malformed outputs before accepting a metric definition into your eval harness.
| Field or Element | Type or Format | Required | Validation Rule |
|---|---|---|---|
metric_name | string (snake_case) | Must match pattern ^[a-z][a-z0-9_]{2,63}[a-z0-9]$. Reject if name collides with an existing metric in the registry. | |
metric_display_name | string (plain text) | Length 5-80 characters. Must not contain only the metric_name repeated. Reject if empty or whitespace-only. | |
scoring_function | enum string | Must be one of: 'binary_pass_fail', 'categorical_label', 'likert_scale', 'continuous_score', 'pairwise_preference'. Reject unknown values. | |
score_range | object with min and max | Must contain numeric 'min' and 'max' keys. min < max. If scoring_function is 'binary_pass_fail', min must be 0 and max must be 1. If 'likert_scale', max-min+1 must be between 3 and 10. | |
rubric_levels | array of objects | Array length must match score_range span. Each object requires 'score' (integer), 'label' (string), and 'description' (string). Scores must be contiguous and cover the full range without gaps. | |
calibration_examples | array of objects | Minimum 3 examples required. Each object requires 'input_summary' (string), 'output_summary' (string), 'expected_score' (number within score_range), and 'rationale' (string). Reject if any expected_score falls outside score_range. | |
edge_case_handling | array of objects | Minimum 2 edge cases required. Each object requires 'condition' (string describing the edge case), 'expected_behavior' (string), and 'default_score' (number or null). If default_score is not null, it must fall within score_range. | |
aggregation_method | enum string | If present, must be one of: 'mean', 'median', 'min', 'max', 'weighted_sum', 'custom'. If 'weighted_sum', a 'weights' object mapping sub-metric names to numeric weights is required. If 'custom', a 'custom_aggregation_description' string is required. |
Common Failure Modes
Custom metric definitions fail in predictable ways. These cards identify the most common failure modes when defining task-specific eval metrics and provide concrete guardrails to prevent them before they corrupt your eval harness.
Vague Scoring Anchors
What to watch: The metric spec uses terms like 'good,' 'accurate,' or 'reasonable' without concrete examples. This causes LLM judges to apply inconsistent standards across runs, producing scores that drift or fail inter-rater reliability checks. Guardrail: Require at least two scored anchor examples per score level, with explicit rationale explaining why each example earned that score. Include both borderline and clear-cut cases.
Metric Overlap and Double-Counting
What to watch: Multiple metrics in the same eval harness inadvertently measure the same underlying quality dimension, inflating its weight in composite scores and masking failures in other dimensions. For example, 'clarity' and 'conciseness' often correlate strongly. Guardrail: Run a correlation analysis across metric scores on a calibration dataset. Flag metric pairs with correlation above 0.7 and either merge them or document the deliberate overlap with justification.
Edge-Case Blindness
What to watch: The metric definition handles typical inputs well but produces nonsensical scores on edge cases like empty outputs, truncated responses, non-English text, or adversarial inputs. These edge cases silently corrupt aggregate scores when they appear in production. Guardrail: Include an explicit edge-case handling section in every metric spec. Define expected scores for null outputs, malformed inputs, and boundary conditions. Validate against a curated edge-case dataset before promoting the metric.
Scale Compression
What to watch: Judges using the metric cluster scores in a narrow range (e.g., 3-4 on a 1-5 scale), making it impossible to distinguish quality differences. This often happens when the rubric lacks differentiation at the extremes or when judges default to a 'safe' middle score. Guardrail: Monitor score distributions during calibration. If more than 60% of scores fall in a single bucket, add distinguishing criteria at the compressed levels and provide examples that clearly merit the underused scores.
Position Bias in Pairwise Metrics
What to watch: Custom pairwise comparison metrics systematically favor the first or second option regardless of quality, especially when differences are subtle. This bias invalidates A/B test results and leads to incorrect prompt promotion decisions. Guardrail: Implement swap-test validation: run each comparison twice with reversed positions and flag cases where the preference flips. Require a swap-consistency rate above 90% before trusting the metric for release gates.
Missing Failure Mode Taxonomy
What to watch: The metric spec defines what good looks like but never enumerates specific failure modes to penalize. Judges then miss critical errors because the rubric only rewards positive qualities without explicitly flagging known failure patterns. Guardrail: Include a failure mode taxonomy in every metric definition. List at least three specific failure patterns with examples and required score penalties. Validate that the metric catches these failures on a seeded test set containing known bad outputs.
Evaluation Rubric for the Metric Spec Itself
Use this rubric to validate the quality of a generated metric specification before adding it to your eval library. Each criterion checks a structural or semantic property that prevents the metric from breaking in production.
| Criterion | Pass Standard | Failure Signal | Test Method |
|---|---|---|---|
Scoring Function Completeness | The spec defines a deterministic scoring function with explicit input types, output range, and aggregation logic | The scoring function is missing, references undefined variables, or produces ambiguous output ranges | Parse the spec and attempt to execute the scoring function against a synthetic [INPUT] and [REFERENCE]; confirm a numeric score is returned |
Edge-Case Handling | The spec enumerates at least three edge cases with expected scores and justification for each | Edge cases are absent, trivial, or produce scores that contradict the stated scoring philosophy | Extract edge-case list; verify each case includes input, expected score, and rationale; spot-check one edge case manually |
Calibration Example Coverage | The spec includes at least two calibration pairs: one high-score example and one low-score example with annotated reasoning | Calibration examples are missing, identical, or lack score annotations | Count calibration pairs; verify score annotations are present and directionally correct (high > low) |
Schema Conformance | The output matches the required metric spec schema with all mandatory fields populated | Required fields are missing, null where non-nullable, or contain values of the wrong type | Validate the generated spec against the metric spec JSON schema; flag any missing keys or type mismatches |
Threshold Recommendation | The spec recommends a pass/fail threshold with a brief justification tied to the scoring range | Threshold is absent, outside the scoring range, or contradicts the calibration examples | Extract threshold value; confirm it falls within the scoring range; check that high-score calibration example passes and low-score example fails |
Scoring Function Determinism | The scoring function produces identical output for identical inputs across three invocations | Scores vary across invocations for the same input, indicating reliance on non-deterministic model behavior | Run the scoring function three times against the same [INPUT] and [REFERENCE]; assert all three scores are equal |
Anti-Pattern Avoidance | The spec avoids known metric anti-patterns: length bias, style preference over substance, and ungrounded fluency scoring | The scoring function rewards longer outputs, penalizes valid stylistic variation, or scores fluency without content checks | Review the scoring function logic against the anti-pattern checklist; flag any criterion that correlates with output length or surface style |
Confidence Annotation | The spec includes a confidence field or note indicating when the metric is unreliable (e.g., ambiguous inputs, out-of-distribution cases) | No confidence signal exists, or the confidence annotation is always high regardless of input difficulty | Feed a deliberately ambiguous [INPUT] into the metric; verify the confidence annotation drops below the spec's stated reliability threshold |
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
Start with the base prompt and a small set of 3-5 known good and bad examples. Remove strict schema enforcement and let the model output a free-text metric definition first. Use a lightweight LLM judge to compare the generated metric against your examples.
Simplify the [OUTPUT_SCHEMA] to only require metric_name, scoring_function, and calibration_examples. Drop edge-case handling and validation checks until the core definition stabilizes.
Watch for
- Overly broad scoring functions that can't distinguish subtle quality differences
- Metric definitions that work on your 5 examples but fail on the next 10
- Missing failure-mode documentation that will bite you in production

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