Repository navigation
Description
Summary
An LTM link score for an arrayed → arrayed causal edge whose source and target dimensions are disjoint/incompatible, where the target has per-element equations (an Equation::Arrayed target whose from-source is referenced in some element equations and whose dimensions do not intersect the target's) produces a degenerate / meaningless link score.
The current flow:
try_cross_dimensional_link_scores(insrc/simlin-engine/src/db_ltm.rs, nested inmodel_ltm_variables) returnsNonewhen the target is arrayed, so the edge falls through toemit_per_shape_link_scores.link_score_dimensionsreturns an empty dimension list for the incompatible-dims case.build_arrayed_link_score_equation(insrc/simlin-engine/src/ltm_augment.rs) then builds anEquation::Arrayedwhose per-element partials are not well-defined without a shared target dimension.- The Phase-1 follow-up fix added
retarget_ltm_equation_dims, which collapses this to a scalar link-score variable (using the first per-element slot's equation text viascalarize_ltm_equation). That is no worse than the pre-Phase-1 behavior (a"0"-placeholder link score) but it is still not a correct link score for that edge — a single scalar can't represent per-(source-element, target-element) attribution across two unrelated dimensions.
Why this matters
Silent correctness on a (likely rare) edge case: the loop scoring code emits a number for this edge that doesn't mean what a link score is supposed to mean. There's no diagnostic. Any loop crossing such an edge gets a degenerate contribution from it.
This is a pre-existing limitation that Phase 1 of the "LTM Cross-Element Aggregate Scoring" plan made more concrete (it now collapses cleanly to a scalar instead of leaving a zero-dimension Equation::Arrayed), not a regression. It is plausibly very rare: it requires an arrayed→arrayed causal edge with fully disjoint dimensions where the target has per-element (not apply-to-all) equations referencing the source.
Locations
src/simlin-engine/src/db_ltm.rs--try_cross_dimensional_link_scores,link_score_dimensions,emit_per_shape_link_scores,retarget_ltm_equation_dims,scalarize_ltm_equation(all nested in / called frommodel_ltm_variables)src/simlin-engine/src/ltm_augment.rs--build_arrayed_link_score_equation
Possible approaches
- Decide what the correct link score for a disjoint-dims arrayed→arrayed edge with per-element target equations is (per-element partial w.r.t. each referenced source element? a tensor link score? not meaningful at all?), and either implement it or emit a diagnostic explaining the edge is unscoreable.
- If the conclusion is "not meaningful," at minimum surface a compile-time note/warning so a model author knows the loop containing this edge has an approximate score, rather than silently emitting a scalarized stand-in.
Discovery context
Identified during code review of Phase 1 of the "LTM Cross-Element Aggregate Scoring" implementation plan (branch ltm-503-cross-element-agg; design plan under docs/implementation-plans/2026-05-09-ltm-503-cross-element-agg/). Flagged as out of that plan's scope.
Tracking
Part of LTM tracking epic: #488. Related to the LTM array-support umbrella #273 and to #503 (cross-element loops normalizing by Δ-aggregate) — but distinct: #503 is about wildcard-reducer cross-element circuits, this is about disjoint-dimension arrayed→arrayed edges with per-element target equations.
Activity
engine: LTM cross-element aggregate scoring (aggregate nodes) (#519)
doc: add LTM arrays hardening design plan
bpowers commentedon May 13, 2026
Resolved by eb1729b, d18275e — Phase 3 of the LTM arrays hardening plan (docs/design-plans/2026-05-11-ltm-arrays-hardening.md). A disjoint-dimension arrayed→arrayed edge whose per-element-equation target references the source by literal element subscripts now emits one
$⁚ltm⁚link_score⁚{from}[{m}]→{to}per distinct referenced source element (anEquation::Arrayedover the target's dims, holdingsource[m]live in the slots that reference it) instead of the silently scalarised stand-in; if the index is non-literal the edge is unscoreable and aCompilationDiagnosticWarningis emitted with no link-score variable.ltm: scoring-correctness and visibility batch from epic #488 (#775)