# Dataflow Pattern Math Reasoning Sft

> Reuse a reviewed pipeline pattern for constructing benchmark-aligned math reasoning SFT records from question-and-answer datasets with verifiable final answers.

- Skill: `opendcai/dataflow-pattern-math-reasoning-sft` (Agent Skill, multi-file: 7 files)
- Install (CLI): `npx skillmds@latest add opendcai/dataflow-pattern-math-reasoning-sft`
- Raw SKILL.md: https://api.skillmd.com/api/skills/opendcai/dataflow-pattern-math-reasoning-sft/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: DevOps & Infra
- Author: opendcai (https://skillmd.com/u/opendcai)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/opendcai/dataflow-pattern-math-reasoning-sft

---

# Math Reasoning SFT Pattern

Use this pattern for short, verifiable math problems whose training output
requires a standalone instruction, regenerated reasoning, and a final answer
compatible with strict benchmark evaluation. Do not use it for proof-only
tasks, open-ended tutoring, or records without a trustworthy answer signal.

The recommended case is
[gsm8k-reasoning-v1](examples/gsm8k-reasoning-v1/case_report.md). It accepts
`question`/`answer` and `problem`/`final_answer` schema branches, normalizes them
to canonical fields, regenerates reasoning without exposing the gold answer to
the generator, validates the derived final answer against gold, and applies an
LLM quality evaluation after deterministic correctness checks.

Preserve these invariants when adapting the case:

- `sample_id` and source dataset provenance survive every stage.
- The reasoning generator sees the problem but not the gold answer.
- Generated reasoning is accepted only when its parsed conclusion matches gold.
- Quality thresholds are justified by the trial score distribution.
- Output always provides nonempty `instruction`, `reasoning`, and `output`.
- Benchmark answer formatting is handled explicitly rather than left to chance.

For a new schema or benchmark, retain the staged validation pattern but adapt
normalization, correctness parsing, difficulty coverage, and final formatting
to the actual task.

