Skip to content

LTM: raw link scores are unusable for ranking; relative link scores not exposed #652

Closed

Description

@bpowers

Summary

Sim.get_links() returns each link's raw LTM link-score time series. The intuitive thing a user does -- rank links by Link.average_score() magnitude to find "the most important links" -- surfaces numerically degenerate links instead of meaningful ones. There is no relative (normalized) link score exposed, even though the engine computes everything needed to derive one.

Observed behavior

On a mid-size model run, the top links by |average raw score| had magnitudes like 6.4e22 and 1.1e16, all on links between near-constant policy/parameter variables. These are not the important links -- they are an artifact of the link-score formula.

This is inherent to the LTM link-score definition: the denominator is the change in the target variable, so links into variables that barely change (near-constant parameters, equilibria) produce astronomically large scores. The LTM literature notes exactly this -- raw scores "can become very large ... near equilibria where denominators approach zero." Consequently, raw link scores are not comparable across different target variables, and ranking links globally by raw magnitude is meaningless.

The established fix: relative link score

The LTM literature's answer is the relative link score: for each target variable, normalize a link's score by the sum of |link scores| of all inputs into that same target at each timestep. This yields a [0, 1] value -- "the fraction of this variable's change attributable to this input" -- which is comparable across the model and is the correct ranking key.

References: Schoenberg 2020, section 4; the LoopX link-thickness discussion in the thesis.

The engine already computes the per-link scores and knows each link's to target, so the relative score is derivable without new simulation machinery -- it just isn't exposed.

Why it matters

  • Correctness / usability: the most natural user workflow (rank links by importance) currently produces misleading results. Users will draw wrong conclusions about which causal links drive model behavior.
  • Consistency with loop-level work: loop scores already have a relative (partition-normalized) counterpart (rel_loop_score); links have no equivalent exposed, leaving the link-level story incomplete.
  • Developer experience: this is a core part of the LTM value proposition ("see which links/loops drive behavior"), so the gap directly undercuts the feature.

Component(s) affected

  • src/simlin-engine -- link-score analysis (where per-link scores and their to targets are available; analyze_links_core or equivalent).
  • src/libsimlin -- FFI surface for get_links.
  • src/pysimlin -- Sim.get_links() / Link (average_score() docstring, and the new relative-score surface).

Possible approaches

Either:

  • (a) Add a Link.relative_score series alongside the raw score. Compute it in analyze_links_core by grouping links by their to target and normalizing each link's score against the per-target sum of |score| per timestep (SAFEDIV/all-zero guarded). This mirrors how rel_loop_score normalizes per cycle partition.
  • (b) Add a Sim.get_links(relative=True) flag that returns the normalized series.

Independent of which is chosen, the pysimlin Link.average_score() docstring should be updated to warn that raw scores are not comparable across different target variables and point users at the relative score for ranking.

Relationship to existing issues

This is distinct from the existing relative-scoring issues, which are all loop-level:

None of those address link-level relative scores or the get_links() / Link.average_score() API surface. #507 (surface synthetic variable names via FFI) is also orthogonal -- it is about addressing existing series by name, not about computing/exposing a relative link score.

Discovery context

Found during the 2026-05-31 LTM-on-C-LEARN experience session, while trying to rank links from a pysimlin Sim.get_links() run. Part of epic #488.

Activity

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

    @bpowers
    OwnerAuthor

    Fixed in PR #668 (merged as f9f850d). Relative link scores (per-target normalization: link score / per-timestep sum of |scores| over all scored inputs into the same target; signed, [-1,1], denom_summand NaN/Inf semantics) are computed in engine::ltm_post::compute_rel_link_scores and attached in libsimlin's shared analyze_links_core, so the VM and wasm paths cannot diverge (parity-tested column-for-column). Exposed as additive SimlinLink fields, pysimlin Link.relative_score + average_relative_score, and the TS engine; Link.average_score()/max_score() docstrings now warn raw scores are not comparable across targets. Caveat documented: in exhaustive mode only in-loop edges carry series, so the denominator covers the scored subset; discovery mode scores every causal edge. The degenerate-huge-raw-vs-active ranking scenario is pinned in miniature (red-verified). Per-element link scores for arrayed models remain a separate gap: #665.

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

    engineenhancementltm

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions