Inferensys

Prompt

Multi-Constraint Instruction Adherence Grading Prompt

A practical prompt playbook for using Multi-Constraint Instruction Adherence Grading Prompt 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

Define the job, reader, and constraints for the Multi-Constraint Instruction Adherence Grading Prompt.

This prompt is designed for evaluation engineers and AI platform teams who need to verify that a model's output satisfies multiple simultaneous constraints—not just one or two. The job-to-be-done is automated, structured grading of a single output against a list of independent requirements, such as word limits, format rules, exclusion lists, tone guidelines, and mandatory inclusions. The ideal user is someone building an evaluation harness into a CI/CD pipeline, a regression test suite, or a pre-release quality gate where partial compliance is still a failure. You need a clear list of constraints, the candidate output to grade, and a defined output schema for the compliance report before using this prompt.

This prompt is not a general-purpose quality scorer. Do not use it when you need a single holistic score without per-constraint traceability, when constraints are vague or subjective without clear pass/fail criteria, or when the output requires human judgment for nuanced trade-offs. It is also not a substitute for schema validators—if you are checking JSON structure, field types, or enum values, use a deterministic parser first and reserve this prompt for semantic and behavioral constraints that require language understanding. The prompt works best when each constraint is stated as a discrete, verifiable condition with an unambiguous expected behavior. For example, 'Output must be under 200 words' is a good constraint; 'Output should be helpful' is not.

Before deploying this prompt in production, define your constraint weighting and conflict resolution strategy. When two constraints contradict each other—such as a word limit and a mandatory inclusion that pushes the output over that limit—the prompt needs explicit precedence rules. The harness described in the implementation section supports weight configuration and conflict detection, but you must decide your organization's policy: does a format violation override a content requirement, or vice versa? Start with a small, curated set of 10–20 test cases where you know the expected per-constraint results, and calibrate the prompt's judgments against human reviewers before scaling to automated pipelines.

PRACTICAL GUARDRAILS

Use Case Fit

Where the Multi-Constraint Instruction Adherence Grading Prompt works, where it fails, and the operational preconditions required before you wire it into an evaluation pipeline.

01

Good Fit: Structured Compliance Gates

Use when: you need a binary pass/fail or partial-credit score across multiple explicit constraints (format, length, exclusion, tone) before an output reaches a downstream parser or user. Guardrail: define each constraint as a machine-readable rule with a clear expected value, not as a vague quality preference.

02

Bad Fit: Subjective Quality Judgments

Avoid when: the primary goal is to rate creativity, persuasiveness, or stylistic elegance without a written rubric. This prompt grades adherence to instructions, not open-ended quality. Guardrail: pair this prompt with a separate pairwise-comparison or rubric-scoring judge for subjective dimensions.

03

Required Inputs

Risk: running the prompt without a complete constraint manifest produces unreliable scores. Guardrail: always supply the original system prompt, the user input, the model output, and a structured list of constraints with expected behavior, weight, and tolerance for each.

04

Operational Risk: Constraint Conflict

Risk: two constraints may contradict each other (e.g., 'be concise' and 'include all details'), forcing the judge to pick a winner without transparency. Guardrail: pre-scan constraints for conflicts using the companion Instruction Conflict Resolution Detection Prompt before grading, and log conflict resolutions in the compliance report.

05

Operational Risk: Judge Drift

Risk: the grading LLM may interpret constraints differently over time or across model versions, causing score instability. Guardrail: pin the judge model version, calibrate against a golden dataset of pre-scored examples, and run inter-rater reliability checks weekly.

06

Not a Replacement for Schema Validation

Risk: teams use this prompt to check JSON structure when deterministic validators are faster and more reliable. Guardrail: run deterministic schema and type checks first. Use this prompt only for semantic constraints that require language understanding, such as tone, exclusion rules, or behavioral policies.

PROMPT PLAYBOOK

Copy-Ready Prompt Template

A reusable prompt template for grading an AI output against multiple simultaneous constraints, producing a structured compliance report with per-constraint pass/fail, partial compliance flags, and a summary judgment.

