SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2201.09948 · 2022

ReLSO: A Transformer-based Model for Latent Space Optimization and Generation of Proteins

arXiv · PDF · Open in the Atlas

Code that ran

8 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, 1 violated it and 5 have no contract verdict; 2 failures of our instrument; 0 no recorded run), measured 2026-11-21; 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/2201.09948.json · badge: /api/ran/2201.09948.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
KrishnaswamyLab/ReLSO-Guided-Generative-Protein-Design-using-Regularized-Transformers canonical (classifier label)
classifier basis not recorded on the link
8 ran · 0 no recorded run
FunctionStatusWhere it lives
directed_evolution_sequence Ran
ran on a synthesized input
KrishnaswamyLab/ReLSO-Guided-Generative-Protein-Design-using-Regularized-Transformers/relso/optim/optim_algs.py
code served (permissive licence) · get_code("bb42954f765973e6")
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)

class SimpleProteinModel(nn.Module):
    """
    Minimal model that takes a sequence and outputs fitness scores.
    Input: (batch_size, sequence_length) with values in [0, 21]
    Output: (batch_size, 1) with fitness scores
    """
    def __init__(self, seq_length=5):
        super().__init__()
        self.embedding = nn.Embedding(22, 8)
        self.fc = nn.Linear(8 * seq_length, 1)
    
    def forward(self, x):
        # x shape: (batch_size, seq_length)
        batch_size = x.shape[0]
        embedded = self.embedding(x.long())  # (batch_size, seq_length, 8)
        flattened = embedded.reshape(batch_size, -1)  # (batch_size, seq_length*8)
        output = self.fc(flattened)  # (batch_size, 1)
        return output

# Create small test sequence of length 5 with amino acid indices in [0, 21]
initial_sequence = np.array([0, 5, 10, 15, 3], dtype=np.int64)

# Create model
model = SimpleProteinModel(seq_length=5)
model.eval()

# Define positions to perform directed evolution on (subset of sequence positions)
positions = [0, 1, 2]

ARGS = {
    "initial_sequence": initial_sequence,
    "model": model,
    "positions": positions,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch, tqdm — 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
embed_path_from_json Ran
ran on a synthesized input
KrishnaswamyLab/ReLSO-Guided-Generative-Protein-Design-using-Regularized-Transformers/relso/utils/model_utils.py
code served (permissive licence) · get_code("a378f08b0159841b")
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 json
from pathlib import Path
import tempfile
import os

# Create a temporary directory for embed_dir
temp_dir = tempfile.mkdtemp()

# Create a temporary JSON file with model info
json_data = {
    "dataset1": {
        "model1": "2024_01_15_10_30_45"
    },
    "dataset2": {
        "model2": "2024_01_16_11_45_30"
    }
}

json_path = os.path.join(temp_dir, "model_info.json")
with open(json_path, 'w') as f:
    json.dump(json_data, f)

ARGS = {
    "json_path": json_path,
    "embed_dir": temp_dir,
    "dataset": "dataset1",
    "model": "model1"
}
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 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
eval_oracle Ran
ran on a synthesized input
KrishnaswamyLab/ReLSO-Guided-Generative-Protein-Design-using-Regularized-Transformers/relso/optim/optim_algs.py
code served (permissive licence) · get_code("8dad5b8f2f73383e")
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 float, 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 torch
import torch.nn as nn

torch.manual_seed(0)

# Create a minimal oracle model that takes input and returns a fitness value
class SimpleOracle(nn.Module):
    def __init__(self, input_dim):
        super().__init__()
        self.linear = nn.Linear(input_dim, 1)
    
    def forward(self, x):
        return self.linear(x)

# Instantiate the oracle with input dimension 4
oracle = SimpleOracle(input_dim=4)

# Create a data point with 4 dimensions
data_point = [0.1, 0.2, 0.3, 0.4]

ARGS = {
    "data_point": data_point,
    "oracle": oracle
}
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 float, 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
model_predict Ran
ran on a synthesized input
KrishnaswamyLab/ReLSO-Guided-Generative-Protein-Design-using-Regularized-Transformers/relso/optim/optim_algs.py
code served (permissive licence) · get_code("64c1e0f93d084ae0")
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 ndarray, 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 torch
import torch.nn as nn
import numpy as np

torch.manual_seed(0)

# Define a small model that takes a sequence and outputs predictions
class SimpleModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 8)
    
    def forward(self, x):
        # x shape: (batch, seq_len)
        # Output shape: (batch, seq_len, 1) to allow indexing [0][-1]
        out = self.linear(x)
        out = out.unsqueeze(-1)
        return out

# Create model instance
model = SimpleModel()

# Create a sequence - can be either numpy or torch tensor
# Using shape (4,) which will be reshaped to (1, 4) in the function
sequence = torch.randn(4, dtype=torch.float32)

ARGS = {
    "sequence": sequence,
    "model": model
}
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 ndarray, 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
scaled_dot_product Ran
ran; our contract draft was wrong, not the code
KrishnaswamyLab/ReLSO-Guided-Generative-Protein-Design-using-Regularized-Transformers/relso/nn/transformers.py
code served (permissive licence) · get_code("e844fff14b289cce")
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 math
from torch.nn import functional as F

