mattbitzesty commited on
Commit
36ec872
·
verified ·
1 Parent(s): a7cf629

Factorial channel ablation: --physics-mode (gamma_only/headspace_only) in train.py + evaluator matching + factorial job script

Browse files
Files changed (1) hide show
  1. src/pino/train.py +23 -2
src/pino/train.py CHANGED
@@ -43,6 +43,14 @@ SMOKE_TEST_CONFIG = {
43
  # Idea3 physics-off ablation: when True, pad_trajectory_collate zeroes the
44
  # physics tensor for every batch (train + val). Set from --physics-off-train.
45
  _PHYSICS_OFF_TRAIN = False
 
 
 
 
 
 
 
 
46
 
47
  def pad_trajectory_collate(batch: list[dict[str, Any]]) -> dict[str, Any]:
48
  """
@@ -96,8 +104,17 @@ def pad_trajectory_collate(batch: list[dict[str, Any]]) -> dict[str, Any]:
96
  # block and physics-informed heads receive no physics signal during BOTH
97
  # training and validation. This is a fair trained baseline (not an
98
  # inference-time shock), isolating the physics channel's contribution.
99
- if _PHYSICS_OFF_TRAIN:
100
  physics = torch.zeros_like(physics)
 
 
 
 
 
 
 
 
 
101
 
102
  return {
103
  "tokens": tokens,
@@ -289,10 +306,14 @@ def main():
289
  parser.add_argument("--use-gamma", action="store_true", help="Add the UNIFAC blend-interaction (gamma) 3rd physics channel; requires a gamma-augmented dataset (physics_gamma field)")
290
  parser.add_argument("--split-strategy", choices=["molecule", "formula"], default="molecule", help="molecule = strict molecule-disjoint holdout (default, used for frozen-task headline results); formula = random formula-level holdout (E1 physics-gamma substantivity experiment; discloses molecule leakage for measured-Poucher eval power)")
291
  parser.add_argument("--physics-off-train", action="store_true", help="Idea3 ablation: zero the physics tensor for every batch (train+val) so the model is a fair no-physics baseline")
 
292
  args = parser.parse_args()
293
 
294
- global _PHYSICS_OFF_TRAIN
295
  _PHYSICS_OFF_TRAIN = bool(getattr(args, "physics_off_train", False))
 
 
 
296
 
297
  logging.basicConfig(
298
  level=logging.INFO,
 
43
  # Idea3 physics-off ablation: when True, pad_trajectory_collate zeroes the
44
  # physics tensor for every batch (train + val). Set from --physics-off-train.
45
  _PHYSICS_OFF_TRAIN = False
46
+ # Factorial physics-channel ablation (idea-3 follow-up): which channel carries
47
+ # the drydown gain? Channels are [x_liquid, log10 OAV, log10 gamma_prop].
48
+ # full : all channels live (default; physics_gamma arm)
49
+ # off : all zeroed (physics_off arm; legacy --physics-off-train)
50
+ # gamma_only : keep channel 2 (log gamma), zero 0-1 -- isolates the
51
+ # non-redundant blend-interaction channel
52
+ # headspace_only : keep channels 0-1, zero channel 2 -- the E2-redundant part
53
+ _PHYSICS_MODE = "full"
54
 
55
  def pad_trajectory_collate(batch: list[dict[str, Any]]) -> dict[str, Any]:
56
  """
 
104
  # block and physics-informed heads receive no physics signal during BOTH
105
  # training and validation. This is a fair trained baseline (not an
106
  # inference-time shock), isolating the physics channel's contribution.
107
+ if _PHYSICS_OFF_TRAIN or _PHYSICS_MODE == "off":
108
  physics = torch.zeros_like(physics)
109
+ elif _PHYSICS_MODE == "gamma_only":
110
+ # Keep only channel 2 (log gamma); zero x_liquid and log10 OAV.
111
+ physics = physics.clone()
112
+ physics[..., 0] = 0.0
113
+ physics[..., 1] = 0.0
114
+ elif _PHYSICS_MODE == "headspace_only":
115
+ # Keep channels 0-1 (x_liquid, log10 OAV); zero the gamma channel.
116
+ physics = physics.clone()
117
+ physics[..., 2] = 0.0
118
 
119
  return {
120
  "tokens": tokens,
 
306
  parser.add_argument("--use-gamma", action="store_true", help="Add the UNIFAC blend-interaction (gamma) 3rd physics channel; requires a gamma-augmented dataset (physics_gamma field)")
307
  parser.add_argument("--split-strategy", choices=["molecule", "formula"], default="molecule", help="molecule = strict molecule-disjoint holdout (default, used for frozen-task headline results); formula = random formula-level holdout (E1 physics-gamma substantivity experiment; discloses molecule leakage for measured-Poucher eval power)")
308
  parser.add_argument("--physics-off-train", action="store_true", help="Idea3 ablation: zero the physics tensor for every batch (train+val) so the model is a fair no-physics baseline")
309
+ parser.add_argument("--physics-mode", choices=["full", "off", "gamma_only", "headspace_only"], default="full", help="Factorial channel ablation: full = all channels; off = all zeroed; gamma_only = keep only log-gamma channel (zero x_liquid/OAV); headspace_only = keep x_liquid/OAV (zero gamma). Applied during BOTH train and val so each arm is a fair trained baseline.")
310
  args = parser.parse_args()
311
 
312
+ global _PHYSICS_OFF_TRAIN, _PHYSICS_MODE
313
  _PHYSICS_OFF_TRAIN = bool(getattr(args, "physics_off_train", False))
314
+ _PHYSICS_MODE = getattr(args, "physics_mode", "full")
315
+ if _PHYSICS_OFF_TRAIN:
316
+ _PHYSICS_MODE = "off"
317
 
318
  logging.basicConfig(
319
  level=logging.INFO,