Inferensys

Prompt

Step-by-Step Correctness Grading Prompt Template

A practical prompt playbook for using Step-by-Step Correctness Grading Prompt Template 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, required context, and boundaries for the Step-by-Step Correctness Grading prompt.

This prompt is for evaluation engineers and AI platform teams who need to automatically grade the correctness of reasoning traces produced by LLMs. It is designed for workflows where the model's step-by-step reasoning is as important as the final answer, such as in mathematical problem-solving, code debugging, medical diagnosis support, or legal analysis. Use this prompt when you need per-step correctness labels, cumulative error flags, and a final verdict that accounts for error propagation. The primary job-to-be-done is converting a raw reasoning trace and a ground-truth reference into a structured, machine-readable evaluation report that can trigger automated gates in a CI/CD pipeline or flag outputs for human review.

This prompt assumes you already have a reasoning trace to evaluate and a ground-truth reference or a set of verifiable facts. The ideal user is an evaluation lead or MLOps engineer integrating this prompt into an automated evaluation harness. Required context includes the full reasoning trace, the original problem statement, and a reference solution or fact set. The prompt is designed to be model-agnostic but performs best with models that have strong instruction-following and structured output capabilities. You should wire this into a system that can parse the JSON output and act on the final_verdict and error_propagation_detected fields, such as blocking a deployment or routing the trace for human annotation.

Do not use this prompt for grading creative writing, open-ended summarization quality, or tasks where there is no objectively correct reasoning path. It is also unsuitable for evaluating conversational quality, tone, or stylistic preferences. If your use case involves subjective quality dimensions, use a rubric-based evaluation prompt from the Rubric Design and Scoring group instead. For high-stakes domains like healthcare or legal analysis, the output of this prompt must be treated as a screening tool, not a final authority. Always route traces flagged with final_verdict: false or error_propagation_detected: true for human review before taking any action based on the model's output.

PRACTICAL GUARDRAILS

Use Case Fit

Where this prompt works and where it does not. Step-by-step correctness grading requires structured reasoning traces, clear dependency chains, and a tolerance for detailed annotation. It is not a lightweight pass/fail check.

01

Good Fit: Structured Multi-Step Reasoning

Use when: you have explicit reasoning traces with numbered or clearly delineated steps. Guardrail: The prompt expects step-level annotation. If your traces are unstructured prose, pre-process them into discrete steps before grading.

02

Bad Fit: Single-Step or Final-Answer-Only Outputs

Avoid when: the model output contains only a final answer without intermediate reasoning. Guardrail: This prompt grades the path, not just the destination. Use a reference-guided or pass/fail evaluation prompt for answer-only outputs.

03

Required Inputs: Trace, Rubric, and Ground Truth

Risk: Running the prompt without a clear rubric or ground truth produces inconsistent, uncalibrated scores. Guardrail: Always supply a [RUBRIC] with scoring anchors, a [REASONING_TRACE] with discrete steps, and a [GROUND_TRUTH] or [REFERENCE_ANSWER] for factual verification.

04

Operational Risk: High Latency and Token Cost

Risk: Grading long reasoning traces step-by-step consumes significant tokens and adds latency to evaluation pipelines. Guardrail: Set a [MAX_STEPS] limit and consider sampling long traces. Use this prompt for offline evaluation batches, not real-time guardrails.

05

Operational Risk: Judge Hallucination on Dependency Links

Risk: The LLM judge may hallucinate dependencies between steps or invent error propagation that does not exist. Guardrail: Require the judge to cite specific step indices when claiming a dependency or propagation error. Cross-validate a sample of dependency annotations with human review.

06

Bad Fit: Creative or Subjective Reasoning

Avoid when: the reasoning involves subjective judgment, creative interpretation, or open-ended analysis without a clear correctness standard. Guardrail: This prompt requires verifiable correctness per step. For subjective quality, use a coherence or alignment scoring rubric instead.

PROMPT PLAYBOOK

Copy-Ready Prompt Template

A reusable prompt template with square-bracket placeholders for grading the step-by-step correctness of reasoning traces.

