SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2310.00344 · ICML · 2024

HarmonyDream: Task Harmonization Inside World Models

Jianye Hao, Dong Li, Chenjun Xiao, Mingsheng Long, Jianmin Wang, Haoyu Ma, Jialong Wu, Ningya Feng, Td-Mpc, 𝑜 𝑟, " 𝑜 # 𝑟 #, 𝑟, and 1 more

arXiv · PDF · Open in the Atlas

Code that ran

5 of 7 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; 0 honoured the contract we drafted, 0 violated it and 0 have no contract verdict; 5 failures of our instrument; 2 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/2310.00344.json · badge: /api/ran/2310.00344.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
thuml/HarmonyDream canonical (classifier label)
classifier basis not recorded on the link
5 ran · 2 no recorded run
FunctionStatusWhere it lives
cast_to_compute Ran
ran; our contract draft was wrong, not the code
thuml/HarmonyDream/dreamerv3-jax/dreamerv3/jaxutils.py
code served (permissive licence) · get_code("24fe13b4f847da6b")
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 dict. 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
import jax.numpy as jnp
import numpy as np

tree_map = jax.tree_util.tree_map

COMPUTE_DTYPE = jnp.float32

def cast_to_compute(values):
    return tree_map(lambda x: x.astype(COMPUTE_DTYPE), values)

# Create test data with various nested structures and data types
# The function uses tree_map to apply astype conversion to all leaves

# Single array
single_array = jnp.array([1.0, 2.0, 3.0, 4.0], dtype=jnp.float64)

# Nested structure: dict of arrays
nested_dict = {
    "tensor1": jnp.array([[1, 2, 3, 4], [5, 6, 7, 8]], dtype=jnp.int32),
    "tensor2": jnp.array([1.5, 2.5, 3.5, 4.5], dtype=jnp.float64),
    "nested": {
        "tensor3": jnp.array([[1.0, 2.0], [3.0, 4.0]], dtype=jnp.float64)
    }
}

# List of arrays
list_arrays = [
    jnp.array([1, 2, 3, 4], dtype=jnp.int32),
    jnp.array([1.1, 2.2, 3.3, 4.4], dtype=jnp.float64)
]

# Tuple of arrays
tuple_arrays = (
    jnp.array([1.0, 2.0, 3.0, 4.0], dtype=jnp.float64),
    jnp.array([[5.0, 6.0], [7.0, 8.0]], dtype=jnp.float64)
)

ARGS = {
    "values": nested_dict
}
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 dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict output the recorded ndim 0 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
get_act Ran
ran; our contract draft was wrong, not the code
thuml/HarmonyDream/dreamerv3-jax/dreamerv3/nets.py
code served (permissive licence) · get_code("03dd934385b4d240")
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 custom_jvp. 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
import jax.numpy as jnp

def get_act(name):
    if callable(name):
        return name
    elif name == 'none':
        return lambda x: x
    elif name == 'mish':
        return lambda x: x * jnp.tanh(jax.nn.softplus(x))
    elif hasattr(jax.nn, name):
        return getattr(jax.nn, name)
    else:
        raise NotImplementedError(name)

# Test with string name 'relu'
ARGS = {
    'name': 'relu'
}
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 custom_jvp — a custom_jvp output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a custom_jvp output the recorded ndim 0 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
pure Ran
ran; our contract draft was wrong, not the code
thuml/HarmonyDream/dreamerv3-jax/dreamerv3/ninjax.py
code served (permissive licence) · get_code("bbd25fa32893729e")
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 function. 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
import jax.numpy as jnp

# Define a simple impure function that uses the global context
def sample_impure_fn(x, y):
    """A simple impure function that accesses and modifies state."""
    ctx = context()
    
    # Access state
    if 'counter' not in ctx:
        ctx['counter'] = jnp.array(0)
    
    # Modify state
    ctx['counter'] = ctx['counter'] + 1
    
    # Use rng
    key = rng()
    noise = jax.random.normal(key, x.shape)
    
    return x + y + noise

# Create tiny example tensors
x = jnp.ones((2, 3))
y = jnp.ones((2, 3))

# Create initial state dict
initial_state = {
    'weight': jnp.array([1.0, 2.0, 3.0]),
    'bias': jnp.array(0.5)
}

# Create an RNG key
rng_key = jax.random.PRNGKey(42)

# Define ARGS mapping all parameters of pure()
ARGS = {
    'fun': sample_impure_fn,
    'nested': False
}
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 function — a function output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a function output the recorded ndim 0 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
subsample Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
thuml/HarmonyDream/dreamerv3-jax/dreamerv3/jaxutils.py
code served (permissive licence) · get_code("e5b1910ea05891b1")
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 1, dtype family float, shape (8,) 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

# Mock nj module since the function references nj.rng()
class MockNJ:
    @staticmethod
    def rng():
        return jax.random.PRNGKey(0)

nj = MockNJ()

# Create test data
values = jnp.array([[1.0, 2.0, 3.0, 4.0],
                    [5.0, 6.0, 7.0, 8.0]])

ARGS = {
    "values": values,
    "amount": 1024
}
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 1, dtype family float, shape (8,) — shape (8,) 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
tensorstats Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
thuml/HarmonyDream/dreamerv3-jax/dreamerv3/jaxutils.py
code served (permissive licence) · get_code("67c6d2355562342f")
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 dict. 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
import jax.numpy as jnp
import jax.random as jr

