SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2107.00052 · NeurIPS · 2021

Stochastic Gradient Descent-Ascent and Consensus Optimization for Smooth Games: Convergence Analysis under Expected Co-coercivity

Gauthier Gidel, Hugo Berard, Simon Lacoste-Julien, Nicolas Loizou, Ioannis Mitliagkas, Mila Diro

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 (6 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 6 have no contract verdict; 0 failures of our instrument; 0 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/2107.00052.json · badge: /api/ran/2107.00052.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
hugobb/StochasticGamesOpt marked official in Papers with Code
Papers with Code archive
6 ran · 0 no recorded run
FunctionStatusWhere it lives
Algorithm Ran
ran on a synthesized input · constructed an object; no result was computed
hugobb/StochasticGamesOpt/hamiltonian/algorithms/co.py
code served (permissive licence) · get_code("5e68062294d17a16")
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, Algorithm: 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 torch.nn as nn
from collections import defaultdict

torch.manual_seed(0)

class SimpleGame(nn.Module):
    def __init__(self, num_players=2):
        super().__init__()
        self.num_players = num_players
        # Create player parameters: 2 players, each with a small tensor
        self.players = nn.ParameterList([
            nn.Parameter(torch.randn(1, 4)),
            nn.Parameter(torch.randn(1, 3))
        ])
        self._optimal = torch.zeros(1, 4)
    
    def init(self, seed):
        torch.manual_seed(seed)
        for p in self.players:
            p.data = torch.randn_like(p.data)
    
    def dist2opt(self):
        # Distance to optimum
        diff = self.players[0] - self._optimal
        return torch.norm(diff)
    
    def hamiltonian(self):
        # Some energy/loss function
        h = torch.tensor(0.0)
        for p in self.players:
            h = h + torch.sum(p ** 2)
        return h
    
    def to(self, device):
        return super().to(device)

game = SimpleGame(num_players=2)

ARGS = {
    'game': game,
    'lr': 0.1,
    'momentum': 0.0,
    'nesterov': False,
    'alternated': False,
    'device': None,
    'save_dir': None,
    'save_freq': 10000,
    'save_trajectory': 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 Algorithm — 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 Algorithm 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
BaseLR Ran
ran on a synthesized input · constructed an object; no result was computed
hugobb/StochasticGamesOpt/hamiltonian/algorithms/co.py
code served (permissive licence) · get_code("916c38c4030e9bc7")
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, BaseLR: 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 torch.nn as nn

torch.manual_seed(0)

class LRScheduler:
    def __init__(self, lr):
        self.lr = lr

    def __call__(self, k):
        raise NotImplementedError

class BaseLR(LRScheduler):
    def __call__(self, k):
        return self.lr

ARGS = {
    'lr': 0.001
}
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 BaseLR — 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 BaseLR 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
ConsensusOptimization Ran
ran on a synthesized input · constructed an object; no result was computed
hugobb/StochasticGamesOpt/hamiltonian/algorithms/co.py
code served (permissive licence) · get_code("6fb6983639d96f9a")
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, ConsensusOptimization: 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 torch.nn as nn
import numpy as np
from collections import defaultdict

torch.manual_seed(0)

# Create a minimal Game class that satisfies the interface used by ConsensusOptimization
class MinimalGame(nn.Module):
    def __init__(self, num_players=2, num_samples=4):
        super().__init__()
        self.num_players = num_players
        self.sampler = MinimalSampler(num_samples)
        # Create player parameters (minimal tensors)
        self.players = nn.ParameterList([
            nn.Parameter(torch.randn(2, 3))
            for _ in range(num_players)
        ])
    
    def init(self, seed):
        """Initialize game with seed"""
        torch.manual_seed(seed)
        np.random.seed(seed)
    
    def dist2opt(self):
        """Return distance to optimum"""
        return torch.tensor(0.5, requires_grad=True)
    
    def hamiltonian(self):
        """Return hamiltonian value"""
        return torch.tensor(0.3, requires_grad=True)
    
    def grad(self, x):
        """Return gradients for players"""
        if x is None:
            # Full batch case
            grad_0 = torch.randn(2, 3)
            grad_1 = torch.randn(2, 3)
        else:
            # Stochastic case
            grad_0 = torch.randn(2, 3)
            grad_1 = torch.randn(2, 3)
        return (grad_0, grad_1)
    
    def to(self, device):
        """Move to device (CPU only)"""
        return super().to(device)

# Create a minimal Sampler class
class MinimalSampler:
    def __init__(self, num_samples=4):
        self.num_samples = num_samples
        self.rng = np.random.default_rng(42)
    
    def sample(self, batch_size=1):
        """Sample batch indices"""
        return torch.tensor(self.rng.integers(0, self.num_samples, batch_size)).long()
    
    def seed(self, seed):
        self.rng = np.random.default_rng(seed)

# Create minimal LRScheduler classes
class BaseLR:
    def __init__(self, lr):
        self.lr = lr
    
    def __call__(self, k):
        return self.lr

class LRScheduler:
    def __init__(self, lr):
        self.lr = lr
    
    def __call__(self, k):
        raise NotImplementedError

# Build the game instance
game = MinimalGame(num_players=2, num_samples=4)

# Define ARGS for ConsensusOptimization
ARGS = {
    'game': game,
    'lr_H': None,
    'batch_size': 2,
    'full_batch': False,
    'lr': 0.01,
    'momentum': 0.0,
    'nesterov': False,
    'alternated': False,
    'device': 'cpu',
    'save_dir': None,
    'save_freq': 10000,
    'save_trajectory': False,
}
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 ConsensusOptimization — 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 ConsensusOptimization 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
DoubleLoopSampler Ran
ran on a synthesized input · constructed an object; no result was computed
hugobb/StochasticGamesOpt/hamiltonian/algorithms/co.py
code served (permissive licence) · get_code("ecf36144342f9fbf")
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, DoubleLoopSampler: 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 numpy as np

torch.manual_seed(0)

class SimpleSampler(np.random.Generator):
    """Stand-in sampler that implements the minimal interface needed."""
    
    def __init__(self, num_samples, seed=None):
        self.rng = np.random.default_rng(seed)
        self.num_samples = num_samples
    
    def sample(self, batch_size=1):
        """Return dummy samples as tensors."""
        return torch.randint(0, self.num_samples, (batch_size,))
    
    def seed(self, seed):
        self.rng = np.random.default_rng(seed)

# Create a base sampler instance
base_sampler = SimpleSampler(num_samples=3, seed=42)

ARGS = {
    "sampler": base_sampler
}
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 DoubleLoopSampler — 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 DoubleLoopSampler 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
LRScheduler Ran
ran on a synthesized input · constructed an object; no result was computed
hugobb/StochasticGamesOpt/hamiltonian/algorithms/co.py
code served (permissive licence) · get_code("02461b74cf5b3d8b")
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, LRScheduler: 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 torch.nn as nn

torch.manual_seed(0)

# LRScheduler takes one parameter: lr (learning rate)
# The __init__ stores it and __call__ raises NotImplementedError
# We need to provide a valid learning rate value

ARGS = {
    "lr": 0.001
}
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 LRScheduler — 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 LRScheduler 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
Sampler Ran
ran on a synthesized input · constructed an object; no result was computed
hugobb/StochasticGamesOpt/hamiltonian/algorithms/co.py
code served (permissive licence) · get_code("2404a86f26725bdd")
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, Sampler: 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 numpy as np

ARGS = {
    "num_samples": 100,
    "seed": 42,
}
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 Sampler — 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 Sampler 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

Two of the most prominent algorithms for solving unconstrained smooth games are the classical stochastic gradient descent-ascent (SGDA) and the recently introduced stochastic consensus optimization (SCO) [Mescheder et al., 2017]. SGDA is known to converge to a stationary point for specific classes of games, but current convergence analyses require a bounded variance assumption. SCO is used successfully for solving large-scale adversarial problems, but its convergence guarantees are limited to its deterministic variant. In this work, we introduce the expected co-coercivity condition, explain its benefits, and provide the first last-iterate convergence guarantees of SGDA and SCO under this condition for solving a class of stochastic variational inequality problems that are potentially non-monotone. We prove linear convergence of both methods to a neighborhood of the solution when they use constant step-size, and we propose insightful stepsize-switching rules to guarantee convergence to the exact solution. In addition, our convergence guarantees hold under the arbitrary sampling paradigm, and as such, we give insights into the complexity of minibatching.

For agents

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

get_harvested_code_for_paper("2107.00052")
get_code_for_paper("2107.00052")
have("2107.00052")

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

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

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

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

Connect an agent — have() is free.