Skip to content

Keep time budgets on truncated and exploding builds - #87

Merged
Autoplectic merged 3 commits into
mainfrom
truncated-path-deadlines
Dec 3, 2026
Merged

Autoplectic merged 3 commits into
mainfrom
truncated-path-deadlines

Conversation

@Autoplectic

@Autoplectic Autoplectic commented Dec 2, 2026 •

Copy link
Copy Markdown
Member

With time_budget, generative_model now keeps to its budget on truncated and exploding bidirectional builds. Before, the build, the persistent criteria, the exact common information multistart and the dit fallbacks could each run far past it: n3-t059-d3 of the binary 3-state dataset ran 814 s of a 300 s budget, 573 s of them in separating_optima.

Changes

  • Build. The first build stops at half the budget. The mixed-state enumeration, the ε-machine minimization and the bidirectional construction check a deadline (new keyword on build_mixed_state_presentation, MealyHMM.mixed_state_presentation, EpsilonMachine.from_hmm, infer_reverse_epsilon_machine and build_bidirectional_epsilon_machine) and raise MixedStateDeadlineError, a MixedStateExplosionError. A stopped build is classed as an explosion with budget_exhausted set, and the forward-only bracket runs with the time left. The retry ladder skips caps at or below one that has already exploded (it used to build at 10,000 reverse states again) and forecasts from that build's time.
  • Persistent criteria. cryptic_order, cryptic_order_from_graph and power_automaton take a deadline and raise TimeoutError past it; the block persistent crypticities stop between lengths. The pipeline gives them a tenth of the time left; past it the cryptic orders are None.
  • Machines. Once the budget is spent only the ε-machine is offered, so the bracket keeps an upper bound.
  • separating_optima. Checks its deadline before every start after the first, whether or not a start has succeeded, and inside the SLSQP objective (_DeadlineReachedError); the first start still runs to the end.
  • Window bound. A bracket still open after the searches gets a second future-window pass with the time left: after the HMM search in _forward_only_result, and after _bracket_search on truncated builds (in the fifth of the budget the searches leave). _branch_and_bound now returns its open leaves in pop order and can resume from them, so n nodes and then m more branch exactly as n + m nodes; the second pass resumes the first pass's stronger window length for ten times its boxes, so the bound only rises.
  • Found in testing.
    • With a budget, simplex chains no lighter than the ε-machine are not lifted. A 78-state reverse chain took 23 s past its stage's deadline.
    • The exact stage's dit fallbacks and the lifted channel's dit run stop at their deadlines; dit's optimizers get a timed objective. Once the earlier stages kept to their shares, minimal_wyner_model on a 2-state ternary truncation with a 20 s budget ran over 30 minutes in dit's Wyner basin hopping.

Differences from the plan

  • The plan's second window pass was a fresh L = 3 pass with more nodes. A fresh pass could not reach the first pass's L = 2 bound on n3-t015-d3 in the time left, so the second pass resumes the stronger first-pass length instead.
  • The build deadline is checked in the ε-machine minimization and the bidirectional construction as well as in the mixed-state enumeration. On n3-t059-d3 at 60 s, the 46.6 s build spent 16.4 s minimizing and 23.3 s in the bidirectional construction.

Measured

  • n3-t059-d3 (default build a 1,261-state truncation) at 60 s: generative_model took 72 to 78 s; it now takes 60.0 s and returns [0.8827307, 1.0795992].
  • The six binary 3-state processes whose reverse machines explode at 1,000 states, at 300 s, at sofic's default caps and at 1,000 reverse states, against the same runs on Bracket exploding builds from the forward machine #86's branch:
process default caps: #86 → #87 1,000 reverse states: #86 → #87
n3-t015-d2 certified, 169 s → certified, 111 s certified, 134 s → certified, 96 s
n3-t015-d3 [1.5661730, 1.5661901], 309 s → certified, 97 s [1.5661852, 1.5661901], 136 s → certified, 91 s
n3-t056-d0 [0.1577373, 0.1581745], 300 s → [0.1577390, 0.1581745], 300 s [0.1577367, 0.1581677], 219 s → [0.1577391, 0.1581677], 300 s
n3-t059-d3 [0.8827307, 0.8926702], 302 s → [0.8827929, 0.8926702], 300 s [0.8827307, 1.0795992], 228 s → the same, 300 s
n3-t061-d4 [1.4317970, 1.5671187], 800 s → [1.4638397, 1.4846025], 300 s [1.4615467, 1.4846025], 157 s → [1.4646028, 1.4846025], 300 s
n3-t123-d1 [0.8811250, 0.8821391], 301 s → [0.8811742, 0.8821391], 300 s [0.8811607, 0.8821391], 191 s → [0.8816557, 0.8821391], 300 s

Every run ends by 310 s, and no bound is worse than on #86. n3-t015-d3 certifies in both settings. Nine lower bounds rise, seven of them through the second window pass, which is why runs that ended early now take the whole budget. n3-t061-d4's default build stops at its 150 s deadline, and the forward-only bracket lowers its upper bound to the HMM search's generator. The #86 runs were made on a busier machine, so their times and first window passes are not strictly comparable.

Tests

  • Fake-clock tests for each stage; the ladder does not repeat an exploded cap; a resumed coverage bound equals one longer search; a slow test that n3-t059-d3's default build ends within 10% of a 60 s budget.
  • Full fast suite: 2978 passed, 9 skipped. The touched slow tests pass. ruff check, ruff format --check, ty check and the docs build with -W are clean.

Ryan James added 3 commits December 1, 2026 20:53
With a time budget, generative_model's first bidirectional build stops at half
the budget: the mixed-state enumeration, the ε-machine minimization and the
bidirectional construction check a deadline and raise MixedStateDeadlineError,
a MixedStateExplosionError, so a stopped build is classed as an explosion and
the forward-only bracket gets the rest. The retry ladder no longer rebuilds a
cap that has exploded.

The persistent criteria, the candidate machines after the ε-machine,
separating_optima's later starts, the exact stage's dit fallbacks and the
lifted dit run stop at their deadlines; with a budget, simplex chains no
lighter than the ε-machine are not lifted. A bracket still open after the
searches gets a second future-window pass with the time left, resuming the
first pass's branch and bound at the stronger window length.
On Windows before Python 3.13, time.monotonic() ticks every 15.6 ms, so a deadline of time.monotonic() can still equal the clock after the first start of separating_optima, which then begins a second one. The full matrix failed this way on windows-latest with 3.11 and 3.12.
@Autoplectic
Autoplectic merged commit a29fa59 into main Dec 3, 2026
77 of 84 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