Skip to content

Keep generative_model inside its budget - #75

Merged
Autoplectic merged 2 commits into
mainfrom
generative-budgets
Nov 24, 2026
Merged

Autoplectic merged 2 commits into
mainfrom
generative-budgets

Conversation

@Autoplectic

@Autoplectic Autoplectic commented Nov 24, 2026 •

Copy link
Copy Markdown
Member

Summary

Three causes of generative_model running past time_budget, found by timing the pipeline stage by stage:

  • Deadline inside the belief-free search. hmm_generator_search checked its deadline only between starts and rounds, so one L-BFGS-B run could go far past it (19 s past a 0.5 s deadline at k = 6 on a 3-state binary process). It now checks after every iteration through the optimizer callback (StopIteration, which needs SciPy 1.11, now the minimum).
  • Word enumeration. word_probabilities computed every word over the full alphabet from scratch, and the reproduction check asked for the dense dictionary up to length 8. On the butterfly process (8 symbols) that is 8**8 words, about 1900 s of a 60 s budget. Words are now built by propagating prefix masses, dropping prefixes whose mass is exactly zero, and the check uses the sparse dictionary (same words of positive probability, same values). Length 8 on butterfly takes 0.02 s, and generative_model(butterfly_process(), time_budget=60) certifies C_g = log2 5 in about 4 s.
  • Coverage stages that cannot help. The coverage stages are skipped once the cheaper lower bounds meet the entropy of an ε-machine, which then certifies the bracket. At cryptic order at most 1, the generator coverage bound runs only when the exact path leaves the bracket open. On all 510 dataset processes of cryptic order at most 1, with a 60 s budget, every bracket certifies at its archived value. The generator coverage bound took about 17 s per process (94% of the 2.5 h total) and never supplied the lower bound.

Processes outside these cases are unchanged; for example RGM 2 still gets its certified lower bound from the generator coverage bound.

Re-timed on this branch, the same 510 processes take 2.6 minutes instead of 2.5 hours (median 0.05 s instead of 18.4 s, p90 0.8 s instead of 19.3 s). The 510 brackets and their bound sources are identical. The slowest, 25.5 s, is s3-n2-t0019-d1: SCIP's dual on the exact path stops 4.9e-6 below the optimum, so the deferred generator coverage bound (17.5 s, no help) and Stage 3 run before the heaviest-term bound certifies it in 0.18 s. Running the heaviest-term bound right after an inconclusive exact path would be a possible follow-up.

Test plan

  • tests/test_hmm_search.py: a deadline 0.5 s out stops a k = 6 run in under 5 s (it was 19 s)
  • tests/test_words.py: hypothesis test that sparse and dense word dictionaries match word_probability on random sparse Mealy HMMs (with and without a start state); butterfly length-8 regression test
  • tests/test_generative_model.py: butterfly certifies within its budget with the coverage stages skipped; the SCIP κ = 1 case certifies through the exact path without the generator coverage bound
  • Full suite: 2899 passed, 9 skipped
  • ruff check, ruff format

Ryan James added 2 commits November 24, 2026 13:56
- hmm_generator_search checks its deadline after every L-BFGS-B iteration
  (StopIteration from the optimizer callback; SciPy >= 1.11), so one start no
  longer runs far past it (19 s past a 0.5 s deadline at k = 6 before).
- Sparse word distributions extend only prefixes with nonzero mass, and the
  reproduction check uses them: on the butterfly process the check ran about
  1900 s of a 60 s budget; generative_model now certifies C_g = log2 5 in ~4 s.
- generative_model skips the coverage stages once the cheaper lower bounds meet
  an epsilon-machine's entropy, and at cryptic order <= 1 runs the generator
  coverage bound only when the exact path leaves the bracket open (on 233
  dataset processes of that class it took ~17 s each and never supplied the
  lower bound).
The coverage-stage figures came from the first 233 processes; the full
run covers 510, with the same share of time, and the branch takes 2.6
minutes on it instead of 2.5 hours.
@Autoplectic
Autoplectic merged commit deda985 into main Nov 24, 2026
10 checks passed
@Autoplectic
Autoplectic deleted the generative-budgets branch November 24, 2026 23:08
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