[RFC][Config] Add torchtitan_configs for full training configurations (#4114) - #4176
Closed
pianpwk wants to merge 1 commit into
Closed
[RFC][Config] Add torchtitan_configs for full training configurations (#4114)#4176pianpwk wants to merge 1 commit into
pianpwk wants to merge 1 commit into
Conversation
pianpwk
requested review from
fegin,
tianyu-l,
wconstab and
wwwjn
as code owners
August 17, 2026 22:32
This was referenced Aug 17, 2026
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.
Stack from ghstack (oldest at bottom):
Stack from ghstack
(oldest at bottom):
TL;DR
We plan to remove most CLI options, especially the options related to
models, optimization, and parallelism, in the future. All users should
use configuration programming to create their own
Trainer.Config,which can be done easily with a coding agent. If CLI is a must, users
can create their own CLI on top of the configuration system.
Motivation
There are several problems with the current configuration + CLI system.
The two major ones developers hit today:
update_from_config: some configurations can only be decided afterthe CLI is parsed, so every model has to provide an
update_from_configto update the model configurations (e.g., sharding, optimization,
backends) from the "new" configurations coming out of the CLI. This path
is indirect and painful to maintain.
CLI option exposure: when developers add a new feature they have to
think about whether and how to expose the option, because the CLI is the
entry to expose a knob. This is further amplified by the first issue --
developers also need to understand how (or if)
update_from_configinteracts with the new knob.
Implementation
torchtitan_configsis a package that lives outside the core torchtitanfolder and is installed by
pip install. It is not going to contain alluse cases, because there are exponentially many combinations. It will
only contains the test configs and some golden configs we verify on
certain hardware. Users can put their own configs in this folder to
launch a job.
Tentative Plan
Introduce the torchtitan_configs package and freeze the CLI (this
PR): Users should launch with
MODULE=torchtitan_configs.tests CONFIG=llama3_debugmodel_fsdp2_cp2 ./run_train.shand no further CLIoptions. Replace "tests" and "llama3_debugmodel_fsdp2_cp2" to fit your
setting. To change options, change the configuration instead of
appending a CLI flag. The existing flags still work, but only for
backward compatibility; they are no longer the recommended way to
configure a run.
Move all the integration tests to use the new way to launch jobs.
Demonstrate and document how to replace a module: With the future
removal of the CLI, using a different implementation/optimization is
done through config replacement. This step will document and demonstrate
how to achieve that. [CP] Pluggable CP attention via cp_method + attention_sharding #3978 is
the tentative PR (still WIP).
Optimization composability: Now that optimizations are composed by
replacing configs, we need to make sure these optimizations still
compose. This needs more discussion and thought on the composability,
and on whether there is a composability issue at all. We also need to
understand if
input_dst_shardingis still required.Split
update_from_config: It does three different things:validation, derivation of the sharding configs, and the RoPE cache
resize. Move the validation to one place so that every model does not
need to implement its own, and leave the RoPE resize where it is. This
step does not change any CLI behavior.
Move the derivation into the configuration functions, which removes
the rest of
update_from_config: The derivation reads--parallelism.enable_sequence_paralleland--parallelism.expert_parallel_degree, and the CLI can still changethem after the configuration function has run, so these two options have
to go first. This is why steps 5 and 6 come late: users need time to
move off these flags, and step 2 already removes the integration tests'
dependency on them. This is also a BC breaking step, both for the two
flags and for any out-of-repo model that implements its own
update_from_config.Restructure configurations and trim CLI options and leave only the
necessary ones: This is a huge BC breaking step. Tentative proposal,
very early version, read this only if you are interested,
https://gist.github.com/fegin/276f0b6d3d7a80ae2573516b25917166