Skip to content

feat: derive config defaults from values, not from fields_set - #4922

Closed
mikasenghaas wants to merge 1 commit into
feat/run-level-fieldsfrom
feat/explicit-auto
Closed

mikasenghaas wants to merge 1 commit into
feat/run-level-fieldsfrom
feat/explicit-auto

Conversation

@mikasenghaas

@mikasenghaas mikasenghaas commented Dec 3, 2026 •

Copy link
Copy Markdown
Member

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 SLURM rl.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:

  • A P/D prefill engine under bidirectional KV transfer lost its recompute policy. The dumped kv_load_failure_policy = None counted as set.
  • An SFT online-eval engine gained vllm.tokenizer on the second parse. The trainer fills tokenizer.name only after the hook that copies it to inference.

build_component_config also had to rebuild each component with model_construct(_fields_set=…) to carry the section's record along.

Idea. Derive each default from the value, not from whether the user wrote it. None means "derive it", or "auto" where None already means something else, as freeze_moe_router and weight_decay already do. A resolved config then holds the derived value and parses to the same result.

Field "Derive it" value Derived value
inference.kv_load_failure_policy None recompute on a bidirectional P/D prefill engine, else vLLM's default
inference.vllm.enable_expert_parallel None (was false) on for a disaggregated deployment
inference.vllm.enable_prefix_caching None on with KV cache offload
inference.vllm.max_lora_rank None the trainer's LoRA rank
orchestrator.inference_metrics_roles None the roles of a disaggregated deployment
*.client.admin_base_url None the engine behind a single-node router
trainer.model.moe.dispatch.num_reserved_sms "auto" (was 16) 32 with llep, else 16
  • build_component_config now validates plainly and keeps no fields_set.
  • test_resolved_configs_parse_to_the_same_components dumps every entrypoint case, parses the dump again, and compares dump_components().
  • model_fields_set reads go from 14 to 4. Out of scope:
    • data_parallel_size and api_server_count belong to the engine sizing, which the next PR moves into one function.
    • client.base_url has 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 None now 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 gets recompute. Set "fail" for vLLM's default.
  • orchestrator.inference_metrics_roles = "None" with a disaggregated deployment: rl now 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_parallel defaults to None in the Python API (it resolves to a bool before any process reads it).
  • build_component_config no longer copies the section's model_fields_set to the component.

No checked-in config sets one of these to None.

Verification

On fcaa8d9, on macOS without torch or vllm:

  • Round trip. Before this PR (on feat: set the run-level fields of rl once #4921, f8fcb74), the probe found two unstable cases: the bidirectional P/D prefill policy (recompute → None) and the SFT online-eval vllm.tokenizer. On this PR, all 17 cases parse to the same components.
  • Launcher output. I dry-ran the 103 launcher cases and diffed every written file against feat: set the run-level fields of rl once #4921. Only the three sft online-eval cases change: engine.json and sft.json add vllm.tokenizer, equal to the model name, which vLLM also uses when it is unset.
  • Tests. The config, launch, router, resume, client and dynamo tests: 745 passed.
Change removed Result
prefill policy derived from the value (back to fields_set) test_resolved_configs_parse_to_the_same_components[rl-pd-bidirectional] and test_bidirectional_prefill_recomputes_unless_a_policy_is_set[None] fail
SFT tokenizer fill falls back to the model the sft-online-eval round trips fail
expert_parallel_default for a disaggregated deployment test_pd_role_engines_bake_in_their_role_vllm_and_env fails
num_reserved_sms auto → 32 with llep test_mega_moe_reserves_more_sms_for_llep_unless_set fails

Merge order

Stacked on #4921 (#4899 → #4905 → #4909 → #4919 → #4921 → this PR).

🤖 Generated with Claude Code


Note

Medium Risk
Behavior change for explicit None on several inference/orchestrator/client fields and for build_component_config round-trips; misconfigured re-parsed JSON could diverge from pre-PR semantics if users relied on null meaning “off.”

Overview
Stops using Pydantic model_fields_set for most config defaults so re-parsing a resolved JSON (launcher output, pod CLI) produces the same component configs as the first parse.

build_component_config now only calls model_validate and no longer rebuilds components with model_construct(_fields_set=…).

Defaults are value-driven: None (or "auto" for num_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 prefill kv_load_failure_policy, orchestrator inference_metrics_roles, client admin_base_url, LoRA max_lora_rank, and MoE num_reserved_sms (32 with LLEP, else 16). enable_expert_parallel changes from default false to None with shared auto_setup_expert_parallel / expert_parallel_default.

SFT propagates inference.vllm.tokenizer from model name when unset so online-eval engines stay stable on round-trip.

Tests: adds test_resolved_configs_parse_to_the_same_components across entrypoint fixtures; removes the old fields_set assertion on built inference; adds bidirectional KV and LLEP SMS cases.

Breaking: explicit null in 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.

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>
@mikasenghaas

Copy link
Copy Markdown
Member Author

Folded into #4928. The config stack is now four PRs, one per motivation: #4899 (public vs internal configs) → #4909 (a complete config per process) → #4919 (package layout) → #4928 (resolve each value in one place).

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant