Skip to content

Anytime pipeline on large joints: stage deadlines, sparse stationary solve, ladder fixes - #54

Merged
Autoplectic merged 7 commits into
mainfrom
caps-lp-time-limit
Nov 14, 2026
Merged

Autoplectic merged 7 commits into
mainfrom
caps-lp-time-limit

Conversation

@Autoplectic

@Autoplectic Autoplectic commented Nov 13, 2026 •

Copy link
Copy Markdown
Member

Summary

These changes clear the last three 4-state survey timeouts. Each one was a single call that ignored the pipeline's deadline, or a computation that grew too fast with the size of the joint.

Stage deadlines

  • Generator caps: branch-and-bound child LPs get the time left as a HiGHS time_limit. A cut-off LP keeps its parent's bound, so the cap stays valid; the root LP always runs to the end. One degenerate node LP had run more than 8 minutes past a 90 s deadline.
  • dit fallbacks: dit's exact and Wyner optimizers take no deadline, so they are skipped above 30 causal-state pairs (logged as a skipped dit fallbacks stage). They had used 190–760 s of a 900 s budget on 30–70-pair joints. Every 3-state survey joint has at most 21 pairs, so the 3-state benchmark is unaffected.
  • Memory lifts: memory_lift_search stops a start in progress at its deadline. Its first start used to run in full regardless (more than 14 minutes).
  • Line-split polish: _optimize and _optimize_coupled take a deadline, and the pipeline's line-split stage passes it. One polish had run more than 10 minutes over budget. The targeted search and coupled_search are unchanged: by design they always finish one polish (or the ε-machine seed).

Builds

  • Sparse stationary solve: stationary_distribution_hmm solves chains with more than 2,000 states sparsely. The dense matrix_rank and eig are $O(n^3)$ and never finished on a 50k-cap reverse machine. Symbolic weights, several closed classes, or a failed residual check fall back to the dense path and its warnings.
  • No double build: the ladder and try_build_bidirectional reuse the machines the preflight built instead of building them twice, which roughly halves build time.
  • max_reverse_states (off by default): a ladder build whose truncated reverse machine is larger than this is classified as an explosion. The survey driver sets it to 1,000, so such cases fall back to window bounds.
  • Renamed the private exception to _DeadlineReachedError (lint rule N818).

Results

80-topology 4-state sample (cpfci survey4_v5.jsonl; ladder budget 300 s, pipeline budget 900 s, hard timeout 1500 s):

case before after
[[0,1],[2,None],[2,3],[1,0]] (95 pairs) timeout [0.932, 1.109] in 902 s
[[None,1],[2,1],[1,3],[3,0]] (144 pairs) timeout [1.073, 1.231] in 900 s
[[0,1],[0,2],[3,None],[1,None]] timeout 50k build has 8,949 reverse states, so it is treated as an explosion; window bounds [1.872, 1.968] in 415 s

Totals: 32 brackets (10 certified), 35 window brackets, 13 skipped, 0 timeouts (was 3). The size cap reclassifies no other case.

Test plan

  • New tests:
    • child LPs get the time left and keep the parent's bound (patched HiGHS);
    • dit fallbacks are skipped above the pair limit;
    • memory_lift_search stops inside a start (fake clock);
    • ALM polish returns at an expired deadline;
    • sparse vs dense stationary distributions agree (hypothesis), the sparse path declines two closed classes, and a 20,000-state chain solves in about 4 s;
    • an oversized ladder build is classified as an explosion.
  • Generator, stationary and mixed-state suites: 157 passed
  • ruff check, ruff format --check, ty check (no errors)

Ryan James and others added 4 commits November 13, 2026 14:22
…ft deadline

Three stages ran far past their deadlines on 4-state survey joints with
95-144 causal-state pairs:
- generator caps: one degenerate node LP ran 8+ minutes; child LPs now get
  the time left as a HiGHS time_limit (a cut-off LP keeps its parent's bound);
- dit exact/Wyner fallbacks take no deadline; skipped above 30 pairs (every
  3-state survey joint has at most 21);
- memory_lift_search ran its whole first start regardless of the deadline;
  a start in progress now stops at it.

Co-authored-by: Cursor <cursoragent@cursor.com>
_optimize and _optimize_coupled take a deadline; every L-BFGS-B objective
raises once it passes and the run returns its last finished step. The
pipeline's line-split stage passes its deadline and checks it between
floors (one polish ran past the budget for over 10 minutes on a 144-pair
4-state joint). Rename the private exception to _DeadlineReachedError (N818).

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
… build

Above 2000 states, stationary_distribution_hmm builds a sparse transition
matrix from the edges and solves pi (P - I) = 0 with one equation replaced
by the normalization. The dense path's matrix_rank and eig are O(n^3) and
never finished on a 50k-state reverse machine in the ladder. Symbolic
weights, several closed classes or a failed residual check fall back to the
dense path.

The ladder and try_build_bidirectional reuse the machines built by the
preflight (_preflight) instead of inferring and building them twice.

Co-authored-by: Cursor <cursoragent@cursor.com>
@Autoplectic

Copy link
Copy Markdown
Member Author

Added: a sparse stationary solve for chains with more than 2,000 states (the dense matrix_rank + eig never finished on a 50k-state reverse machine), and the ladder and try_build_bidirectional now reuse the preflight's machines instead of building them twice. Together these take the last 4-state case's ladder build from never finishing to 354 s. That case still times out, because the pipeline then has to construct its problem from a truncated bidirectional machine with tens of thousands of reverse states; that is a policy question rather than a solver bug. Tests: 157 passed across the generator, stationary and mixed-state suites; ruff and ty clean.

…xplosions

A ladder build whose reverse machine exceeds max_reverse_states (off by
default) is reported as an explosion so surveys use window bounds. The last
4-state survey timeout built an 8,949-state truncated reverse machine at the
50k cap, and the pipeline then spent its whole budget setting up the problem.

Co-authored-by: Cursor <cursoragent@cursor.com>
@Autoplectic Autoplectic changed the title Anytime pipeline on large joints: LP time limits, dit gate, memory-lift and ALM deadlines Anytime pipeline on large joints: stage deadlines, sparse stationary solve, ladder fixes Nov 14, 2026
Ryan James and others added 2 commits November 14, 2026 08:17
…(Ubuntu CI took 31 s)

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>

# Conflicts:
#	sofic/generators/generative_search.py
@Autoplectic
Autoplectic merged commit 8f22409 into main Nov 14, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant