SandHouse
Pages and contents

OPAL

Field
Value
⋮⋮
Authors
Ajay, Kumar et. al.
⋮⋮
Year
2021
⋮⋮
Link / arXiv
https://arxiv.org/pdf/2010.13611
⋮⋮
Code
⋮⋮
My relevance (1-5)
4
⋮⋮
Tags
#rl #abstraction

Our main insight is that, when presented with offline data composed of a variety of behaviors, an effective way to leverage this data is to extract a continuous space of recurring and temporally extended primitive behaviors before using these primitives for downstream task learning. Primitives extracted in this way serve two purposes: they delineate the behaviors that are supported by the data from those that are not, making them useful for avoiding distributional shift in offline RL; and they provide a degree of temporal abstraction, which reduces the effective horizon yielding better learning in theory, and improved offline RL in practice.

[image: 2026-08-11_14-40-01.png]

Method

Let a trajectory be

τ=(s0,a0,s1,a1,…,sc−1,ac−1)

The idea is approximately τ→qθz where many similar trajectories can potentially be represented by similar values of z. The learned primitive can then be executed through a policy πψ(at∣st,z) . z conditions a policy that chooses actions depending on the current state.

The paper optimizes

minθ,ψ,ω⁡𝔼τ∼𝒟[𝔼z∼qθ(z∣τ)[−∑t=0c−1log⁡πψ(at∣st,z)]]

subject to

𝔼τ∼𝒟[DKL(qθ(z∣τ)∥pω(z∣s0))]≤ϵKL

Encoder

The encoder qθ(z∣τ) sees the entire trajectory τ and outputs a distribution over latent primitive z. Conceptually, it maps trajectories to what abstract behavior was being performed. For example, many different trajectories might encode to latent representations corresponding approximately to z∼``pick something up''.

Primitive Policy / Decoder

Given the current state st and primitive z, the decoder predicts which action should occur. The term

−log⁡πψ(at∣st,z)

is the negative log-likelihood of the action actually observed in the dataset. Therefore

−∑t=0c−1log⁡πψ(at∣st,z)

asks: If z is supposed to summarize this trajectory, can z plus the current state reproduce the actions that generated it? Minimizing this forces z to retain information about the behavioral structure of the trajectory.

Primitive Prior

The prior pω(z∣s0) only sees the initial state s0. It tries to predict which primitives are reasonable from that state

s0→pω(z∣s0)

This is important because during downstream RL we do not know the future trajectory τ yet, so we cannot use qθ(z∣τ). Instead, the agent can sample or choose primitives from pω(z∣s0).

KL Constraint

The KL constraint is

DKL(qθ(z∣τ)∥pω(z∣s0))≤ϵKL

Without it, the encoder could encode arbitrary details of the entire trajectory into z. That would reconstruct the actions well, but would not necessarily produce a reusable primitive. Instead, OPAL forces

qθ(z∣τ)≈pω(z∣s0)

The encoder knows the entire trajectory, while the prior only knows its starting state. Therefore z is pressured to capture information that is both: 1. useful for reproducing the behavior, and 2. reasonably predictable/applicable from the initial state. This acts as an information bottleneck.

Overview

The complete process is τ→qθz and then (st,z)→πψat. At the same time, s0→pωz must approximately agree with the trajectory encoder. So the model is trying to discover a latent variable that is able to represent many behaviors under matching conditions. For example, many trajectories such as move hand left, open hand, close fingers, move hand right might potentially share an abstraction like “pick up object.” Importantly, z does not need to specify the exact movements. The primitive policy πψ(a∣s,z) determines the appropriate low-level action given the current situation.

This is similar to a conditional VAE. The reconstruction term asks if z contains enough information to reproduce a behavior while the KL constraint asks if zcan represent a compressed primitive from where the behavior began. Together they encourage behavioral abstractions rather than simply memorizing every trajectory.