Repository navigation
feat: derive config defaults from values, not from fields_set - #4922
Closed
mikasenghaas wants to merge 1 commit into
Closed
mikasenghaas wants to merge 1 commit into
mikasenghaas wants to merge 1 commit into
Conversation
Many defaults applied only when the user left a field unset, read from model_fields_set. A resolved config (configs/<entrypoint>.json, or a pod's CLI flags) counts every field as set, so its second parse could build other components than the first: - A P/D prefill engine under bidirectional KV transfer lost its recompute policy, since the dumped None counted as set. - An SFT online-eval engine gained vllm.tokenizer on the second parse. Derive these defaults from the value instead: None (or "auto" for num_reserved_sms) means "derive it". build_component_config then validates plainly and no longer carries the section's fields_set. A test parses every entrypoint's resolved config again and compares the components. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Dec 3, 2026
Member
Author
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.
Summary
Why. Many config defaults applied only when the user left a field unset, which the validators read from
model_fields_set. A resolved config counts every field as set:configs/<entrypoint>.json, the single-node SLURMrl.json, or a pod's CLI flags. So parsing a resolved config again could build other components than the first parse did. Two cases did:recomputepolicy. The dumpedkv_load_failure_policy = Nonecounted as set.vllm.tokenizeron the second parse. The trainer fillstokenizer.nameonly after the hook that copies it to inference.build_component_configalso had to rebuild each component withmodel_construct(_fields_set=…)to carry the section's record along.Idea. Derive each default from the value, not from whether the user wrote it.
Nonemeans "derive it", or"auto"whereNonealready means something else, asfreeze_moe_routerandweight_decayalready do. A resolved config then holds the derived value and parses to the same result.inference.kv_load_failure_policyNonerecomputeon a bidirectional P/D prefill engine, else vLLM's defaultinference.vllm.enable_expert_parallelNone(wasfalse)inference.vllm.enable_prefix_cachingNoneinference.vllm.max_lora_rankNoneorchestrator.inference_metrics_rolesNone*.client.admin_base_urlNonetrainer.model.moe.dispatch.num_reserved_sms"auto"(was16)llep, else 16build_component_confignow validates plainly and keeps nofields_set.test_resolved_configs_parse_to_the_same_componentsdumps every entrypoint case, parses the dump again, and comparesdump_components().model_fields_setreads go from 14 to 4. Out of scope:data_parallel_sizeandapi_server_countbelong to the engine sizing, which the next PR moves into one function.client.base_urlhas a real URL as its default, and runtime code reads it directly. Its check already resolves to a stable value, which the round-trip test covers.Breaking
An explicit
Nonenow means "derive it", where it meant "off" or "vLLM's default" before. Each case below needs an explicit value to keep the old result:inference.kv_load_failure_policy = "None"with bidirectional P/D: prefill now getsrecompute. Set"fail"for vLLM's default.orchestrator.inference_metrics_roles = "None"with a disaggregated deployment:rlnow derives the roles.client.admin_base_url = "None"behind a single-node router: the admin client now targets the engine directly.inference.vllm.enable_expert_paralleldefaults toNonein the Python API (it resolves to a bool before any process reads it).build_component_configno longer copies the section'smodel_fields_setto the component.No checked-in config sets one of these to
None.Verification
On fcaa8d9, on macOS without torch or vllm:
recompute→None) and the SFT online-evalvllm.tokenizer. On this PR, all 17 cases parse to the same components.engine.jsonandsft.jsonaddvllm.tokenizer, equal to the model name, which vLLM also uses when it is unset.fields_set)test_resolved_configs_parse_to_the_same_components[rl-pd-bidirectional]andtest_bidirectional_prefill_recomputes_unless_a_policy_is_set[None]failsft-online-evalround trips failexpert_parallel_defaultfor a disaggregated deploymenttest_pd_role_engines_bake_in_their_role_vllm_and_envfailsnum_reserved_smsauto→ 32 withlleptest_mega_moe_reserves_more_sms_for_llep_unless_setfailsMerge order
Stacked on #4921 (#4899 → #4905 → #4909 → #4919 → #4921 → this PR).
🤖 Generated with Claude Code
Note
Medium Risk
Behavior change for explicit
Noneon several inference/orchestrator/client fields and forbuild_component_configround-trips; misconfigured re-parsed JSON could diverge from pre-PR semantics if users relied onnullmeaning “off.”Overview
Stops using Pydantic
model_fields_setfor most config defaults so re-parsing a resolved JSON (launcher output, pod CLI) produces the same component configs as the first parse.build_component_confignow only callsmodel_validateand no longer rebuilds components withmodel_construct(_fields_set=…).Defaults are value-driven:
None(or"auto"fornum_reserved_sms) means “derive at validation time” instead of “only if the user omitted the field.” Touchpoints include expert parallel on disaggregated deployments, prefix caching with KV offload, bidirectional P/D prefillkv_load_failure_policy, orchestratorinference_metrics_roles, clientadmin_base_url, LoRAmax_lora_rank, and MoEnum_reserved_sms(32 with LLEP, else 16).enable_expert_parallelchanges from defaultfalsetoNonewith sharedauto_setup_expert_parallel/expert_parallel_default.SFT propagates
inference.vllm.tokenizerfrom model name when unset so online-eval engines stay stable on round-trip.Tests: adds
test_resolved_configs_parse_to_the_same_componentsacross entrypoint fixtures; removes the oldfields_setassertion on built inference; adds bidirectional KV and LLEP SMS cases.Breaking: explicit
nullin JSON now triggers derivation where it previously meant off or vLLM default (documented in the PR body).Reviewed by Cursor Bugbot for commit fcaa8d9. Bugbot is set up for automated code reviews on this repo. Configure here.