SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2406.18872 · 2024

Efficacy of Language Model Self-Play in Non-Zero-Sum Games

arXiv · PDF · Open in the Atlas

Code that ran

6 of 6 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; 4 honoured the contract we drafted, 1 violated it and 0 have no contract verdict; 1 failure 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/2406.18872.json · badge: /api/ran/2406.18872.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
nickatomlin/lm-selfplay canonical (classifier label)
classifier basis: census
6 ran · 0 no recorded run
FunctionStatusWhere it lives
calculateFinalScore Ran
ran, honoured the contract we drafted
nickatomlin/lm-selfplay/utils.py
code served (permissive licence) · get_code("50cf1dd8ad001a02")
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 int, ndim 0, dtype family int, 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 torch

torch.manual_seed(0)

# Define player_values as a dictionary with string keys and numeric values
player_values = {
    'player_1': 10,
    'player_2': 20,
    'player_3': 15
}

# Define player_cnts as a dictionary with string keys and numeric values
player_cnts = {
    'player_1': 2,
    'player_2': 3,
    'player_3': 1
}

# Define opponent_values as a dictionary with string keys and numeric values
opponent_values = {
    'player_1': 8,
    'player_2': 12,
    'player_3': 10
}

# Define opponents_cnts as a dictionary with string keys and numeric values
opponents_cnts = {
    'player_1': 1,
    'player_2': 2,
    'player_3': 3
}

# Define objective as one of the valid string values
objective = 'comp'

ARGS = {
    'player_values': player_values,
    'player_cnts': player_cnts,
    'opponent_values': opponent_values,
    'opponents_cnts': opponents_cnts,
    'objective': objective
}
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 int, ndim 0, dtype family int, 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
calculateScore Ran
ran, honoured the contract we drafted
nickatomlin/lm-selfplay/utils.py
code served (permissive licence) · get_code("d6bd8ab38d827e4c")
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 int, ndim 0, dtype family int, 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 torch

torch.manual_seed(0)

# player_values should be a dict with numeric values
player_values = {
    "player_1": 10,
    "player_2": 20,
    "player_3": 15
}

# player_cnts should be a dict with numeric counts
player_cnts = {
    "player_1": 2,
    "player_2": 3,
    "player_3": 1
}

ARGS = {
    "player_values": player_values,
    "player_cnts": player_cnts
}
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 int, ndim 0, dtype family int, 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
calculate_avg_score Ran
ran, honoured the contract we drafted
nickatomlin/lm-selfplay/analysis.py
code served (permissive licence) · get_code("53865464ea6e4582")
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 float64, ndim 0, 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 tempfile
import os

# Create a temporary directory with the required score files
temp_dir = tempfile.mkdtemp()

# Create p0_scores file
with open(f'{temp_dir}/p0_scores', 'w') as f:
    f.write('10\n')
    f.write('20\n')
    f.write('0\n')

# Create p1_scores file
with open(f'{temp_dir}/p1_scores', 'w') as f:
    f.write('15\n')
    f.write('25\n')
    f.write('0\n')

ARGS = {
    'dir_path': temp_dir,
    'filter_zeros': False
}
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 float64, ndim 0, dtype family float — no output shape is stated: observe_signature.py recorded float ndim 0, which disagrees with the fixture run
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
check_agreement_validity Ran
ran, violated the contract we drafted
nickatomlin/lm-selfplay/utils.py
code served (permissive licence) · get_code("daa7afcdf7fc4595")
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

def check_agreement_validity(game_text):
    """
    Check if the proposals in the game text match the total item counts specified at the beginning.

    Args:
    game_text (str): The game text containing item counts and proposals.

    Returns:
    dict: A dictionary containing the results of compatibility check for books, hats, and balls, and overall compatibility.
    """
    item_counts = re.search('Item counts: there are (\\d+) books, (\\d+) hats, and (\\d+) balls.', game_text)
    proposals = re.findall('\\[propose\\] \\((\\d+) books, (\\d+) hats, (\\d+) balls\\)', game_text)
    if item_counts:
        total_books, total_hats, total_balls = map(int, item_counts.groups())
    else:
        return {'error': 'Item counts not found in the provided text'}
    sum_books, sum_hats, sum_balls = (0, 0, 0)
    for proposal in proposals:
        sum_books += int(proposal[0])
        sum_hats += int(proposal[1])
        sum_balls += int(proposal[2])
    is_valid_deal = sum_books == total_books and sum_hats == total_hats and (sum_balls == total_balls)
    return is_valid_deal


