@@ -171,6 +171,115 @@ def py():
171171 reg (f"{ seg_name } -accuracy.txt" , metric .out_accuracy )
172172 reg (f"{ seg_name } -chunk_idx_mae.txt" , metric .out_chunk_idx_mae )
173173
174+ # Hyper-param sweep at the best 10s setting (cs10/ov2.5): empty_exit_penalty x word_start_heuristic.
175+ # empty_exit_penalty only applies to exiting a chunk with zero words assigned; overlap makes such
176+ # empty chunks more likely, so this is where it should matter. word_start_heuristic=False turns the
177+ # pruning off (every chunk forwards the transcript from word 0 instead of from the prev chunk's best
178+ # exit) -- the exact reference for what the heuristic costs, at ~2x the compute.
179+ # (eep=-5, wsh=True) are the defaults, i.e. the same job as the plain cs10-ov2.5 above (reused).
180+ _cfg_hp = rf .build_dict (Phi4MM , model_dir = dl_phi4mm_dir , grad_wrt = None , model_dtype = "bfloat16" )
181+ for _wsh in [True , False ]:
182+ for _eep in [0.0 , - 2.0 , - 5.0 , - 10.0 , - 20.0 ]:
183+ _seg_hp = ChunkSegmentationFromModelBatchedJob (
184+ dataset_dir = dl_ds_buckeye .out_hub_cache_dir ,
185+ dataset_key = "val" ,
186+ model_config = _cfg_hp ,
187+ chunk_size_secs = 10.0 ,
188+ chunk_overlap_secs = 2.5 ,
189+ empty_exit_penalty = _eep ,
190+ word_start_heuristic = _wsh ,
191+ max_batch_size = 8 ,
192+ )
193+ _hp_name = f"chunk-align/phi4mm-buckeye-val-cs10-ov2.5-eep{ _eep :g} -wsh{ int (_wsh )} "
194+ _seg_hp .add_alias (_hp_name )
195+ reg (f"{ _hp_name } .hdf" , _seg_hp .out_hdf )
196+
197+ _metric_hp = CalcChunkAssignmentMetricsJob (
198+ chunk_seg_hdf = _seg_hp .out_hdf ,
199+ dataset_dir = dl_ds_buckeye .out_hub_cache_dir ,
200+ dataset_key = "val" ,
201+ dataset_offset_factors = _DATASET_OFFSET_FACTORS ["buckeye" ],
202+ )
203+ _metric_hp .add_alias (f"{ _hp_name } -metric" )
204+ reg (f"{ _hp_name } -accuracy.txt" , _metric_hp .out_accuracy )
205+ reg (f"{ _hp_name } -chunk_idx_mae.txt" , _metric_hp .out_chunk_idx_mae )
206+
207+ # empty_exit_penalty across chunk configs (word_start_heuristic=True throughout: the cs10/ov2.5
208+ # ablation showed the heuristic is ~2x cheaper and no worse). Not a full cs x ov grid on purpose:
209+ # eep only fires on a chunk that would exit with ZERO words, so what decides whether it acts at
210+ # all is the empty-chunk pressure -- chunks (~duration/(cs-ov)) vs words (~3/s). cs and ov act
211+ # through that same step, so we sweep along the pressure axis and isolate overlap once at fixed cs.
212+ # eep=-5 is the default -> those cells reuse the plain cs*-ov* jobs above (free).
213+ for _cs , _ov , _eeps in [
214+ # low pressure control (step 25s, ~75 words/chunk): expect eep to do nothing
215+ (30.0 , 5.0 , [0.0 , - 5.0 , - 20.0 ]),
216+ # isolate OVERLAP at fixed cs=10 (cs10/ov2.5 is already swept above): step 5s vs 7.5s
217+ (10.0 , 5.0 , [0.0 , - 2.0 , - 5.0 , - 10.0 , - 20.0 ]),
218+ # isolate CHUNK SIZE at zero overlap (step 2s)
219+ (2.0 , 0.0 , [0.0 , - 2.0 , - 5.0 , - 10.0 , - 20.0 ]),
220+ # collapse probe (step 0.5s -> ~2 chunks/s vs ~3 words/s, so most chunks MUST be empty and
221+ # the -5 default fights that): does removing the penalty recover acc 0.07 / 0.02?
222+ (1.0 , 0.5 , [0.0 , - 5.0 ]),
223+ (0.5 , 0.0 , [0.0 , - 5.0 ]),
224+ ]:
225+ for _eep in _eeps :
226+ _seg_e = ChunkSegmentationFromModelBatchedJob (
227+ dataset_dir = dl_ds_buckeye .out_hub_cache_dir ,
228+ dataset_key = "val" ,
229+ model_config = _cfg_hp ,
230+ chunk_size_secs = _cs ,
231+ chunk_overlap_secs = _ov ,
232+ empty_exit_penalty = _eep ,
233+ max_batch_size = 8 ,
234+ )
235+ _e_name = f"chunk-align/phi4mm-buckeye-val-cs{ _cs :.0f} -ov{ _ov :g} -eep{ _eep :g} "
236+ _seg_e .add_alias (_e_name )
237+ reg (f"{ _e_name } .hdf" , _seg_e .out_hdf )
238+
239+ _metric_e = CalcChunkAssignmentMetricsJob (
240+ chunk_seg_hdf = _seg_e .out_hdf ,
241+ dataset_dir = dl_ds_buckeye .out_hub_cache_dir ,
242+ dataset_key = "val" ,
243+ dataset_offset_factors = _DATASET_OFFSET_FACTORS ["buckeye" ],
244+ )
245+ _metric_e .add_alias (f"{ _e_name } -metric" )
246+ reg (f"{ _e_name } -accuracy.txt" , _metric_e .out_accuracy )
247+ reg (f"{ _e_name } -chunk_idx_mae.txt" , _metric_e .out_chunk_idx_mae )
248+
249+ # word_start_heuristic=False (exact, unpruned) at smaller chunk sizes. At cs10/ov2.5 the exact DP
250+ # was FLAT across eep (0.9847-0.9849) while the heuristic swung (0.976-0.986), i.e. eep acts only
251+ # through the heuristic's argmax, not through the DP itself. If that generalizes, the small-chunk
252+ # degradation is a heuristic failure and eep merely modulates it. Not run at the step-0.5s configs:
253+ # unpruned there means ~1200 chunks x full-transcript forwards per seq, which would blow the 12h cap.
254+ for _cs , _ov , _eeps in [
255+ (2.0 , 0.0 , [0.0 , - 5.0 , - 20.0 ]),
256+ (1.0 , 0.0 , [0.0 , - 5.0 ]),
257+ ]:
258+ for _eep in _eeps :
259+ _seg_x = ChunkSegmentationFromModelBatchedJob (
260+ dataset_dir = dl_ds_buckeye .out_hub_cache_dir ,
261+ dataset_key = "val" ,
262+ model_config = _cfg_hp ,
263+ chunk_size_secs = _cs ,
264+ chunk_overlap_secs = _ov ,
265+ empty_exit_penalty = _eep ,
266+ word_start_heuristic = False ,
267+ max_batch_size = 8 ,
268+ )
269+ _x_name = f"chunk-align/phi4mm-buckeye-val-cs{ _cs :.0f} -ov{ _ov :g} -eep{ _eep :g} -wsh0"
270+ _seg_x .add_alias (_x_name )
271+ reg (f"{ _x_name } .hdf" , _seg_x .out_hdf )
272+
273+ _metric_x = CalcChunkAssignmentMetricsJob (
274+ chunk_seg_hdf = _seg_x .out_hdf ,
275+ dataset_dir = dl_ds_buckeye .out_hub_cache_dir ,
276+ dataset_key = "val" ,
277+ dataset_offset_factors = _DATASET_OFFSET_FACTORS ["buckeye" ],
278+ )
279+ _metric_x .add_alias (f"{ _x_name } -metric" )
280+ reg (f"{ _x_name } -accuracy.txt" , _metric_x .out_accuracy )
281+ reg (f"{ _x_name } -chunk_idx_mae.txt" , _metric_x .out_chunk_idx_mae )
282+
174283 # fp32 batched (default fast path) at cs30, to check the fast path (esp. batched_logprobs) is
175284 # bit-exact vs the fp32 single-seq reference below. The bf16 sweep diverges more for small
176285 # chunks, so this isolates real logic differences from bf16 numerical noise.
0 commit comments