# Create a simple RNG key for JAX
key = jr.PRNGKey(0)

# Create a small test tensor (2x4 = 8 elements)
tensor = jnp.array([[1.0, 2.0, 3.0, 4.0],
                     [5.0, 6.0, 7.0, 8.0]])

# Define ARGS with all parameters for tensorstats
ARGS = {
    'tensor': tensor,
    'prefix': 'test'
}
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 dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict output the recorded ndim 0 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
grad Not yet run
unverified (harvested, no recorded run)
thuml/HarmonyDream/dreamerv3-jax/dreamerv3/ninjax.py
code served (permissive licence) · get_code("1ad869363216c281")
How it ran

no invocation recorded.

rng Not yet run
unverified (harvested, no recorded run)
thuml/HarmonyDream/dreamerv3-jax/dreamerv3/ninjax.py
code served (permissive licence) · get_code("45b97b51433849a7")
How it ran

no invocation recorded.

Also present in other papers' code

Of 7 samples lifted from this paper's linked repositories, 7 carry a function identity and 0 do not. Of the 7 distinct functions with an identity, 7 are also present in other papers whose code we hold (7 with at least one paper dated earlier, 0 the same month, 7 later) and 0 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
get_act 9 other papers
4 dated earlier, 5 later
2303.03226 (2023-03)
Safe Reinforcement Learning via Probabilistic Logic Shields
2305.14343 (2023-05)
Video Prediction Models as Rewards for Reinforcement Learning
2306.11488 (2023-06)
Informed POMDP: Leveraging Additional Information in Model-Based RL
and 6 more not named here
grad 6 other papers
4 dated earlier, 2 later
2303.03226 (2023-03)
Safe Reinforcement Learning via Probabilistic Logic Shields
2305.14343 (2023-05)
Video Prediction Models as Rewards for Reinforcement Learning
2306.11488 (2023-06)
Informed POMDP: Leveraging Additional Information in Model-Based RL
and 3 more not named here
pure 6 other papers
4 dated earlier, 2 later
2303.03226 (2023-03)
Safe Reinforcement Learning via Probabilistic Logic Shields
2305.14343 (2023-05)
Video Prediction Models as Rewards for Reinforcement Learning
2306.11488 (2023-06)
Informed POMDP: Leveraging Additional Information in Model-Based RL
and 3 more not named here
rng 6 other papers
4 dated earlier, 2 later
2303.03226 (2023-03)
Safe Reinforcement Learning via Probabilistic Logic Shields
2305.14343 (2023-05)
Video Prediction Models as Rewards for Reinforcement Learning
2306.11488 (2023-06)
Informed POMDP: Leveraging Additional Information in Model-Based RL
and 3 more not named here
cast_to_compute 5 other papers
4 dated earlier, 1 later
2303.03226 (2023-03)
Safe Reinforcement Learning via Probabilistic Logic Shields
2305.14343 (2023-05)
Video Prediction Models as Rewards for Reinforcement Learning
2306.11488 (2023-06)
Informed POMDP: Leveraging Additional Information in Model-Based RL
and 2 more not named here
subsample 5 other papers
3 dated earlier, 2 later
2305.14343 (2023-05)
Video Prediction Models as Rewards for Reinforcement Learning
2306.11488 (2023-06)
Informed POMDP: Leveraging Additional Information in Model-Based RL
2307.07176 (2023-07)
SAFEDREAMER: SAFE REINFORCEMENT LEARNING WITH WORLD MODEL
and 2 more not named here
tensorstats 5 other papers
3 dated earlier, 2 later
2305.14343 (2023-05)
Video Prediction Models as Rewards for Reinforcement Learning
2306.11488 (2023-06)
Informed POMDP: Leveraging Additional Information in Model-Based RL
2307.07176 (2023-07)
SAFEDREAMER: SAFE REINFORCEMENT LEARNING WITH WORLD MODEL
and 2 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

Model-based reinforcement learning (MBRL) holds the promise of sample-efficient learning by utilizing a world model, which models how the environment works and typically encompasses components for two tasks: observation modeling and reward modeling. In this paper, through a dedicated empirical investigation, we gain a deeper understanding of the role each task plays in world models and uncover the overlooked potential of sample-efficient MBRL by mitigating the domination of either observation or reward modeling. Our key insight is that while prevalent approaches of explicit MBRL attempt to restore abundant details of the environment via observation models, it is difficult due to the environment's complexity and limited model capacity. On the other hand, reward models, while dominating implicit MBRL and adept at learning compact task-centric dynamics, are inadequate for sample-efficient learning without richer learning signals. Motivated by these insights and discoveries, we propose a simple yet effective approach, HarmonyDream, which automatically adjusts loss coefficients to maintain task harmonization, i.e. a dynamic equilibrium between the two tasks in world model learning. Our experiments show that the base MBRL method equipped with HarmonyDream gains 10%-69% absolute performance boosts on visual robotic tasks and sets a new state-of-the-art result on the Atari 100K benchmark. Code is available at https: //github.com/thuml/HarmonyDream.

For agents

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

get_harvested_code_for_paper("2310.00344")
get_code_for_paper("2310.00344")
have("2310.00344")

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

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

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

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

Connect an agent — have() is free.