Repository navigation
Description
Summary
generate_nonlinear_partial (src/simlin-engine/src/ltm_augment.rs) -- the MIN/MAX nested-binary and STDDEV unrolled-variance per-row source->agg partial builders -- is body-blind for non-bare reducer bodies. It substitutes the bare source elements into the analytic partial shape, ignoring any arithmetic inside the reducer argument, producing silent garbage link scores.
This is the NONLINEAR-arm sibling of #744. The #744 fix (commit 5a533bf6 on branch ltm-fix-batch-2) taught the LINEAR (SUM/MEAN) per-row partial to derive from the reducer BODY -- live row, frozen co-reduced rows and co-sources, via the pin_body_to_row / freeze_pinned_body machinery -- but the nonlinear arm still builds its MIN/MAX/STDDEV shapes from the bare elements.
Repro (confirmed empirically)
grow = 1 + MIN(pop[*] * 0.25)
emits the per-row partial
MIN(pop[north], PREVIOUS(pop[south]))
-- raw pop units compared against a 0.25-scaled aggregate -- producing garbage link scores of roughly 2884 on the probe fixture.
Why it matters
Medium severity: silent garbage link scores (and hence loop scores) for MIN/MAX/STDDEV reducers with ANY arithmetic inside the argument, e.g. MIN(cost[*] * weight). Bare bodies like MIN(pop[*]) remain correct (the #483 analytic partials are sound for those).
Component
src/simlin-engine/src/ltm_augment.rs(generate_nonlinear_partial: the MIN/MAX nested-binary builder and the STDDEV unrolled-variance builder)
Fix shape
Extend the #744 pin/freeze machinery (pin_body_to_row / freeze_pinned_body, built in 5a533bf6) so each term_for in the nonlinear builders is the row-pinned BODY rather than the bare element; bail to the documented delta-ratio fallback when the body is unpinnable -- the same contract the linear arm follows.
Cross-references (related, NOT duplicates)
- ltm: source->agg link score wrong-signed for hoisted multi-source reducer with sign-flipping coefficient (SUM linear shortcut ignores the body's coefficient) #744 -- the linear (SUM/MEAN) sibling; its fix builds the pin/freeze machinery this issue should reuse.
- ltm-augment: STDDEV/RANK partials silently fall back to delta-ratio #483 (closed) -- STDDEV analytic partial, correct for BARE bodies only; this issue covers non-bare bodies.
- ltm: un-hoisted multi-source iterated-dim-feeder reducer emits silent garbage arrayed loop score (combined_read_slice slice-disagreement carve-out) #743 -- un-hoisted multi-source reducers; this issue covers hoisted reducers on the nonlinear classification arm.
- docs/tech-debt.md entry 27 -- the resolved STDDEV/RANK bare-body work.
- Epic epic: Loops that Matter (LTM) -- open work #488 (Augmentation group).
Discovery context
Confirmed during GH #744 implementation on branch ltm-fix-batch-2 (commit 5a533bf6); the limitation is noted generically in generate_nonlinear_partial's rustdoc as of that commit, pending this issue number.
Activity