SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2410.06101 · NeurIPS · 2024

Coevolving with the Other You: Fine-Tuning LLM with Sequential Cooperative Multi-Agent Reinforcement Learning

Hao Ma, Tianyi Hu, Min Chen, Zhiqiang Pu, Boyin Liu, Xiaolin Ai, Yanyan Liang

arXiv · PDF · Open in the Atlas

Code that ran

8 of 11 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, 2 violated it and 0 have no contract verdict; 6 failures of our instrument; 3 no recorded run), measured 2026-11-22; 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/2410.06101.json · badge: /api/ran/2410.06101.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
Harry67Hu/CORY canonical (classifier label)
classifier basis: census
8 ran · 3 no recorded run
FunctionStatusWhere it lives
collator Ran
ran; our contract draft was wrong, not the code
Harry67Hu/CORY/imdb_train/cory.py
code served (permissive licence) · get_code("bda36ad0c44dbd74")
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 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

torch.manual_seed(0)

# The collator function takes a list of dictionaries and groups values by key
# It expects data to be a list where each element is a dict with the same keys

# Create sample data - a list of dicts with consistent keys
data = [
    {
        "input_ids": torch.tensor([1, 2, 3, 4]),
        "attention_mask": torch.tensor([1, 1, 1, 0]),
        "labels": 0
    },
    {
        "input_ids": torch.tensor([5, 6, 7, 8]),
        "attention_mask": torch.tensor([1, 1, 1, 1]),
        "labels": 1
    }
]

ARGS = {
    "data": data
}
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 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
convert_to_scalar Ran
ran; our contract draft was wrong, not the code
Harry67Hu/CORY/trl/core.py
code served (permissive licence) · get_code("c32b636f13ed9ee5")
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
import numpy as np

torch.manual_seed(0)

ARGS = {
    "stats": {
        "loss": torch.tensor(0.5),
        "accuracy": torch.tensor([0.95]),
        "batch_size": 32,
        "learning_rate": 0.001,
        "numpy_metric": np.array(0.87),
        "numpy_array_metric": np.array([0.92]),
        "string_value": "test",
        "multi_dim_tensor": torch.randn(2, 3),
    }
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, 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
create_demo_text Ran
ran; our contract draft was wrong, not the code
Harry67Hu/CORY/gsm8k_utils/gsm8k_utils.py
code served (permissive licence) · get_code("5013cfeaf23a03ad")
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 random

ARGS = {
    'n_shot': 3,
    'cot_flag': True
}
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 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
extract_answer_from_output Ran
ran; our contract draft was wrong, not the code
Harry67Hu/CORY/gsm8k_utils/gsm8k_utils.py
pointer only (licence: MIT); the stored copy get_code serves, from voidism/DoLa, is pointer only (licence: NONE) · get_code("96fe095fcc6b821a")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from voidism/DoLa, and GitHub detected no licence in that repository when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

is_correct Ran
ran, violated the contract we drafted
Harry67Hu/CORY/gsm8k_utils/gsm8k_utils.py
code served (permissive licence) · get_code("e198da7bdc5637e3")
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 bool, ndim 0, dtype family float, shape () 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 re

ANS_RE = re.compile('#### (\\-?[0-9\\.\\,]+)')
INVALID_ANS = '[invalid]'

def extract_answer_from_output(completion):
    match = ANS_RE.search(completion)
    if match:
        match_str = match.group(1).strip()
        match_str = match_str.replace(',', '')
        return match_str
    else:
        return INVALID_ANS

def is_correct(model_answer, answer):
    gt_answer = extract_answer_from_output(answer)
    assert gt_answer != INVALID_ANS
    return model_answer == gt_answer

# Setup code to construct valid arguments
model_answer = "42.5"
answer = "The calculation gives us #### 42.5 as the final result."

ARGS = {
    "model_answer": model_answer,
    "answer": answer
}
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 bool, ndim 0, dtype family float, shape () — shape () 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
is_transformers_greater_than Ran
ran, violated the contract we drafted
Harry67Hu/CORY/trl/import_utils.py
code served (permissive licence) · get_code("f4334934ee795269")
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 bool, ndim 0, dtype family float, shape () 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 importlib

# The function takes a version string and compares it with the installed
# transformers library version. We just need to provide a valid version string.
ARGS = {
    "version": "4.0.0"
}
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 bool, ndim 0, dtype family float, shape () — shape () 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
respond_to_batch Ran
ran; our contract draft was wrong, not the code
Harry67Hu/CORY/trl/models/model.py
code served (permissive licence) · get_code("3fe7529a76b17e9c")
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 int, shape (2, 400) 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 torch.nn as nn

torch.manual_seed(0)

class MockGenerateModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 4)
    
    def generate(self, input_ids, attention_mask=None, do_sample=False, top_k=5, top_p=1.0, max_length=400):
        batch_size = input_ids.shape[0]
        seq_length = max_length
        output = torch.randint(0, 100, (batch_size, seq_length), dtype=torch.long)
        return output

class MockModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.model = MockGenerateModel()

model = MockModel()
source_ids = torch.randint(0, 100, (2, 3), dtype=torch.long)
attention_mask = torch.ones((2, 3), dtype=torch.long)
max_target_length = 400
top_k = 5
top_p = 1.0

ARGS = {
    "model": model,
    "source_ids": source_ids,
    "attention_mask": attention_mask,
    "max_target_length": max_target_length,
    "top_k": top_k,
    "top_p": top_p
}
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 int, shape (2, 400) — shape (2, 400) 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
top_k_top_p_filtering Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
Harry67Hu/CORY/trl/core.py
code served (permissive licence) · get_code("5bcf8e086423cf6b")
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
from transformers.generation import TopKLogitsWarper, TopPLogitsWarper

torch.manual_seed(0)

# Create small logits tensor: batch_size=2, vocab_size=4
logits = torch.randn(2, 4, dtype=torch.float32)

ARGS = {
    "logits": logits,
    "top_k": 2,
    "top_p": 0.9,
    "filter_value": -float('Inf'),
    "min_tokens_to_keep": 1,
}
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 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
build_dataset Not yet run
unverified (harvested, no recorded run)
Harry67Hu/CORY/gsm8k_utils/gsm8k_eval.py
code served (permissive licence) · get_code("0efa9af73116efc0")
How it ran

no invocation recorded.

flatten_dict Not yet run
unverified (harvested, no recorded run)
Harry67Hu/CORY/trl/core.py
code served (permissive licence) · get_code("a51ae45a1f6c0b5b")
How it ran

no invocation recorded.

scheduler_step Not yet run
unverified (harvested, no recorded run)
Harry67Hu/CORY/trl/models/modeling_sd_base.py
code served (permissive licence) · get_code("59046fe10dd792f4")
How it ran

no invocation recorded.

Also present in other papers' code

