SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2011.00382 · ICML · 2021

A Policy Gradient Algorithm for Learning to Learn in Multiagent Reinforcement Learning

Chuangchuang Sun, Dong-Ki Kim, Jonathan How, Miao Liu, Matthew Riemer, Marwa Abdulhai, Golnaz Habibi, Sebastian Lopez-Cot, Gerald Tesauro

arXiv · PDF · Open in the Atlas

Code that ran

6 of 8 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; 2 honoured the contract we drafted, 0 violated it and 3 have no contract verdict; 1 failure of our instrument; 2 no recorded run), measured 2026-11-21; 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/2011.00382.json · badge: /api/ran/2011.00382.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
dkkim93/meta-mapg canonical (classifier label)
classifier basis: census
3 ran · 1 no recorded run
alexis-jacq/LOLA community
Papers with Code archive
3 ran · 1 no recorded run
FunctionStatusWhere it lives
build_grads Ran
ran on a synthesized input
alexis-jacq/LOLA/lola_dice/rpg.py
code served (permissive licence) · get_code("d43d42fecfa6b959")
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 list, 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 tensorflow as tf

# Set up TensorFlow to use eager execution for easier testing
tf.config.run_functions_eagerly(True)

# Create a simple scope name
scope_name = "test_scope"

# Create loss tensors - small tensors representing scalar losses
loss1 = tf.constant(2.5, dtype=tf.float32)
loss2 = tf.constant(1.3, dtype=tf.float32)
losses = [loss1, loss2]

# Create parameter lists - each loss will have its own set of parameters
# First set of parameters for loss1
param1_1 = tf.Variable(tf.ones((2, 3), dtype=tf.float32), trainable=True)
param1_2 = tf.Variable(tf.ones((4,), dtype=tf.float32), trainable=True)
params1 = [param1_1, param1_2]

# Second set of parameters for loss2
param2_1 = tf.Variable(tf.ones((2, 3), dtype=tf.float32), trainable=True)
param2_2 = tf.Variable(tf.ones((4,), dtype=tf.float32), trainable=True)
params2 = [param2_1, param2_2]

params = [params1, params2]

ARGS = {
    "scope": scope_name,
    "losses": losses,
    "params": params
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 2, dtype family float — a list 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
build_losses Ran
ran, honoured the contract we drafted
alexis-jacq/LOLA/lola_dice/rpg.py
code served (permissive licence) · get_code("83c18353fc1e61a1")
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 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 tensorflow as tf
import numpy as np

class Policy:
    """Stand-in Policy class with required attributes."""
    def __init__(self, batch_size=2, seq_len=3, action_dim=4):
        self.batch_size = batch_size
        self.seq_len = seq_len
        self.action_dim = action_dim
        
        # Create placeholder tensors that the function uses
        self.log_pi_acs_cumsum = tf.constant(
            np.random.randn(batch_size, seq_len).astype(np.float32)
        )
        self.log_pi_acs = tf.constant(
            np.random.randn(batch_size, seq_len).astype(np.float32)
        )
        self.vpred = tf.constant(
            np.random.randn(batch_size, seq_len).astype(np.float32)
        )
        self.discount = tf.constant(
            np.random.randn(batch_size, seq_len).astype(np.float32)
        )
        self.rets_ph = tf.constant(
            np.random.randn(batch_size, seq_len).astype(np.float32)
        )
        self.values_ph = tf.constant(
            np.random.randn(batch_size, seq_len).astype(np.float32)
        )

# Create policies
policy1 = Policy(batch_size=2, seq_len=3, action_dim=4)
policy2 = Policy(batch_size=2, seq_len=3, action_dim=5)

ARGS = {
    'scope': 'test_scope',
    'policies': [policy1, policy2],
    'use_baseline': True,
    'use_dice': True,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 2, 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
lstm_cell Ran
ran on a synthesized input
dkkim93/meta-mapg/network/categorical_lstm.py
code served (permissive licence) · get_code("f006932feacd0d06")
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 3, 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

torch.manual_seed(0)

# LSTM cell parameters
batch_size = 2
input_size = 4
hidden_size = 3

# Input tensor: (batch_size, input_size)
input_tensor = torch.randn(batch_size, input_size)

# Hidden state (h_t): (batch_size, hidden_size)
h_t = torch.randn(batch_size, hidden_size)

# Cell state (c_t): (batch_size, hidden_size)
c_t = torch.randn(batch_size, hidden_size)

hidden = (h_t, c_t)

# Weight matrices
# w_ih: (4 * hidden_size, input_size) - 4 gates * hidden_size
w_ih = torch.randn(4 * hidden_size, input_size)

# w_hh: (4 * hidden_size, hidden_size)
w_hh = torch.randn(4 * hidden_size, hidden_size)

# Bias terms
# b_ih: (4 * hidden_size,)
b_ih = torch.randn(4 * hidden_size)

# b_hh: (4 * hidden_size,)
b_hh = torch.randn(4 * hidden_size)

ARGS = {
    'input': input_tensor,
    'hidden': hidden,
    'w_ih': w_ih,
    'w_hh': w_hh,
    'b_ih': b_ih,
    'b_hh': b_hh,
}
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 3, 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
magic_box Ran
ran; our contract draft was wrong, not the code
dkkim93/meta-mapg/meta/dice.py
code served (permissive licence) · get_code("17699ef2e449301d")
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 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

torch.manual_seed(0)

# Create a small input tensor
x = torch.randn(2, 4, requires_grad=True)

ARGS = {
    "x": x
}
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 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: none by the harness; any seed is in the setup block
pc_grad Ran
ran on a synthesized input
dkkim93/meta-mapg/meta/projection_grad.py
code served (permissive licence) · get_code("fdc3c01715c2c370")
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 ndarray, ndim 1, dtype family float, shape (12,) 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 random
import numpy as np
from multiprocessing import Manager
import argparse

# Set random seed for reproducibility
random.seed(0)
np.random.seed(0)

# Create a multiprocessing manager dict to simulate process_dict
manager = Manager()
process_dict = manager.dict()

# Create sample gradients for multiple processes
# Using distinct sizes (4, 3) for dimensions
n_process = 4
n_params = 12

# Populate process_dict with gradients from each process
for rank in range(n_process):
    for task_id in range(2):
        key = str(rank) + f"_task_{task_id}"
        # Create a small gradient vector
        grad = np.random.randn(n_params).astype(np.float32)
        process_dict[key] = grad

# Create args with required attributes
args = argparse.Namespace(
    n_process=n_process
)

# Set up parameters for pc_grad function
rank = 0
key = "_task_0"
eps = 1e-08

# Define ARGS dictionary
ARGS = {
    "process_dict": process_dict,
    "rank": rank,
    "args": args,
    "key": key,
    "eps": eps
}
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 ndarray, ndim 1, dtype family float, shape (12,) — shape (12,) 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
stop_forward Ran
ran, honoured the contract we drafted
alexis-jacq/LOLA/lola_dice/rpg.py
code served (permissive licence) · get_code("cfc6f16a78f519bd")
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 SymbolicTensor. 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 tensorflow as tf
import numpy as np

# Create a small TensorFlow tensor
x_value = tf.constant([
    [1.0, 2.0, 3.0, 4.0],
    [5.0, 6.0, 7.0, 8.0]
], dtype=tf.float32)

# The function takes a single parameter 'x' which should be a tensor
ARGS = {
    'x': x_value
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type SymbolicTensor — a SymbolicTensor 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
build_new_params Not yet run
unverified (harvested, no recorded run)
alexis-jacq/LOLA/lola_dice/rpg.py
code served (permissive licence) · get_code("3084c14c98bf7e53")
How it ran

no invocation recorded.

get_dice_loss Not yet run
unverified (harvested, no recorded run)
dkkim93/meta-mapg/meta/dice.py
code served (permissive licence) · get_code("2a6aa3337b478e39")
How it ran

no invocation recorded.

Also present in other papers' code

Of 8 samples lifted from this paper's linked repositories, 8 carry a function identity and 0 do not. Of the 8 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 7 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
magic_box 2 other papers
1 dated earlier, 1 later
1709.04326 (2017-09)
Learning with Opponent-Learning Awareness
2112.15400 (2021-12)
A Theoretical Understanding of Gradient Bias in Meta-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-21.

Repositories linked to this paper

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

Abstract

A fundamental challenge in multiagent reinforcement learning is to learn beneficial behaviors in a shared environment with other simultaneously learning agents. In particular, each agent perceives the environment as effectively nonstationary due to the changing policies of other agents. Moreover, each agent is itself constantly learning, leading to natural non-stationarity in the distribution of experiences encountered. In this paper, we propose a novel meta-multiagent policy gradient theorem that directly accounts for the non-stationary policy dynamics inherent to multiagent learning settings. This is achieved by modeling our gradient updates to consider both an agent's own non-stationary policy dynamics and the non-stationary policy dynamics of other agents in the environment. We show that our theoretically grounded approach provides a general solution to the multiagent learning problem, which inherently comprises all key aspects of previous state of the art approaches on this topic. We test our method on a diverse suite of multiagent benchmarks and demonstrate a more efficient ability to adapt to new agents as they learn than baseline methods across the full spectrum of mixed incentive, competitive, and cooperative domains. Our contributions. With this insight, we make the following primary contributions in this paper: 1) New theorem: We derive a new meta-multiagent policy gradient theorem (Meta-MAPG) that, for the first time,

For agents

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

get_harvested_code_for_paper("2011.00382")
get_code_for_paper("2011.00382")
have("2011.00382")

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

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

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

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

Connect an agent — have() is free.