Skip to content

ltm-augment: TIME-bearing reducer bodies break the PREVIOUS(agg) anchor in body-aware partials (nonlinear arm attributes full time-drift to every row) #763

Description

@bpowers

Summary

The body-aware per-row source[e] -> $⁚ltm⁚agg⁚{n} partials break the PREVIOUS(agg) anchor identity whenever the reducer body references TIME, a time builtin (PULSE/STEP/RAMP), or a nested PREVIOUS(x). freeze_pinned_body (src/simlin-engine/src/ltm_augment.rs ~3457) freezes only model dependencies, and reducer_body_ctx_parts (src/simlin-engine/src/db/ltm/link_scores.rs ~975) deliberately excludes TIME from the dep set -- so in a "fully frozen" term, TIME (and the time builtins, and nested PREVIOUS(x)) stays LIVE. A row whose every model dep is frozen therefore does NOT reproduce the previous-step value: R(all-frozen terms) != PREVIOUS(agg).

On the NONLINEAR arm (MIN/MAX/STDDEV), the partial's anchor subtraction R(live row, frozen rows) - PREVIOUS(agg) then attributes the full time-drift to EVERY row -- including provably non-influential ones -- destroying the frozen-argmin-scores-0 property.

Repro (demonstrated at eab752c8 on ltm-fix-batch-2)

grow = 1 + MIN(pop[*] * TIME)

The south row is never the argmin (its true ceteris-paribus partial is 0 at every step), yet it scores 0.9999, 0.9920, 0.9764, ... -- the drift pop_north_prev * delta-TIME duplicated onto every row.

Scope by arm

Why it matters

Low-medium severity: silently wrong per-row link scores (and the loop scores through those rows inherit the drift) for time-bearing reducer bodies -- an uncommon but perfectly legal equation shape. NOT a regression: the pre-#762 bare substitution emitted worse garbage for the same body, and the delta-ratio fallback would also score ~1 here. But it is a demonstrated wrong-value class that was invisible in the rustdoc (a doc caveat citing this issue is being added on the branch).

Component

  • src/simlin-engine/src/ltm_augment.rs (freeze_pinned_body, the MIN/MAX/STDDEV builders in generate_nonlinear_partial)
  • src/simlin-engine/src/db/ltm/link_scores.rs (reducer_body_ctx_parts's TIME exclusion)

Fix directions

  1. Bail to delta-ratio when the pinned body references TIME, a time builtin, or PREVIOUS -- detectable during pinning. Honest relabeling (delta-ratio is the documented conservative fallback) rather than a better value.
  2. Freeze time-like terms too by anchoring both evaluations of the guard form at the SAME time sample, so the anchor identity R(all-frozen) = PREVIOUS(agg) holds again. A deeper change to the guard form, but recovers the frozen-argmin-scores-0 property.

Cross-references (related, NOT duplicates)

Discovery context

Demonstrated during adversarial review of the GH #762 work on branch ltm-fix-batch-2 (commit eab752c8).

Metadata

Metadata

Assignees

No one assigned

    Labels

    ltmLoops that Matter (LTM) analysis subsystem

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions