SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2206.06614 · ICML · 2022

Transformers are Meta-Reinforcement Learners

Luckeciano Melo, Transformer Encoder

arXiv · PDF · Open in the Atlas

Code that ran

3 of 4 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 1 has no contract verdict; 2 failures of our instrument; 1 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/2206.06614.json · badge: /api/ran/2206.06614.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
luckeciano/transformers-metarl canonical (classifier label)
classifier basis not recorded on the link
3 ran · 1 no recorded run
FunctionStatusWhere it lives
find_task_for_env_id_in_any_benchmark Ran
ran; our contract draft was wrong, not the code
luckeciano/transformers-metarl/benchmarks/src/garage_benchmarks/benchmarks.py
code served (permissive licence) · get_code("286b82196c4fe36b")
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, ndim 1, 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

# Set random seed for reproducibility
torch.manual_seed(0)

# Populate the _BENCHMARKS global variable that the function uses
_BENCHMARKS = [
    {
        'name': 'benchmark_1',
        'tasks': [
            {'env_id': 'CartPole-v1', 'reward': 100},
            {'env_id': 'MountainCar-v0', 'reward': 50},
        ]
    },
    {
        'name': 'benchmark_2',
        'tasks': [
            {'env_id': 'Acrobot-v1', 'reward': 75},
            {'env_id': 'LunarLander-v2', 'reward': 200},
        ]
    }
]

# The function takes only one parameter: env_id
ARGS = {
    'env_id': 'CartPole-v1'
}
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 tuple, ndim 1, dtype family float — a tuple output has no array shape of its own; none is stated
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
get_task Ran
ran; our contract draft was wrong, not the code
luckeciano/transformers-metarl/benchmarks/src/garage_benchmarks/benchmarks.py
code served (permissive licence) · get_code("8574703c48d0d43d")
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 torch

# Construct a minimal benchmark dict with tasks
benchmark = {
    'tasks': [
        {'env_id': 'CartPole-v1', 'name': 'CartPole'},
        {'env_id': 'MountainCar-v0', 'name': 'MountainCar'},
        {'env_id': 'Pendulum-v1', 'name': 'Pendulum'},
    ]
}

env_id = 'CartPole-v1'

ARGS = {
    'benchmark': benchmark,
    'env_id': env_id,
}
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 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
make_optimizer Ran
ran on a synthesized input
luckeciano/transformers-metarl/src/garage/_functions.py
code served (permissive licence) · get_code("8a3741971be6face")
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 Adam. 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 torch.nn as nn
import torch.optim as optim

torch.manual_seed(0)

# Create a simple PyTorch module
class SimpleModule(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 3)
    
    def forward(self, x):
        return self.linear(x)

module = SimpleModule()

# Test case 1: optimizer_type as a type with module and kwargs
ARGS = {
    "optimizer_type": optim.Adam,
    "module": module,
    "lr": 0.001,
    "betas": (0.9, 0.999),
    "eps": 1e-8,
    "weight_decay": 0.0,
}
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 Adam — a Adam output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Adam 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_benchmark Not yet run
unverified (harvested, no recorded run)
luckeciano/transformers-metarl/benchmarks/src/garage_benchmarks/benchmarks.py
code served (permissive licence) · get_code("4edad3b8d64c574e")
How it ran

no invocation recorded.

Also present in other papers' code

Of 4 samples lifted from this paper's linked repositories, 4 carry a function identity and 0 do not. Of the 4 distinct functions with an identity, 4 are also present in other papers whose code we hold (4 with at least one paper dated earlier, 0 the same month, 0 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
find_task_for_env_id_in_any_benchmark 5 other papers
5 dated earlier
1604.06778 (2016-04)
Benchmarking Deep Reinforcement Learning for Continuous Control
1606.03476 (2016-06)
Generative Adversarial Imitation Learning
1905.02363 (2019-05)
Dimension-Wise Importance Sampling Weight Clipping for Sample-Efficient Reinforcement Learning
and 2 more not named here
get_benchmark 5 other papers
5 dated earlier
1604.06778 (2016-04)
Benchmarking Deep Reinforcement Learning for Continuous Control
1606.03476 (2016-06)
Generative Adversarial Imitation Learning
1905.02363 (2019-05)
Dimension-Wise Importance Sampling Weight Clipping for Sample-Efficient Reinforcement Learning
and 2 more not named here
get_task 5 other papers
5 dated earlier
1604.06778 (2016-04)
Benchmarking Deep Reinforcement Learning for Continuous Control
1606.03476 (2016-06)
Generative Adversarial Imitation Learning
1905.02363 (2019-05)
Dimension-Wise Importance Sampling Weight Clipping for Sample-Efficient Reinforcement Learning
and 2 more not named here
make_optimizer 2 other papers
2 dated earlier
1604.06778 (2016-04)
Benchmarking Deep Reinforcement Learning for Continuous Control
2205.13697 (2022-05)
FedFormer: Contextual Federation with Attention in 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

The transformer architecture and variants presented a remarkable success across many machine learning tasks in recent years. This success is intrinsically related to the capability of handling long sequences and the presence of contextdependent weights from the attention mechanism. We argue that these capabilities suit the central role of a Meta-Reinforcement Learning algorithm. Indeed, a meta-RL agent needs to infer the task from a sequence of trajectories. Furthermore, it requires a fast adaptation strategy to adapt its policy for a new task -which can be achieved using the self-attention mechanism. In this work, we present TrMRL (Transformers for Meta-Reinforcement Learning), a meta-RL agent that mimics the memory reinstatement mechanism using the transformer architecture. It associates the recent past of working memories to build an episodic memory recursively through the transformer layers. We show that the selfattention computes a consensus representation that minimizes the Bayes Risk at each layer and provides meaningful features to compute the best actions. We conducted experiments in highdimensional continuous control environments for locomotion and dexterous manipulation. Results show that TrMRL presents comparable or superior asymptotic performance, sample efficiency, and out-of-distribution generalization compared to the baselines in these environments.

For agents

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

get_harvested_code_for_paper("2206.06614")
get_code_for_paper("2206.06614")
have("2206.06614")

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

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

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

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

Connect an agent — have() is free.