Repository navigation
Keep generative_model inside its budget - #75
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Three causes of
generative_modelrunning pasttime_budget, found by timing the pipeline stage by stage:hmm_generator_searchchecked itsdeadlineonly between starts and rounds, so one L-BFGS-B run could go far past it (19 s past a 0.5 s deadline atk = 6on 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_probabilitiescomputed 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 is8**8words, 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, andgenerative_model(butterfly_process(), time_budget=60)certifiesC_g = log2 5in about 4 s.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 ak = 6run in under 5 s (it was 19 s)tests/test_words.py: hypothesis test that sparse and dense word dictionaries matchword_probabilityon random sparse Mealy HMMs (with and without a start state); butterfly length-8 regression testtests/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 boundruff check,ruff format