This section provides a copy-ready prompt template for the Step-by-Step Correctness Grading task. The template is designed to be wired directly into an evaluation harness. It expects a reasoning trace as input and produces per-step correctness labels, cumulative error flags, and a final verdict. All dynamic inputs are represented as square-bracket placeholders, which your application must resolve before sending the request to the model.

text
You are an expert evaluation judge. Your task is to grade the correctness of a provided reasoning trace, step by step.

## INPUT
[REASONING_TRACE]

## CONTEXT
[GROUND_TRUTH_CONTEXT]

## OUTPUT_SCHEMA
You must respond with a valid JSON object conforming to this schema:
{
  "steps": [
    {
      "step_index": "integer",
      "step_text": "string",
      "correctness_label": "CORRECT | PARTIALLY_CORRECT | INCORRECT | UNVERIFIABLE",
      "error_type": "string | null",
      "justification": "string"
    }
  ],
  "cumulative_errors": [
    {
      "origin_step_index": "integer",
      "propagated_to_steps": ["integer"],
      "error_description": "string"
    }
  ],
  "final_verdict": "PASS | FAIL | UNCERTAIN",
  "verdict_rationale": "string"
}

## CONSTRAINTS
[CONSTRAINTS]

## EVALUATION_RUBRIC
[RUBRIC]

## INSTRUCTIONS
1. Parse the [REASONING_TRACE] into individual reasoning steps.
2. For each step, determine its correctness by comparing it against the [GROUND_TRUTH_CONTEXT] and the logical dependency on prior steps.
3. Assign a `correctness_label` to each step. Use `UNVERIFIABLE` if the [GROUND_TRUTH_CONTEXT] lacks the necessary information.
4. If a step is incorrect, identify the `error_type` from the allowed list in [CONSTRAINTS].
5. Track `cumulative_errors` where an error in one step causes a subsequent step to fail, even if that subsequent step's internal logic is sound.
6. Produce a `final_verdict` based on the [RUBRIC]. A single critical error that invalidates the conclusion should result in a `FAIL` verdict.
7. If the [REASONING_TRACE] is empty or cannot be parsed, return a `final_verdict` of `UNCERTAIN` with an appropriate `verdict_rationale`.

To adapt this template, replace the placeholders with concrete values in your application code. [REASONING_TRACE] should be the raw text output from the model under evaluation. [GROUND_TRUTH_CONTEXT] must contain the verified facts, source documents, or a reference answer against which steps are judged. [CONSTRAINTS] should be a list of allowed error types (e.g., Factual Error, Logical Fallacy, Calculation Error) and any domain-specific rules. [RUBRIC] defines the scoring criteria, such as 'A FAIL verdict requires at least one INCORRECT step that directly undermines the conclusion.' Before deploying, validate that the model's output strictly conforms to the OUTPUT_SCHEMA; a malformed JSON response should trigger a retry or fallback, not a silent failure in your evaluation pipeline.

IMPLEMENTATION TABLE

Prompt Variables

Placeholders required by the Step-by-Step Correctness Grading Prompt Template. Replace each placeholder with concrete values before sending the prompt to the model. Validation notes describe how to check that the input is well-formed before execution.

PlaceholderPurposeExampleValidation Notes

[REASONING_TRACE]

The full step-by-step reasoning output to be graded

Step 1: Identify knowns. Given x=5, y=3... Step 2: Apply formula... Step 3: Conclude z=15.

Must contain at least 2 distinct reasoning steps. Parse check: split on step delimiters or newlines. Reject if empty or single block.

[QUESTION_OR_TASK]

The original question or task that the reasoning trace attempts to answer

Calculate the area of a right triangle with base 6 and height 8.

Must be non-empty string. Compare against [REASONING_TRACE] to verify trace addresses this task. Null allowed if grading standalone reasoning quality.

[GROUND_TRUTH_FACTS]

Known-correct facts, source passages, or reference data for grounding verification

The area of a triangle is (base * height) / 2. Base=6, height=8.

Optional but strongly recommended. If provided, must be parseable as discrete claims. Use for step-level grounding checks. Null allowed for pure logical validity grading.

[RUBRIC_DIMENSIONS]

Scoring dimensions and anchor descriptions defining what each score level means

Logical validity: 1=invalid inference, 3=minor gap, 5=fully valid. Grounding: 1=hallucinated, 3=partially supported, 5=fully grounded.

Must define at least 2 dimensions with score anchors. Parse as JSON or structured text. Reject if dimensions missing score level descriptions.

[STEP_DELIMITER]

Character or pattern that separates reasoning steps in the trace

\nStep \d+:|(?=\n\d+.)

Must be a valid regex or literal string. Test against [REASONING_TRACE] to confirm it splits into expected step count. Default to double-newline if not specified.

[OUTPUT_SCHEMA]

Expected JSON schema for the grading output

{"steps": [{"index": int, "content": str, "validity": int, "grounding": int, "error_flag": bool}], "cumulative_errors": [str], "final_verdict": str}

Must be valid JSON Schema or example structure. Validate that schema includes step-level fields, error accumulation, and final verdict. Reject if flat or missing per-step granularity.

[ERROR_PROPAGATION_RULES]

Rules defining how errors in one step affect downstream step scoring

If step N has validity <= 2 and step N+1 depends on step N, flag step N+1 for dependency error and cap validity at 2.

Must be expressed as conditional rules. Test with a synthetic trace containing a known early error to verify propagation logic triggers. Null allowed for independent step grading.

[CONFIDENCE_THRESHOLD]

Minimum confidence score below which the grader should flag uncertainty

0.7

Must be float between 0.0 and 1.0. Steps scored below this threshold should trigger an uncertainty flag in output. Default to 0.5 if not specified.

PROMPT PLAYBOOK

Implementation Harness Notes

How to wire the step-by-step correctness grading prompt into an evaluation pipeline with validation, retries, and human review gates.

This prompt is designed to operate as a stateless evaluation function inside a larger grading pipeline. It receives a reasoning trace and a reference solution, then returns structured per-step annotations. The harness should treat the LLM call as one component in a multi-stage workflow: pre-processing to normalize the trace format, the grading call itself, post-processing to validate the output schema, and a routing decision based on the final verdict and error flags. Do not use this prompt directly on user-facing chat interfaces; it belongs in batch evaluation jobs, CI/CD regression suites, or asynchronous review queues where latency tolerance is higher and output consistency matters more than speed.

Integration pattern: Wrap the prompt in a function with the signature grade_reasoning_trace(trace: str, reference: str, rubric: dict) -> GradingResult. Pre-process the input trace by splitting it into numbered steps if the model didn't produce them natively. Inject the step count into the [CONSTRAINTS] placeholder to bound the expected output array length. After the LLM call, validate the JSON response against a strict schema: require steps as an array of objects with step_index (int), correctness_label (enum of CORRECT, PARTIALLY_CORRECT, INCORRECT, NOT_EVALUABLE), error_type (nullable string), and justification (string). Reject and retry any response missing required fields or containing step indices outside the expected range. Log schema validation failures separately from content-level grading failures to distinguish model non-compliance from genuine reasoning errors.

Retry and fallback strategy: Implement up to two retries on schema validation failure, each time appending the validation error message to the [CONSTRAINTS] field. If the model still fails to produce valid JSON after two retries, escalate the entire trace to a human review queue and emit an EVALUATION_FAILED status rather than silently accepting a malformed result. For content-level concerns—such as a high density of INCORRECT labels or an error_propagation_detected flag set to true—route the trace to a secondary judge model for confirmation before surfacing it as a definitive failure. This two-judge pattern reduces false positives from a single LLM judge misreading ambiguous reasoning steps.

Model choice and tool use: This prompt benefits from models with strong instruction-following and structured output capabilities. Prefer models that support constrained JSON generation (e.g., GPT-4 with structured outputs, Claude with tool-use mode) to reduce schema violations at the source. If your model provider supports it, define the output as a tool call with a typed schema rather than relying solely on the prompt's [OUTPUT_SCHEMA] description. Do not give the grading model access to external tools, retrieval, or code execution during evaluation—the grader should judge the trace as presented, not attempt to solve the problem itself. For traces involving mathematical reasoning, consider a pre-grading verification step that runs calculations through a deterministic arithmetic validator before the LLM judge evaluates the reasoning logic, separating computational correctness from logical correctness.

