Skip to content

ltm: degenerate link score for disjoint-dimension arrayed-to-arrayed edges with per-element target equations #510

Closed

Description

@bpowers

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:

  1. try_cross_dimensional_link_scores (in src/simlin-engine/src/db_ltm.rs, nested in model_ltm_variables) returns None when the target is arrayed, so the edge falls through to emit_per_shape_link_scores.
  2. link_score_dimensions returns an empty dimension list for the incompatible-dims case.
  3. build_arrayed_link_score_equation (in src/simlin-engine/src/ltm_augment.rs) then builds an Equation::Arrayed whose per-element partials are not well-defined without a shared target dimension.
  4. 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 via scalarize_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 from model_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

  1. added
    ltm
    on May 9, 2026
  2. bpowers commented on May 13, 2026

    @bpowers
    OwnerAuthor

    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 (an Equation::Arrayed over the target's dims, holding source[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 a CompilationDiagnostic Warning is emitted with no link-score variable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    ltm

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions