SandHouse
Pages and contents

Schema Networks

https://arxiv.org/pdf/1706.04317 2017

The Problem

Deep reinforcement learning can learn strong policies for individual environments, but those policies often fail when the environment changes even if the underlying physical dynamics remain the same. For example, a policy trained on ordinary Breakout may fail if the paddle is moved or a wall is inserted, despite the facts that balls still bounce, paddles still control balls, and ball-brick collisions still produce rewards.

The authors argue that robust transfer requires learning the causal structure of the environment, rather than directly learning a policy tied to a particular state distribution. They introduce Schema Networks, an object-oriented generative model that learns reusable local cause-effect rules. Because these rules describe dynamics rather than a particular task layout, the same learned model can be used to plan in new environments without additional training.

The Method

Entity-Based State

Rather than representing the environment as one unstructured state vector, the world is represented as a collection of entities. Each entity has a common set of attributes.

For entity Ei , its state at time t is

Ei(t)=(Ξ±i,1(t),…,Ξ±i,M(t))

where Ξ±i,j(t) is a binary variable representing whether attribute j is active for entity i .

The complete state is

s(t)=(E1(t),…,EN(t))

Actions and rewards are also represented using binary variables.

The important assumption is that dynamics can be described using local interactions between entities and their attributes, rather than a monolithic transition function over the entire state.

Schemas

A schema is a local cause-effect rule. It predicts that some attribute will become active at the next timestep when a set of preconditions is satisfied.

A grounded schema k can be written as

Ο•k=AND⁑(Ξ±i1,j1,…,Ξ±iH,jH,a)

where the Ξ± terms are entity-attribute preconditions and a is an optional action condition.

For example, a schema might approximately represent

ball at x∧velocity-rightβ†’ball at x+1

or

ball touches brick∧brick is positiveβ†’r+

A schema therefore resembles a learned logical implication, although the complete model is represented as a probabilistic graphical model.

The paper defines probabilistic versions of Boolean AND and OR:

AND⁑(v1,…,vn)=∏i=1nP(vi=1)
OR⁑(v1,…,vn)=1βˆ’βˆi=1n(1βˆ’P(vi=1))

The OR operation is particularly important because multiple different schemas may independently cause the same effect.

For example,

A→C

and

B→C

can coexist, giving

C=OR⁑(Ο•A,Ο•B)

This explicit representation of multiple causes is one of the main differences between Schema Networks and ordinary learned transition models.

Grounded and Ungrounded Schemas

The model distinguishes between ungrounded schemas and grounded schemas.

An ungrounded schema is a reusable template:

Ξ¦l(Ex1,…,ExH)=AND⁑(Ξ±x1,y1,…,Ξ±xH,yH)

The variables x1,…,xH describe entity roles rather than particular entities.

The same schema can then be instantiated for different entities, positions, and times to produce grounded schemas.

For example, the abstract rule

objectx contacts objectyβ†’effect on objectx

can be instantiated for many different objects.

This is the main source of compositional transfer: the learned dynamics are attached to reusable relational templates rather than particular locations or states.

Combining Causes into Dynamics

An entity attribute at t+1 becomes active if any schema predicts it.

If schemas Ο•k1,…,Ο•kQ predict attribute Ξ±i,j , then

Ti,j(si,j(t+1)∣s(t),a(t))=OR⁑(Ο•k1,…,Ο•kQ,Ξ›i,j)

where Ξ›i,j is a self-transition representing persistence when no schema causes the attribute to change.

The complete transition distribution factorizes over entity attributes:

T(s(t+1)∣s(t),a(t))=∏i=1N∏j=1MTi,j(si,j(t+1)∣s(t),a(t))

This gives the Schema Network a sparse, structured world model made from independently reusable causal mechanisms.

Learning Schemas

Learning becomes a supervised structure-learning problem.

For a particular target attribute, the authors construct a binary input matrix

X∈0,1DΓ—D0

containing candidate attributes of an entity and its nearby entities. The target is

y∈0,1D

representing whether the desired future attribute became active.

The model seeks a set of schemas W such that

y=fW(X)

where each column of

W∈0,1D0Γ—L

represents one schema. Nonzero entries specify which preconditions belong to that schema.

The learning objective balances predictive accuracy against schema complexity:

minW∈0,1D0Γ—L⁑1Dβ€–yβˆ’fW(X)β€–1+Cβ€–Wβ€–1

The first term penalizes prediction error. The second encourages sparse schemas with few preconditions.

Finding the exact optimum is NP-hard, so the authors use a greedy procedure based on linear-programming relaxations. Schemas are added one at a time, with each new schema required to have perfect precision while increasing recall. The result is a small collection of sparse rules explaining the observed transitions.

Planning as Inference
Once the dynamics have been learned, the agent does not learn a separate policy. Instead, action selection is performed by inference through the causal model.

The Schema Network is unrolled across future timesteps:

s(0),a(0),s(1),a(1),…,s(T)

with schemas connecting possible causes to their future effects.

Planning asks for an assignment of future action variables that makes a desired reward possible. This becomes approximately a MAP inference problem in the factor graph.

Conceptually,

a0:Tβˆ’1βˆ—=arg⁑maxa0:Tβˆ’1⁑P(rgoal=1∣s(0),a0:Tβˆ’1)

The authors approximately solve this using max-product belief propagation.

Planning proceeds first forward to determine which future rewards appear feasible, then backward from the selected reward through the schemas that could have caused it.

Thus the system can reason approximately as

r+←brick destroyed←ball hits brick←paddle redirects ball←at

The ability to move backward through explicit causes is called regression planning.

Multiple causation is particularly important here. If several schemas can cause an effect, reasoning backward must determine which cause is consistent with the rest of the desired trajectory. The graphical-model representation also supports explaining away, where evidence for one cause reduces the need to invoke another.

The overall architecture can therefore be summarized as

experience→learn sparse causal schemas→compose schemas into a world model→plan backward from reward

rather than learning

state→policy

directly.


The strongest results depend on substantial structure being supplied to the model. Schema Networks do not learn directly from raw pixels: a vision system provides tracked entities and attributes, and spatial position receives special treatment. The experiments are also much simpler than realistic environments: states, actions, attributes, and rewards are discretized into binary variables, the dynamics are deterministic, and entity states are fully observed. The schema-learning algorithm assumes that contradictory examples have been removed, which becomes problematic in genuinely stochastic environments. Structure learning is also combinatorial and the exact objective is NP-hard, requiring a greedy approximation. The paper therefore demonstrates the usefulness of explicit causal structure more convincingly than it demonstrates a scalable general solution for learning that structure from perception.

Schema Networks are closely related to Object-Oriented MDPs and Relational MDPs, which similarly attempt to factor environments into reusable objects and relations. They are also related to Interaction Networks and Neural Physics Engines, which learn object-centered relational dynamics. The authors argue that Schema Networks differ because they explicitly separate alternative causes of an effect and form a generative graphical model, permitting backward inference and regression planning. Compared with model-free methods such as A3C and transfer methods such as Progressive Networks, Schema Networks transfer the learned dynamics rather than transferring a policy or neural features. This is what allows zero-shot transfer when the layout changes but the underlying causal mechanisms remain the same.