Skip to content

ltm: declined element-mapped sliced reducer emits a non-compiling scalar link score on the conservative path (loop scores stub to 0) #758

Closed

Description

@bpowers

Summary

When a mapped-dimension sliced reducer is declined for aggregate-node hoisting -- specifically the element-mapped case behind the #756 positional-only gate -- the reference falls back to the conservative (un-hoisted) path, and the conservative link score it emits does not compile: the emitter mints $⁚ltm⁚link_score⁚matrix→growth with dims=[], a SCALAR equation whose body references the apply-to-all (arrayed) idents matrix and growth. Fragment compilation fails (22 Assembly warnings on the probe fixture), and every loop score through the edge is silently stubbed to constant 0.

This directly contradicts the documented contract. The rustdoc above link_score_var_name (src/simlin-engine/src/ltm_augment.rs, ~1570-1583 at 74f53661) says of the still-declined cases ("a mapped sliced reducer the correspondence declines (element-mapped -- GH #756 -- or reverse-declared -- GH #757)"): "a coarse conservative score is the right semantics for all of those." Empirically false: the declined cases get no score at all -- a warned zero-stub. The matching claim in the RefShape doc in src/simlin-engine/src/db/analysis.rs is likewise wrong for this case. (A doc fix citing this issue is queued on the ltm-core-batch branch.)

Fixture shape

State = {CA, NY}            -- target dim
Region = {west, east}       -- source dim, with an EXPLICIT element map State -> Region
                               (element-wise map declared on the dimension, not a
                                positional/name correspondence)
matrix[Region, D2]
growth[State] = 1 + SUM(matrix[State, *])   -- inline sliced reducer over the mapped pair
... a feedback loop closed through matrix and growth

Because the State/Region correspondence is an explicit element map, mapped_element_correspondence declines it (the #756 positional-only gate in src/simlin-engine/src/ltm_agg.rs), the reducer is not hoisted into a $⁚ltm⁚agg⁚{n} node, and the reference stays on the conservative path. The conservative per-shape link score is then emitted scalar (dims=[]) while its equation references the arrayed A2A variables -- fragment compile fails, and the loop-score equations that reference the never-compiled link score stub to 0.

Verified byte-identical at the parent of 74f53661: pre-existing, not a regression of the #534 work. In fact the #534 fix removed this fate for positional mappings by hoisting them; only the still-declined cases remain on the broken conservative path:

Why it matters

Medium severity. Silent zero loop scores plus a fragment-diagnostic warning flood for any model with an inline sliced reducer over an element-mapped dimension pair. The model class is currently rare because element maps barely work end-to-end (#756 executed-lowering bug, #753 different-cardinality compile failure), but the failure is the worst kind: the model compiles and simulates fine, LTM output looks plausible, and the affected loops just read 0.

It also invalidates the safety story used to justify the #756/#757 declines: "the conservative path is still correct, just imprecise" (see #534's "Why it matters", and the rustdoc cited above). The conservative path for these shapes is not coarse-but-correct -- it is non-compiling.

Components affected

  • src/simlin-engine/src/db/ltm/link_scores.rs -- emit_per_shape_link_scores and the dims computation for the conservative Bare/Wildcard link-score variable (emits dims=[] for an edge whose endpoints are arrayed)
  • src/simlin-engine/src/ltm_augment.rs -- the per-shape partial-equation builder (the scalar equation body referencing A2A idents), and the link_score_var_name rustdoc making the false "right semantics" claim
  • src/simlin-engine/src/db/analysis.rs -- the RefShape doc with the matching claim; emit_edges_for_reference's conservative cross-product arm (the edges whose loop scores reference the broken name)
  • src/simlin-engine/src/ltm_agg.rs -- mapped_element_correspondence / the engine: permuted element maps were read by position, giving wrong values #756 positional-only gate (the decline that routes this shape onto the conservative path)

Possible approaches

Discovery context

Unmasked during adversarial review of the GH #534 work on branch ltm-core-batch (commit 74f53661, "engine: hoist mapped-dimension sliced reducers into agg nodes"). The #534 fix hoists positionally-mapped sliced reducers, which made the remaining declined cases (element-mapped, reverse-declared) the only inhabitants of this conservative path -- probing them revealed the path was never compiling for arrayed endpoints.

Tracking

Part of LTM tracking epic #488. Related but distinct:

Activity

  1. added
    ltm
    on Jun 10, 2026
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