SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2309.15178 · NeurIPS · 2024

Zero-Shot Reinforcement Learning from Low Quality Data

Tom Bewley, Scott Jeen, Jonathan Cullen

arXiv · PDF · Open in the Atlas

Code that ran

10 of 18 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 9 have no contract verdict; 0 failures of our instrument; 8 no recorded run), measured 2026-11-23; 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/2309.15178.json · badge: /api/ran/2309.15178.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
enjeeneer/conservative-world-models marked official in Papers with Code
Papers with Code archive
10 ran · 8 no recorded run
FunctionStatusWhere it lives
AbstractActor Ran
ran on a synthesized input
enjeeneer/conservative-world-models/agents/cfb/agent.py
code served (permissive licence) · get_code("676367224566988e")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) and returned TruncatedNormal. 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
import abc

class AbstractMLP(torch.nn.Module, metaclass=abc.ABCMeta):
    """Abstract base class for all feedforward networks."""

    def __init__(self, input_dimension: int, output_dimension: int, hidden_dimension: int, hidden_layers: int, activation: str, device: torch.device, preprocessor: bool=False, layernorm: bool=False):
        self._input_dimension = input_dimension
        self._output_dimension = output_dimension
        self._hidden_dimension = hidden_dimension
        self._hidden_layers = hidden_layers
        self._activation = activation
        self.device = device
        self._preprocessor = preprocessor
        self._layernorm = layernorm
        super().__init__()
        self.trunk = self._build()

    def _build(self) -> torch.nn.Sequential:
        """
        Creates MLP trunk.
        """
        if self.hidden_layers == 0:
            function = [torch.nn.Linear(self.input_dimension, self.output_dimension)]
        else:
            if self._layernorm:
                function = [torch.nn.Linear(self.input_dimension, self.hidden_dimension), torch.nn.LayerNorm(self.hidden_dimension), torch.nn.Tanh()]
            else:
                function = [torch.nn.Linear(self.input_dimension, self.hidden_dimension), self.activation]
            for _ in range(self.hidden_layers - 1):
                function += [torch.nn.Linear(self.hidden_dimension, self.hidden_dimension), self.activation]
            function.append(torch.nn.Linear(self.hidden_dimension, self.output_dimension))
        if self.preprocessor:
            function.append(self.activation)
        trunk = torch.nn.Sequential(*function).to(self.device)
        return trunk

    @property
    def input_dimension(self) -> int:
        return self._input_dimension

    @property
    def output_dimension(self) -> int:
        return self._output_dimension

    @property
    def hidden_dimension(self) -> int:
        return self._hidden_dimension

    @property
    def hidden_layers(self) -> int:
        return self._hidden_layers

    @property
    def activation(self) -> torch.nn:
        if self._activation == 'relu':
            return torch.nn.ReLU()
        else:
            raise NotImplementedError(f'{self._activation} not implemented.')

    @property
    def preprocessor(self) -> bool:
        return self._preprocessor

class TruncatedNormal(torch.distributions.Normal):
    """Implementation of the Truncated Normal distribution."""

    def __init__(self, loc, scale, low=-1.0, high=1.0, eps=1e-06) -> None:
        super().__init__(loc, scale, validate_args=False)
        self.low = low
        self.high = high
        self.eps = eps

    def _clamp(self, x) -> torch.Tensor:
        clamped_x = torch.clamp(x, self.low + self.eps, self.high - self.eps)
        x = x - x.detach() + clamped_x.detach()
        return x

    def sample(self, clip=None, sample_shape=torch.Size()) -> torch.Tensor:
        shape = self._extended_shape(sample_shape)
        eps = torch.distributions.utils._standard_normal(shape, dtype=self.loc.dtype, device=self.loc.device)
        eps *= self.scale
        if clip is not None:
            eps = torch.clamp(eps, -clip, clip)
        x = self.loc + eps
        return self._clamp(x)

class AbstractActor(AbstractMLP, metaclass=abc.ABCMeta):
    """Abstract actor that selects action given input."""

    def __init__(self, observation_length: int, action_length: int, hidden_dimension: int, hidden_layers: int, activation: str, device: torch.device):
        super().__init__(input_dimension=observation_length, output_dimension=action_length, hidden_dimension=hidden_dimension, hidden_layers=hidden_layers, activation=activation, device=device, layernorm=True)

    def forward(self, observation: torch.Tensor, std: float) -> torch.distributions.Distribution:
        """
        Passes input through network to predict action
        Args:
            observation: obs tensor of shape [batch_dim, input_length]
            std: standard deviation of action distribution
        Returns:
            action: action tensor of shape [batch_dim, action_length]
        """
        if observation.shape[-1] != self.input_dimension:
            raise ValueError(f'Input shape {observation.shape} does not match input dimension {self.input_dimension}')
        mu = self.trunk(observation)
        mu = torch.tanh(mu)
        std = torch.ones_like(mu) * std
        dist = TruncatedNormal(mu, std)
        return dist

