@@ -221,6 +221,11 @@ def py():
221221 # the -5 default fights that): does removing the penalty recover acc 0.07 / 0.02?
222222 (1.0 , 0.5 , [0.0 , - 5.0 ]),
223223 (0.5 , 0.0 , [0.0 , - 5.0 ]),
224+ # optimal overlap at cs1 once eep is set right (eep=0): ov0.5 gave 0.5530, so map the rest.
225+ # eep=-5 for cs1-ov0 is the plain cs1-ov0 job above (0.6318).
226+ (1.0 , 0.0 , [0.0 ]),
227+ (1.0 , 0.25 , [0.0 ]),
228+ (1.0 , 0.75 , [0.0 ]),
224229 ]:
225230 for _eep in _eeps :
226231 _seg_e = ChunkSegmentationFromModelBatchedJob (
@@ -280,6 +285,91 @@ def py():
280285 reg (f"{ _x_name } -accuracy.txt" , _metric_x .out_accuracy )
281286 reg (f"{ _x_name } -chunk_idx_mae.txt" , _metric_x .out_chunk_idx_mae )
282287
288+ # --- algorithm variants (batched job only) ---
289+
290+ # 1) word_start_beam: one knob interpolating the argmax heuristic (beam=None, the old default)
291+ # and the exact DP (word_start_heuristic=False).
292+ # cs1-ov0 is where the two endpoints differ most (0.6318 argmax vs 0.2473 exact), so map the curve there:
293+ # wider beam = less pruning = closer to exact, which we expect to get WORSE
294+ # (search-error effect, cf. the NMT beam-search curse).
295+ for _beam in [0.0 , 1.0 , 2.0 , 5.0 , 10.0 , 20.0 ]:
296+ _seg_bm = ChunkSegmentationFromModelBatchedJob (
297+ dataset_dir = dl_ds_buckeye .out_hub_cache_dir ,
298+ dataset_key = "val" ,
299+ model_config = _cfg_hp ,
300+ chunk_size_secs = 1.0 ,
301+ chunk_overlap_secs = 0.0 ,
302+ max_batch_size = 8 ,
303+ word_start_beam = _beam ,
304+ )
305+ _bm_name = f"chunk-align/phi4mm-buckeye-val-cs1-ov0-beam{ _beam :g} "
306+ _seg_bm .add_alias (_bm_name )
307+ reg (f"{ _bm_name } .hdf" , _seg_bm .out_hdf )
308+ _m_bm = CalcChunkAssignmentMetricsJob (
309+ chunk_seg_hdf = _seg_bm .out_hdf ,
310+ dataset_dir = dl_ds_buckeye .out_hub_cache_dir ,
311+ dataset_key = "val" ,
312+ dataset_offset_factors = _DATASET_OFFSET_FACTORS ["buckeye" ],
313+ )
314+ _m_bm .add_alias (f"{ _bm_name } -metric" )
315+ reg (f"{ _bm_name } -accuracy.txt" , _m_bm .out_accuracy )
316+ reg (f"{ _bm_name } -chunk_idx_mae.txt" , _m_bm .out_chunk_idx_mae )
317+
318+ # 2) exit_bias: a global words-per-chunk knob (added to EVERY exit),
319+ # vs empty_exit_penalty which only hits chunks exiting with zero words,
320+ # and which we showed is a pure heuristic artifact.
321+ # Swept with eep=0 so the bias is the only exit knob.
322+ # bias=0 is the existing cs2-ov0-eep0 (0.8535).
323+ for _bias in [- 2.0 , - 1.0 , 1.0 , 2.0 ]:
324+ _seg_eb = ChunkSegmentationFromModelBatchedJob (
325+ dataset_dir = dl_ds_buckeye .out_hub_cache_dir ,
326+ dataset_key = "val" ,
327+ model_config = _cfg_hp ,
328+ chunk_size_secs = 2.0 ,
329+ chunk_overlap_secs = 0.0 ,
330+ empty_exit_penalty = 0.0 ,
331+ max_batch_size = 8 ,
332+ exit_bias = _bias ,
333+ )
334+ _eb_name = f"chunk-align/phi4mm-buckeye-val-cs2-ov0-eep0-bias{ _bias :g} "
335+ _seg_eb .add_alias (_eb_name )
336+ reg (f"{ _eb_name } .hdf" , _seg_eb .out_hdf )
337+ _m_eb = CalcChunkAssignmentMetricsJob (
338+ chunk_seg_hdf = _seg_eb .out_hdf ,
339+ dataset_dir = dl_ds_buckeye .out_hub_cache_dir ,
340+ dataset_key = "val" ,
341+ dataset_offset_factors = _DATASET_OFFSET_FACTORS ["buckeye" ],
342+ )
343+ _m_eb .add_alias (f"{ _eb_name } -metric" )
344+ reg (f"{ _eb_name } -accuracy.txt" , _m_eb .out_accuracy )
345+ reg (f"{ _eb_name } -chunk_idx_mae.txt" , _m_eb .out_chunk_idx_mae )
346+
347+ # 3) length_norm: score a word by its per-token MEAN log-prob instead of the sum,
348+ # so a multi-token word is not systematically dearer to emit than the single exit token.
349+ # Compare against the plain cs*-ov* jobs (cs2-ov0 0.8747, cs10-ov2.5 0.9856, cs1-ov0 0.6318).
350+ for _cs , _ov in [(2.0 , 0.0 ), (10.0 , 2.5 ), (1.0 , 0.0 )]:
351+ _seg_ln = ChunkSegmentationFromModelBatchedJob (
352+ dataset_dir = dl_ds_buckeye .out_hub_cache_dir ,
353+ dataset_key = "val" ,
354+ model_config = _cfg_hp ,
355+ chunk_size_secs = _cs ,
356+ chunk_overlap_secs = _ov ,
357+ max_batch_size = 8 ,
358+ length_norm = True ,
359+ )
360+ _ln_name = f"chunk-align/phi4mm-buckeye-val-cs{ _cs :.0f} -ov{ _ov :g} -lnorm"
361+ _seg_ln .add_alias (_ln_name )
362+ reg (f"{ _ln_name } .hdf" , _seg_ln .out_hdf )
363+ _m_ln = CalcChunkAssignmentMetricsJob (
364+ chunk_seg_hdf = _seg_ln .out_hdf ,
365+ dataset_dir = dl_ds_buckeye .out_hub_cache_dir ,
366+ dataset_key = "val" ,
367+ dataset_offset_factors = _DATASET_OFFSET_FACTORS ["buckeye" ],
368+ )
369+ _m_ln .add_alias (f"{ _ln_name } -metric" )
370+ reg (f"{ _ln_name } -accuracy.txt" , _m_ln .out_accuracy )
371+ reg (f"{ _ln_name } -chunk_idx_mae.txt" , _m_ln .out_chunk_idx_mae )
372+
283373 # fp32 batched (default fast path) at cs30, to check the fast path (esp. batched_logprobs) is
284374 # bit-exact vs the fp32 single-seq reference below. The bf16 sweep diverges more for small
285375 # chunks, so this isolates real logic differences from bf16 numerical noise.
0 commit comments