LearnState#

class hybrid_aif.system.LearnState[source]#

Bases: Module

Optimizer state for an agent’s gradient-learnable parts: learn’s explicit carry.

Returned by System.learn() and the objective-side trainers and handed back on the next call; never held in a module attribute. A sibling of SystemParams, not a field of it.

Both fields are seeded by System.init_learn_state(), so the carry’s structure is fixed from the first call; each trainer steps its own entries, passes the rest through unchanged, and raises when an entry it owns is missing. Dict keys are static under jit.

Design: docs/design/amortization.md A2 A6 and chunk 2c §(b).

opt_states: dict[str, object]#

Optimizer states, keyed by slot-qualified address ("transition:x", the lr_by_slot key space), plus scoring:<term> for each mounted term with a trainer (objectives.registry.Estimator.trainer) and ACTOR_KEY for a policy module in policy_prior.

moments: dict[str, object]#

Running statistics that are not optimizer state (the actor’s return-normalization moving averages, the slow critic’s update counter, the model-reduction counter), keyed by trainer name.

__init__(opt_states=<factory>, moments=<factory>)#