INIT_ARGS = {
    'observation_length': 4,
    'action_length': 3,
    'hidden_dimension': 8,
    'hidden_layers': 2,
    'activation': 'relu',
    'device': torch.device('cpu')
}

ARGS = {
    'observation': torch.randn(2, 4),
    'std': 0.1
}

if __name__ == '__main__':
    actor = AbstractActor(**INIT_ARGS)
    dist = actor(**ARGS)
    sample = dist.sample()
    print(f"Distribution: {dist}")
    print(f"Sample shape: {sample.shape}")
    print(f"Sample: {sample}")
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type TruncatedNormal — a TruncatedNormal output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a TruncatedNormal 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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
AbstractGaussianActor Ran
ran on a synthesized input
enjeeneer/conservative-world-models/agents/cfb/agent.py
code served (permissive licence) · get_code("350547f0b8b706cb")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) and returned SquashedNormal. 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
import numpy as np

INIT_ARGS = {
    'observation_length': 4,
    'action_length': 3,
    'hidden_dimension': 8,
    'hidden_layers': 2,
    'activation': 'relu',
    'device': torch.device('cpu'),
    'log_std_bounds': (-5.0, 2.0)
}

ARGS = {
    'observation': torch.randn(2, 4)  # batch_dim=2, observation_length=4
}
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type SquashedNormal — a SquashedNormal output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a SquashedNormal 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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
AbstractPreprocessor Ran
ran on a synthesized input
enjeeneer/conservative-world-models/agents/cfb/agent.py
code served (permissive licence) · get_code("a9f70659526f31de")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) and returned Tensor, ndim 2, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim 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
import torch.nn as nn

# INIT_ARGS for AbstractPreprocessor.__init__
INIT_ARGS = {
    'observation_length': 5,
    'concatenated_variable_length': 3,
    'hidden_dimension': 8,
    'feature_space_dimension': 4,
    'hidden_layers': 2,
    'activation': 'relu',
    'device': torch.device('cpu')
}

# ARGS for forward method
# concatenation shape: [batch_dim, observation_length + concatenated_variable_length]
# = [batch_dim, 5 + 3] = [batch_dim, 8]
ARGS = {
    'concatenation': torch.randn(2, 8)
}
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 2, dtype family float — no output shape is stated: observe_signature.py observed this class with its constructor sizes canonicalised where it could, which the node does not record, so its shape is not stated as this setup block's
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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
BackwardModel Ran
ran on a synthesized input
enjeeneer/conservative-world-models/agents/cfb/agent.py
code served (permissive licence) · get_code("815b8b7187def028")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) and returned Tensor, ndim 2, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim 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

# INIT_ARGS for BackwardModel.__init__
INIT_ARGS = {
    'observation_length': 6,
    'z_dimension': 4,
    'hidden_dimension': 8,
    'hidden_layers': 2,
    'device': torch.device('cpu'),
    'activation': 'relu'
}

# ARGS for BackwardModel.forward
ARGS = {
    'observation': torch.randn(2, 6)  # batch_size=2, observation_length=6
}
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 2, dtype family float — no output shape is stated: observe_signature.py observed this class with its constructor sizes canonicalised where it could, which the node does not record, so its shape is not stated as this setup block's
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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
BackwardRepresentation Ran
ran on a synthesized input
enjeeneer/conservative-world-models/agents/cfb/agent.py
code served (permissive licence) · get_code("ff9f5d55817b5b9e")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) and returned Tensor, ndim 2, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim 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
import torch.nn as nn

device = torch.device('cpu')

INIT_ARGS = {
    'observation_length': 4,
    'z_dimension': 3,
    'backward_hidden_dimension': 8,
    'backward_hidden_layers': 2,
    'device': device,
    'backward_activation': 'relu',
}

ARGS = {
    'observation': torch.randn(2, 4),
}
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 2, dtype family float — no output shape is stated: observe_signature.py observed this class with its constructor sizes canonicalised where it could, which the node does not record, so its shape is not stated as this setup block's
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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
ForwardModel Ran
ran on a synthesized input
enjeeneer/conservative-world-models/agents/cfb/agent.py
code served (permissive licence) · get_code("23d435a38e160c8d")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) and returned Tensor, ndim 2, dtype family float, shape (2, 5) 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 torch
import abc

