Skip to content

ltm: black-box module link formula is a gain (dz/dx), not a link score #675

Closed

Description

@bpowers

Summary

The black-box module link-score formula (black_box_delta_ratio_equation, src/simlin-engine/src/db.rs:380) computes Δto/Δfrom -- the gain dz/dx (a sensitivity), not an LTM link score. Per the LTM papers (docs/reference/ltm--loops-that-matter.md §3.1/§3.3), a link score is |Δ_x(z)/Δz| · sign(Δ_x(z)/Δx) -- normalized by the target's change Δz. The gain lacks the |ẋ/ż|-style weighting that converts a sensitivity into a realized contribution and is what makes link scores chain multiplicatively into path and loop scores.

This is the next-order problem behind the now-closed #307 ("black-box module link scoring collapses magnitude to 1"): #307 replaced the old ABS(Δto/Δto) unit-magnitude form with Δto/Δfrom (epic #488 line 17, "now uses true delta-ratio", commit c16d9a90). That fixed the constant-1 magnitude but the delta-ratio it landed on is still mathematically the wrong quantity for a link score -- it did not satisfy #307's own success criterion #2 ("compute a contribution-consistent magnitude"). #307 is closed, so this gap is currently untracked.

Where it fires

black_box_delta_ratio_equation is invoked for:

  • Module-to-module links (from_is_module && to_is_module) -- unavoidable; modules have no user-visible equation for ceteris-paribus analysis, so there is no link_score_guard_form partial available.
  • Discovery-mode variable-to-module links -- via the Δ(module·output)/Δfrom variant (the composite reference only resolves in exhaustive compilation).

(src/simlin-engine/src/db.rs ~lines 523, 534, 537, 554, 556, 560.)

Why it matters

Any loop product that traverses a module-to-module link (or a discovery-mode variable-to-module link) carries a quantitative bias relative to a true LTM loop score, because a gain factor and a link-score factor do not compose into the same product. For models with chained modules in a feedback loop, ranked loop scores can be over- or under-weighted purely as an artifact of crossing a module boundary scored this way. This is a silent numeric correctness gap, not a crash.

Component(s) affected

  • src/simlin-engine/src/db.rs (black_box_delta_ratio_equation and its module-to-module / discovery-mode call sites)
  • Loop/path-score consumers downstream (src/ltm_finding.rs, src/ltm_post.rs) inherit the bias.

Current documentation state

A caveat documenting this is already in docs/design/ltm--loops-that-matter.md ("Black-box formula caveat", commit cc072973): it states the formula is Δto/Δfrom, "the gain dz/dx ... not a link score", lacking the |Δfrom/Δto|-style weighting, and that "a loop product through such a link is biased relative to a true LTM loop score." The caveat documents the limitation but the fix is untracked -- this issue tracks that.

Possible approaches for resolution

  1. Normalize by Δto and synthesize the sign factor, mirroring link_score_guard_form, with the ceteris-paribus partial replaced by the observed Δto attribution -- i.e. recover |Δ_x(z)/Δz| from the realized change rather than emitting the raw gain.
  2. Compose through the module composite in discovery mode as well (the variable-to-module case), rather than falling back to the Δ(module·output)/Δfrom gain variant.
  3. If a contribution-consistent magnitude genuinely cannot be computed for a module class, ensure the value is surfaced as not-fully-comparable to regular link scores rather than silently entering loop products (cf. ltm: black-box module link scoring collapses magnitude to 1 #307 success criterion server-side support #3).

Discovery context

Identified during a design review on 2026-06-02 while auditing the LTM module-boundary handling. Distinct from the now-closed #307 (which removed the constant-1 magnitude) and from #274 (broad "improve/generalize module support", which does not spell out this critique).

Severity

Major -- quantitative bias in loop scores through chained modules; silent, no crash.

Activity

  1. added
    ltm
    on Jun 2, 2026
  2. bpowers commented on Jun 2, 2026

    @bpowers
    OwnerAuthor

    Implemented in cb2a774. Module→module and variable→module links now reference the target module's composite score wherever the sub-model exposes one (in both exhaustive and discovery mode — the old "composites don't resolve in discovery" restriction was stale post-#548); module→variable links use a real ceteris-paribus partial on the target's equation; the residual no-composite black-box case uses a magnitude-1 signed unit-transfer (exact for single-input stateless modules, perfect-mixing-spirit otherwise) instead of the gain. Verified: an isolated loop through a module→module chain now scores exactly ±1 at any gain, and a SMOOTH-routed loop's score is byte-identical to the fully-expanded explicit-stock model's. Ground truth worth recording: the pre-fix paths weren't merely biased — passthrough-module links were silently dead (composite refs to absent vars reading 0; see #683 for the residual defense-in-depth gap).

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