SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2311.17283 · NeurIPS · 2023

Lineax: unified linear solves and linear least-squares in JAX and Equinox

Patrick Kidger, Terry Lyons, Jason Rader

arXiv · PDF · Open in the Atlas

Code that ran

8 of 10 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, 0 violated it and 0 have no contract verdict; 4 failures of our instrument; 2 no recorded run), measured 2026-11-23; 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/2311.17283.json · badge: /api/ran/2311.17283.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
google/lineax canonical (classifier label)
classifier basis: census
8 ran · 2 no recorded run
FunctionStatusWhere it lives
invert_tags Ran
ran; our contract draft was wrong, not the code
google/lineax/lineax/_tags.py
code served (permissive licence) · get_code("a48b712d0f4fd930")
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 frozenset. 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
from typing import Optional

# Define some tag classes to use as examples
class SymmetricTag:
    def __repr__(self):
        return "SymmetricTag"

class DiagonalTag:
    def __repr__(self):
        return "DiagonalTag"

class TriangularTag:
    def __repr__(self):
        return "TriangularTag"

class PositiveSemidefiniteTag:
    def __repr__(self):
        return "PositiveSemidefiniteTag"

class UnitDiagonalTag:
    def __repr__(self):
        return "UnitDiagonalTag"

class TridiagonalTag:
    def __repr__(self):
        return "TridiagonalTag"

# Define rules for inverting tags
def preserve_symmetric_rule(tags: frozenset[object]) -> Optional[object]:
    """Symmetric property is preserved under inversion."""
    if any(isinstance(tag, SymmetricTag) for tag in tags):
        return SymmetricTag()
    return None

def preserve_diagonal_rule(tags: frozenset[object]) -> Optional[object]:
    """Diagonal property is preserved under inversion."""
    if any(isinstance(tag, DiagonalTag) for tag in tags):
        return DiagonalTag()
    return None

def remove_tridiagonal_rule(tags: frozenset[object]) -> Optional[object]:
    """Tridiagonal is NOT preserved under inversion."""
    # This rule removes tridiagonal tags, so it returns None if present
    return None

def preserve_triangular_rule(tags: frozenset[object]) -> Optional[object]:
    """Triangular property is preserved under inversion."""
    if any(isinstance(tag, TriangularTag) for tag in tags):
        return TriangularTag()
    return None

def preserve_psd_rule(tags: frozenset[object]) -> Optional[object]:
    """Positive semidefinite is preserved under inversion."""
    if any(isinstance(tag, PositiveSemidefiniteTag) for tag in tags):
        return PositiveSemidefiniteTag()
    return None

def unit_diagonal_special_rule(tags: frozenset[object]) -> Optional[object]:
    """Unit diagonal is only preserved if also diagonal or triangular."""
    has_unit_diagonal = any(isinstance(tag, UnitDiagonalTag) for tag in tags)
    has_diagonal = any(isinstance(tag, DiagonalTag) for tag in tags)
    has_triangular = any(isinstance(tag, TriangularTag) for tag in tags)
    
    if has_unit_diagonal and (has_diagonal or has_triangular):
        return UnitDiagonalTag()
    return None

# Build the rules list
invert_tags_rules = [
    preserve_symmetric_rule,
    preserve_diagonal_rule,
    remove_tridiagonal_rule,
    preserve_triangular_rule,
    preserve_psd_rule,
    unit_diagonal_special_rule,
]

# Create test cases for the function
symmetric_tag = SymmetricTag()
diagonal_tag = DiagonalTag()
triangular_tag = TriangularTag()
psd_tag = PositiveSemidefiniteTag()
unit_diag_tag = UnitDiagonalTag()
tridiag_tag = TridiagonalTag()

# Test case 1: Simple symmetric matrix
tags_case1 = frozenset([symmetric_tag])

# Test case 2: Diagonal matrix
tags_case2 = frozenset([diagonal_tag])

# Test case 3: Triangular with unit diagonal (should preserve both)
tags_case3 = frozenset([triangular_tag, unit_diag_tag])

# Test case 4: Tridiagonal (should be removed)
tags_case4 = frozenset([tridiag_tag])

# Test case 5: Complex case with multiple tags
tags_case5 = frozenset([symmetric_tag, psd_tag, diagonal_tag])

# Test case 6: Unit diagonal without diagonal or triangular (should not be preserved)
tags_case6 = frozenset([unit_diag_tag])

# Use one of these as the main test case
ARGS = {
    "tags": tags_case3
}
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 frozenset — a frozenset output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a frozenset 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
jacobian Ran
ran; our contract draft was wrong, not the code
google/lineax/lineax/_misc.py
code served (permissive licence) · get_code("c30590f204af2200")
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 jax
import jax.numpy as jnp

# Define a simple function to differentiate
def simple_fn(x):
    return jnp.sum(x ** 2)

# Create test inputs as JAX arrays
test_input = jnp.array([1.0, 2.0, 3.0, 4.0])

ARGS = {
    'fn': simple_fn,
    'in_size': 4,
    'out_size': 1,
    'holomorphic': False,
    'has_aux': False,
    'jac': None
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
jax — 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
resolve_rcond Ran
ran, honoured the contract we drafted
google/lineax/lineax/_misc.py
code served (permissive licence) · get_code("809e62065ec84219")
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 float32, 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 jax.numpy as jnp
import numpy as np

ARGS = {
    "rcond": None,
    "n": 5,
    "m": 3,
    "dtype": jnp.float32,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
jax, numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type float32, 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
stop_gradient_transpose Ran
ran, honoured the contract we drafted
google/lineax/lineax/_solve.py
code served (permissive licence) · get_code("fee475e0e7816aec")
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 3, 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)

# The function stop_gradient_transpose takes two parameters: ct and x
# Looking at the function body, it simply returns (ct,) - a tuple containing ct
# It doesn't actually use x in any way, just returns ct wrapped in a tuple
# So ct and x can be any valid objects, but tensors make sense for a gradient-related function

ct = torch.randn(2, 4)
x = torch.randn(2, 4)

ARGS = {
    "ct": ct,
    "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 tuple, ndim 3, 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
sum_squares Ran
ran, honoured the contract we drafted
google/lineax/lineax/_norm.py
code served (permissive licence) · get_code("7d2a879b7a2e29c6")
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 ArrayImpl, 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 jax
import jax.numpy as jnp
from jaxtyping import PyTree

# Create a simple PyTree structure with some arrays
# Using distinct sizes to make dimensions unambiguous
tree_example = {
    'weights': jnp.array([[1.0, 2.0, 3.0], [4.0, 5.0, 6.0]]),
    'bias': jnp.array([0.5, 1.5]),
    'nested': {
        'param': jnp.array([[[1.0, 2.0], [3.0, 4.0]]])
    }
}

ARGS = {
    'x': tree_example
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
jax, jaxtyping — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ArrayImpl, 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
transpose_tags Ran
ran; our contract draft was wrong, not the code
google/lineax/lineax/_tags.py
code served (permissive licence) · get_code("41f0f2dbf21c56ef")
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 frozenset. 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
from torch import nn

class _HasRepr:
    def __init__(self, string: str):
        self.string = string

    def __repr__(self):
        return self.string

symmetric_tag = _HasRepr('symmetric_tag')
antisymmetric_tag = _HasRepr('antisymmetric_tag')

def transpose_rule_1(tags):
    if antisymmetric_tag in tags:
        return frozenset(tags - {antisymmetric_tag} | {_HasRepr('transposed_antisymmetric')})
    return None

def transpose_rule_2(tags):
    if _HasRepr('orthogonal_tag') in tags:
        return None
    return None

transpose_tags_rules = [transpose_rule_1, transpose_rule_2]

def transpose_tags(tags: frozenset[object]):
    if symmetric_tag in tags:
        return tags
    new_tags = []
    for rule in transpose_tags_rules:
        out = rule(tags)
        if out is not None:
            new_tags.append(out)
    return frozenset(new_tags)

ARGS = {
    'tags': frozenset([antisymmetric_tag, _HasRepr('some_other_tag')])
}
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 frozenset — a frozenset output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a frozenset 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
tree_dot Ran
ran, honoured the contract we drafted
google/lineax/lineax/_norm.py
code served (permissive licence) · get_code("8246f77328f21ea5")
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 ArrayImpl, 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 jax
import jax.numpy as jnp
from jaxtyping import Array, ArrayLike, Inexact, PyTree, Scalar

# Create two pytrees with the same structure
# Each pytree will contain nested arrays

tree1 = {
    'layer1': jnp.array([[1.0, 2.0, 3.0, 4.0], [5.0, 6.0, 7.0, 8.0]]),
    'layer2': jnp.array([9.0, 10.0, 11.0, 12.0]),
    'nested': {
        'sublayer': jnp.array([[13.0, 14.0], [15.0, 16.0]])
    }
}

tree2 = {
    'layer1': jnp.array([[1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0]]),
    'layer2': jnp.array([2.0, 2.0, 2.0, 2.0]),
    'nested': {
        'sublayer': jnp.array([[3.0, 3.0], [3.0, 3.0]])
    }
}

ARGS = {
    'tree1': tree1,
    'tree2': tree2,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
jax, jaxtyping — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ArrayImpl, 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
tree_where Ran
ran; our contract draft was wrong, not the code
google/lineax/lineax/_misc.py
code served (permissive licence) · get_code("bdb9f2ead609a1f7")
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 jax.numpy as jnp
import jax.tree_util as jtu
from jaxtyping import Array, ArrayLike, Bool, PyTree

# Create a scalar boolean predicate
pred = jnp.array(True)

# Create two PyTrees with matching structure containing JAX arrays
true_tree = {
    'a': jnp.array([1.0, 2.0, 3.0, 4.0]),
    'b': {
        'nested': jnp.array([[1.0, 2.0], [3.0, 4.0]])
    },
    'c': jnp.array(5.0)
}

false_tree = {
    'a': jnp.array([5.0, 6.0, 7.0, 8.0]),
    'b': {
        'nested': jnp.array([[5.0, 6.0], [7.0, 8.0]])
    },
    'c': jnp.array(10.0)
}

ARGS = {
    'pred': pred,
    'true': true_tree,
    'false': false_tree
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
jax, jaxtyping — 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
tags_from_checks Not yet run
unverified (harvested, no recorded run)
google/lineax/lineax/_tags.py
code served (permissive licence) · get_code("c36b199b5608ed5d")
How it ran

no invocation recorded.

two_norm Not yet run
unverified (harvested, no recorded run)
google/lineax/lineax/_norm.py
code served (permissive licence) · get_code("b0c90a3ae8b1c1ad")
How it ran

no invocation recorded.

Also present in other papers' code

Of 10 samples lifted from this paper's linked repositories, 10 carry a function identity and 0 do not. Of the 10 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 10 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-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

We introduce Lineax, a library bringing linear solves and linear least-squares to the JAX+Equinox scientific computing ecosystem. Lineax uses general linear operators, and unifies linear solves and least-squares into a single, autodifferentiable API. Solvers and operators are user-extensible, without requiring the user to implement any custom derivative rules to get differentiability. Lineax is available at https://github.com/google/lineax.

For agents

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

get_harvested_code_for_paper("2311.17283")
get_code_for_paper("2311.17283")
have("2311.17283")

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

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

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

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

Connect an agent — have() is free.