This prompt template is designed to be dropped into an evaluation harness where a single model output must be checked against several independent constraints at once. Unlike a simple pass/fail check, this prompt instructs the judge model to evaluate each constraint separately, flag partial compliance where a constraint is mostly but not fully met, and then produce a weighted summary judgment. The square-bracket placeholders let you swap in your own constraints, weighting scheme, output schema, and conflict-resolution rules without rewriting the core grading logic.

text
You are an expert evaluation judge. Your task is to grade a single AI-generated [OUTPUT_TYPE] against multiple constraints simultaneously. You must evaluate each constraint independently, detect partial compliance, and produce a structured compliance report.

## INPUT

### Output to Evaluate

[OUTPUT]

code

### Constraints to Check
Evaluate the output against each constraint below. For each constraint, determine whether the output PASSES, FAILS, or is PARTIALLY COMPLIANT. Partial compliance means the output mostly meets the constraint but has a minor deviation that does not fully break it.

[CONSTRAINTS]

### Constraint Weights
Use these weights to calculate the overall compliance score. Weights must sum to 1.0.

[WEIGHTS]

### Conflict Resolution Rules
If two constraints appear to conflict, apply these precedence rules to determine which constraint takes priority:

[CONFLICT_RULES]

## INSTRUCTIONS

1. Evaluate each constraint independently. Do not let one constraint's failure influence another constraint's grade unless a conflict rule explicitly requires it.
2. For each constraint, provide:
   - **Verdict**: PASS, FAIL, or PARTIAL
   - **Confidence**: 0.0 to 1.0
   - **Evidence**: Quote the specific part of the output that supports your verdict.
   - **Explanation**: One to two sentences explaining your reasoning.
3. If you mark a constraint as PARTIAL, explain exactly what was met and what was missed.
4. Calculate the **Weighted Compliance Score** as: sum of (constraint weight × score) where PASS = 1.0, PARTIAL = 0.5, FAIL = 0.0.
5. Produce a **Summary Judgment**: PASS if weighted score >= [PASS_THRESHOLD], FAIL otherwise.
6. If any constraint marked FAIL is a [CRITICAL_CONSTRAINT], the Summary Judgment must be FAIL regardless of the weighted score.
7. Flag any constraints that appear to conflict with each other and explain how you resolved the conflict.

## OUTPUT SCHEMA

Return ONLY valid JSON matching this schema:

[OUTPUT_SCHEMA]

## EXAMPLES

[EXAMPLES]

Adaptation guidance: Replace [CONSTRAINTS] with a numbered list of constraints, each with a unique ID, a clear description, and a critical boolean flag. Replace [WEIGHTS] with a mapping of constraint IDs to numeric weights. Replace [CONFLICT_RULES] with explicit precedence statements such as "Constraint A overrides Constraint B when both apply." Replace [OUTPUT_SCHEMA] with your target JSON schema, typically including constraint_results (array of per-constraint objects), weighted_score (float), summary_judgment (string), and conflict_notes (array). Replace [EXAMPLES] with at least two worked examples showing a clear PASS case and a case with partial compliance or conflict. Set [PASS_THRESHOLD] to a value between 0.7 and 0.9 depending on your tolerance for partial compliance. List any constraint IDs that are dealbreakers in [CRITICAL_CONSTRAINT]. For high-stakes domains such as healthcare or finance, add a [RISK_LEVEL] placeholder that gates whether the summary judgment requires human review before acceptance.

IMPLEMENTATION TABLE

Prompt Variables

Required inputs for the Multi-Constraint Instruction Adherence Grading Prompt. Each variable must be supplied at runtime for reliable evaluation output.

PlaceholderPurposeExampleValidation Notes

[OUTPUT_TO_EVALUATE]

The generated text or structured output being graded for constraint compliance

The quick brown fox jumps over the lazy dog. It was a sunny day.

Must be non-empty string. Truncate if exceeding model context window minus prompt overhead. Null not allowed.

[CONSTRAINT_LIST]

Array of constraint objects, each with an id, description, weight, and type

[{"id":"word-limit","description":"Output must be under 50 words","weight":1.0,"type":"hard"}]

Must be valid JSON array with 1-20 objects. Each object requires id (string), description (string), weight (float 0.0-1.0), and type (enum: hard, soft). Duplicate ids not allowed.

[CONSTRAINT_WEIGHTS]

Overall weighting strategy: equal, custom, or priority-ordered

custom

Must be one of: equal, custom, priority-ordered. If custom, [CONSTRAINT_LIST] weight fields must sum to 1.0. If priority-ordered, constraints are evaluated in array order.

[PASS_THRESHOLD]

Minimum overall compliance score required for a passing judgment

0.85

Must be float between 0.0 and 1.0. Default 0.80 if not specified. Threshold below 0.50 triggers a warning in eval harness.

[PARTIAL_COMPLIANCE_MODE]

Whether to allow partial credit for partially met constraints

Must be boolean. When true, constraints can receive scores between 0.0 and 1.0. When false, constraints are binary pass/fail only.

[CONFLICT_RESOLUTION_STRATEGY]

How to handle constraints that conflict with each other

report-and-flag

Must be one of: strict-fail (any conflict = fail), report-and-flag (note conflict, grade independently), priority-weighted (higher-weight constraint wins). Default: report-and-flag.

[OUTPUT_SCHEMA_VERSION]

Version of the expected output schema for the compliance report

1.2

Must match semver string. Schema version determines expected fields in output. Current supported: 1.0, 1.1, 1.2. Mismatch triggers schema validation error in harness.

PROMPT PLAYBOOK

Implementation Harness Notes

How to wire the Multi-Constraint Instruction Adherence Grading Prompt into an evaluation pipeline with validation, retries, and human review gates.

This prompt is designed to be called programmatically as a grading step inside an evaluation harness, not as a one-off manual check. The typical integration pattern is: (1) your system generates an output from a candidate prompt or model, (2) you pass the original instruction set and the generated output into this grading prompt, and (3) you parse the structured compliance report to decide whether the output passes, fails, or requires human review. The grading prompt itself should be treated as a deterministic evaluation function—use low temperature (0.0–0.2), disable sampling where possible, and always request structured output (JSON) to avoid parsing ambiguity.

Validation and retry logic must be built around the grader's output. After receiving the JSON compliance report, validate that all expected fields are present (per_constraint_results, summary_judgment, overall_score, conflict_flags). If the grader returns malformed JSON or missing fields, retry up to two times with the same input. If retries are exhausted, log the failure and escalate to a human review queue. For high-stakes domains (healthcare, legal, finance), configure the harness to require human approval whenever the overall_score falls below your defined threshold or when conflict_flags indicate the model had to choose between contradictory instructions. This prevents silently accepting outputs where the grader itself was uncertain about trade-off quality.

Weighting and threshold configuration should live in your application layer, not in the prompt. Store a configuration object that maps each constraint ID to a weight (0.0–1.0) and a minimum acceptable score. After the grader returns per-constraint results, your harness computes the weighted overall score and compares each constraint against its threshold. This separation lets you tune weights without changing the grading prompt and supports A/B testing different threshold profiles. For constraint conflict detection, configure a conflict_pairs list in your harness that defines which constraints are known to conflict (e.g., 'be concise' vs. 'include all details'). When the grader flags a conflict between a pair not in your known-conflict list, treat it as a prompt design bug that needs investigation.

Model choice matters for the grader itself. Use a model with strong instruction-following and structured output capabilities (GPT-4o, Claude 3.5 Sonnet, or equivalent). Avoid using the same model family for both generation and grading when evaluating for production—this can mask systematic failures that both models share. For cost-sensitive pipelines, you can use a smaller model for the grader (GPT-4o-mini, Claude Haiku) but validate calibration against a larger judge on a golden dataset first. Log every grading result with the grader model version, timestamp, and input hash for auditability. When grading outputs that will be shown to users, store the compliance report alongside the output so you can trace why an output was accepted or rejected during incident review.

What to avoid: Do not use this prompt as a real-time guard in a user-facing chat loop—the latency and cost of running a full constraint audit on every turn is prohibitive. Instead, use it for offline evaluation, pre-deployment testing, and periodic sampling of production outputs. Do not treat the grader's output as ground truth without periodic human calibration; schedule monthly reviews where human evaluators grade the same outputs and compare against the automated scores to detect grader drift. Finally, do not skip the conflict detection step—multi-constraint prompts often contain hidden contradictions that only surface when you systematically check for them, and ignoring conflict flags leads to silently degraded outputs.

IMPLEMENTATION TABLE

