SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2210.06702 · NeurIPS · 2022

A Mixture of Surprises for Unsupervised Reinforcement Learning

Gao Huang, Andrew Zhao, Matthieu Lin, Yangguang Li, Yong-Jin Liu

arXiv · PDF · Open in the Atlas

Code that ran

8 of 12 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 1 honoured the contract we drafted, 0 violated it and 7 have no contract verdict; 0 failures of our instrument; 4 no recorded run), measured 2026-11-22; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2210.06702.json · badge: /api/ran/2210.06702.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
LeapLabTHU/MOSS canonical (classifier label)
classifier basis not recorded on the link
8 ran · 4 no recorded run
FunctionStatusWhere it lives
increment_episode Ran
ran on a synthesized input
LeapLabTHU/MOSS/helpers.py
code served (permissive licence) · get_code("6923cb7ec7ed3f3d")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned LoopVar. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
from typing import NamedTuple

class LoopVar(NamedTuple):
    global_step: int
    global_episode: int
    episode_step: int
    episode_reward: float
    total_reward: float
    pointer: int

# Create a sample LoopVar instance
loop_var = LoopVar(
    global_step=100,
    global_episode=5,
    episode_step=42,
    episode_reward=150.5,
    total_reward=755.0,
    pointer=3
)

# Define ARGS mapping all parameters
ARGS = {
    "x": loop_var,
    "n": 1
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type LoopVar — a LoopVar output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a LoopVar output the recorded ndim 1 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
increment_step Ran
ran on a synthesized input
LeapLabTHU/MOSS/helpers.py
code served (permissive licence) · get_code("35febe40098b0a79")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned LoopVar. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

from typing import NamedTuple

class LoopVar(NamedTuple):
    global_step: int
    global_episode: int
    episode_step: int
    episode_reward: float
    total_reward: float
    pointer: int

def increment_step(x: LoopVar, reward: float, n: int=1) -> LoopVar:
    return LoopVar(global_step=x.global_step + n, global_episode=x.global_episode, episode_step=x.episode_step + n, episode_reward=x.episode_reward + reward, total_reward=x.episode_reward + reward, pointer=x.pointer)

x = LoopVar(
    global_step=0,
    global_episode=0,
    episode_step=0,
    episode_reward=0.0,
    total_reward=0.0,
    pointer=0
)

reward = 1.5

ARGS = {
    "x": x,
    "reward": reward,
    "n": 1
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type LoopVar — a LoopVar output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a LoopVar output the recorded ndim 1 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
l2_loss Ran
ran on a synthesized input
LeapLabTHU/MOSS/core/calculations/losses.py
code served (permissive licence) · get_code("5435e0ae11d6a827")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned ArrayImpl, ndim 2, dtype family float, shape (2, 4) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import jax.numpy as jnp
import numpy as np

# Create small test tensors with distinct shapes
preds = jnp.array([[1.0, 2.0, 3.0, 4.0],
                     [5.0, 6.0, 7.0, 8.0]], dtype=jnp.float32)

targets = jnp.array([[0.5, 1.5, 2.5, 3.5],
                      [4.5, 5.5, 6.5, 7.5]], dtype=jnp.float32)

ARGS = {
    "preds": preds,
    "targets": targets
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
chex, jax, numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ArrayImpl, ndim 2, dtype family float, shape (2, 4) — shape (2, 4) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
random_flip Ran
ran on a synthesized input
LeapLabTHU/MOSS/core/calculations/augmentations.py
code served (permissive licence) · get_code("694ec6f6ee783784")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned ArrayImpl, ndim 3, dtype family float, shape (2, 4, 3) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import jax
import jax.numpy as jnp
import jax.random

# Create a small batch of images: shape (2, 4, 3) for batch_size=2, height=4, width=3
images = jnp.ones((2, 4, 3), dtype=jnp.float32)

# Create a random number generator key
rng = jax.random.PRNGKey(0)

ARGS = {
    "images": images,
    "rng": rng,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
jax — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ArrayImpl, ndim 3, dtype family float, shape (2, 4, 3) — shape (2, 4, 3) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
random_shift_aug Ran
ran on a synthesized input
LeapLabTHU/MOSS/core/calculations/augmentations.py
code served (permissive licence) · get_code("9953da0307ba0153")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned ArrayImpl, ndim 4, dtype family float, shape (2, 4, 4, 3) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import jax
import jax.numpy as jnp
import numpy as np

# The function expects a JAX array with shape [N, H, W, C]
# where H == W (square spatial dimensions)
# Let's create a small valid example

N = 2  # batch size
H = 4  # height
W = 4  # width (must equal H)
C = 3  # channels

# Create a random array with the expected shape
x = jnp.ones((N, H, W, C), dtype=jnp.float32)

ARGS = {
    "x": x
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
jax, numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ArrayImpl, ndim 4, dtype family float, shape (2, 4, 4, 3) — shape (2, 4, 4, 3) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
reset_episode Ran
ran on a synthesized input
LeapLabTHU/MOSS/helpers.py
code served (permissive licence) · get_code("1484fd6608b194fc")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned LoopVar. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

from typing import NamedTuple

class LoopVar(NamedTuple):
    global_step: int
    global_episode: int
    episode_step: int
    episode_reward: float
    total_reward: float
    pointer: int

# Create a valid LoopVar instance
loop_var = LoopVar(
    global_step=100,
    global_episode=5,
    episode_step=20,
    episode_reward=150.5,
    total_reward=750.25,
    pointer=3
)

ARGS = {
    "x": loop_var
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type LoopVar — a LoopVar output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a LoopVar output the recorded ndim 1 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
running_stats Ran
ran on a synthesized input
LeapLabTHU/MOSS/core/calculations/losses.py
code served (permissive licence) · get_code("c68193d3061f96e9")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned tuple. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import jax.numpy as jnp
import numpy as np

# Create small test tensors
mean = jnp.array([0.1, 0.2, 0.3, 0.4])  # dim 4
std = jnp.array([0.5, 0.6, 0.7, 0.8])   # dim 4
x = jnp.array([[1.0, 2.0, 3.0, 4.0],
               [1.5, 2.5, 3.5, 4.5]])    # batch 2, dim 4
num = 10.0

ARGS = {
    "mean": mean,
    "std": std,
    "x": x,
    "num": num,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
jax, numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple — a tuple output has no array shape of its own; none is stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
schedule Ran
ran, honoured the contract we drafted
LeapLabTHU/MOSS/core/calculations/misc.py
code served (permissive licence) · get_code("ae234269debed3f4")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned float, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import re
import numpy as np

# Test case 1: simple float string
ARGS = {
    "schdl": "0.5",
    "step": 10
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type float, ndim 0, dtype family float, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
l2_loss_without_bias Not yet run
unverified (harvested, no recorded run)
LeapLabTHU/MOSS/core/calculations/losses.py
code served (permissive licence) · get_code("f9b1c01addee13ef")
How it ran

no invocation recorded.

linear_relu Not yet run
unverified (harvested, no recorded run)
LeapLabTHU/MOSS/core/calculations/layers.py
code served (permissive licence) · get_code("55a01c5ebe41e60c")
How it ran

no invocation recorded.

mlp Not yet run
unverified (harvested, no recorded run)
LeapLabTHU/MOSS/core/calculations/layers.py
code served (permissive licence) · get_code("8f66a508eba0c6bc")
How it ran

no invocation recorded.

trunk Not yet run
unverified (harvested, no recorded run)
LeapLabTHU/MOSS/core/calculations/layers.py
code served (permissive licence) · get_code("69f4a94c5240be35")
How it ran

no invocation recorded.

Also present in other papers' code

Of 12 samples lifted from this paper's linked repositories, 12 carry a function identity and 0 do not. Of the 12 distinct functions with an identity, 1 are also present in other papers whose code we hold (1 with at least one paper dated earlier, 0 the same month, 1 later) and 11 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

FunctionAlso present inEarliest-datedOthers named
schedule 17 other papers
7 dated earlier, 10 later · 7 only as an assembly brick
2103.04551 (2021-03)
Behavior From the Void: Unsupervised Active Pre-Training
2107.09645 (2021-07)
Mastering Visual Continuous Control: Improved Data-Augmented Reinforcement Learning
2202.10324 (2022-02)
VRL3: A Data-Driven Framework for Visual Deep Reinforcement Learning
and 14 more not named here

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-22.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

Unsupervised reinforcement learning aims at learning a generalist policy in a reward-free manner for fast adaptation to downstream tasks. Most of the existing methods propose to provide an intrinsic reward based on surprise. Maximizing or minimizing surprise drives the agent to either explore or gain control over its environment. However, both strategies rely on a strong assumption: the entropy of the environment's dynamics is either high or low. This assumption may not always hold in real-world scenarios, where the entropy of the environment's dynamics may be unknown. Hence, choosing between the two objectives is a dilemma. We propose a novel yet simple mixture of policies to address this concern, allowing us to optimize an objective that simultaneously maximizes and minimizes the surprise. Concretely, we train one mixture component whose objective is to maximize the surprise and another whose objective is to minimize the surprise. Hence, our method does not make assumptions about the entropy of the environment's dynamics. We call our method a Mixture Of SurpriseS (MOSS) for unsupervised reinforcement learning. Experimental results show that our simple method achieves state-of-the-art performance on the URLB benchmark, outperforming previous pure surprise maximization-based objectives. Our code is available at: https: //github.com/LeapLabTHU/MOSS.

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2210.06702")
get_code_for_paper("2210.06702")
have("2210.06702")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2210.06702.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2210.06702.svg)](https://syntology.ai/paper/2210.06702)

Connect an agent — have() is free.