Repository navigation
Description
Summary
An apply-to-all (A2A) equation whose RHS embeds a multi-source reducer whose per-row feeder is arrayed over the iterated dimension is declined for aggregate-node hoisting by combined_read_slice (src/simlin-engine/src/ltm_agg.rs), falls back to the conservative (un-hoisted) path, and the resulting arrayed loop score variable is silent garbage -- approximately -250 at every step for a trivially reinforcing feedback loop. Not zero (a recognizable "unscored" sentinel), but an actively wrong, plausible-looking number.
Fixture shape
D1 = {r1, r2}, D2 = {c1, c2}
matrix[D1, D2] -- arrayed dep
frac[D1] -- per-row feeder, arrayed over the iterated dim
growth[D1] = SUM(matrix[D1, *] * frac[D1]) -- A2A over D1, reducer embedded as a sub-expression
... a feedback loop closed through (matrix or frac) and growth, trivially reinforcing
With LTM enabled the model compiles and simulates, the arrayed loop is enumerated (loop id u1), but its loop score reads ~-250 at every step. Verified identical at commit 1dcf899f and its parent -- pre-existing on main, not a regression of the ltm-core-batch work.
Mechanism
combined_read_slice(src/simlin-engine/src/ltm_agg.rs, ~line 892) folds each arrayed source reference'scompute_read_sliceand requires them all to agree. Herematrix[D1,*]reads[Iterated(D1), Reduced]whilefrac[D1]reads[Iterated(D1)]-- incompatible slices, so it returnsNone(the documented multi-source-disagreement carve-out, see the function's doc comment: "a multi-source reducer whose references read incompatible slices").- No synthetic
$⁚ltm⁚agg⁚{n}node is minted; the reducer references stay on the conservative (un-hoisted) path. - Whatever the conservative path emits for these references (
src/simlin-engine/src/db/ltm/link_scores.rs) feeds a partial equation built bysrc/simlin-engine/src/ltm_augment.rswhose magnitude is garbage -- the constant ~-250per step. The exact partial-equation defect producing that magnitude has not been root-caused; that is part of this issue's scope.
Why it matters
Medium. This is the silent-garbage class #737 was about, but for the arrayed-feeder / un-hoisted case: a legal, not-exotic model shape (per-row total = SUM(row * per-row coefficient), e.g. weighted row sums with per-region weights) where LTM produces a confidently wrong arrayed loop score with no diagnostic. Unlike #534's conservative fallback (correct-but-imprecise over-approximation), the fallback here is actively wrong, and unlike #737's silent zero (at least recognizable as degenerate), this is a non-zero garbage value a user could mistake for a real dominance signal.
Components affected
src/simlin-engine/src/ltm_agg.rs--combined_read_slice(the multi-source slice-disagreement carve-out that declines the hoist) andcollect_arrayed_source_slicessrc/simlin-engine/src/db/ltm/link_scores.rs-- what gets emitted for the un-hoisted conservative path for these reference sitessrc/simlin-engine/src/ltm_augment.rs-- the partial-equation builder producing the garbage magnitude
Possible approaches
- Hoist this shape. A feeder arrayed only over the iterated dim (
frac[D1]with read slice[Iterated(D1)]) is per-agg-slot constant: for each row of the arrayed agg it plays exactly the role the scalar feeder plays in theSUM(arrayed[*] * scalar)case (ltm: loop-score builder's PureScalar fast path never routes a loop through a scalar synthetic agg node (silent zero loop score) #737/ltm: synthetic agg node for SUM(arrayed[*] * scalar) with a scalar target fails to compile and is stubbed to constant 0 #738's fixture).combined_read_slicecould accept the combination "one source withReducedaxes + feeders whose slices are a sub-slice of the iterated axes" instead of requiring literal agreement, routing the feeder through the agg as a per-row input. - Independently, fix the conservative path so un-hoisted is never garbage. Whatever
link_scores.rs+ltm_augment.rsemit for a declined reducer must be either correct (conservative over-approximation a la ltm: mapped-dimension sliced reducers are not hoisted into aggregate nodes (compute_read_slice declines a remapped iterated axis) #534) or visibly degraded (0 + anAssemblywarning, the ltm: synthetic agg node for SUM(arrayed[*] * scalar) with a scalar target fails to compile and is stubbed to constant 0 #738 pattern) -- root-causing the ~-250 magnitude is the first step. This half matters even if the hoist is extended, since other carve-outs (bare dynamic index, mapped dims ltm: mapped-dimension sliced reducers are not hoisted into aggregate nodes (compute_read_slice declines a remapped iterated axis) #534) share the conservative path. - A characterization test pinning the current end-to-end behavior (compiles, simulates, loop enumerated, garbage magnitude documented) should land first, mirroring
ltm_array_agg.rs::scalar_feeder_scalar_target_loop_compiles_and_is_well_formed.
Discovery context
Demonstrated by a reviewer during adversarial review on branch ltm-core-batch (out of scope for that batch). Verified identical at 1dcf899f and its parent.
Tracking
Part of LTM tracking epic #488 and the array-support umbrella #273. Related but distinct: #737 (the scalar-feeder sibling -- hoisted agg, loop-builder never routes through it, silent zero; fixed on branch ltm-core-batch), #738 (scalar-target agg fragment fails to compile, stubbed to 0 with a warning), #534 (the mapped-dimension hoisting carve-out in compute_read_slice -- different decline reason, and its conservative fallback is correct-but-imprecise rather than garbage), #514 (the Phase-4 sliced-reducer hoisting work that introduced the carve-out list).
Activity
engine: decline an LTM table-argument index that reads at runtime