Pages and contents
Pages
On this page
- Introduction
- Motivation
- Z
- C
- M
- A
- Continuity
- The Space
- Encoding
- Predictive Prior
- Recurrence of
- World Model Prediction Loss
- World Model Regularization
- Role of
- The and Space
- Thought
- Reading From
- Thought Transition
- Mamba-Like Think Function
- Actions
- RL Loss
- Training
- Phase 1
- Phase 2
- V2 - Things To Add
- Explicit Memory
- Intrinsic Reward for Thoughts
- Multiple Thoughts Per Environment Step
- Deferred Object-Centric Structure
- Original Motivation
- Original Slot Formation
- Why It Is Deferred
- Possible Future Latent Segmentation
- Initial Architecture Summary
- Statements
Thought Learner 1
Introduction
Motivation
I seek to create an AI agent capable of general and efficient learning. I propose a framework of dynamics inspired by human cognition.
Z
The agent should maintain a rich latent representation of its current perception. This representation should preserve information useful for predicting future states, selecting actions, and producing higher-level thoughts. The perceptual latent space will be denoted as .
Rather than imposing an explicit object-centric structure on in the initial model, will consist simply of dense learned features. We should also form beliefs about future perceptual states, denoted .
C
A "conscious" thought space where the agent is able to plan and process perceptual encodings, memories, goals, and previous thoughts. This is a recurrent system, possibly a state space model, that takes previous thoughts as well as present experience to produce thoughts capable of triggering actions. I originally intended to include a separate working-memory component, but the recurrent thought space itself should be capable of serving as working memory.
Given the current perceptual context, it can retain information from previous thoughts while selectively reading from .
M
An explicit long-term memory that is queried by thoughts. This will be included later. It should likely persist tuples involving so that previous experiences can be retrieved when useful. , , and may eventually mutually influence their representation spaces so that memories remain compatible with the agent's changing internal representations.
A
The action set is denoted while an action at time is
Continuity
In order to preserve a sense of continuity between latent transitions, particularly within the thought space , we can implement a residual-like property among recurrent components of the network state. Let represent some internal state at time . A general structural-continuity equation is
where represents a prior or recurrent prediction, represents new information, and determines how strongly that information modifies the existing state. This structure can be interpreted loosely as a learned belief update.
The Space
Encoding
Given an environment state , we encode it into dense features using some efficient attention or vision architecture, likely FMA or a variant thereof.
where is the perceptual encoder. For an image or video frame, may be represented as a collection of dense latent vectors
These vectors do not initially have any required semantic interpretation. In particular, we do not require A feature may instead represent some local visual pattern, region, texture, motion cue, object part, complete object, or more abstract property learned by the model. The purpose of in V1 is therefore to provide a rich perceptual representation that is
1. Useful for predicting future states,
2. Accessible to the thought process ,
3. Useful for action selection.
Explicit object discovery is deferred.
Predictive Prior
Although is obtained directly from perception, the agent should also learn to predict how its latent perceptual state will evolve. Given the current latent state and action,
where is the latent dynamics model. represents the agent's prediction of the next latent state before observing . This can be recursively propagated to predict multiple steps into the future:
Thus represents what is currently perceived while represents what the agent expects to perceive in the future.
Recurrence of
We want to use the priors of and itself to for a recurrent relation of dense feature updates. For simpler initial experiments of interest to V1, this section is optional. But for more complex environments such as Minecraft, this is likely to be essential.
Where is a gate term that controls how much the priors influence the encodings at timestamp .
This equation means that must be initialized to something. We can sample from a learned Gaussian.
World Model Prediction Loss
We want to contain information that makes the future predictable. After observing the future environment
we compare the predicted latent state against the posterior representation produced from the actual observation. A simple JEPA-like objective is
Here measures the prediction error between the predicted future representation and the representation produced after actually observing the future. The stop-gradient prevents the prediction target from simply moving toward the prediction. The outer sum allows the model to learn predictions across multiple future horizons.
For the initial model, can preserve the spatial organization produced by the encoder so that predicts a future dense feature representation of the same general structure. If direct feature-to-feature prediction proves too restrictive because features move spatially through time, more sophisticated prediction, alignment, or grouping mechanisms can be introduced later.
World Model Regularization
To prevent representation collapse, we must include a loss term that regularizes the latent distribution. The VISReg loss is one that handles center, scale, and full projected distributional shape, beating performance of SIGReg and with greater flexibility.
Where represents the centered imbedding of a replay buffer
sorts the projected values in each dimension, and represents the fixed quantiles of the standard Gaussian distribution. This has linear time complexity. The VISReg paper mentions that the default works well for high-quality datasets, but increasing the shape loss weight improves performance on low-quality datasets.
Finally, we have the world model loss
Role of
The initial purpose of is intentionally broad. We want
to produce a representation from which both prediction and behavior can emerge. The two primary consumers of are therefore for world-model prediction and for thought and planning. The policy may also access directly so that simple behaviors do not necessarily have to pass through the entire thought process.
The and Space
Thought
The space is where planning occurs and where I attempt to approximate a sequence of internal thoughts. also acts as working memory because the current thought depends recurrently on previous thought states. The thought system should selectively read information from rather than requiring the entire dense representation to be compressed into a single vector beforehand. The general form is
For the first simplified version, explicit memory retrieval will be deferred.
There may eventually be multiple internal thought steps per environment timestep, but this will also be deferred initially.
Reading From
The current thought should selectively query the dense perceptual representation. Given the previous thought and perceptual features , we calculate
The attended perceptual context is
Importantly, this attention does not assume that each corresponds to an object. It allows the thought process to retrieve whichever parts of the learned perceptual representation are useful at a given moment.
Thought Transition
A simple form of the thought transition is
where
represents the recurrent continuation of the previous thought state while introduces information from current perception. The gate controls how strongly the new perceptual information modifies the existing thought state.
Mamba-Like Think Function
Rather than using only a simple gated recurrence, the thought space can eventually use a Mamba-like state space model to maintain information across a sequence of thoughts. First, the current thought queries
We then update a recurrent hidden state
The explicit thought is produced from this hidden state
Thus acts as the recurrent memory of the thought sequence while represents the current explicit thought exposed to the policy. The overall Think function can therefore be written as
with the transition
For V1, a simpler gated recurrence may be preferable before introducing the full state-space implementation.
Actions
Thoughts can produce deliberate actions while may also directly contribute to action selection.
More precisely, the actor defines a policy
Where the policy query queries the dense features of .
To appropriately summarize the dense information of , the mechanism should have multiple heads. Allowing the policy to observe both and means the architecture does not require every action to be mediated by deliberate thought, instead there can be reflexive actions that are essential for survival in the case of an environment like Minecraft. may learn to contribute primarily when temporal reasoning, planning, memory, or selective attention are useful.
RL Loss
For the initial model, reinforcement learning can use a standard actor-critic setup with GAE for advantage estimation and PPO for the policy update. The critic estimates
where is a multi-headed learned query of the dense features of the same form as . First define the one-step temporal-difference residual
Instead of a plain n-step return, we estimate the advantage using Generalized Advantage Estimation
Here, controls the bias-variance tradeoff. We then define the value target as
Let the policy ratio be
The actor is trained with the PPO clipped objective
The critic minimizes the squared value error
We also include an entropy term to encourage exploration. The total reinforcement learning loss is
Training
Phase 1
The first phase of training should be focused on building a baseline world model representation. We should take a diverse number of samples with a sample number depending on the complexity of the world environment. Specifically, we should collect a set of short trajectory segments, where for episodic learning, each is a complete episode or a subset of an episode where is the terminating step.
These trajectory segments are used to train . During this phase, each is re-encoded with the updated function at each training step. This prevents large representation divergence in the term. If online learning is then to maintain a latent replay buffer only, this pretraining phase could have an objective of training until
Where is some some small value indicating that the representation has stabilized on the domain. This is important because for the VISReg, a large drift in sample representation during online learning would cause a poorly constructed latent replay buffer.
Since VISReg consumes some , and is a dense set a feature vectors, we need to regularize independent patches across the batch.
When is introduced in future models, this phase should be more intensive and include a phase 1.5 that stabilizes before writing memories that no longer make sense in a modest number of time steps.
Phase 2
The training objective combines predictive representation learning with reinforcement learning.
The world-model objective trains and to form useful predictive latent representations. The reinforcement learning objective primarily trains and . For the initial model, policy gradients should not necessarily be allowed to freely modify or . The RL input can instead use so that the perceptual representation is primarily shaped by the predictive objective rather than potentially unstable policy gradients.
This gives the rough learning structure for predictive learning and for reinforcement learning. This separation can be relaxed later if end-to-end RL gradients prove useful.
For phase 2, since the space is stable, we can store the following buffer to evaluate the loss.
Where represents an episode termination indicator. This replay buffer shouldn’t exceed a size that causes significant drift between and . However, given a small enough in phase 1 and a low learning rate for , large buffers can be achieved without concern. should sample a smaller window from the replay buffer to account for policy drift, ideally a single episode or a subset of an episode (for large episodes).
An initial environment could be MiniGrid or another simple environment with visual observations and discrete actions. This could implement a high entropy exploration policy for phase 1 with many episodes.
V2 - Things To Add
Explicit Memory
We would eventually like to store thoughts, their associated perceptual states, actions, and rewards so that previous experiences can be queried at any given moment. We can call this czar-memory because the variables spell out the word
A thought could form a query and retrieve relevant memories through The retrieved information could then become another input to the thought process.
Intrinsic Reward for Thoughts
I have not yet described a mechanism through which intermediate thoughts could receive reinforcement when they make progress toward an objective. Eventually, may maintain some representation of expected goal achievement. Changes in this belief could potentially provide an intrinsic learning signal for internal thought transitions. External reinforcement learning rewards should initially remain the dominant and grounded learning signal. This mechanism should therefore be deferred until the basic perceptual world model, thought recurrence, and actor-critic loop work reliably.
Multiple Thoughts Per Environment Step
The first version uses approximately one thought update per environment transition. A later model could allow before choosing an external action. This would allow the model to perform internal computation at a different temporal frequency from its interaction with the environment.
Deferred Object-Centric Structure
Original Motivation
The original architecture treated as an explicitly object-centric latent space consisting of slots
Each slot was intended to correspond approximately to a persistent object in the environment. The motivation for this structure was that many important aspects of world modeling appear naturally relational. Objects persist through time, interact with one another, move independently, and can be individually relevant to planning. An explicit object representation would make computations of the form
particularly natural. It could also provide an efficient interface between perception, prediction, thought, and explicit memory.
Original Slot Formation
The original proposal used predicted object states as queries into dense visual features. A competitive attention mechanism assigned features to slots
Each slot then aggregated its assigned sensory information
The prior object representation was corrected using this evidence
This provided a clean interpretation: The prior maintained object identity through time while incoming visual evidence corrected the predicted state.
Why It Is Deferred
The problem is that this architecture imposes a strong assumption before it has been demonstrated to be necessary, that the world should be partitioned in discrete object slots. There may not be a single correct decomposition. For example, depending on the task, a model may benefit from representing: - an entire person, - a person's hand, - an object being held, - several objects as a group, - a spatial region, - a moving surface, - or some abstract feature spanning multiple physical objects. Requiring every latent vector to correspond to a discrete object may therefore constrain the representation unnecessarily. Fixed or oversupplied slot sets also introduce additional problems involving assignment, slot collapse, unused slots, object appearance and disappearance, occlusion, and temporal identity. These mechanisms substantially increase the complexity of V1 before determining whether explicit objects are actually required.
There is also a convincing paper “Are We Done With Object Centric Learning” by Rubenstein et. al. that explain that segmentation models have outperformed slot mechanisms. It seems that there is a general drift away from trying to force slot attention mechanisms to work and I agree with the sentiment.
Possible Future Latent Segmentation
Following the thoughts and experiments of Rubenstein et. al., explicit structure can later be introduced after learning dense representations. For example,
could perform some form of learned grouping or segmentation directly in latent space. The resulting representation might take the form
where the are persistent entities or regions without requiring that they correspond exactly to semantic objects. Possible implementations include: - latent segmentation, - learned clustering, - latent particles, - region or mask proposals, - dynamically formed entities, - hierarchical groups of dense features. This creates a weaker and potentially more useful inductive bias. The value of this additional structure can then be measured experimentally by comparing it against the dense V1 representation.
Initial Architecture Summary
The simplified V1 architecture is
The two principal learning mechanisms are for predictive representation learning and for behavior. Thus the initial model tests a relatively small set of hypotheses.
1. Predictive learning can form useful dense perceptual representations.
2. A recurrent thought state can selectively read from those representations.
3. The thought state can accumulate information across time.
4. The combination of and can support reinforcement learning.
5. Explicit object or entity structure can be added later only if experiments demonstrate that it provides value.
Statements
Right now, models only immediate transitions abstractly. For planning to take effect, we need to form abstract representations of events of arbitrary timescales. The space abstracts direct sensory experience and the sequential nature of the world. There needs to be a way to form abstractions of expectations within the space in a Bayesian manner. For example the space should form beliefs such that if it digs a dirt hole when its nighttime, that no mobs will attack it. This is difficult, but there is likely active research other than latent hierarchies, which doesn’t quite seem like what I’m envisioning.