Skip to content

fix(data): warn when behavioral dataset config keys are silently ignored - #3271

Merged
yuki-97 merged 4 commits into
NVIDIA-NeMo:mainfrom
tianyi-zhang-02:fix/warn-ignored-dataset-config-keys
Jul 28, 2026
Merged

yuki-97 merged 4 commits into
NVIDIA-NeMo:mainfrom
tianyi-zhang-02:fix/warn-ignored-dataset-config-keys

Conversation

@tianyi-zhang-02

@tianyi-zhang-02 tianyi-zhang-02 commented Jul 17, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do ?

load_response_dataset instantiates with dataset_class(**data_config), and every built-in loader accepts **kwargs — so a standard ResponseDatasetConfig key the class doesn't support is silently swallowed. E.g. subset: socratic on gsm8k silently loads the hardcoded main config, and split_validation_size/seed silently do nothing on the 12 loaders that never call split_train_validation (while the SFT guide documents them as generic keys).

This adds a dispatcher-level guard, warn_on_unsupported_dataset_config_keys, that warns when a user-set behavioral key (subset, split, split_validation_size, seed) is not declared anywhere in the resolved class's __init__ MRO.

Design notes:

  • MRO-aware: kwargs-forwarding subclasses that delegate to a declaring base (the intent datasets) are not flagged.
  • functools.partial registry entries (AIME variants) are unwrapped before inspection.
  • None values and falsy split_validation_size are skipped, so documented config boilerplate (subset: null, split_validation_size: 0) stays quiet — none of the shipped examples/configs emit warnings.
  • Warning, not error, for backward compatibility.
  • Known limitation: an external dotted-path dataset class that consumes one of these keys via kwargs.get(...) without declaring it in any __init__ signature would see a spurious warning. None of the built-in loaders do this (verified), and it's warning-only by design — but flagging it for review. Scoped to the response dispatcher; the preference dispatcher has the same pattern and can adopt the shared helper as a follow-up.

Issues

Closes #3270. Generalizes the failure mode @RayenTian flagged in the #3131 review.

Usage

data:
  train:
    dataset_name: gsm8k
    subset: socratic   # before: silently loads "main"; after: UserWarning at dispatch

Before your PR is "Ready for review"

  • New tests: 7 unit cases for the guard (unsupported key warns; supported key quiet; None/0 quiet; MRO forwarding quiet; partial unwrapped; non-class input safe) plus an end-to-end dispatcher test, in tests/unit/data/datasets/test_response_dataset_registry.py (registry-dispatch scope).
  • Validation: helper cases verified locally (all pass); ruff check / ruff format --check clean; pyrefly==0.24.2 (CI-pinned) reports no new errors on the two whitelisted files touched.
  • Docs: N/A (warning makes existing documented behavior observable; no doc changes required).

cc @RayenTian @yuki-97

load_response_dataset instantiates with dataset_class(**data_config) and
every built-in loader accepts **kwargs, so a standard ResponseDatasetConfig
key the class does not support is swallowed with no feedback — e.g.
subset: socratic on gsm8k silently loads the hardcoded 'main' config, and
split_validation_size/seed silently do nothing on the 12 loaders that never
call split_train_validation.

Add a dispatcher-level guard that warns when a user-set behavioral key
(subset, split, split_validation_size, seed) is not declared anywhere in
the resolved class's __init__ MRO. MRO-aware so kwargs-forwarding
subclasses (intent datasets) are not flagged; functools.partial registry
entries (AIME variants) are unwrapped; None values and a falsy
split_validation_size are skipped to keep documented config boilerplate
quiet.

Closes NVIDIA-NeMo#3270

Co-Authored-By: Claude Fable 5 <[email protected]>
Signed-off-by: Tianyi Zhang <[email protected]>
@tianyi-zhang-02
tianyi-zhang-02 requested review from a team as code owners July 17, 2026 20:00
@copy-pr-bot

copy-pr-bot Bot commented Jul 17, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@svcnvidia-nemo-ci svcnvidia-nemo-ci added the waiting-on-maintainers Waiting on maintainers to respond label Jul 19, 2026
Comment thread nemo_rl/data/datasets/utils.py Resolved
@RayenTian

Copy link
Copy Markdown
Contributor

Thanks a lot for adding this, @tianyi-zhang-02 !

Could we also apply warn_on_unsupported_dataset_config_keys() in load_preference_dataset()? It uses the same dataset_class(**data_config) pattern and is vulnerable to the same silent swallowing of unsupported keys—for example,
Tulu3PreferenceDataset would silently ignore a configured split.

Eval datasets are not yet using a fully unified loading format: some go through load_response_dataset(), while the remaining eval-specific loaders still use the legacy dispatcher. I think it is reasonable to defer the eval-side check and track it as pending under #2840, where the eval datasets are being consolidated into the response dataset registry.

@svcnvidia-nemo-ci svcnvidia-nemo-ci added waiting-on-customer Waiting on the original author to respond and removed waiting-on-maintainers Waiting on maintainers to respond labels Jul 21, 2026
Address review on NVIDIA-NeMo#3271:
- Expand _BEHAVIORAL_DATASET_CONFIG_KEYS to all constructor-consumed keys
  from ResponseDatasetConfig / PreferenceDatasetConfig (data_path,
  input_key, output_key, download_dir, prompt_key, chosen_key,
  rejected_key in addition to the original four). Audited every shipped
  examples/configs usage against the declaring loaders: no new warnings
  (OpenMathInstruct-2/output_key, NemoGymDataset/data_path,
  mmpr-tiny/download_dir all declare their keys).
- Apply the same guard in load_preference_dataset (same
  dataset_class(**data_config) pattern; e.g. Tulu3PreferenceDataset
  silently ignored a configured split). Eval-side deferred to the NVIDIA-NeMo#2840
  registry consolidation per review discussion.

Co-Authored-By: Claude Fable 5 <[email protected]>
Signed-off-by: Tianyi Zhang <[email protected]>
@tianyi-zhang-02

tianyi-zhang-02 commented Jul 21, 2026 •

Copy link
Copy Markdown
Contributor Author

Done in fae1d7c — load_preference_dataset now applies the same warn_on_unsupported_dataset_config_keys() guard (the expanded key set covers the preference-side keys, so Tulu3PreferenceDataset with a configured split now warns), with an end-to-end dispatcher test added. Agreed on deferring the eval side to the #2840 registry consolidation. Would be happy to extend the guard there once that lands :D

@svcnvidia-nemo-ci svcnvidia-nemo-ci removed the waiting-on-customer Waiting on the original author to respond label Jul 22, 2026
@RayenTian

Copy link
Copy Markdown
Contributor

LGTM! Thanks a lot for adding this. Trigger CI now.

@RayenTian

Copy link
Copy Markdown
Contributor

/ok to test ce56cf9

@tianyi-zhang-02

tianyi-zhang-02 commented Jul 22, 2026 •

Copy link
Copy Markdown
Contributor Author

cc @RayenTian. Thanks! The CI quality check failure is just the label gate - TEST_LEVEL=none because the PR has no CI:L* label. Could you add one (CI:Lfast matched #3071/#3131) and re-run /ok to test ce56cf9? The label is read at workflow start.

@svcnvidia-nemo-ci svcnvidia-nemo-ci added the waiting-on-maintainers Waiting on maintainers to respond label Jul 24, 2026

@yuki-97 yuki-97 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for adding this @tianyi-zhang-02

@yuki-97 yuki-97 added the CI:Lfast Runs a fast test suite and re-use nightly `main` container (but sync dependencies to PRs version) label Jul 27, 2026
@yuki-97

yuki-97 commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

/ok to test e466eae

@yuki-97
yuki-97 enabled auto-merge (squash) July 27, 2026 15:20
@svcnvidia-nemo-ci svcnvidia-nemo-ci removed the waiting-on-maintainers Waiting on maintainers to respond label Jul 27, 2026
@yuki-97
yuki-97 merged commit 80555d3 into NVIDIA-NeMo:main Jul 28, 2026
79 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI:Lfast Runs a fast test suite and re-use nightly `main` container (but sync dependencies to PRs version) community-request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Standard dataset config keys are silently ignored by built-in response dataset loaders

4 participants