Expected Output Contract

Fields, types, and validation rules for the structured compliance report produced by the Multi-Constraint Instruction Adherence Grading Prompt. Use this contract to parse, validate, and store grading results in your evaluation pipeline.

Field or ElementType or FormatRequiredValidation Rule

overall_judgment

enum: PASS | FAIL | PARTIAL

Must match one of three allowed values. If any constraint fails, overall_judgment must be FAIL or PARTIAL, never PASS.

overall_score

number (0.0-1.0)

Must be between 0 and 1 inclusive. Calculate as passing_constraints / total_constraints unless custom weights are provided in [CONSTRAINT_WEIGHTS].

constraint_results

array of objects

Must contain exactly one entry per constraint in [CONSTRAINTS_LIST]. Array length must equal input constraint count. Duplicate constraint_id values are invalid.

constraint_results[].constraint_id

string

Must match a constraint_id from [CONSTRAINTS_LIST] exactly. Case-sensitive. Missing or unknown IDs trigger a schema rejection.

constraint_results[].status

enum: PASS | FAIL | PARTIAL

Must be one of three allowed values. PARTIAL requires a non-null partial_detail field. PASS requires no violations in violation_snippets.

constraint_results[].partial_detail

string or null

Required when status is PARTIAL. Must describe which sub-part passed and which failed. Null when status is PASS or FAIL. Maximum 500 characters.

constraint_results[].violation_snippets

array of strings

Each string must be a direct quote from [OUTPUT_TO_GRADE]. Empty array when status is PASS. Maximum 5 snippets per constraint. Each snippet max 300 characters.

conflict_detected

boolean

Must be true if two or more constraints in [CONSTRAINTS_LIST] cannot be simultaneously satisfied. When true, conflict_detail is required.

conflict_detail

string or null

Required when conflict_detected is true. Must list conflicting constraint_ids and describe the nature of the conflict. Null when conflict_detected is false.

grading_notes

string

Free-text field for judge reasoning. Maximum 1000 characters. Must not contain unresolved placeholders or reference external data not provided in [CONTEXT].

PRACTICAL GUARDRAILS

Common Failure Modes

Multi-constraint grading breaks in predictable ways. These are the most common failure modes when evaluating outputs against several simultaneous constraints, and how to prevent them before they corrupt your eval pipeline.

01

Constraint Weighting Collapse

What to watch: The judge treats all constraints as equally important, even when some are critical (e.g., safety refusals) and others are cosmetic (e.g., tone). A critical failure gets the same weight as a minor style deviation, producing a misleadingly acceptable score. Guardrail: Define explicit constraint weights in the rubric. Use a priority field (critical/high/medium/low) and configure the scoring harness to multiply severity by weight. Critical failures should trigger automatic rejection regardless of other scores.

02

Constraint Conflict Deadlock

What to watch: Two constraints contradict each other (e.g., 'be concise' and 'include all legal disclaimers'). The judge penalizes the output for failing whichever constraint was sacrificed, producing a false negative. The model cannot win. Guardrail: Pre-scan your constraint set for conflicts before running evals. Add a conflict_resolution field to the rubric specifying which constraint takes precedence. The judge should note conflicts and apply the precedence rule rather than penalizing both sides.

03

Partial Compliance Blindness

What to watch: The judge uses binary pass/fail per constraint and misses near-misses. An output that satisfies 4 of 5 required elements gets the same score as one that satisfies 0 of 5. This hides improvement signals and makes threshold tuning impossible. Guardrail: Require the judge to produce a compliance percentage per constraint, not just a boolean. Configure the harness to accept partial_compliance scores (0.0–1.0) and set pass thresholds per constraint type. Reserve binary fail for truly absent requirements.

04

Constraint Scope Drift

What to watch: The judge applies constraints to the wrong part of the output. A word-count constraint meant for the summary gets applied to the entire response including citations. A tone constraint meant for user-facing text gets applied to structured JSON fields. Guardrail: Scope every constraint explicitly in the rubric with a target_field or applies_to descriptor. For structured outputs, map constraints to specific JSON paths. For unstructured text, define boundaries (e.g., 'applies to the summary section only').

05

Judge Hallucination on Constraint Presence

