SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2310.18605 · 2023

TorchDEQ: A Library for Deep Equilibrium Models

arXiv · PDF · Open in the Atlas

Code that ran

7 of 13 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; 2 honoured the contract we drafted, 1 violated it and 0 have no contract verdict; 4 failures of our instrument; 6 no recorded run), measured 2026-11-23; 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/2310.18605.json · badge: /api/ran/2310.18605.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
locuslab/torchdeq canonical (classifier label)
classifier basis: census
7 ran · 6 no recorded run
FunctionStatusWhere it lives
backward_factory Ran
ran; our contract draft was wrong, not the code
locuslab/torchdeq/torchdeq/grad.py
code served (permissive licence) · get_code("57ab5dcbc1952b7d")
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 function. 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 torch import autograd

torch.manual_seed(0)

# Stand-in solver class that provides necessary methods
class StandInSolver:
    def __call__(self, *args, **kwargs):
        # Returns (grad_star, some_value, info_dict)
        return torch.randn(2, 4), None, {'iterations': 5, 'converged': True}

# Stand-in trainer module
class StandInTrainer(nn.Module):
    def __init__(self):
        super().__init__()
        self.hook = None
        self.linear = nn.Linear(4, 4)
    
    def forward(self, z):
        return self.linear(z)

# Stand-in func that represents the fixed point function
def stand_in_func(z):
    return z * 0.9  # Simple contraction mapping

# Build arguments dictionary
ARGS = {
    'grad_type': 'ift',
    'hook_ift': False,
    'b_solver': StandInSolver(),
    'b_solver_kwargs': {
        'max_iter': 10,
        'stop_mode': 'residual'
    },
    'sup_gap': -1,
    'sup_loc': None,
    'tau': 1.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 function — a function output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a function 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
deq_decorator Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
locuslab/torchdeq/torchdeq/utils/layer_utils.py
code served (permissive licence) · get_code("4ff06575536b0142")
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. 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

torch.manual_seed(0)

# Define a simple function that takes tensors and returns tensors
class SimpleFunc(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 4)
    
    def forward(self, z):
        return self.linear(z)

class SimpleMultiFunc(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear1 = nn.Linear(4, 4)
        self.linear2 = nn.Linear(3, 3)
    
    def forward(self, z1, z2):
        return self.linear1(z1), self.linear2(z2)

# Test case 1: Single tensor z_init (uses DEQWrapper)
func_single = SimpleFunc()
z_init_single = torch.randn(2, 4)

# Test case 2: List of tensors z_init (uses SpeedyMDEQWrapper with no_stat=True)
func_multi = SimpleMultiFunc()
z_init_list = [torch.randn(2, 4), torch.randn(2, 3)]

# Test case 3: Tuple of tensors z_init (uses MDEQWrapper with no_stat=False)
z_init_tuple = (torch.randn(2, 4), torch.randn(2, 3))

ARGS = {
    "func": func_single,
    "z_init": z_init_single,
    "no_stat": True
}
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 tuple — a tuple output has no array shape of its own; none 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
fp_correction Ran
ran, honoured the contract we drafted
locuslab/torchdeq/torchdeq/loss/correction.py
code served (permissive licence) · get_code("1552f16f70dc3e07")
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 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. The code mentions cuda, and the harness aliases cuda to the CPU for every sample; whether this run needed that is 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)

# Define a simple criterion (loss function)
def simple_criterion(x, y, mask):
    """Computes masked L1 loss between x and y"""
    return ((x - y) * mask).abs().mean()

# Create test data
# x is a list of 3 tensors representing convergence sequence
x_list = [torch.randn(2, 4) for _ in range(3)]

# y is a single target tensor
y = torch.randn(2, 4)

# mask is a single binary mask tensor
mask = torch.rand(2, 4)

# Build the ARGS dictionary with all parameters
ARGS = {
    'crit': simple_criterion,
    'args': (x_list, y, mask),
    'weight_func': 'exp',
    'return_loss_values': False,
    'gamma': 0.8,
}
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 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
line_search Ran
ran; our contract draft was wrong, not the code
locuslab/torchdeq/torchdeq/solver/broyden.py
code served (permissive licence) · get_code("3c0e1781de7876ee")
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. 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)

# Create small test tensors
x0 = torch.randn(4)
update = torch.randn(4)
g0 = torch.randn(4)

# Define a simple gradient function g that takes x_est and returns a gradient
def g(x_est):
    # Simple quadratic function: gradient is 2*x
    return 2 * x_est

ARGS = {
    "update": update,
    "x0": x0,
    "g0": g0,
    "g": g,
    "nstep": 0,
    "on": True
}
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 tuple — a tuple output has no array shape of its own; none 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
make_pair Ran
ran, violated the contract we drafted
locuslab/torchdeq/torchdeq/grad.py
code served (permissive licence) · get_code("41e82f3c5dad5481")
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
import torch.nn as nn

torch.manual_seed(0)

# Construct test arguments for make_pair
# The function takes two lists and aligns them

# Case 1: Equal length lists
target_list = [1, 2, 3, 4]
source_list = ['a', 'b', 'c', 'd']

ARGS = {
    'target': target_list,
    'source': source_list
}
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
rmatvec Ran
ran; our contract draft was wrong, not the code
locuslab/torchdeq/torchdeq/solver/broyden.py
code served (permissive licence) · get_code("18129febc3623c8c")
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)

# The function rmatvec takes:
# - part_Us: tensor used with shape (b, d, l) in einsum 'bd, bdl -> bl'
# - part_VTs: tensor used with shape (b, l, d) in einsum 'bl, bld -> bd'
# - x: tensor used with shape (b, d) in einsums

batch_size = 2
d = 4
l = 3

part_Us = torch.randn(batch_size, d, l)
part_VTs = torch.randn(batch_size, l, d)
x = torch.randn(batch_size, d)

ARGS = {
    "part_Us": part_Us,
    "part_VTs": part_VTs,
    "x": x,
}
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
scalar_search_armijo Ran
ran, honoured the contract we drafted
locuslab/torchdeq/torchdeq/solver/broyden.py
code served (permissive licence) · get_code("b2b5022f654ee4d3")
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 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

torch.manual_seed(0)

# The function expects:
# - phi: a callable that takes a scalar alpha and returns a scalar value
# - phi0: a scalar (initial function value)
# - derphi0: a scalar (initial derivative value)
# - c1: a scalar (default 0.0001)
# - alpha0: a scalar (default 1)
# - amin: a scalar (default 0)

# Create a simple quadratic function as phi
# phi(alpha) = (alpha - 0.5)^2 + 0.1
def phi(alpha):
    return (alpha - 0.5) ** 2 + 0.1

# Evaluate at alpha=1 to get phi0
phi0 = phi(1.0)

# Derivative of phi at alpha=1: d/d_alpha[(alpha - 0.5)^2 + 0.1] = 2(alpha - 0.5)
# At alpha=1: 2(1 - 0.5) = 1.0
derphi0 = 1.0

ARGS = {
    "phi": phi,
    "phi0": phi0,
    "derphi0": derphi0,
    "c1": 0.0001,
    "alpha0": 1.0,
    "amin": 0.0,
}
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 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
anderson_solver Not yet run
unverified (harvested, no recorded run)
locuslab/torchdeq/torchdeq/solver/anderson.py
code served (permissive licence) · get_code("2b081a164710a995")
How it ran

no invocation recorded.

fixed_point_iter Not yet run
unverified (harvested, no recorded run)
locuslab/torchdeq/torchdeq/solver/fp_iter.py
code served (permissive licence) · get_code("7d4074259849d14f")
How it ran

no invocation recorded.

get_deq Not yet run
unverified (harvested, no recorded run)
locuslab/torchdeq/torchdeq/core.py
code served (permissive licence) · get_code("2677e9c85456cf7e")
How it ran

no invocation recorded.

jac_reg Not yet run
unverified (harvested, no recorded run)
locuslab/torchdeq/torchdeq/loss/jacobian.py
code served (permissive licence) · get_code("c9d6967faf17a74e")
How it ran

no invocation recorded.

power_method Not yet run
unverified (harvested, no recorded run)
locuslab/torchdeq/torchdeq/loss/jacobian.py
code served (permissive licence) · get_code("e2bb819b499ea264")
How it ran

no invocation recorded.

simple_fixed_point_iter Not yet run
unverified (harvested, no recorded run)
locuslab/torchdeq/torchdeq/solver/fp_iter.py
code served (permissive licence) · get_code("454b51ab87ef1d00")
How it ran

no invocation recorded.

Also present in other papers' code

Of 13 samples lifted from this paper's linked repositories, 13 carry a function identity and 0 do not. Of the 13 distinct functions with an identity, 2 are also present in other papers whose code we hold (2 with at least one paper dated earlier, 0 the same month, 2 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
scalar_search_armijo 13 other papers
10 dated earlier, 3 later · 4 only as an assembly brick
2006.08656 (2020-06)
Multiscale Deep Equilibrium Models
2106.00553 (2021-06)
SHINE: SHaring the INverse Estimate from the forward pass for bi-level optimization and implicit models
2106.08748 (2021-06)
Input Invex Neural Network
and 10 more not named here
line_search 11 other papers
8 dated earlier, 3 later · 3 only as an assembly brick
2006.08656 (2020-06)
Multiscale Deep Equilibrium Models
2106.08748 (2021-06)
Input Invex Neural Network
2109.14247 (2021-09)
Training Feedback Spiking Neural Networks by Implicit Differentiation on the Equilibrium State
and 8 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-23.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

Deep Equilibrium (DEQ) Models, an emerging class of implicit models that maps inputs to fixed points of neural networks, are of growing interest in the deep learning community. However, training and applying DEQ models is currently done in an ad-hoc fashion, with various techniques spread across the literature. In this work, we systematically revisit DEQs and present TorchDEQ, an out-of-the-box PyTorch-based library that allows users to define, train, and infer using DEQs over multiple domains with minimal code and best practices. Using TorchDEQ, we build a ``DEQ Zoo'' that supports six published implicit models across different domains. By developing a joint framework that incorporates the best practices across all models, we have substantially improved the performance, training stability, and efficiency of DEQs on ten datasets across all six projects in the DEQ Zoo. TorchDEQ and DEQ Zoo are released as \href{https://github.com/locuslab/torchdeq}{open source}.

For agents

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

get_harvested_code_for_paper("2310.18605")
get_code_for_paper("2310.18605")
have("2310.18605")

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

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

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

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

Connect an agent — have() is free.