Skip to content

Commit 6cebd1c

Browse files
ItsMrLinmeta-codesync[bot]
authored andcommitted
Remove arithmetic transforms from InSampleUniform registration (facebook#5117)
Summary: Pull Request resolved: facebook#5117 `InSampleUniformGenerator` selects existing arms for LILO labeling -- it does not generate new points and therefore does not need parameter normalization. The `Cont_X_trans` transform chain includes `Log`, `Logit`, and `UnitX`, which perform arithmetic whose forward/reverse round-trip introduces ~1e-15 IEEE 754 rounding. This can produce arms with slightly different parameter values and signatures ("ghost arms"), preventing the experiment from reusing existing `Arm` objects. Downstream, LILO source resolution fails because no arm matches by signature. This diff registers `InSampleUniform` with only the structural/type transforms (`RemoveFixed`, `OrderedChoiceToIntegerRange`, `OneHot`, `IntToFloat`) needed for categorical, ordered-choice, integer, and fixed parameter compatibility. The arithmetic transforms (`Log`, `Logit`, `UnitX`) are removed since they serve no purpose for in-sample selection and introduce precision loss. Note: for experiments with `digits` set on `RangeParameter`, the auto-added `Cast` transform also rounds parameter values. In properly configured new experiments this is consistent (Cast untransform re-rounds on the reverse path), but historical experiments may have arms stored with un-rounded values from before Cast handled this correctly. This diff addresses the UnitX/Log/Logit source of precision loss; historical data inconsistencies are a separate concern. Reviewed By: andycylmeta Differential Revision: D98970704 fbshipit-source-id: e3baeb66156393f81492bd02208bcaac3f7b9aa2
1 parent efd72a6 commit 6cebd1c

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

ax/adapter/registry.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,10 +216,17 @@ class GeneratorSetup(NamedTuple):
216216
generator_class=UniformGenerator,
217217
transforms=Cont_X_trans,
218218
),
219+
# In-sample generators only select existing arms -- they do not need
220+
# arithmetic transforms (Log, Logit, UnitX) whose forward/reverse
221+
# round-trip introduces ~1e-15 IEEE 754 rounding. This rounding
222+
# produces "ghost arms" with slightly different parameter values
223+
# and signatures, preventing the experiment from reusing existing
224+
# Arm objects. Structural/type transforms are kept for compatibility
225+
# with categorical, ordered-choice, integer, and fixed parameters.
219226
"InSampleUniform": GeneratorSetup(
220227
adapter_class=RandomAdapter,
221228
generator_class=InSampleUniformGenerator,
222-
transforms=Cont_X_trans,
229+
transforms=[RemoveFixed, OrderedChoiceToIntegerRange, OneHot, IntToFloat],
223230
),
224231
"ST_MTGP": GeneratorSetup(
225232
adapter_class=TorchAdapter,

0 commit comments

Comments
 (0)