SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2501.11039 · 2025

Model Predictive Task Sampling for Efficient and Robust Adaptation

arXiv · PDF · Open in the Atlas

Code that ran

5 of 5 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 5 have no contract verdict; 0 failures of our instrument; 0 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/2501.11039.json · badge: /api/ran/2501.11039.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
thu-rllab/mpts canonical (classifier label)
classifier basis not recorded on the link
5 ran · 0 no recorded run
FunctionStatusWhere it lives
get_returns Ran
ran on a synthesized input
thu-rllab/mpts/MetaRL/meta_testing.py
code served (permissive licence) · get_code("900a7b6332276dd7")
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 (8, 2) 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 simple Episode class to hold rewards and mask
class Episode:
    def __init__(self, rewards, mask):
        self.rewards = rewards
        self.mask = mask

# Build episodes_per_task: list of tasks, each task contains list of episodes
# Each episode has rewards and mask tensors

# Task 1: 2 episodes
task1_episode1 = Episode(
    rewards=torch.randn(3, 4),  # shape (3, 4)
    mask=torch.ones(3, 4)        # shape (3, 4)
)
task1_episode2 = Episode(
    rewards=torch.randn(3, 4),
    mask=torch.ones(3, 4)
)
task1_episodes = [task1_episode1, task1_episode2]

# Task 2: 2 episodes
task2_episode1 = Episode(
    rewards=torch.randn(3, 4),
    mask=torch.ones(3, 4)
)
task2_episode2 = Episode(
    rewards=torch.randn(3, 4),
    mask=torch.ones(3, 4)
)
task2_episodes = [task2_episode1, task2_episode2]

# Combine into episodes_per_task
episodes_per_task = [task1_episodes, task2_episodes]

ARGS = {
    "episodes_per_task": episodes_per_task
}
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 (8, 2) — shape (8, 2) 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
get_task_returns Ran
ran on a synthesized input
thu-rllab/mpts/MetaRL/metalearner.py
code served (permissive licence) · get_code("2e09fec136475516")
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, 2) 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)

class Episode:
    def __init__(self, rewards, mask, infos):
        self.rewards = rewards
        self.mask = mask
        self.infos = infos

# Create sample data for episodes_per_task
# episodes_per_task is a list of tasks, where each task contains a list of episodes
# Each episode has rewards (tensor), mask (tensor), and infos (list of dicts)

# Create 2 tasks
episodes_per_task = []

# Task 0: 2 updates
task0_episodes = []
for update_idx in range(2):
    # rewards shape: (batch_size=3, seq_len=4)
    rewards = torch.randn(3, 4)
    # mask shape: (batch_size=3, seq_len=4)
    mask = torch.ones(3, 4)
    # infos: list of 3 items (batch_size), each is a list with 1 dict
    infos = [
        [{'reward_forward': 1.5}],
        [{'reward_goal': 2.0}],
        [{'reward_forward': 1.8}]
    ]
    episode = Episode(rewards, mask, infos)
    task0_episodes.append(episode)
episodes_per_task.append(task0_episodes)

# Task 1: 2 updates
task1_episodes = []
for update_idx in range(2):
    rewards = torch.randn(3, 4)
    mask = torch.ones(3, 4)
    infos = [
        [{'reward_forward': 1.2}],
        [{'reward_goal': 1.9}],
        [{'reward_forward': 2.1}]
    ]
    episode = Episode(rewards, mask, infos)
    task1_episodes.append(episode)
episodes_per_task.append(task1_episodes)

ARGS = {
    'episodes_per_task': episodes_per_task,
    'use_last_r': False
}
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, 2) — shape (2, 2) 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
make_env Ran
ran on a synthesized input
thu-rllab/mpts/MetaRL/sampler.py
code served (permissive licence) · get_code("4246e3602f23a27a")
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 gym

# The function make_env takes env_name as a parameter
# It returns a callable that creates a gym environment when called
# We need to provide a valid gym environment name

env_name = "CartPole-v1"

ARGS = {
    "env_name": env_name
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
gym — 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
task_get_returns Ran
ran on a synthesized input
thu-rllab/mpts/MetaRL/meta_testing.py
code served (permissive licence) · get_code("0de61eb1c79a8298")
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 1, dtype family float, shape (2,) 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)

class Episode:
    def __init__(self, rewards, mask):
        self.rewards = rewards
        self.mask = mask

