Add integer max-log (frontier_lite) metric mode to the trellis engine - #589
Conversation
9d40d2b to
94c0c1d
Compare
|
Review-panel follow-up pushed, two execution-confirmed defects fixed: (1) score_alpha=0 under maxlog_int no longer evaluates suffix scores, so NegInf-quantized suffix rows from ~1e-17-probability mechanisms can no longer poison and prune feasible states (repro test added; previously flipped the decoded label); (2) merge_indistinguishable is now rejected under maxlog_int — the XOR merge sums coset mass, which silently changed 'Exact' Viterbi answers (verified on the M1 fixture model). Also: integer prune ties now match upstream's order (score desc, log-mass desc, key asc; integer ties are not measure-zero), the suffix-table scale check moved out of the innermost scoring loop, and a +inf quantizer debug assertion was added. All guards mutation-tested; fixtures unchanged. |
94c0c1d to
21820ad
Compare
|
Post-panel delta review fixes: the release-mode quantizer test is now cfg-gated (it asserted a debug-only panic and failed under the repo's release-mode just test/check-all gates, while CI's dev-profile lane stayed green) with the release fallback pinned explicitly; a nonzero score_alpha that quantizes to zero at the configured scale is now rejected loudly instead of silently disabling suffix scoring (e.g. score_alpha=0.4 at int_metric_scale=1); and the alpha short-circuit carries a why-comment so it cannot be 'simplified' back into the sentinel-poisoning bug. |
21820ad to
cc73cf1
Compare
…le gating, invariant assertions, discriminating tests
…e route metric, adopt upstream integer tie order
…der maxlog, document the alpha short-circuit
cc73cf1 to
9ccb2fc
Compare
Summary
Stacked on #587; retarget to
devwhen that merges. Adds upstream'sfrontier_lite/maxlog_intmetric mode: the DP runs on scaledint64masses with max-log (Viterbi) semantics, for both the binary and N-ary kernels.TrellisConfiggainsmetric_mode(LogSumExpFloatdefault,MaxLogInt) andint_metric_scale(default 1024), named as upstream names them.MaxLogInt,log_evidenceis the winning route mass (not a log-sum),logical_massesare per-label best-route masses, andrunner_up_gapis a route-mass margin; the result rustdoc and both decoder docs say so explicitly (Rust API only for now).Delta=infto the negative sentinel and clamps it to zero, silently turning "no delta pruning" into "prune to score-ties" — it changed a decoded label in a direct probe. PECOS rejects non-finite delta underMaxLogIntat construction instead.FrontierCommitteerejectsMaxLogInt: its arbitration ranks on coset-mass posteriors, and one ranking component degenerates to a constant under max-log. BP-Trellis pins the float metric internally (its config exposes no metric knob).Verification
upstream_maxlog_fixtures.json): 5 binary models decoded by upstream's native binary engine underfrontier_liteat scales 1024 and 64, wide and pruned; PECOS matches status, predicted label, every terminal mass,log_evidence, and the top-mass gap within 1e-9. Themaxlog_metric_flips_winnerfixture proves the metric actually switched: the same model and syndrome decode to label 0 under the float metric and label 1 under max-log.±2.5/scale, the case that separates half-away from ties-to-even), and fast-path/generic-path agreement.cargo teston the three engine crates (16 suites), coldclippy --all-targets -- -D warningsincludingpecos-rslib-exp,cargo fmt --check, and the full pre-commit lane all pass.Follow-up (separate PR): Python bindings expose the metric knob (Phase C).