Skip to content

ltm: expose cycle-partition id/size on discovered loops so singleton-partition loops can be grouped or filtered #671

Closed

Description

@bpowers

Summary

Model.analyze() ranks loops by mean partition-relative contribution (the #543 semantics: a loop's importance is its share within its own cycle partition). This is correct, but it has a UX consequence: every loop that is alone in its cycle partition ranks at exactly 1.0 and therefore sorts at the very top -- above the genuinely interesting coupled-core loops.

On C-LEARN this means the dozen 2-variable gas-uptake loops (hfc[x] -> hfc_uptake[x], each in its own singleton partition) all pin to 1.0 and dominate the top of the ranking, pushing the coupled climate-core loops down. The pysimlin docstrings (src/pysimlin/simlin/sim.py:377, src/pysimlin/simlin/model.py:317) already acknowledge that a loop alone in its partition degenerates to +/-1, but a caller has no way to act on that: there is no accessor for a loop's cycle-partition id or the partition's loop count, so callers cannot group, filter, or down-weight singleton-partition loops.

Why it matters

This is correct per the method but a UX trap: the top of the discovery ranking is occupied by trivially-dominant isolated loops, and the user has no structured way to tell them apart from coupled loops that are dominant against competition. Surfacing the partition structure lets callers (pysimlin scripts, the MCP loop-dominance surface, the diagram) collapse or de-emphasize singletons and focus on contested partitions.

Components affected

  • src/simlin-engine (cycle-partition data already exists: LtmVariablesResult.loop_partitions, per-slot for A2A loops)
  • src/libsimlin/src/analysis.rs (would need an accessor to expose partition id / size per loop)
  • src/pysimlin/simlin/sim.py, src/pysimlin/simlin/model.py, src/pysimlin/simlin/run.py (Loop / structural-loop surface)

Proposal

Expose the cycle partition -- the partition id and/or the partition's loop count -- on discovered/structural loops through the FFI and pysimlin, so callers can group or filter. Optionally add a secondary sort key (e.g. partition size descending, or "contested partitions first") so singleton-partition loops don't crowd out coupled-core loops by default.

Relationship to existing issues

Distinct from #543, which is about the ranking key inside discovery (rank_and_filter ranking by raw avg_abs_score instead of partition-relative contribution). #543 fixes which loops are kept/ordered inside the engine; this issue assumes the (post-#543) partition-relative ranking is correct and asks to expose the partition structure to callers so the singleton-at-1.0 artifact can be grouped/filtered at the consumer layer. Also related to the existing partition-aware filtering discussion in #310 / tech-debt #28, but those concern truncation order, not surfacing the partition to callers.

Severity

Low (capability / UX gap; the ranking is method-correct, the issue is consumer-side legibility).

How discovered

Identified during an LTM "experience report" exercise on C-LEARN (notebooks/clearn_ltm_experience.ipynb, 2026-06-02): the dozen singleton gas-uptake loops all ranked at 1.0 above the coupled core.

Part of epic #488.

Activity

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

    @bpowers
    OwnerAuthor

    Implemented in #686 (02c88ab). Both halves: (1) cycle partitions are now first-class discovery output -- FoundLoop.partition / DiscoveryResult.partitions in the engine, SimlinDiscoveredLoop.partition + SimlinDiscoveredPartition in the FFI, Loop.partition + Analysis.partitions in pysimlin; (2) the default ranking is "contested partitions first": competing loops keep the mean-relative order, trivially-isolated (singleton-partition) loops sort after all of them and are dropped first under the cap. On C-LEARN the carbon-climate core now tops analyze() and the gas-uptake singletons trail it. The exhaustive/pinned-surface parity gap is split out as #685.

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