SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2302.02662 · ICML · 2023

Grounding Large Language Models in Interactive Environments with Online Reinforcement Learning

Sylvain Lamprier, Pierre-Yves Oudeyer, Olivier Sigaud, Thomas Wolf, Thomas Carta, Clément Romac

arXiv · PDF · Open in the Atlas

Code that ran

9 of 12 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (2 of them constructed an object rather than computing a result; 1 honoured the contract we drafted, 0 violated it and 5 have no contract verdict; 3 failures of our instrument; 3 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/2302.02662.json · badge: /api/ran/2302.02662.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
flowersteam/grounding_llms_with_online_rl canonical (classifier label)
classifier basis: classifier_2025
6 ran · 3 no recorded run
clementromac/lamorel canonical (classifier label)
classifier basis not recorded on the link
2 ran · 0 no recorded run
flowersteam/lamorel canonical (classifier label)
classifier basis: classifier_2025
1 ran · 0 no recorded run
FunctionStatusWhere it lives
BaseUpdater Ran
ran on a synthesized input
flowersteam/lamorel/lamorel/src/lamorel/server/llms/updaters/base_updater.py
code served (permissive licence) · get_code("b087b0213c49d353")
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 NoneType. 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 logging
import torch
import numpy as np

logging.basicConfig(level=logging.WARNING)

# Mock LLM module for testing
class MockLLMModule:
    def __init__(self):
        self.param = torch.nn.Parameter(torch.randn(4, 3))
    
    def forward(self, x):
        return x

INIT_ARGS = {}

METHOD = 'perform_update'

ARGS = {
    'contexts': ['This is context one', 'This is context two'],
    'candidates': [['candidate A', 'candidate B'], ['candidate C', 'candidate D']],
    '_current_batch_ids': [0, 1]
}
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 NoneType — a NoneType output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a NoneType 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)
DictList Ran
ran on a synthesized input · constructed an object; no result was computed
flowersteam/grounding_llms_with_online_rl/experiments/agents/ppo/llm_ppo_agent.py
code served (permissive licence) · get_code("f35eacbd3758dba2")
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 an instance of its own class, DictList: the run constructed the object and did not call it, so no result was computed. 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 random
from collections.abc import Mapping

# Construct the argument for DictList
# The __init__ is inherited from dict, so it takes a dict-like object as input
# Looking at the class, it's initialized with a dict where values are lists

# Create a simple dictionary of lists with same length
test_dict = {
    "a": [[1, 2], [3, 4], [5, 6]],
    "b": [[7], [8], [9]],
    "c": [["x", "y"], ["z", "w"], ["p", "q"]]
}

ARGS = {
    "dict": test_dict
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type DictList — the run constructed an instance of its own class and did not call it; no shape 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
ExtraInfoCollector Ran
ran on a synthesized input · constructed an object; no result was computed
flowersteam/grounding_llms_with_online_rl/experiments/agents/ppo/llm_ppo_agent.py
code served (permissive licence) · get_code("f93854005e6f5869")
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 an instance of its own class, ExtraInfoCollector: the run constructed the object and did not call it, so no result was computed. 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 random
from colorama import init

torch.manual_seed(0)
init(autoreset=True)

ARGS = {
    'aux_info': ['seen_state', 'see_door', 'see_obj', 'obj_in_instr', 'in_front_of_what', 'visit_proportion', 'bot_action'],
    'shape': (2, 4),
    'device': torch.device('cpu')
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
colorama, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ExtraInfoCollector — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a ExtraInfoCollector 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
emph Ran
ran; our contract draft was wrong, not the code
flowersteam/grounding_llms_with_online_rl/experiments/agents/ppo/llm_ppo_agent.py
code served (permissive licence) · get_code("efa2c567105100f0")
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 str. 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
from colorama import Fore, Back, Style, init

init(autoreset=False)

ARGS = {
    'text': 'Hello World',
    'color': 'B'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
colorama, numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str 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
info Ran
ran; our contract draft was wrong, not the code
flowersteam/grounding_llms_with_online_rl/experiments/agents/ppo/llm_ppo_agent.py
code served (permissive licence) · get_code("a01836a09eb71d45")
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 str. 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
from colorama import Fore, Back, Style, init

init(autoreset=False)

COLORS = {'R': Fore.RED, 'G': Fore.GREEN, 'B': Fore.BLUE, 'P': Fore.MAGENTA, 'Y': Fore.YELLOW, 'Q': Fore.WHITE, 'K': Fore.BLACK, ' ': Fore.RESET}

def emph(text, color='B'):
    ascii_color = COLORS.get(color, Fore.BLACK)
    return ascii_color + Style.BRIGHT + text + Fore.BLACK + Style.RESET_ALL

def info(text, heading=None, heading_color='B'):
    if heading:
        return f'\t{emph(heading)}: {text}'
    else:
        return f'\t{text}'

ARGS = {
    'text': 'This is some informational text',
    'heading': 'Status',
    'heading_color': 'G'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
colorama, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str 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
load_hf_model_and_tokenizer Ran
ran on a synthesized input
clementromac/lamorel/lamorel/src/lamorel/server/llms/utils/load_hf_model_and_tokenizer.py
code served (permissive licence) · get_code("a71506f048bfc377")
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
from transformers import AutoTokenizer, AutoConfig
from unittest.mock import Mock, MagicMock
from enum import Enum

# Mock the model classes since we can't download real models
class MockCausalLM:
    @classmethod
    def from_pretrained(cls, path, **kwargs):
        return Mock()
    
    @classmethod
    def from_config(cls, config, **kwargs):
        return Mock()

class MockSeq2SeqLM:
    @classmethod
    def from_pretrained(cls, path, **kwargs):
        return Mock()
    
    @classmethod
    def from_config(cls, config, **kwargs):
        return Mock()

# Create a mock tokenizer
class MockTokenizer:
    pass

# Create a mock config with necessary attributes
class MockConfig:
    def __init__(self):
        self.num_hidden_layers = 12
        self.attribute_map = {}

# Mock AutoTokenizer.from_pretrained
original_tokenizer_from_pretrained = AutoTokenizer.from_pretrained
AutoTokenizer.from_pretrained = Mock(return_value=MockTokenizer())

# Mock AutoConfig.from_pretrained
original_config_from_pretrained = AutoConfig.from_pretrained
AutoConfig.from_pretrained = Mock(return_value=MockConfig())

# Patch the ModelTypesEnum to use our mock classes
from transformers import AutoModelForCausalLM, AutoModelForSeq2SeqLM

class ModelTypesEnum(Enum):
    causal = MockCausalLM
    seq2seq = MockSeq2SeqLM

# Replace in the module namespace for the function to use
import sys
current_module = sys.modules[__name__]
current_module.ModelTypesEnum = ModelTypesEnum

ARGS = {
    'type': 'causal',
    'path': 'gpt2',
    'pretrained': True
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch, transformers — 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
prepare_args_for_parsing Ran
ran on a synthesized input
clementromac/lamorel/lamorel/src/lamorel_launcher/launch.py
code served (permissive licence) · get_code("5451850f7e5ef008")
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 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

torch.manual_seed(0)

def prepare_args_for_parsing(dict_args):
    args = []
    for key, value in dict_args.items():
        args.append(f'--{key}')
        if value is not None:
            args.append(f'{value}')
    return args

ARGS = {
    'dict_args': {
        'learning_rate': 0.001,
        'batch_size': 32,
        'epochs': 10,
        'model_name': 'bert',
        'debug': None,
        'output_dir': '/tmp/output',
        'seed': 42,
        'use_cuda': 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 list, ndim 1, 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
reward_function Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
flowersteam/grounding_llms_with_online_rl/experiments/train_language_agent.py
code served (permissive licence) · get_code("351f0073ef3dccf5")
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 list, 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

torch.manual_seed(0)

# The function only uses:
# - reward: compared with 0 (numeric comparison)
# - subgoal_proba, policy_value, llm_0: not used in the function body

ARGS = {
    "subgoal_proba": torch.tensor([[0.1, 0.2, 0.3, 0.4], [0.5, 0.6, 0.7, 0.8]]),
    "reward": 5.0,
    "policy_value": torch.tensor([[1.0, 2.0, 3.0, 4.0], [5.0, 6.0, 7.0, 8.0]]),
    "llm_0": None,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 1, 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
reward_function_shapped Ran
ran, honoured the contract we drafted
flowersteam/grounding_llms_with_online_rl/experiments/train_language_agent.py
code served (permissive licence) · get_code("fdf8fa20114f1fbe")
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 list, 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 numpy as np

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

# Define ARGS dict with valid arguments for reward_function_shapped
ARGS = {
    "subgoal_proba": 0.7,  # probability value between 0 and 1
    "reward": 5.0,  # positive reward value
    "policy_value": 0.3,  # policy value for division
    "llm_0": None  # not used in function body
}
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 list, ndim 1, 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
BaseAgent Not yet run
unverified (harvested, no recorded run)
flowersteam/grounding_llms_with_online_rl/experiments/agents/ppo/llm_ppo_agent.py
code served (permissive licence) · get_code("3a32c056e4db9777")
How it ran

no invocation recorded.

BasePPOAgent Not yet run
unverified (harvested, no recorded run)
flowersteam/grounding_llms_with_online_rl/experiments/agents/ppo/llm_ppo_agent.py
code served (permissive licence) · get_code("e7ee48ded5e587f1")
How it ran

no invocation recorded.

LLMPPOAgent Not yet run
unverified (harvested, no recorded run)
flowersteam/grounding_llms_with_online_rl/experiments/agents/ppo/llm_ppo_agent.py
code served (permissive licence) · get_code("7c1ab31fe12a53a6")
How it ran

no invocation recorded.

Also present in other papers' code

Of 12 samples lifted from this paper's linked repositories, 12 carry a function identity and 0 do not. Of the 12 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 11 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
ExtraInfoCollector
brick of this paper's assembly: helper
1 other paper
1 dated earlier
1707.06347 (2017-07)
Proximal Policy Optimization Algorithms

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

Recent works successfully leveraged Large Language Models' (LLM) abilities to capture abstract knowledge about world's physics to solve decision-making problems. Yet, the alignment between LLMs' knowledge and the environment can be wrong and limit functional competence due to lack of grounding. In this paper, we study an approach (named GLAM) to achieve this alignment through functional grounding: we consider an agent using an LLM as a policy that is progressively updated as the agent interacts with the environment, leveraging online Reinforcement Learning to improve its performance to solve goals. Using an interactive textual environment designed to study higher-level forms of functional grounding, and a set of spatial and navigation tasks, we study several scientific questions: 1) Can LLMs boost sample efficiency for online learning of various RL tasks? 2) How can it boost different forms of generalization? 3) What is the impact of online learning? We study these questions by functionally grounding several variants (size, architecture) of FLAN-T5.

For agents

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

get_harvested_code_for_paper("2302.02662")
get_code_for_paper("2302.02662")
have("2302.02662")

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

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

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

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

Connect an agent — have() is free.