# Create episodes for multiple tasks
# Structure: episodes_per_task is a list of tasks
# Each task contains a list of episodes
# Each episode has rewards and mask tensors

episodes_per_task = []

# Task 1: 2 updates/episodes
task1_episodes = []
for update_idx in range(2):
    rewards = torch.randn(3, 4)  # shape: (batch=3, features=4)
    mask = torch.ones(3, 4)  # shape: (batch=3, features=4)
    task1_episodes.append(Episode(rewards, mask))
episodes_per_task.append(task1_episodes)

# Task 2: 2 updates/episodes
task2_episodes = []
for update_idx in range(2):
    rewards = torch.randn(3, 4)  # shape: (batch=3, features=4)
    mask = torch.ones(3, 4)  # shape: (batch=3, features=4)
    task2_episodes.append(Episode(rewards, mask))
episodes_per_task.append(task2_episodes)

ARGS = {
    "episodes_per_task": episodes_per_task
}
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 1, dtype family float, shape (2,) — shape (2,) 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
total_rewards Ran
ran on a synthesized input
thu-rllab/mpts/MetaRL/meta_testing.py
code served (permissive licence) · get_code("9eb6bc08b78e30be")
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 (2,) 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 numpy as np

torch.manual_seed(0)

class Episode:
    def __init__(self, rewards, mask):
        self.rewards = rewards
        self.mask = mask

# Create small episodes with distinct dimensions
# rewards: (seq_len=3, batch=2)
# mask: (seq_len=3, batch=2)
episode1_task1 = Episode(
    rewards=torch.randn(3, 2),
    mask=torch.ones(3, 2)
)
episode2_task1 = Episode(
    rewards=torch.randn(3, 2),
    mask=torch.ones(3, 2)
)

episode1_task2 = Episode(
    rewards=torch.randn(3, 2),
    mask=torch.ones(3, 2)
)
episode2_task2 = Episode(
    rewards=torch.randn(3, 2),
    mask=torch.ones(3, 2)
)

# episodes_per_task is a list of lists of episodes
episodes_per_task = [
    [episode1_task1, episode2_task1],
    [episode1_task2, episode2_task2]
]

ARGS = {
    "episodes_per_task": episodes_per_task,
    "interval": False
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, scipy, torch — 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 (2,) — shape (2,) 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

Also present in other papers' code

Of 5 samples lifted from this paper's linked repositories, 5 carry a function identity and 0 do not. Of the 5 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, 0 later) and 4 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
make_env 1 other paper
1 dated earlier
1703.03400 (2017-03)
Model-Agnostic Meta-Learning for Fast Adaptation of Deep Networks

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

Foundation models have revolutionized general-purpose problem-solving, offering rapid task adaptation through pretraining, meta-training, and finetuning. Recent crucial advances in these paradigms reveal the importance of challenging task prioritized sampling to enhance adaptation robustness under distribution shifts. However, ranking task difficulties over iteration as a preliminary step typically requires exhaustive task evaluation, which is practically unaffordable in computation and data-annotation. This study provides a novel perspective to illuminate the possibility of leveraging the dual importance of adaptation robustness and learning efficiency, particularly in scenarios where task evaluation is risky or costly, such as iterative agent-environment interactions for robotic policy evaluation or computationally intensive inference steps for finetuning foundation models. Firstly, we introduce Model Predictive Task Sampling (MPTS), a framework that bridges the task space and adaptation risk distributions, providing a theoretical foundation for robust active task sampling. MPTS employs a generative model to characterize the episodic optimization process and predicts task-specific adaptation risk via posterior inference. The resulting risk predictive model amortizes the costly evaluation of task adaptation performance and provably approximates task difficulty rankings. MPTS seamlessly integrates into zero-shot, few-shot, and supervised finetuning settings. Empirically, we conduct extensive experiments in pattern recognition using foundation models and sequential decision-making. Our results demonstrate that MPTS significantly enhances adaptation robustness for tail risk or out-of-distribution (OOD) tasks and improves learning efficiency compared to state-of-the-art (SoTA) methods. The code is available at the project site https://github.com/thu-rllab/MPTS.

For agents

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

get_harvested_code_for_paper("2501.11039")
get_code_for_paper("2501.11039")
have("2501.11039")

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

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

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

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

Connect an agent — have() is free.