Of 11 samples lifted from this paper's linked repositories, 11 carry a function identity and 0 do not. Of the 11 distinct functions with an identity, 7 are also present in other papers whose code we hold (7 with at least one paper dated earlier, 3 the same month, 6 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
top_k_top_p_filtering 21 other papers
6 dated earlier, 2 the same month, 13 later
2305.12191 (2023-05)
Pointwise Mutual Information Based Metric and Decoding Strategy for Faithful Generation in Document Grounded Dialogs
2305.18290 (2023-05)
Direct Preference Optimization: Your Language Model is Secretly a Reward Model
2311.17911 (2023-11)
OPERA: Alleviating Hallucination in Multi-Modal Large Language Models via Over-Trust Penalty and Retrospection-Allocation
and 18 more not named here
convert_to_scalar 18 other papers
3 dated earlier, 2 the same month, 13 later
2305.18290 (2023-05)
Direct Preference Optimization: Your Language Model is Secretly a Reward Model
2406.11280 (2024-06)
ISR-DPO: Aligning Large Multimodal Models for Videos by Iterative Self-Retrospective DPO
2406.19371 (2024-06)
Suri: Multi-constraint Instruction Following for Long-form Text Generation
and 15 more not named here
flatten_dict 18 other papers
3 dated earlier, 2 the same month, 13 later
2305.18290 (2023-05)
Direct Preference Optimization: Your Language Model is Secretly a Reward Model
2406.11280 (2024-06)
ISR-DPO: Aligning Large Multimodal Models for Videos by Iterative Self-Retrospective DPO
2406.19371 (2024-06)
Suri: Multi-constraint Instruction Following for Long-form Text Generation
and 15 more not named here
collator 9 other papers
9 dated earlier
1909.08593 (2019-09)
Fine-Tuning Language Models from Human Preferences
2204.07705 (2022-04)
SUPER-NATURALINSTRUCTIONS: Generalization via Declarative Instructions on 1600+ NLP Tasks
2304.08177 (2023-04)
Efficient and Effective Text Encoding for Chinese LLaMA and Alpaca
and 6 more not named here
extract_answer_from_output 5 other papers
3 dated earlier, 2 later
2309.03883 (2023-09)
DoLa: Decoding by Contrasting Layers Improves Factuality in Large Language Models
2401.05930 (2024-01)
SH2: Self-Highlighted Hesitation Helps You Decode More Truthfully
2403.01548 (2024-03)
In-Context Sharpness as Alerts: An Inner Representation Perspective for Hallucination Mitigation
and 2 more not named here
is_transformers_greater_than 4 other papers
3 dated earlier, 1 later
2404.14233 (2024-04)
Detecting and Mitigating Hallucination in Large Vision Language Models via Fine-Grained AI Feedback
2405.18654 (2024-05)
Mitigating Object Hallucination in MLLMs via Data-augmented Phrase-level Alignment
2405.21075 (2024-05)
Video-MME: The First-Ever Comprehensive Evaluation Benchmark of Multi-modal LLMs in Video Analysis
and 1 more not named here
scheduler_step 4 other papers
1 dated earlier, 3 later
2305.18290 (2023-05)
Direct Preference Optimization: Your Language Model is Secretly a Reward Model
2501.06911 (2025-01)
Risk-Averse Fine-tuning of Large Language Models
2509.12521 (2025-09)
Phi: Preference Hijacking in Multi-modal Large Language Models at Inference Time
and 1 more not named here

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

Reinforcement learning (RL) has emerged as a pivotal technique for fine-tuning large language models (LLMs) on specific tasks. However, prevailing RL finetuning methods predominantly rely on PPO and its variants. Though these algorithms are effective in general RL settings, they often exhibit suboptimal performance and vulnerability to distribution collapse when applied to the fine-tuning of LLMs. In this paper, we propose CORY, extending the RL fine-tuning of LLMs to a sequential cooperative multi-agent reinforcement learning framework, to leverage the inherent coevolution and emergent capabilities of multi-agent systems. In CORY, the LLM to be fine-tuned is initially duplicated into two autonomous agents: a pioneer and an observer. The pioneer generates responses based on queries, while the observer generates responses using both the queries and the pioneer's responses. The two agents are trained together. During training, the agents exchange roles periodically, fostering cooperation and coevolution between them. Experiments evaluate CORY's performance by fine-tuning GPT-2 and Llama-2 under subjective and objective reward functions on the IMDB Review and GSM8K datasets, respectively. Results show that CORY outperforms PPO in terms of policy optimality, resistance to distribution collapse, and training robustness, thereby underscoring its potential as a superior methodology for refining LLMs in real-world applications. The code can be found at: https://github.com/Harry67Hu/CORY.

For agents

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

get_harvested_code_for_paper("2410.06101")
get_code_for_paper("2410.06101")
have("2410.06101")

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

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

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

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

Connect an agent — have() is free.