Skip to content

Data validation should auto-convert common formats and give actionable errors #1340

Description

@cwing-nvidia

Use cases, pain points, and background

Today ng_prepare_data only validates data that is already in Gym format — it rejects anything else with no actionable feedback. Users see offending_example_idxs: [0, 1, 2, ...] but no information about what's wrong or how to fix it.

Once Chat Completions conversion is available (#1339), ng_prepare_data can auto-detect and convert common formats instead of rejecting them, and provide helpful error messages when it can't.

Description

  • Wire convert_to_gym_format() into ng_prepare_data's validation loop: if a row fails BaseRunRequest validation, attempt conversion before rejecting
  • Replace silent "offending" markers with actionable error messages (e.g. "row 0 has messages but no responses_create_params — run with +auto_convert=true to convert automatically")
  • Reconsider the relationship between ng_prepare_data and ng_materialize_prompts — should ng_prepare_data subsume prompt materialization?

Design

  • nemo_gym/train_data_utils.py — modify compute_sample_metrics to preserve ValidationError details; add auto-convert option
  • Default behavior unchanged (auto_convert=false) — existing workflows are not affected

Out of scope

Acceptance Criteria

  • When ng_prepare_data rejects a row, the error message explains why and suggests what to do
  • ng_prepare_data +auto_convert=true converts Chat Completions rows before validating
  • Default behavior (no auto_convert) is unchanged
  • Converted rows are logged so the user knows their data was transformed

Parent issue: #1338

Metadata

Metadata

Assignees

No one assigned

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions