fix: honor every eval.defaults key and restore per-dataset stop / min_new_tokens - #2242
Open
keepkeen wants to merge 1 commit into
Open
fix: honor every eval.defaults key and restore per-dataset stop / min_new_tokens#2242keepkeen wants to merge 1 commit into
keepkeen wants to merge 1 commit into
Conversation
…_new_tokens Two related holes in the eval config resolution: 1. `eval.defaults` was only consulted for the 14 names in the two spec tables. Every other EvalDatasetConfig field placed under defaults — rm_type, repetition_penalty, skip_special_tokens, app_service, eval_task_timeout, ... — was silently dropped. The documented contract (examples/eval_multi_task/README.md) is "eval.defaults defines inference parameters shared by every dataset entry", with no subset restriction. Worse, a typo'd key in defaults was silently accepted, while the same typo inside a dataset entry raises from the dataclass constructor. Fix: after the spec pass, merge the remaining defaults keys with setdefault (dataset entry still wins), and reject unknown keys with a ValueError so defaults and dataset entries are held to the same standard. 2. Per-dataset `stop` / `stop_token_ids` / `min_new_tokens` were accepted from the YAML but read nowhere: the THUDM#1005 refactor moved their sibling fields (temperature, top_p, top_k, max_response_len) into the spec tables and deleted the resolution lines for these three without a replacement. `--eval-min-new-tokens` has been defined but dead since then. An eval config setting different stop strings than training silently evaluated with the training-time --rollout-stop. Fix: restore the pre-THUDM#1005 resolution in eval_rollout_single_dataset and add the three fields to DATASET_RUNTIME_SPECS (arg fallbacks: rollout_stop, rollout_stop_token_ids, eval_min_new_tokens) so they also flow through eval.defaults like their siblings. Adds tests/test_eval_config.py (cpu-unittest job) pinning the full resolution order — dataset entry > eval.defaults > args — for spec and non-spec fields, plus the unknown-key rejection.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Two related holes in eval config resolution:
eval.defaultssilently drops most keys, and per-datasetstop/stop_token_ids/min_new_tokensare accepted from the YAML but never read.Bug 1:
eval.defaultsonly works for 14 fieldsbuild_eval_dataset_configsconsultsdefaultsexclusively through_pick_from_mapping(defaults, spec["default_keys"])for the names inDATASET_RUNTIME_SPECS+DATASET_SAMPLE_SPECS. Every otherEvalDatasetConfigfield placed undereval.defaults—rm_type,repetition_penalty,skip_special_tokens,no_stop_trim,custom_generate_function_path,app_service,eval_task_timeout,eval_early_stop_*,metadata_overrides— is silently discarded. With a config in the shippedexamples/eval_multi_taskstyle:max_response_lenandtop_papply, butrm_typeandrepetition_penaltycome outNone— the eval runs with no reward model, silently. The README documents no subset restriction: "eval.defaultsdefines inference parameters shared by every dataset entry. Override them inside an individual dataset block if needed."The typo handling is also asymmetric: a misspelled key in
defaultsis silently accepted, while the same misspelling inside a dataset entry raisesTypeErrorfrom the dataclass constructor.Bug 2:
stop/stop_token_ids/min_new_tokensare dead configEvalDatasetConfigaccepts all three from the YAML, but the sampling params hardcode the training-time values:and
min_new_tokensis never set —--eval-min-new-tokenshas zero readers in the repo. This is a regression: #1005 ("Fix evaluation parameter parsing") moved the sibling fields (temperature,top_p,top_k,max_response_len) into the spec tables and deleted the resolution lines for these three without a replacement (later #8f732538 re-addedskip_special_tokens/no_stop_trim/repetition_penalty, but not these). An eval config that setsstop: ["</answer>"]for one dataset silently evaluates with the training stop strings instead — changing eval scores with no warning.Fix
defaultskeys withsetdefault(dataset entry still wins), and reject unknown keys with aValueErrorlisting the valid names —defaultsand dataset entries now get the same strictness.stop/stop_token_ids/min_new_tokensineval_rollout_single_dataset, and add the three fields toDATASET_RUNTIME_SPECS(arg fallbacksrollout_stop/rollout_stop_token_ids/eval_min_new_tokens) so they also flow througheval.defaultslike their siblings — which revives--eval-min-new-tokens.Resolution order for every field is now uniformly: dataset entry >
eval.defaults> args.Test
New
tests/test_eval_config.pyin thecpu-unittestjob: non-spec defaults reaching every dataset, dataset-entry override priority, the three restored fields resolving dataset > defaults > args, unknown-key rejection, and the existing spec-field arg fallback. Four of five cases fail onmain.