class AbstractMLP(torch.nn.Module, metaclass=abc.ABCMeta):
    """Abstract base class for all feedforward networks."""

    def __init__(self, input_dimension: int, output_dimension: int, hidden_dimension: int, hidden_layers: int, activation: str, device: torch.device, preprocessor: bool=False, layernorm: bool=False):
        self._input_dimension = input_dimension
        self._output_dimension = output_dimension
        self._hidden_dimension = hidden_dimension
        self._hidden_layers = hidden_layers
        self._activation = activation
        self.device = device
        self._preprocessor = preprocessor
        self._layernorm = layernorm
        super().__init__()
        self.trunk = self._build()

    def _build(self) -> torch.nn.Sequential:
        """
        Creates MLP trunk.
        """
        if self.hidden_layers == 0:
            function = [torch.nn.Linear(self.input_dimension, self.output_dimension)]
        else:
            if self._layernorm:
                function = [torch.nn.Linear(self.input_dimension, self.hidden_dimension), torch.nn.LayerNorm(self.hidden_dimension), torch.nn.Tanh()]
            else:
                function = [torch.nn.Linear(self.input_dimension, self.hidden_dimension), self.activation]
            for _ in range(self.hidden_layers - 1):
                function += [torch.nn.Linear(self.hidden_dimension, self.hidden_dimension), self.activation]
            function.append(torch.nn.Linear(self.hidden_dimension, self.output_dimension))
        if self.preprocessor:
            function.append(self.activation)
        trunk = torch.nn.Sequential(*function).to(self.device)
        return trunk

    @property
    def input_dimension(self) -> int:
        return self._input_dimension

    @property
    def output_dimension(self) -> int:
        return self._output_dimension

    @property
    def hidden_dimension(self) -> int:
        return self._hidden_dimension

    @property
    def hidden_layers(self) -> int:
        return self._hidden_layers

    @property
    def activation(self) -> torch.nn:
        if self._activation == 'relu':
            return torch.nn.ReLU()
        else:
            raise NotImplementedError(f'{self._activation} not implemented.')

    @property
    def preprocessor(self) -> bool:
        return self._preprocessor

class ForwardModel(AbstractMLP):
    """
    Predicts the expected future states (measure) given an
    embedding of a current state-action pair and policy parameterised by z.
    """

    def __init__(self, preprocessor_feature_space_dimension: int, number_of_preprocessed_features: int, z_dimension: int, hidden_dimension: int, hidden_layers: int, device: torch.device, activation: str):
        super().__init__(input_dimension=preprocessor_feature_space_dimension * number_of_preprocessed_features, output_dimension=z_dimension, hidden_dimension=hidden_dimension, hidden_layers=hidden_layers, activation=activation, device=device)

    def forward(self, h: torch.Tensor) -> torch.Tensor:
        """
        Takes observation, action, z, preprocesses and forwards into z-space.
        Args:
            h: preprocessed/embedded obs/action/z tensor of shape
             [batch_dim, preprocessor_feature_space_dimension * number_of_features]
        Returns:
            z_: embedded tensor of shape [batch_dim, z_dimension]
        """
        z_ = self.trunk(h)
        return z_


INIT_ARGS = {
    'preprocessor_feature_space_dimension': 4,
    'number_of_preprocessed_features': 3,
    'z_dimension': 5,
    'hidden_dimension': 8,
    'hidden_layers': 2,
    'device': torch.device('cpu'),
    'activation': 'relu',
}

ARGS = {
    'h': torch.randn(2, 12),
}
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 2, dtype family float, shape (2, 5) — shape (2, 5) 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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
SquashedNormal Ran
ran on a synthesized input
enjeeneer/conservative-world-models/agents/cfb/agent.py
code served (permissive licence) · get_code("6360b567a0112530")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) and returned Tensor, ndim 2, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim 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
import math

class TanhTransform(torch.distributions.transforms.Transform):
    """Implementation of the Tanh transformation."""
    domain = torch.distributions.constraints.real
    codomain = torch.distributions.constraints.interval(-1.0, 1.0)
    bijective = True
    sign = +1

    def __init__(self, cache_size=1):
        super().__init__(cache_size=cache_size)

    @staticmethod
    def atanh(x):
        return 0.5 * (x.log1p() - (-x).log1p())

    def __eq__(self, other):
        return isinstance(other, TanhTransform)

    def _call(self, x):
        return x.tanh()

    def _inverse(self, y):
        return self.atanh(y)

    def log_abs_det_jacobian(self, x, y):
        return 2.0 * (math.log(2.0) - x - torch.nn.functional.softplus(-2.0 * x))