Human review integration: Set a threshold on the final_verdict and cumulative error count to trigger human review. For high-stakes domains (healthcare, legal, finance), any trace with one or more INCORRECT steps or an error_propagation_detected flag should route to a human evaluator before the grade is finalized. Store the LLM judge's annotations alongside the human reviewer's corrections to build a calibration dataset for future judge alignment. Avoid using this prompt as the sole arbiter in production systems where grading errors could cause downstream harm—treat it as a filter that reduces human review load, not a replacement for expert judgment.

IMPLEMENTATION TABLE

Expected Output Contract

Define the exact fields, types, and validation rules your grading harness must enforce for each step-level annotation produced by the Step-by-Step Correctness Grading Prompt.

Field or ElementType or FormatRequiredValidation Rule

step_index

integer

Must be a non-negative integer starting at 0. Must be strictly sequential across all steps in the output array.

step_description

string

Must be a non-empty string that summarizes the reasoning step being evaluated. Must not exceed 200 characters.

correctness_label

string

Must be one of the predefined enum values: 'CORRECT', 'PARTIALLY_CORRECT', 'INCORRECT', 'NOT_EVALUABLE'. No other values are permitted.

error_type

string

Required if correctness_label is 'INCORRECT' or 'PARTIALLY_CORRECT'. Must be one of: 'FACTUAL_ERROR', 'LOGICAL_FALLACY', 'CALCULATION_ERROR', 'CITATION_ERROR', 'UNSUPPORTED_LEAP', 'OTHER'. Set to null otherwise.

error_description

string

Required if error_type is not null. Must provide a concise, specific explanation of the error. Must not be a generic restatement of the error_type.

propagates_to_steps

array of integers

If present, each integer must be a valid step_index greater than the current step. If no downstream impact, set to an empty array. Must not contain duplicate indices.

confidence_score

float

Must be a float between 0.0 and 1.0 inclusive. Represents the judge's confidence in the correctness_label assignment. A score below 0.7 should trigger a human review flag.

final_verdict

string

Must be a single string at the end of the output array: 'ALL_CORRECT', 'ERRORS_PRESENT', or 'INCONCLUSIVE'. This field is only valid as the final element in the steps array.

PRACTICAL GUARDRAILS

Common Failure Modes

Step-by-step correctness grading breaks when the judge loses track of dependencies, tolerates early errors that cascade, or applies inconsistent standards across steps. These failure modes target the most common production issues.

01

Cascading Error Blindness

What to watch: The judge marks later steps correct even when they depend on an earlier incorrect step, inflating scores. Guardrail: Require the judge to label each step with its dependencies and re-evaluate dependent steps when a prior step is marked incorrect.

02

Step Granularity Mismatch

What to watch: The reasoning trace combines multiple logical leaps into one step, making it impossible to isolate where correctness breaks. Guardrail: Pre-process the trace to enforce a maximum of one claim or operation per step. Reject or split compound steps before grading.

03

Judge Leniency Drift

What to watch: The LLM judge becomes more lenient over long traces, accepting sloppy reasoning in later steps that it would have flagged early on. Guardrail: Randomize step order for evaluation when possible, or calibrate the judge with anchor examples at regular intervals throughout the trace.

04

Missing Dependency Declaration

What to watch: A step uses a value or conclusion from a prior step without declaring the dependency, so the grader cannot trace error propagation. Guardrail: Add a pre-grading extraction pass that maps all variable references and conclusion citations before correctness scoring begins.

05

Final Answer Override Bias

What to watch: The judge sees a correct final answer and retroactively marks flawed intermediate steps as correct, or vice versa. Guardrail: Grade all intermediate steps before revealing the final answer to the judge. Use a two-pass structure: step grading first, then holistic verdict.

06

Undefined Correctness Criteria

What to watch: The judge applies vague standards like 'reasonable' or 'logical' without operational definitions, producing inconsistent step labels. Guardrail: Define per-step correctness as a concrete checklist: valid operation, supported by cited evidence, no missing premises, and consistent with prior conclusions.

IMPLEMENTATION TABLE

Evaluation Rubric

Use this rubric to evaluate the quality of a step-by-step correctness grading prompt's output before integrating it into an automated evaluation pipeline. Each criterion targets a specific failure mode in reasoning trace assessment.

CriterionPass StandardFailure SignalTest Method

Per-Step Correctness Labeling

Each reasoning step in [REASONING_TRACE] receives a label of 'correct', 'incorrect', or 'unverifiable' based on [GROUND_TRUTH] and [SOURCE_EVIDENCE].

A step with a factual error is labeled 'correct', or a correct step is labeled 'incorrect'.

Parse the output JSON. For a golden test set of 5 traces with known step-level errors, confirm the label field for each step matches the expected label with >95% accuracy.

Error Propagation Flagging

When a step is labeled 'incorrect', all subsequent steps that logically depend on it are flagged with error_propagation: true and cite the originating step index.

A downstream step that uses an incorrect intermediate value is not flagged, or a step that is independent is incorrectly flagged.

Inject a known error at step 2 of a 5-step trace. Verify that steps 3 and 4 (which depend on step 2) have error_propagation: true and step 5 (which is independent) has error_propagation: false.

Cumulative Error Severity Scoring

The final_verdict.severity field is 'none', 'minor', 'major', or 'critical' and is consistent with the number and impact of flagged errors.

A single minor calculation error yields a 'critical' severity, or a foundational logic error yields a 'minor' severity.

Run the prompt on 10 traces with pre-defined severity levels. Measure exact match accuracy against the expected severity. A Cohen's Kappa of >0.8 against human labels is required.

Inter-Step Dependency Validation

The dependency_graph field in the output correctly maps each step index to the indices of steps it depends on.

A step that explicitly references the result of a prior step is missing from its depends_on array, or a non-existent dependency is added.

For a trace with a known dependency chain (1->2->3), parse the dependency_graph. Assert that step 3's depends_on array contains 2, and step 2's contains 1. Check for false positives.

Final Verdict Justification

The final_verdict.justification field provides a concise, traceable summary that references specific step indices and error types, not a generic statement.

The justification says 'The reasoning is flawed' without citing which step was the root cause or what the error was.

Use an LLM-as-a-judge check: provide the output and ask 'Does this justification cite at least one specific step index and error type?' Pass if the answer is 'yes' for 100% of a test set.

Output Schema Conformance

The output is valid JSON that strictly matches the [OUTPUT_SCHEMA], including all required fields (trace_id, step_evaluations, dependency_graph, final_verdict).

The output is missing the dependency_graph field, contains a trailing comma, or uses null for a required field.

Validate the raw output string with a JSON schema validator configured with the expected schema. The test passes if validation succeeds without errors.

Uncertainty Handling

When [SOURCE_EVIDENCE] is insufficient to verify a step, the label is 'unverifiable' and the confidence score is below the [CONFIDENCE_THRESHOLD] of 0.7.

An unverifiable step is labeled 'correct' with a high confidence score, or a verifiable step is labeled 'unverifiable'.

Provide a trace where step 3 makes a claim not found in [SOURCE_EVIDENCE]. Assert that the label for step 3 is 'unverifiable' and its confidence score is < 0.7.

ADAPTATION OPTIONS

Adapt This Prompt

How to adapt

Use the base prompt with a single frontier model and manual review of 20-50 traces. Drop the inter-step dependency validation harness and focus on per-step correctness labels and a final verdict. Replace [OUTPUT_SCHEMA] with a simple JSON template containing steps array and final_verdict string.

Watch for

  • Judge hallucinating step content that wasn't in the original trace
  • Inconsistent correctness labels when steps are ambiguous
  • Missing error propagation detection without the full dependency graph
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.