What to watch: The judge reports a constraint violation that doesn't exist, or claims a constraint was satisfied when the output clearly violates it. This is especially common with long outputs and subtle constraints like tone or brand voice. Guardrail: Require the judge to quote the specific output segment that triggered each violation. Run a second-pass verification where a lightweight check confirms the quoted segment actually exists in the output. Flag judgments without evidence as unreliable and escalate for human review.

06

Threshold Configuration Fragility

What to watch: Small changes to the overall pass threshold (e.g., 80% vs 85%) cause wild swings in pass rates because constraint scores cluster near the boundary. The eval pipeline becomes a tuning knob rather than a reliable gate. Guardrail: Use tiered thresholds with a gray zone. Below 70% is fail, above 90% is pass, and 70–90% triggers human review or a more expensive judge. This prevents threshold gaming and acknowledges that borderline outputs need human judgment, not automated rubber-stamping.

IMPLEMENTATION TABLE

Evaluation Rubric

Use this rubric to test whether the Multi-Constraint Instruction Adherence Grading Prompt produces reliable, actionable compliance reports before integrating it into an automated evaluation pipeline.

CriterionPass StandardFailure SignalTest Method

Per-constraint pass/fail accuracy

Correctly identifies pass/fail for each constraint in 95% of test cases against human-labeled ground truth

Judge marks a constraint as passed when a clear violation exists, or marks it as failed when the constraint is fully met

Run 50 hand-labeled multi-constraint test cases through the judge; compute per-constraint agreement with human labels

Partial compliance flag sensitivity

Flags partial compliance when output satisfies some but not all sub-requirements of a constraint

Judge assigns binary pass/fail to a constraint that has partial compliance, or flags partial compliance on a fully met constraint

Feed 20 outputs with known partial compliance (e.g., correct format but wrong tone); verify partial_compliance flag is true

Conflict detection accuracy

Identifies conflicting constraints in the instruction set when two constraints cannot be simultaneously satisfied

Judge reports no conflicts when constraints are mutually exclusive, or reports false conflicts on compatible constraints

Provide 10 instruction sets with known conflicts and 10 without; measure precision and recall of conflict_detected field

Summary judgment alignment with weighted score

Summary judgment matches the pass/fail threshold derived from weighted constraint scores within 2% tolerance

Summary judgment is PASS when weighted score is below threshold, or FAIL when weighted score is above threshold

Compute weighted score from per-constraint results; compare to summary_judgment across 100 outputs with varying weight configs

Output schema validity

Every response parses as valid JSON matching the expected schema with all required fields present

Response is missing required fields, contains extra untyped fields, or fails JSON.parse

Validate 200 judge responses against the output schema using a JSON Schema validator; require 100% parse success

Constraint weight application correctness

Weighted score reflects the configured weights: a failed high-weight constraint reduces score more than a failed low-weight constraint

Swapping weights between two constraints produces identical overall score, or score changes in wrong direction

Run identical output through judge with weight config A and weight config B (weights swapped); verify score changes directionally

Threshold gating behavior

When overall score equals the pass threshold exactly, the judge applies the configured tie-breaking rule consistently

Judge produces different summary judgments for the same score-threshold tie across repeated runs

Set threshold to 0.70 and feed outputs scoring exactly 0.70; verify summary_judgment is deterministic across 10 repeated calls

Null or missing constraint handling

When a constraint field is null or absent in the instruction set, the judge skips it without error and does not count it in scoring

Judge fails with an error, assigns a default score to the missing constraint, or includes it in the compliance report

Submit instruction sets with [CONSTRAINTS] containing null entries; verify skipped_constraints count matches and no errors

ADAPTATION OPTIONS

Adapt This Prompt

How to adapt

Use the base prompt with a single model and lightweight validation. Start with 3–5 constraints before scaling to 20+. Hard-code the constraint list directly in the prompt rather than injecting from a config file.

code
Constraints to check:
1. [CONSTRAINT_1]
2. [CONSTRAINT_2]
3. [CONSTRAINT_3]

Output a JSON object with per-constraint pass/fail and a summary judgment.

Watch for

  • The judge hallucinating constraints you didn't specify
  • Overly verbose explanations that bury the pass/fail signal
  • Inconsistent JSON structure when you add or remove constraints
  • No conflict detection between constraints
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.