SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2406.10977 · 2024

Toward Optimal LLM Alignments Using Two-Player Games

arXiv · PDF · Open in the Atlas

Code that ran

7 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; 0 honoured the contract we drafted, 0 violated it and 0 have no contract verdict; 7 failures of our instrument; 1 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/2406.10977.json · badge: /api/ran/2406.10977.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
ruizheng20/gpo canonical (classifier label)
classifier basis: census
7 ran · 1 no recorded run
FunctionStatusWhere it lives
build_prompt_history Ran
ran; our contract draft was wrong, not the code
ruizheng20/gpo/gpo/gpo_datahelper.py
code served (permissive licence) · get_code("4ac3d9d133a3734b")
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 logging

p1_prompt = 'Human:'
p2_prompt = 'AI:'

def build_prompt_history(context, dialog_sep='<\\s>'):
    if isinstance(context, list):
        if len(context) == 0:
            n_turns = 0
            context = [p1_prompt]
        elif context[-1].startswith(p1_prompt):
            n_turns = 1
        elif context[-1].startswith(p2_prompt):
            n_turns = 2
        else:
            logging.critical(context)
            raise ValueError
        context = dialog_sep.join(context)
    if n_turns == 0:
        return f'{context}'
    else:
        return f'{context}{dialog_sep}' + p1_prompt


# Test case 1: empty list
context_empty = []

# Test case 2: list ending with p1_prompt
context_p1 = ['Human: Hello', 'AI: Hi there', 'Human:']

# Test case 3: list ending with p2_prompt
context_p2 = ['Human: Hello', 'AI: Hi there']

# Test case 4: string context
context_string = 'Human: Hello<\\s>AI: Hi'

ARGS = {
    'context': ['Human: Hello', 'AI: Hi there'],
    'dialog_sep': '<\\s>'
}
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
get_adv_separate_prompt Ran
ran; our contract draft was wrong, not the code
ruizheng20/gpo/gpo/gpo_datahelper.py
code served (permissive licence) · get_code("f6d83385de70f664")
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

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

# The function get_adv_separate_prompt takes a single parameter 'i' which is an int
# It uses i % 2 == 0 to determine which prompt to return
# No other parameters or complex objects are needed

ARGS = {
    'i': 0
}
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 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
get_global_statistics Ran
ran; our contract draft was wrong, not the code
ruizheng20/gpo/utils.py
code served (permissive licence) · get_code("e1507eef3b40426e")
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 unittest.mock import Mock

torch.manual_seed(0)

# Create a mock accelerator that implements the minimal interface needed
mock_accelerator = Mock()
mock_accelerator.device = 'cpu'

# Mock the reduce method to sum across processes (simulating single process)
def mock_reduce(tensor):
    return tensor

mock_accelerator.reduce = mock_reduce

# Create a small tensor (batch size 2, dimension 4)
xs = torch.randn(2, 4)

# Create a mask tensor (optional, same shape as xs)
mask = torch.ones(2, 4, dtype=torch.bool)

ARGS = {
    'accelerator': mock_accelerator,
    'xs': xs,
    'mask': mask,
    'device': 'cpu'
}
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_separate_prompt Ran
ran; our contract draft was wrong, not the code
ruizheng20/gpo/gpo/gpo_datahelper.py
code served (permissive licence) · get_code("31961e93e883be23")
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

p1_prompt = 'Human:'
p2_prompt = 'AI:'

def get_separate_prompt(i: int):
    assert p1_prompt is not None and p2_prompt is not None
    return p1_prompt if i % 2 == 0 else p2_prompt

ARGS = {
    'i': 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 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
get_separate_prompt Ran
ran; our contract draft was wrong, not the code
ruizheng20/gpo/rm/reward_datahelper.py
code served (permissive licence) · get_code("8a9c8c138ba6f286")
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

torch.manual_seed(0)

def get_human_prompt():
    return 'Human:'

def get_assistant_prompt():
    return 'Assistant:'

def get_separate_prompt(i: int):
    return get_human_prompt() if i % 2 == 0 else get_assistant_prompt()

ARGS = {
    'i': 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 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
mean_pooling Ran
ran; our contract draft was wrong, not the code
ruizheng20/gpo/gpo/sentence_embed.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from dengyang17/llm-proactive, is pointer only (licence: NONE) · get_code("77f69af078e09830")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (Apache-2.0), but get_code serves the stored copy, first harvested from dengyang17/llm-proactive, 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.

whiten Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
ruizheng20/gpo/utils.py
code served (permissive licence) · get_code("b60c18c9b0c0e819")
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 minimal accelerator mock that supports distributed operations
class MockAccelerator:
    def __init__(self):
        self.device = 'cpu'
        self.use_distributed = False
    
    def reduce(self, tensor):
        # In non-distributed mode, just return the tensor as-is
        return tensor

# Create test tensors
xs = torch.randn(2, 4)  # batch_size=2, dim=4
mask = torch.ones(2, 4, dtype=torch.bool)  # matching shape, boolean mask

accelerator = MockAccelerator()

ARGS = {
    'xs': xs,
    'mask': mask,
    'shift_mean': True,
    'accelerator': accelerator
}
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
get_eval_ds_config Not yet run
unverified (harvested, no recorded run)
ruizheng20/gpo/utils.py
code served (permissive licence) · get_code("259b0b2755f70e0e")
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, 5 are also present in other papers whose code we hold (5 with at least one paper dated earlier, 0 the same month, 1 later) and 3 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
mean_pooling 22 other papers
17 dated earlier, 5 later · 1 only as an assembly brick
2206.04624 (2022-06)
Factuality Enhanced Language Models for Open-Ended Text Generation
2023.findings-emnlp.540 (2023 (year only))
Open-ended Commonsense Reasoning with Unrestricted Answer Scope
2302.05698 (2023-02)
Compositional Exemplars for In-context Learning
and 19 more not named here
get_eval_ds_config 1 other paper
1 dated earlier
2401.06080 (2024-01)
Secrets of RLHF in Large Language Models Part II: Reward Modeling
get_global_statistics 1 other paper
1 dated earlier
2401.06080 (2024-01)
Secrets of RLHF in Large Language Models Part II: Reward Modeling
get_separate_prompt 1 other paper
1 dated earlier
2401.06080 (2024-01)
Secrets of RLHF in Large Language Models Part II: Reward Modeling
whiten 1 other paper
1 dated earlier
2401.06080 (2024-01)
Secrets of RLHF in Large Language Models Part II: Reward Modeling

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

The standard Reinforcement Learning from Human Feedback (RLHF) framework primarily focuses on optimizing the performance of large language models using pre-collected prompts. However, collecting prompts that provide comprehensive coverage is both tedious and challenging, and often fails to include scenarios that LLMs need to improve on the most. In this paper, we investigate alignment through the lens of two-agent games, involving iterative interactions between an adversarial and a defensive agent. The adversarial agent's task at each step is to generate prompts that expose the weakness of the defensive agent. In return, the defensive agent seeks to improve its responses to these newly identified prompts it struggled with, based on feedback from the reward model. We theoretically demonstrate that this iterative reinforcement learning optimization converges to a Nash Equilibrium for the game induced by the agents. Experimental results in safety scenarios demonstrate that learning in such a competitive environment not only fully trains agents but also leads to policies with enhanced generalization capabilities for both adversarial and defensive agents.

For agents

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

get_harvested_code_for_paper("2406.10977")
get_code_for_paper("2406.10977")
have("2406.10977")

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

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

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

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

Connect an agent — have() is free.