dwarf warm-cache silently under-warms any config that sets particle_type.n_classes #59
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
dwarf warm-cachebuilds its config fromDEFAULT_CONFIGwith only the conditioning and router axes overridable (giant/tools/warm_setup_cache.py), so it has no way to expressstage2_model.particle_type.n_classes. Under the defaultparticle_type.target = "onehot"it therefore always resolvesresolve_type_n_classestoconditioning.particle.emb_dim(16) and warms the species top-N map undertopn_key("pdg", 16).Any config that sets
n_classesto something else —configs/baseline.tomlsets 32 — then misses that entry and rebuilds it duringgiant train, which is a full scan of every parquet file (build_pdg_topn_map_from_files). That is the most expensive single piece of the setup stage, and it is exactly the workwarm-cacheexists to eliminate. Nothing fails and nothing warns; the run just quietly pays for the scan it was told it wouldn't.Reproduced on a synthetic dataset:
The other cache keys (
val_fraction,seed, both conditioning axes) happen to line up withwarm-cache's defaults for this config, son_classesis the only mismatch — but it is also the only one the CLI cannot be told about.The fix is to let
warm-cachetake the same--configa training run takes and warm from the merged config, rather than re-deriving a partial one from flags.run_setup_stagealready accepts the full merged v0.3 cfg, so this is a wrapper change:Driving it that way is verifiably complete — a second pass over the same data is a clean hit on every section:
Worth keeping the existing flags working for the no-config case, and worth considering whether
--val-fraction/--seed/--particle-conditioning/--material-conditioningshould be rejected alongside--configrather than silently layered over it, since a mismatch there produces the same silent under-warm through the normalizer key instead of the top-N key.Fixed in
d25dfc0on fix/issue-59.warm-cache now accepts --config and resolves everything run_setup_stage needs (val_fraction/seed, conditioning types, both stages' router, stage2_model.particle_type.n_classes, ...) from one gconfig.merge_cli_overrides + validate_config pass — the same pipeline giant train itself uses — instead of a hand-rolled partial override dict. Verified end to end against configs/baseline.toml: a second warm-cache --config configs/baseline.toml run now shows 'pdg top-N map: cache hit (... 32 classes)' instead of rebuilding.
Decision made during planning: when --config is given, the individual --val-fraction/--seed/--particle-conditioning/--material-conditioning/--router*/flags are rejected outright (not silently layered on top) — a hardcoded CLI default overriding an unset config value would reproduce the same silent-mismatch bug one level down. Also removed a hardcoded stage2_model.router/k_max override in the same function that was a no-op today but had the identical latent-clobber problem.
Adding validate_config to warm-cache's path surfaced that the pre-existing test_warm_cache_router_process_warms_proc_map test was exercising a router.type=process + conditioning.particle.type=physical combination that giant train's own validate_config already rejects as incompatible — fixed the test to pass --particle-conditioning embedding, which is what a real process-router run requires. No follow-up filed; this was a same-commit test correction, not a new bug.