8000 feat(export): add a canonical RL transition dataset exporter and validator · Issue #9 · Mnehmos/mathcorpus · GitHub
[go: up one dir, main page]

Skip to content
8000

feat(export): add a canonical RL transition dataset exporter and validator #9

Open

Description

@Mnehmos

Problem

MathCorpus currently exports packet records, corpus metadata, and nested packet JSON, but it does not provide a canonical reinforcement-learning transition dataset. Packet rows are theorem records, not state → action → reward → next_state experiences.

MathCorpus needs its own RL export tooling so imported Proof Search trajectories can be validated, split, filtered, and distributed without depending on the Proof Search database or exporter implementation.

This issue should consume the transition format produced by llm-driven-proof-search#238 and align with MCIP v1 from #1.

Scope

Add a versioned RL transition schema and tools to:

  • validate imported transition bundles
  • join transitions to immutable packet identities and statement hashes
  • enforce training eligibility, redaction, contamination, and split policy
  • export canonical JSONL
  • export optional Parquet with native scalar columns
  • group transitions into full episode manifests
  • produce dataset cards and aggregate statistics

Required transition fields

Each accepted transition must include or explicitly mark unavailable:

  • schema version
  • packet ID and formal statement hash
  • episode and problem-version IDs
  • step index
  • state or state-artifact reference
  • action
  • scalar reward
  • next state or next-state artifact reference
  • terminated and truncated flags
  • terminal/truncation reasons
  • action and verifier outcome
  • environment, verifier, action, observation, reward-policy, and restriction-profile versions
  • model config hash and redaction-aware model metadata
  • token, cost, wall-time, and Lean CPU metrics
  • diagnostic and dependency artifact references where available

Acceptance criteria

  • The exporter never treats packets.jsonl or packet-shaped records as RL transitions.
  • Validation rejects transitions missing core RL fields unless an explicit legacy missing-data policy applies.
  • Imported transitions are cryptographically bound to the referenced packet statement and environment.
  • Train/validation/test assignment follows packet lineage and template-family locking to prevent leakage.
  • Public policy can independently redact observations, actions, diagnostics, model metadata, and artifacts while retaining hashes.
  • JSONL and Parquet exports contain identical logical records.
  • Parquet exposes major scalar fields as native columns rather than only a serialized JSON blob.
  • Episode manifests verify ordered, gap-free transition sequences and final outcome consistency.
  • Aggregate reports include episode count, transition count, reward distribution, outcome distribution, horizon length, token/cost/timing summaries, missing-field rates, and negative-action rates.
  • Conformance fixtures round-trip with the Proof Search exporter from llm-driven-proof-search#238.
  • Existing packets.jsonl, negative-example, SFT, DPO, and MCIP outputs remain separately named and documented.

Dependencies

Activity

  1. Mnehmos commented on Jul 12, 2026

    @Mnehmos
    OwnerAuthor

    Started the MathCorpus-side consumer (commit 9d8b5af):

    • schema/mcip/v1/rl_transition.schema.json — new record type consuming the shape llm-driven-proof-search#238 proposes, plus every field this issue lists as required-or-explicitly-unavailable. Required-but-nullable, with a missing_field_reasons honesty mechanism so a legacy gap is explained rather than defaulted to 0/false.
    • tools/mathcorpus/rl_transitions.py — bundle validation, packet join (packet_id + formal_statement_sha256), publish-eligibility (never more permissive than the joined packet's own training.eligibility), episode step-index contiguity, and the missing-field honesty check.
    • tools/export_rl_transitions.py — validate → join → policy-filter → canonical rl_transitions.jsonl + rl_episode_manifest.json.
    • Two synthetic conformance fixtures (export_eligibility: private_only) round-trip cleanly through validation and the exporter.

    Leaving this open — real cross-repo blocker, not just remaining scope. Checked llm-driven-proof-search#238 and #231 directly: neither has any implementation started (no matching branch, no rl_transition/proofsearch.rl_transition references in the tree). #238's JSON shape is currently only a proposal in its issue body, not shipped code, and it explicitly depends on #231 (persisting real reward/terminated/truncated/observation values) which is also untouched. There is no real transition data to validate the consumer side against yet.

    Deliberately deferred rather than guessed at: Parquet native-column export and dataset-card/aggregate-stat generation (both in this issue's scope) — building those now would mean designing against a shape #238 hasn't committed to. Full status and rationale: docs/rl-transitions.md.

    Next step is on the llm-driven-proof-search side: #231 then #238. Once real bundles exist, tools/export_rl_transitions.py should work against them unmodified (or with a minor schema bump if the shipped shape differs slightly from what's modeled here).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0