Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,19 @@
A second correctness review: every fix below was reproduced against a
brute-force reference or a closed-form value and has a regression test.

### Simplex-chain generator search

- New `sofic.generators.simplex_chains`: `simplex_chain_search(bidir)` constructs exact one-sided generators. A
reverse-sufficient generator is a finite law on the simplex of beliefs on the reverse causal states that
dominates its image under the belief updates in convex order (Strassen 1965). Writing each updated belief as a
convex combination of a pool of atoms gives a chain whose closed classes are exact generators; the search
alternates linear programs over those representations with gradient steps on the atoms, on both sides, starting
from the ε-machines. Every iterate passes a Tzeng word check, and at cryptic orders up to 4 the atoms stay on the
faces of the synchronizing complex. Results are `SimplexChainResult`s (`pi`, `K`, `atoms`, `word_error`).
- `generative_model` runs it right after the exact path (`simplex_chains=True`, stage `"chains"`) with a quarter of
the remaining budget, or 2 s per side without one, and stops once a generator meets the lower bound. On 306
archive processes it went below the best known upper bound on 42, by up to 0.295 bits (`n3-t138-d4`).

### Generator cardinality

- Minimal generators can need more than `min(|S+|, |S-|) + 1` states. The skip-one chain (the first-order Markov
Expand Down
20 changes: 19 additions & 1 deletion docs/generators/generative_models.rst
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,8 @@ runs the same search when the bidirectional machine is already known.
may propose feasible channels, then an entropy-ordered sweep over multistart
separating decompositions (:func:`~sofic.generators.coupled_generators.separating_decomposition_channels`);
* upper bounds over nested classes, cheapest first: the ε-machines and
bidirectional machine, memory-1 lifts, the exact minimal functional generator
bidirectional machine, exact one-sided generators from the simplex-chain search (below), memory-1 lifts, the
exact minimal functional generator
(:func:`~sofic.generators.functional_generators.functional_cover_search`), lifted channels (for
small machines), and the coupled search seeded with everything found so far.

Expand Down Expand Up @@ -254,6 +255,21 @@ results through :func:`~sofic.generators.hmm_search.coupled_seed_from_hmm`. On t
lowered seven open upper bounds, for example from :math:`C_\mu = 0.9037` to :math:`0.7956` with a 4-state
generator that the belief-parameterized searches never reached.

Both searches are local in the generator's parameters. :func:`~sofic.generators.simplex_chains.simplex_chain_search`
instead constructs *one-sided* generators exactly. A generator is reverse-sufficient when the future of each state
:math:`w` is the mixture of the reverse causal states' futures weighted by its belief :math:`R_w` on :math:`S^-`. It
is then a finite law on the simplex :math:`\Delta(S^-)` that dominates its image under the belief updates in convex
order :cite:`Strassen1965`. Writing every updated belief of a finite pool of atoms as a convex combination of the
pool gives a chain whose closed classes are exact generators. The state entropy is concave on the polytope of those
representations, so the search alternates linear programming over the representations with gradient steps on the
atoms; forward-sufficient generators are the mirror image on :math:`\Delta(S^+)`. Each side starts from its own
ε-machine, every iterate passes a word check over a Tzeng basis :cite:`Tzeng1992`, and at cryptic orders up to 4 the
atoms are kept on the faces of the synchronizing complex. The construction and the search are not from the
literature. The pipeline runs the search right after the exact path (``simplex_chains=True``) with a quarter of the
remaining budget, or 2 s per side without one, and stops once a generator meets the lower bound. On 306 archive
processes (binary 2- and 3-state and ternary 2-state ε-machines) it went below the best known upper bound on 42, by
more than :math:`10^{-6}` on 22 and by up to 0.295 bits; half the final values came within 0.57 s.

Wyner and functional generators
-------------------------------

Expand Down Expand Up @@ -472,6 +488,8 @@ Coupled generators and bounds
.. autofunction:: sofic.generators.generative_search.resolve_bidirectional
.. autofunction:: sofic.generators.hmm_search.hmm_generator_search
.. autofunction:: sofic.generators.hmm_search.coupled_seed_from_hmm
.. autofunction:: sofic.generators.simplex_chains.simplex_chain_search
.. autoclass:: sofic.generators.simplex_chains.SimplexChainResult
.. autofunction:: sofic.generators.global_bound.generator_global_bound
.. autoclass:: sofic.generators.global_bound.GlobalBoundResult
.. autofunction:: sofic.generators.global_bound.separating_global_bound
Expand Down
11 changes: 11 additions & 0 deletions docs/references.bib
Original file line number Diff line number Diff line change
Expand Up @@ -1890,6 +1890,17 @@ @article{Tzeng1992
doi = {10.1137/0221017},
}

@article{Strassen1965,
author = {Strassen, Volker},
title = {The Existence of Probability Measures with Given Marginals},
journal = {The Annals of Mathematical Statistics},
volume = {36},
number = {2},
pages = {423--439},
year = {1965},
doi = {10.1214/aoms/1177700153},
}

@article{Ruebeck2018,
author = {Ruebeck, Joshua B. and James, Ryan G. and Mahoney, John R. and Crutchfield, James P.},
title = {Prediction and Generation of Binary {Markov} Processes: Can a Finite-State Fox Catch a {Markov} Mouse?},
Expand Down
40 changes: 35 additions & 5 deletions sofic/generators/generative_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@
**entropy-ordered sweep** over all multistart separating decompositions (not only
:math:`\op{G}` optima) up to the current best upper bound.
4. *Upper bounds:* ε-machines, line-split seeds from the exact optima
(:func:`~sofic.generators.coupled_generators.line_split_seeds`), memory lifts, the exact minimal functional generator
(:func:`~sofic.generators.coupled_generators.line_split_seeds`), exact one-sided generators from the simplex-chain
search (:func:`~sofic.generators.simplex_chains.simplex_chain_search`, ``simplex_chains``; a quarter of the
remaining budget, or 2 s per side without one, stopping once a generator meets the lower bound), memory lifts,
the exact minimal functional generator
(:func:`~sofic.generators.functional_generators.functional_cover_search`), lifted channels
(small joints), coupled search, and a belief-free search over HMM symbol matrices
(:func:`~sofic.generators.hmm_search.hmm_generator_search`, ``hmm_search``), which reaches generators the
Expand Down Expand Up @@ -100,6 +103,7 @@
support_bound_states,
theorem_generator,
)
from sofic.generators.simplex_chains import simplex_chain_search

_MAX_RECTANGLES = 7
_FLOW_THRESHOLDS = ((0.6,), (0.55, 0.65))
Expand Down Expand Up @@ -133,6 +137,9 @@
# (|S+| |A|^(kappa - 1) bounds them); it took at most 1.3 s on the 3-state archive.
_LOOKAHEAD_MAX_KAPPA = 3
_LOOKAHEAD_MAX_STATES = 64
# Seconds per side of the simplex-chain search when there is no budget (on the 3-state archive half the final
# generators came within 0.6 s and 90% within 8 s); with one, the search gets a quarter of what is left.
_SIMPLEX_CHAIN_SECONDS = 2.0


def _entropy(p: np.ndarray) -> float:
Expand Down Expand Up @@ -468,7 +475,7 @@ def _bracket_search(
memory_starts: int = 10,
residual_atol: float = 1e-7,
reproduction_atol: float = 1e-5,
stages: Sequence[str] = ("machines", "exact", "memory", "functional", "lifted", "coupled", "hmm"),
stages: Sequence[str] = ("machines", "exact", "chains", "memory", "functional", "lifted", "coupled", "hmm"),
large: int = 9,
exact_starts: int = 30,
dit_fallback: bool = True,
Expand All @@ -479,6 +486,7 @@ def _bracket_search(
generator_heaviest_term: bool = True,
hmm_search: bool = True,
hmm_search_starts: int = 8,
simplex_chains: bool = True,
global_bound: bool = False,
global_bound_states: int | None = None,
generator_caps: int = 2,
Expand Down Expand Up @@ -940,6 +948,23 @@ def maybe_return_early() -> GenerativeModelResult | None:
theta = _optimize_coupled(problem, theta, k, 3000, residual_atol=residual_atol, deadline=deadline)
offer(f"{name}, floor {floor:g}", problem.unpack(theta, k))

if simplex_chains and "chains" in stages and not wyner and not out_of_time("simplex-chain search"):
stage_deadline = share(0.25)
chains = simplex_chain_search(
problem,
seconds=_SIMPLEX_CHAIN_SECONDS if stage_deadline is None else math.inf,
deadline=stage_deadline,
kappa=math.inf if kappa is None else float(max(kappa)),
target=lower + _CERT_TOL,
rng=rng,
)
log.append({"stage": "simplex-chain search", "values": {res.side: res.entropy for res in chains}})
for res in chains:
offer(f"simplex chain ({res.side}, k={len(res.pi)})", coupled_seed_from_hmm(problem, res.matrices))
early = maybe_return_early()
if early is not None and early.certified:
return _finalize_result(early)

if "memory" in stages and not out_of_time("memory lifts"):
for _value, residual, nu in memory_lift_search(bidir, 2, starts=memory_starts, deadline=share(0.2), rng=rng)[
:3
Expand Down Expand Up @@ -1162,7 +1187,7 @@ def generative_model_from_bidirectional(
memory_starts: int = 10,
residual_atol: float = 1e-7,
reproduction_atol: float = 1e-5,
stages: Sequence[str] = ("machines", "exact", "memory", "functional", "lifted", "coupled", "hmm"),
stages: Sequence[str] = ("machines", "exact", "chains", "memory", "functional", "lifted", "coupled", "hmm"),
large: int = 9,
exact_starts: int = 30,
dit_fallback: bool = True,
Expand All @@ -1173,6 +1198,7 @@ def generative_model_from_bidirectional(
generator_heaviest_term: bool = True,
hmm_search: bool = True,
hmm_search_starts: int = 8,
simplex_chains: bool = True,
global_bound: bool = False,
global_bound_states: int | None = None,
generator_caps: int = 2,
Expand Down Expand Up @@ -1213,6 +1239,7 @@ def generative_model_from_bidirectional(
generator_heaviest_term=generator_heaviest_term,
hmm_search=hmm_search,
hmm_search_starts=hmm_search_starts,
simplex_chains=simplex_chains,
global_bound=global_bound,
global_bound_states=global_bound_states,
generator_caps=generator_caps,
Expand Down Expand Up @@ -1313,6 +1340,7 @@ def generative_model(
generator_heaviest_term: bool = True,
hmm_search: bool = True,
hmm_search_starts: int = 8,
simplex_chains: bool = True,
global_bound: bool = False,
global_bound_states: int | None = None,
generator_caps: int = 2,
Expand All @@ -1333,7 +1361,8 @@ def generative_model(
the generator of a least-entropy separating decomposition with at most :math:`K(P)` terms
(:mod:`~sofic.generators.separating_generators`), and the search returns once some
:math:`\\op{G}{S^+ : S^-}` optimum generates (theorem path).
4. Otherwise memory lifts, lifted channels on small joints, then
4. Otherwise the simplex-chain search for exact one-sided generators, memory lifts, lifted channels on small
joints, then
:func:`~sofic.generators.universal_optimizer.universal_generative_optimizer`
(full coupled equations).

Expand All @@ -1358,7 +1387,7 @@ def generative_model(
memory_starts=memory_starts,
residual_atol=residual_atol,
reproduction_atol=reproduction_atol,
stages=("machines", "exact", "memory", "functional", "lifted", "coupled", "hmm"),
stages=("machines", "exact", "chains", "memory", "functional", "lifted", "coupled", "hmm"),
large=large,
exact_starts=exact_starts,
dit_fallback=dit_fallback,
Expand All @@ -1369,6 +1398,7 @@ def generative_model(
generator_heaviest_term=generator_heaviest_term,
hmm_search=hmm_search,
hmm_search_starts=hmm_search_starts,
simplex_chains=simplex_chains,
global_bound=global_bound,
global_bound_states=global_bound_states,
generator_caps=generator_caps,
Expand Down
Loading
Loading