torch.manual_seed(0)

# Create small tensors for q, k, v
# q: (batch=2, seq_len=3, d_k=4)
# k: (batch=2, seq_len=3, d_k=4)
# v: (batch=2, seq_len=3, d_v=5)
batch_size = 2
seq_len = 3
d_k = 4
d_v = 5

q = torch.randn(batch_size, seq_len, d_k)
k = torch.randn(batch_size, seq_len, d_k)
v = torch.randn(batch_size, seq_len, d_v)

# Create a mask (optional parameter)
# mask shape: (batch=2, 1, seq_len=3, seq_len=3)
# 1 means attend, 0 means mask out
mask = torch.ones(batch_size, 1, seq_len, seq_len)

ARGS = {
    "q": q,
    "k": k,
    "v": v,
    "mask": mask
}
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 — 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
str2auxnetwork Ran
ran; our contract draft was wrong, not the code
KrishnaswamyLab/ReLSO-Guided-Generative-Protein-Design-using-Regularized-Transformers/relso/nn/auxnetwork.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from guangyliu/eddpm, is pointer only (licence: NONE) · get_code("af78970db657f767")
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 guangyliu/eddpm, 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.

str2bool Ran
ran, violated the contract we drafted
KrishnaswamyLab/ReLSO-Guided-Generative-Protein-Design-using-Regularized-Transformers/train_relso.py
code served (permissive licence) · get_code("7c508037b40522af")
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 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 argparse

def str2bool(v):
    if isinstance(v, bool):
        return v
    if v.lower() in ('yes', 'true', 't', 'y', '1'):
        return True
    elif v.lower() in ('no', 'false', 'f', 'n', '0'):
        return False
    else:
        raise argparse.ArgumentTypeError('Boolean value expected.')

# Test cases for str2bool
ARGS = {
    'v': 'true'  # string input that should convert to boolean
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
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
weight_path_from_json Ran
ran on a synthesized input
KrishnaswamyLab/ReLSO-Guided-Generative-Protein-Design-using-Regularized-Transformers/relso/utils/model_utils.py
code served (permissive licence) · get_code("d1761f68e78db5bb")
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 json
import tempfile
from pathlib import Path

# Create a temporary directory and a valid JSON file
temp_dir = tempfile.TemporaryDirectory()
weight_dir = temp_dir.name

# Create a sample JSON file with model info
json_data = {
    "cifar10": {
        "resnet18": "20240115_143022"
    },
    "imagenet": {
        "vgg16": "20240115_150000"
    }
}

json_path = Path(temp_dir.name) / "model_info.json"
with open(json_path, 'w') as f:
    json.dump(json_data, f)

ARGS = {
    "json_path": str(json_path),
    "weight_dir": weight_dir,
    "dataset": "cifar10",
    "model": "resnet18"
}
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

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, 3 are also present in other papers whose code we hold (1 with at least one paper dated earlier, 0 the same month, 3 later) and 5 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
str2bool 175 other papers
45 dated earlier, 128 later, 2 same year, order not determinable · 2 only as an assembly brick
1406.6247 (2014-06)
Recurrent Models of Visual Attention
1603.09382 (2016-03)
Deep Networks with Stochastic Depth
1710.10196 (2017-10)
Progressive Growing of GANs for Improved Quality, Stability, and Variation
and 172 more not named here
scaled_dot_product 2 other papers
2 later
2402.19009 (2024-02)
Unified Generation, Reconstruction, and Representation: Generalized Diffusion with Adaptive Latent Encoding-Decoding
2410.16432 (2024-10)
Fair Bilevel Neural Network (FairBiNN): On Balancing fairness and accuracy via Stackelberg Equilibrium
str2auxnetwork 1 other paper
1 later
2402.19009 (2024-02)
Unified Generation, Reconstruction, and Representation: Generalized Diffusion with Adaptive Latent Encoding-Decoding

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-21.

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 development of powerful natural language models have increased the ability to learn meaningful representations of protein sequences. In addition, advances in high-throughput mutagenesis, directed evolution, and next-generation sequencing have allowed for the accumulation of large amounts of labeled fitness data. Leveraging these two trends, we introduce Regularized Latent Space Optimization (ReLSO), a deep transformer-based autoencoder which features a highly structured latent space that is trained to jointly generate sequences as well as predict fitness. Through regularized prediction heads, ReLSO introduces a powerful protein sequence encoder and novel approach for efficient fitness landscape traversal. Using ReLSO, we explicitly model the sequence-function landscape of large labeled datasets and generate new molecules by optimizing within the latent space using gradient-based methods. We evaluate this approach on several publicly-available protein datasets, including variant sets of anti-ranibizumab and GFP. We observe a greater sequence optimization efficiency (increase in fitness per optimization step) by ReLSO compared to other approaches, where ReLSO more robustly generates high-fitness sequences. Furthermore, the attention-based relationships learned by the jointly-trained ReLSO models provides a potential avenue towards sequence-level fitness attribution information.

For agents

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

get_harvested_code_for_paper("2201.09948")
get_code_for_paper("2201.09948")
have("2201.09948")

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

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

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

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

Connect an agent — have() is free.