# Valid case: proposals sum to item counts
valid_game_text = """Item counts: there are 5 books, 3 hats, and 7 balls.
[propose] (2 books, 1 hats, 3 balls)
[propose] (3 books, 2 hats, 4 balls)
"""

# Invalid case: proposals don't match item counts
invalid_game_text = """Item counts: there are 10 books, 5 hats, and 8 balls.
[propose] (3 books, 2 hats, 2 balls)
[propose] (2 books, 1 hats, 2 balls)
"""

# Edge case: single proposal matching exactly
single_proposal_text = """Item counts: there are 4 books, 2 hats, 1 balls.
[propose] (4 books, 2 hats, 1 balls)
"""

ARGS = {
    "game_text": valid_game_text
}
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
parse_context Ran
ran, honoured the contract we drafted
nickatomlin/lm-selfplay/play.py
code served (permissive licence) · get_code("09f5d85dbba60372")
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 int; 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

def parse_context(ctx):
    ctx = ctx.split()
    cnts = [int(n) for n in ctx[0::2]]
    vals = [int(v) for v in ctx[1::2]]
    return (cnts, vals)

ARGS = {
    "ctx": "1 10 2 20 3 30"
}
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 2, dtype family int — 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
parse_game_context Ran
ran; our contract draft was wrong, not the code
nickatomlin/lm-selfplay/analysis.py
code served (permissive licence) · get_code("521481a1b9af58fb")
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 re

def parse_game_context(text):
    result = {}
    counts_match = re.search('Item counts: there are ([\\d\\s\\w,]+)\\.', text)
    if counts_match:
        counts_text = counts_match.group(1)
        counts = re.findall('(\\d+) (\\w+)', counts_text)
        result['counts'] = {item: int(count) for count, item in counts}
    p0_values_match = re.search('Player 0 values: ([\\w\\s,]+)\\.', text)
    if p0_values_match:
        p0_values_text = p0_values_match.group(1)
        p0_values = dict(re.findall('(\\w+) are worth (\\d+)', p0_values_text))
        result['p0_values'] = {item: int(value) for item, value in p0_values.items()}
    p1_values_match = re.search('Player 1 values: ([\\w\\s,]+)\\.', text)
    if p1_values_match:
        p1_values_text = p1_values_match.group(1)
        p1_values = dict(re.findall('(\\w+) are worth (\\d+)', p1_values_text))
        result['p1_values'] = {item: int(value) for item, value in p1_values.items()}
    return result

text = (
    "Item counts: there are 5 apples, 3 bananas, 7 oranges. "
    "Player 0 values: apples are worth 10, bananas are worth 20, oranges are worth 15. "
    "Player 1 values: apples are worth 12, bananas are worth 18, oranges are worth 14."
)

ARGS = {
    'text': text
}
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 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

Also present in other papers' code

Of 6 samples lifted from this paper's linked repositories, 6 carry a function identity and 0 do not. Of the 6 distinct functions with an identity, 0 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 0 later) and 6 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.

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

Game-playing agents like AlphaGo have achieved superhuman performance through self-play, which is theoretically guaranteed to yield optimal policies in competitive games. However, most language tasks are partially or fully cooperative, so it is an open question whether techniques like self-play can effectively be used to improve language models. We empirically investigate this question in a negotiation game setting known as Deal or No Deal (DoND). Crucially, the objective in DoND can be modified to produce a fully cooperative game, a strictly competitive one, or anything in between. We finetune language models in self-play over multiple rounds of filtered behavior cloning in DoND for each of these objectives and evaluate them in self-play and in collaboration with humans. We find that language models improve substantially in self-play, achieving 14-17x higher scores in task reward after finetuning. Further, the trained models generalize to both cooperation and competition with humans, scoring 2.5-6x higher than base models. We view these results as an early promising sign for language model self-play in cooperative settings, despite a lack of theoretical guarantees.

For agents

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

get_harvested_code_for_paper("2406.18872")
get_code_for_paper("2406.18872")
have("2406.18872")

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

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

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

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

Connect an agent — have() is free.