class SquashedNormal(torch.distributions.transformed_distribution.TransformedDistribution):
    """Implementation of the Squashed Normal distribution."""

    def __init__(self, loc, scale):
        self.loc = loc
        self.scale = scale
        self.base_dist = torch.distributions.Normal(loc, scale)
        transforms = [TanhTransform()]
        super().__init__(self.base_dist, transforms)

    @property
    def mean(self):
        mu = self.loc
        for tr in self.transforms:
            mu = tr(mu)
        return mu

INIT_ARGS = {
    'loc': torch.tensor([0.5, -0.3, 1.2]),
    'scale': torch.tensor([1.0, 0.8, 1.5])
}

ARGS = {
    'sample_shape': torch.Size([2])
}

METHOD = 'sample'
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 2, dtype family float — no output shape is stated: observe_signature.py observed this class with its constructor sizes canonicalised where it could, which the node does not record, so its shape is not stated as this setup block's
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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
TanhTransform Ran
ran on a synthesized input
enjeeneer/conservative-world-models/agents/cfb/agent.py
code served (permissive licence) · get_code("18d2cc67d612e1e4")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) and returned Tensor, 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 torch
import math

class TanhTransform(torch.distributions.transforms.Transform):
    """Implementation of the Tanh transformation."""
    domain = torch.distributions.constraints.real
    codomain = torch.distributions.constraints.interval(-1.0, 1.0)
    bijective = True
    sign = +1

    def __init__(self, cache_size=1):
        super().__init__(cache_size=cache_size)

    @staticmethod
    def atanh(x):
        return 0.5 * (x.log1p() - (-x).log1p())

    def __eq__(self, other):
        return isinstance(other, TanhTransform)

    def _call(self, x):
        return x.tanh()

    def _inverse(self, y):
        return self.atanh(y)

    def log_abs_det_jacobian(self, x, y):
        return 2.0 * (math.log(2.0) - x - torch.nn.functional.softplus(-2.0 * x))


INIT_ARGS = {
    'cache_size': 1
}

ARGS = {
    'x': torch.randn(2, 4),
    'y': torch.tanh(torch.randn(2, 4))
}

METHOD = 'log_abs_det_jacobian'

if __name__ == '__main__':
    transform = TanhTransform(**INIT_ARGS)
    result = getattr(transform, METHOD)(**ARGS)
    print(f"Result shape: {result.shape}")
    print(f"Result: {result}")
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, 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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
TruncatedNormal Ran
ran on a synthesized input
enjeeneer/conservative-world-models/agents/cfb/agent.py
code served (permissive licence) · get_code("eb6b6a9c095395c9")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) and returned Tensor, ndim 3, dtype family float, shape (2, 3, 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 torch

class TruncatedNormal(torch.distributions.Normal):
    """Implementation of the Truncated Normal distribution."""

    def __init__(self, loc, scale, low=-1.0, high=1.0, eps=1e-06) -> None:
        super().__init__(loc, scale, validate_args=False)
        self.low = low
        self.high = high
        self.eps = eps

    def _clamp(self, x) -> torch.Tensor:
        clamped_x = torch.clamp(x, self.low + self.eps, self.high - self.eps)
        x = x - x.detach() + clamped_x.detach()
        return x

    def sample(self, clip=None, sample_shape=torch.Size()) -> torch.Tensor:
        shape = self._extended_shape(sample_shape)
        eps = torch.distributions.utils._standard_normal(shape, dtype=self.loc.dtype, device=self.loc.device)
        eps *= self.scale
        if clip is not None:
            eps = torch.clamp(eps, -clip, clip)
        x = self.loc + eps
        return self._clamp(x)


INIT_ARGS = {
    'loc': torch.tensor([0.0, 0.5, -0.3, 0.2]),
    'scale': torch.tensor([0.1, 0.2, 0.15, 0.25]),
    'low': -1.0,
    'high': 1.0,
    'eps': 1e-06
}

ARGS = {
    'clip': 0.5,
    'sample_shape': torch.Size([2, 3])
}

METHOD = 'sample'

if __name__ == '__main__':
    dist = TruncatedNormal(**INIT_ARGS)
    result = dist.sample(**ARGS)
    print(f"Result shape: {result.shape}")
    print(f"Result: {result}")
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 3, dtype family float, shape (2, 3, 4) — shape (2, 3, 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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
schedule Ran
ran, honoured the contract we drafted
enjeeneer/conservative-world-models/agents/cfb/agent.py
code served (permissive licence) · get_code("53f6373e323067d0")
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) and returned float64, ndim 0, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim 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 numpy as np
import re

def schedule(schdl, step) -> float:
    try:
        return float(schdl)
    except ValueError:
        match = re.match('linear\\((.+),(.+),(.+)\\)', schdl)
        if match:
            init, final, duration = [float(g) for g in match.groups()]
            mix = np.clip(step / duration, 0.0, 1.0)
            return (1.0 - mix) * init + mix * final
        match = re.match('step_linear\\((.+),(.+),(.+),(.+),(.+)\\)', schdl)
        if match:
            init, final1, duration1, final2, duration2 = [float(g) for g in match.groups()]
            if step <= duration1:
                mix = np.clip(step / duration1, 0.0, 1.0)
                return (1.0 - mix) * init + mix * final1
            else:
                mix = np.clip((step - duration1) / duration2, 0.0, 1.0)
                return (1.0 - mix) * final1 + mix * final2

ARGS = {
    "schdl": "linear(0.1,0.01,100)",
    "step": 50
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type float64, ndim 0, dtype family float — no output shape is stated: observe_signature.py recorded float ndim 0, which disagrees with the fixture run
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
AbstractAgent Not yet run
unverified (harvested, no recorded run)
enjeeneer/conservative-world-models/agents/cfb/agent.py
code served (permissive licence) · get_code("5c45e7cf6e639135")
How it ran

no invocation recorded.

AbstractMLP Not yet run
unverified (harvested, no recorded run)
enjeeneer/conservative-world-models/agents/cfb/agent.py
code served (permissive licence) · get_code("0952e55bb0dcf25c")
How it ran

no invocation recorded.

ActorModel Not yet run
unverified (harvested, no recorded run)
enjeeneer/conservative-world-models/agents/cfb/agent.py
code served (permissive licence) · get_code("aa653345ad8ad268")
How it ran

no invocation recorded.

Batch Not yet run
unverified (harvested, no recorded run)
enjeeneer/conservative-world-models/agents/cfb/agent.py
code served (permissive licence) · get_code("b940ca501e37511f")
How it ran

no invocation recorded.

CFB Not yet run
unverified (harvested, no recorded run)
enjeeneer/conservative-world-models/agents/cfb/agent.py
code served (permissive licence) · get_code("c28fc24e49523491")
How it ran

no invocation recorded.

FB Not yet run
unverified (harvested, no recorded run)
enjeeneer/conservative-world-models/agents/cfb/agent.py
code served (permissive licence) · get_code("d2fc051560d214e9")
How it ran

no invocation recorded.

ForwardBackwardRepresentation Not yet run
unverified (harvested, no recorded run)
enjeeneer/conservative-world-models/agents/cfb/agent.py
code served (permissive licence) · get_code("64523b02a6612ce0")
How it ran

no invocation recorded.

ForwardRepresentation Not yet run
unverified (harvested, no recorded run)
enjeeneer/conservative-world-models/agents/cfb/agent.py
code served (permissive licence) · get_code("2b3a474296d0ab6a")
How it ran

no invocation recorded.

Also present in other papers' code

Of 18 samples lifted from this paper's linked repositories, 18 carry a function identity and 0 do not. Of the 18 distinct functions with an identity, 1 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 1 later) and 17 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
brick of this paper's assembly: helper
1 other paper
1 later
2510.15382 (2025-10)
Towards Robust Zero-Shot Reinforcement Learning

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-23.

Repositories linked to this paper

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

Abstract

Zero-shot reinforcement learning (RL) promises to provide agents that can perform any task in an environment after an offline, reward-free pre-training phase. Methods leveraging successor measures and successor features have shown strong performance in this setting, but require access to large heterogenous datasets for pre-training which cannot be expected for most real problems. Here, we explore how the performance of zero-shot RL methods degrades when trained on small homogeneous datasets, and propose fixes inspired by conservatism, a well-established feature of performant single-task offline RL algorithms. We evaluate our proposals across various datasets, domains and tasks, and show that conservative zero-shot RL algorithms outperform their non-conservative counterparts on low quality datasets, and perform no worse on high quality datasets. Somewhat surprisingly, our proposals also outperform baselines that get to see the task during training. Our code is available via the project page https://enjeeneer.io/projects/zero-shot-rl/.

For agents

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

get_harvested_code_for_paper("2309.15178")
get_code_for_paper("2309.15178")
have("2309.15178")

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

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

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

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

Connect an agent — have() is free.