SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2307.15043 · 2023

Universal and Transferable Adversarial Attacks on Aligned Language Models

J Zico Kolter, Nicholas Carlini, Matt Fredrikson, Andy Zou, Zifan Wang, Milad Nasr

arXiv · PDF · Open in the Atlas

Code that ran

39 of 61 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (7 of them constructed an object rather than computing a result; 4 honoured the contract we drafted, 1 violated it and 14 have no contract verdict; 20 failures of our instrument; 22 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/2307.15043.json · badge: /api/ran/2307.15043.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
fra31/rlhf-trojan-competition-submission community
Papers with Code archive
8 ran · 2 no recorded run
grayswanai/nanogcg community
Papers with Code archive
7 ran · 3 no recorded run
sj21j/Regularized_Relaxation community (classifier label)
classifier basis not recorded on the link
5 ran · 1 no recorded run
mcgill-nlp/adversarialtriggers community
Papers with Code archive
4 ran · 7 no recorded run
thompsonj/nanoGCG community
Papers with Code archive
4 ran · 4 no recorded run
amanb2000/magic_words community
Papers with Code archive
4 ran · 4 no recorded run
arobey1/smooth-llm community
Papers with Code archive
3 ran · 0 no recorded run
copy not recorded community
not in the paper's declared repositories
2 ran · 0 no recorded run
ed-zh/parden community
Papers with Code archive
1 ran · 1 no recorded run
aounon/certified-llm-safety community
Papers with Code archive
1 ran · 0 no recorded run
FunctionStatusWhere it lives
Attack Ran
ran on a synthesized input · constructed an object; no result was computed
arobey1/smooth-llm/lib/attacks.py
code served (permissive licence) · get_code("c8b60c98283b0f93")
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, Attack: 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 io import StringIO

torch.manual_seed(0)

# Create a minimal target model
class SimpleModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 3)
    
    def forward(self, x):
        return self.linear(x)

# Create instances
target_model = SimpleModel()

# Create a logfile (StringIO for no actual file I/O)
logfile = StringIO()

ARGS = {
    'logfile': logfile,
    'target_model': target_model,
}
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 Attack — 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 Attack 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
AttackBuffer Ran
ran on a synthesized input · constructed an object; no result was computed
grayswanai/nanogcg/nanogcg/gcg.py
code served (permissive licence) · get_code("cb8e994854e018bd")
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, AttackBuffer: 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
from torch import Tensor

torch.manual_seed(0)

# Create a minimal tokenizer stand-in that supports batch_decode
class MinimalTokenizer:
    def batch_decode(self, ids):
        # ids is a Tensor, convert to list of strings
        # Just return a dummy decoded string for each batch element
        if ids.dim() == 1:
            return ["hello world"]
        else:
            return ["hello world"] * ids.shape[0]

# Define ARGS with all parameters for AttackBuffer.__init__
ARGS = {
    "size": 3
}
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 AttackBuffer — 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 AttackBuffer 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
AttackBuffer Ran
ran on a synthesized input
thompsonj/nanoGCG/nanogcg/gcg.py
code served (permissive licence) · get_code("b9d6e9f0f2ef1785")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) and returned NoneType. 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 Tensor
import logging

logging.basicConfig(level=logging.INFO)

class MockTokenizer:
    def batch_decode(self, ids):
        return ["hello world"]

INIT_ARGS = {
    'size': 3
}

ARGS = {
    'loss': 0.5,
    'reward': 1.2,
    'optim_ids': torch.tensor([[1, 2, 3, 4]])
}

METHOD = 'add'

if __name__ == '__main__':
    from torch import Tensor
    import logging
    
    logger = logging.getLogger('nanogcg')
    
    class AttackBuffer:
    
        def __init__(self, size: int):
            self.buffer = []
            self.size = size
    
        def add(self, loss: float, reward: float, optim_ids: Tensor) -> None:
            if self.size == 0:
                self.buffer = [(loss, reward, optim_ids)]
                return
            if len(self.buffer) < self.size:
                self.buffer.append((loss, reward, optim_ids))
            else:
                self.buffer[-1] = (loss, reward, optim_ids)
            self.buffer.sort(key=lambda x: x[0])
    
        def get_best_ids(self) -> Tensor:
            return self.buffer[0][2]
    
        def get_lowest_loss(self) -> float:
            return self.buffer[0][0]
    
        def get_highest_loss(self) -> float:
            return self.buffer[-1][0]
    
        def log_buffer(self, tokenizer):
            message = 'buffer:'
            for loss, reward, ids in self.buffer:
                optim_str = tokenizer.batch_decode(ids)[0]
                optim_str = optim_str.replace('\\', '\\\\')
                optim_str = optim_str.replace('\n', '\\n')
                message += f'\nloss: {loss}' + f' | string: {optim_str} | reward: {reward}'
            logger.info(message)
    
        def get_ids(self):
            return [ids for _, _, ids in self.buffer]
    
    buffer = AttackBuffer(**INIT_ARGS)
    buffer.add(**ARGS)
    buffer.add(loss=0.3, reward=2.0, optim_ids=torch.tensor([[5, 6, 7, 8]]))
    buffer.add(loss=0.8, reward=0.5, optim_ids=torch.tensor([[9, 10, 11, 12]]))
    
    print("Lowest loss:", buffer.get_lowest_loss())
    print("Highest loss:", buffer.get_highest_loss())
    print("Best IDs:", buffer.get_best_ids())
    print("All IDs:", buffer.get_ids())
    
    tokenizer = MockTokenizer()
    buffer.log_buffer(tokenizer)
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type NoneType — a NoneType output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a NoneType 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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
GCG Ran
ran on a synthesized input · constructed an object; no result was computed
arobey1/smooth-llm/lib/attacks.py
code served (permissive licence) · get_code("8f2bb9303de66805")
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, GCG: 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 json
import tempfile
import torch
import torch.nn as nn


class MockTokenizer:
    def __call__(self, text):
        class TokenizerOutput:
            def __init__(self, text):
                # Simple mock: split by spaces and assign IDs
                tokens = text.split()
                self.input_ids = list(range(len(tokens)))
        
        return TokenizerOutput(text)
    
    def decode(self, input_ids):
        # Mock decode: reconstruct some text from IDs
        return "<s> " + " ".join([f"token_{i}" for i in input_ids]) + " </s>"


class MockConvTemplate:
    def __init__(self):
        self.roles = ("User", "Assistant")
        self.messages = []
    
    def append_message(self, role, message):
        self.messages.append((role, message))
    
    def get_prompt(self):
        # Mock prompt generation
        prompt_text = ""
        for role, message in self.messages:
            prompt_text += f"{role}: {message}\n"
        return prompt_text


class MockTargetModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.tokenizer = MockTokenizer()
        self.conv_template = MockConvTemplate()
        self.linear = nn.Linear(4, 4)
    
    def forward(self, x):
        return self.linear(x)


# Create a temporary logfile with the expected JSON structure
logfile_dict = {
    "goal": ["Make the model say something harmful"],
    "target": ["This is the target response"],
    "controls": ["control_string_1"]
}

with tempfile.NamedTemporaryFile(mode='w', suffix='.json', delete=False) as f:
    json.dump(logfile_dict, f)
    logfile_path = f.name

# Create mock target model
target_model = MockTargetModel()

ARGS = {
    "logfile": logfile_path,
    "target_model": target_model
}
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 GCG — 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 GCG 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
GCGConfig Ran
ran on a synthesized input · constructed an object; no result was computed
grayswanai/nanogcg/nanogcg/gcg.py
code served (permissive licence) · get_code("a9682b120ee13622")
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, GCGConfig: 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 transformers
from dataclasses import dataclass
from typing import List, Optional

torch.manual_seed(0)

# Create minimal stand-in tokenizer
class MockTokenizer:
    def __init__(self):
        self.vocab_size = 50257
        self.pad_token_id = 0
        self.bos_token_id = 1
        self.eos_token_id = 2
    
    def batch_decode(self, ids):
        # ids shape: (batch_size, seq_len)
        # Return list of strings, one per batch element
        batch_size = ids.shape[0] if ids.dim() > 1 else 1
        if ids.dim() == 1:
            ids = ids.unsqueeze(0)
        return ["token sequence"] * ids.shape[0]
    
    def __call__(self, text, return_tensors=None, add_special_tokens=True):
        # Return a dict with 'input_ids' key
        if return_tensors == 'pt':
            return {
                'input_ids': torch.tensor([[1, 2, 3, 4]], dtype=torch.long)
            }
        return {'input_ids': [[1, 2, 3, 4]]}

# Create minimal stand-in PreTrainedModel
class MockModel(torch.nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = torch.nn.Linear(4, 8)
    
    def forward(self, input_ids, **kwargs):
        return torch.randn(2, 4, 50257)

draft_model = MockModel()
draft_tokenizer = MockTokenizer()

probe_sampling_config = None  # Optional, can be None

ARGS = {
    'num_steps': 250,
    'optim_str_init': 'x x x x x x x x x x x x x x x x x x x x',
    'search_width': 512,
    'batch_size': None,
    'topk': 256,
    'n_replace': 1,
    'buffer_size': 0,
    'use_mellowmax': False,
    'mellowmax_alpha': 1.0,
    'early_stop': False,
    'use_prefix_cache': True,
    'allow_non_ascii': False,
    'filter_ids': True,
    'add_space_before_target': False,
    'seed': None,
    'verbosity': 'INFO',
    'probe_sampling_config': probe_sampling_config,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch, transformers — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type GCGConfig — 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 GCGConfig 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
GCGHistory Ran
ran on a synthesized input
thompsonj/nanoGCG/nanogcg/gcg.py
code served (permissive licence) · get_code("88a3e18b9506e939")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) and returned NoneType. 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 Tensor

class GCGHistory:

    def __init__(self):
        self.history = set()

    def add(self, optim_ids) -> None:
        for id in optim_ids.cpu().numpy():
            self.history.add(str(id))

    def get_history(self) -> Tensor:
        return self.history


INIT_ARGS = {}

ARGS = {
    'optim_ids': torch.tensor([1, 2, 3, 4], dtype=torch.int64)
}

METHOD = 'add'

if __name__ == '__main__':
    instance = GCGHistory(**INIT_ARGS)
    instance.add(**ARGS)
    result = instance.get_history()
    print("History:", result)
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type NoneType — a NoneType output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a NoneType 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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
GCGResult Ran
ran on a synthesized input · constructed an object; no result was computed
grayswanai/nanogcg/nanogcg/gcg.py
code served (permissive licence) · get_code("5c73323812cc0eb2")
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, GCGResult: 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 dataclasses import dataclass
from typing import List, Optional, Tuple, Union

torch.manual_seed(0)

@dataclass
class GCGResult:
    best_loss: float
    best_string: str
    losses: List[float]
    strings: List[str]

ARGS = {
    "best_loss": 0.5432,
    "best_string": "hello world adversarial example",
    "losses": [1.2345, 0.9876, 0.5432, 0.4123],
    "strings": [
        "initial prompt attempt",
        "second iteration string",
        "third refined string",
        "hello world adversarial example"
    ]
}
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 GCGResult — 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 GCGResult 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
Logger Ran
ran on a synthesized input · constructed an object; no result was computed
fra31/rlhf-trojan-competition-submission/method/attacks.py
code served (permissive licence) · get_code("a445b00c2e83ec24")
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, Logger: 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 tempfile
import os

# Create a temporary file for logging
temp_dir = tempfile.mkdtemp()
log_file = os.path.join(temp_dir, "test.log")

ARGS = {
    "log_path": log_file
}
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 Logger — 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 Logger 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
Prompt Ran
ran on a synthesized input · constructed an object; no result was computed
arobey1/smooth-llm/lib/attacks.py
code served (permissive licence) · get_code("6b3191d8fc67d0d2")
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, Prompt: 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

torch.manual_seed(0)

# Define arguments for Prompt.__init__
full_prompt = "This is a full prompt with a variable part: [VARIABLE]"
perturbable_prompt = "[VARIABLE]"
max_new_tokens = 50

ARGS = {
    "full_prompt": full_prompt,
    "perturbable_prompt": perturbable_prompt,
    "max_new_tokens": max_new_tokens,
}
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 Prompt — 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 Prompt 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
_get_eval_loss Ran
ran, honoured the contract we drafted
mcgill-nlp/adversarialtriggers/adversarial_triggers/trainer/trigger_trainer.py
code served (permissive licence) · get_code("d84d37af47c6fe79")
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 1, dtype family float, shape (2,) 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
from typing import Dict

torch.manual_seed(0)

# Create a minimal mock model that satisfies the function's usage
class MockCausalLM(nn.Module):
    def __init__(self, vocab_size=256, hidden_dim=4):
        super().__init__()
        self.embedding = nn.Embedding(vocab_size, hidden_dim)
        self.lm_head = nn.Linear(hidden_dim, vocab_size)
    
    def __call__(self, input_ids, attention_mask):
        # Returns a dict with 'logits' key
        x = self.embedding(input_ids)
        logits = self.lm_head(x)
        return {'logits': logits}

# Create model instance
model = MockCausalLM(vocab_size=256, hidden_dim=4)
model.eval()

# Create batch with required keys
batch = {
    'input_ids': torch.randint(0, 256, (2, 5)),  # batch_size=2, seq_len=5
    'attention_mask': torch.ones(2, 5, dtype=torch.long),
    'labels': torch.randint(0, 256, (2, 5))  # same shape as input_ids
}

# Set some labels to -100 to test the normalization logic
batch['labels'][0, 0] = -100
batch['labels'][1, 2] = -100

ARGS = {
    'model': model,
    'batch': batch
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch, transformers — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 1, dtype family float, shape (2,) — shape (2,) 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
_get_token_grad Ran
ran; our contract draft was wrong, not the code
mcgill-nlp/adversarialtriggers/adversarial_triggers/trainer/trigger_trainer.py
code served (permissive licence) · get_code("737b13f7178dd472")
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
from typing import Dict

torch.manual_seed(0)

# Create a minimal mock model that satisfies the function's usage
class MockCausalLM(nn.Module):
    def __init__(self, vocab_size=50, hidden_dim=4):
        super().__init__()
        self.embedding = nn.Embedding(vocab_size, hidden_dim)
        self.lm_head = nn.Linear(hidden_dim, vocab_size)
        self.vocab_size = vocab_size
        self.hidden_dim = hidden_dim
    
    def get_input_embeddings(self):
        return self.embedding
    
    def forward(self, inputs_embeds, attention_mask):
        # inputs_embeds: (batch_size, seq_len, hidden_dim)
        # attention_mask: (batch_size, seq_len)
        logits = self.lm_head(inputs_embeds)
        return {'logits': logits}

# Create model
vocab_size = 50
hidden_dim = 4
model = MockCausalLM(vocab_size=vocab_size, hidden_dim=hidden_dim)

# Create batch with required tensors
batch_size = 2
seq_len = 6
num_trigger_tokens = 2

batch = {
    'input_ids': torch.randint(0, vocab_size, (batch_size, seq_len)),
    'attention_mask': torch.ones((batch_size, seq_len), dtype=torch.long),
    'trigger_mask': torch.zeros((batch_size, seq_len), dtype=torch.bool),
    'labels': torch.randint(0, vocab_size, (batch_size, seq_len)),
}

# Set trigger mask to have exactly num_trigger_tokens True values per batch
batch['trigger_mask'][0, :num_trigger_tokens] = True
batch['trigger_mask'][1, :num_trigger_tokens] = True

ARGS = {
    'model': model,
    'batch': batch,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch, transformers — 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
add_reply Ran
ran; our contract draft was wrong, not the code
fra31/rlhf-trojan-competition-submission/method/attacks.py
code served (permissive licence) · get_code("4ab92d112af903d0")
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 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

torch.manual_seed(0)

# Build minimal valid arguments for add_reply function
# add_reply(clean_tkns, trigger_tkns, attn_mask=None)

# clean_tkns: should be a tensor of token IDs
# The function checks len(clean_tkns.shape) and expects at least 1D
# It then accesses clean_tkns[:, :-5] and clean_tkns[:, -5:] in trigger mode
# For reply mode it just concatenates clean_tkns with trigger_tkns
# So we need at least 5 tokens in the sequence dimension for trigger mode
# But add_reply uses mode='reply', so we can have fewer tokens
# Let's make clean_tkns shape (2, 6) - batch_size=2, seq_len=6
clean_tkns = torch.randint(0, 100, (2, 6), dtype=torch.long)

# trigger_tkns: tensor of trigger token IDs
# The function does trigger_tkns.repeat(bs, 1) where bs is batch size
# So it should be 2D or will be unsqueezed to 2D
# Let's make it (1, 3) - 1 row, 3 trigger tokens
trigger_tkns = torch.randint(0, 100, (1, 3), dtype=torch.long)

# attn_mask: optional attention mask
# The function checks if attn_mask is not None
# It asserts attn_mask.shape == clean_tkns.shape
# So it should match clean_tkns shape: (2, 6)
attn_mask = torch.ones((2, 6), dtype=torch.bool)

ARGS = {
    'clean_tkns': clean_tkns,
    'trigger_tkns': trigger_tkns,
    'attn_mask': attn_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, ndim 3, 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
adjust_learning_rate Ran
ran on a synthesized input
sj21j/Regularized_Relaxation/rr.py
code served (permissive licence) · get_code("e0fcb1c976d55bf4")
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 numpy as np

torch.manual_seed(0)

# The function adjust_learning_rate takes three parameters:
# - initial_lr: a learning rate value (float)
# - iteration: an iteration number (int)
# - decay_rate: a decay rate value (float, typically between 0 and 1)
# 
# The function computes: initial_lr * decay_rate ** iteration
# This is a simple exponential decay learning rate schedule.

ARGS = {
    "initial_lr": 0.1,
    "iteration": 5,
    "decay_rate": 0.95
}
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 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
calc_loss Ran
ran on a synthesized input
sj21j/Regularized_Relaxation/softprompt.py
code served (permissive licence) · get_code("e496788013a04ab0")
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

torch.manual_seed(0)

# Create a small model that accepts inputs_embeds and returns logits
class SimpleLanguageModel(nn.Module):
    def __init__(self, embedding_dim, vocab_size):
        super().__init__()
        self.linear = nn.Linear(embedding_dim, vocab_size)
    
    def forward(self, inputs_embeds):
        # inputs_embeds shape: (batch_size, seq_len, embedding_dim)
        logits = self.linear(inputs_embeds)
        return type('Output', (), {'logits': logits})()

# Model parameters
embedding_dim = 4
vocab_size = 8
batch_size = 1

# Create model
model = SimpleLanguageModel(embedding_dim, vocab_size)

# Create embeddings with distinct sizes:
# embeddings: (batch_size, seq_len_1, embedding_dim)
embeddings = torch.randn(batch_size, 3, embedding_dim)

# embeddings_attack: (batch_size, seq_len_2, embedding_dim)
embeddings_attack = torch.randn(batch_size, 2, embedding_dim)

# embeddings_target: (batch_size, seq_len_3, embedding_dim)
embeddings_target = torch.randn(batch_size, 5, embedding_dim)

# targets: shape should match the sliced logits
# loss_slice_start = len(embeddings[0]) + len(embeddings_attack[0]) = 3 + 2 = 5
# logits[0, loss_slice_start - 1:-1, :] = logits[0, 4:-1, :]
# total seq_len = 3 + 2 + 5 = 10
# so logits[0, 4:-1, :] has shape (5, vocab_size)
targets = torch.randint(0, vocab_size, (5,))

ARGS = {
    'model': model,
    'embeddings': embeddings,
    'embeddings_attack': embeddings_attack,
    'embeddings_target': embeddings_target,
    'targets': targets
}
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
check_tokenization Ran
ran; our contract draft was wrong, not the code
fra31/rlhf-trojan-competition-submission/method/attacks.py
code served (permissive licence) · get_code("72493c9a581afc21")
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. 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)

def decode_fn(tkns):
    """Convert token indices to a string."""
    return "hello world"

def encode_fn(text):
    """Convert a string to token indices."""
    # Return a tensor matching the expected shape
    return torch.tensor([[1, 2, 3, 4]])

# Create token tensor
tkns = torch.tensor([[1, 2, 3, 4]])

ARGS = {
    "tkns": tkns,
    "decode_fn": decode_fn,
    "encode_fn": encode_fn,
}
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
configure_pad_token Ran
ran; our contract draft was wrong, not the code
grayswanai/nanogcg/nanogcg/gcg.py
code served (permissive licence) · get_code("32c910ba47ebc6b3")
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 MockTokenizer. 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.

from transformers import PreTrainedTokenizerBase

class MockTokenizer(PreTrainedTokenizerBase):
    """Minimal mock tokenizer for testing."""
    def __init__(self, pad_token=None, unk_token=None, eos_token=None, 
                 pad_token_id=None, unk_token_id=None, eos_token_id=None):
        self.pad_token = pad_token
        self.unk_token = unk_token
        self.eos_token = eos_token
        self.pad_token_id = pad_token_id
        self.unk_token_id = unk_token_id
        self.eos_token_id = eos_token_id
        self.added_tokens = {}
    
    def add_special_tokens(self, special_tokens_dict):
        """Mock implementation of add_special_tokens."""
        if 'pad_token' in special_tokens_dict:
            self.pad_token = special_tokens_dict['pad_token']
            self.pad_token_id = len(self.added_tokens) + 50000
            self.added_tokens['pad_token'] = special_tokens_dict['pad_token']
    
    def __call__(self, *args, **kwargs):
        """Minimal call implementation."""
        return {}
    
    def save_pretrained(self, *args, **kwargs):
        """Minimal save_pretrained implementation."""
        pass


# Test case 1: tokenizer with no pad_token but has unk_token
tokenizer_with_unk = MockTokenizer(
    pad_token=None,
    unk_token="<unk>",
    eos_token=None,
    pad_token_id=None,
    unk_token_id=0,
    eos_token_id=None
)

ARGS = {
    "tokenizer": tokenizer_with_unk
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
transformers — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type MockTokenizer — a MockTokenizer output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a MockTokenizer 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
create_token_mask Ran
ran; our contract draft was wrong, not the code
mcgill-nlp/adversarialtriggers/adversarial_triggers/trainer/trigger_trainer.py
code served (permissive licence) · get_code("eaa3fb63f5fe88fe")
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 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
import numpy as np
from typing import List

# Define ARGS dictionary with all parameters for create_token_mask
ARGS = {
    "input_ids": [1, 2, 3, 4, 5, 6, 7, 8],
    "search_token_ids": [3, 4, 5],
    "offset": 0,
}
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 list, ndim 1, dtype family int — 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
estimate_grad Ran
ran; our contract draft was wrong, not the code
fra31/rlhf-trojan-competition-submission/method/attacks.py
code served (permissive licence) · get_code("ba6f3154083bbf4f")
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 (3, 100) 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 torch.nn.functional as F

torch.manual_seed(0)

# Create a minimal model that matches what estimate_grad expects
class MinimalModel(nn.Module):
    def __init__(self, vocab_size=100, hidden_dim=4):
        super().__init__()
        self.model = nn.Module()
        self.model.embed_tokens = nn.Embedding(vocab_size, hidden_dim)
        self.lm_head = nn.Linear(hidden_dim, vocab_size)
        self.device_attr = 'cpu'
    
    @property
    def device(self):
        return self.device_attr
    
    def forward(self, input_ids=None, inputs_embeds=None, attention_mask=None):
        if inputs_embeds is not None:
            hidden = inputs_embeds
        else:
            hidden = self.model.embed_tokens(input_ids)
        logits = self.lm_head(hidden)
        
        class Output:
            pass
        out = Output()
        out.logits = logits
        return out

# Create minimal batch with required keys
batch = {
    'input_ids_with_trigger': torch.randint(0, 100, (2, 20)),  # bs=2, seq_len=20
    'attention_mask_with_trigger': torch.ones((2, 20), dtype=torch.long),
}

# Create model
model = MinimalModel(vocab_size=100, hidden_dim=4)

# Create tensors
trigger_tkns = torch.tensor([5, 6, 7])  # 1D tensor of trigger tokens
reply_tkns = torch.tensor([10, 11, 12])  # 1D tensor of reply tokens

device = 'cpu'

# Create encode_fn - simple function that returns token indices
def encode_fn(text):
    # Return a simple token sequence
    return torch.tensor([1, 2, 3, 4, 5], dtype=torch.long)

# Create clean_gens - list of strings with ASSISTANT: marker
clean_gens = [
    "USER: hello ASSISTANT: response one",
    "USER: hi ASSISTANT: response two"
]

ARGS = {
    'model': model,
    'batch': batch,
    'trigger_tkns': trigger_tkns,
    'reply_tkns': reply_tkns,
    'device': device,
    'encode_fn': encode_fn,
    'is_min': False,
    'clean_gens': clean_gens,
}
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 (3, 100) — shape (3, 100) 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
find_executable_batch_size Ran
ran; our contract draft was wrong, not the code
grayswanai/nanogcg/nanogcg/gcg.py
code served (permissive licence) · get_code("1422bdde04346c68")
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. 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 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 functools

torch.manual_seed(0)

# Create a simple function that takes batch_size as first argument
def dummy_training_function(batch_size, model, optimizer):
    """A dummy training function that uses batch_size"""
    x = torch.randn(batch_size, 4)
    y = model(x)
    loss = y.sum()
    optimizer.zero_grad()
    loss.backward()
    optimizer.step()
    return loss.item()

# Create a minimal model
class SimpleModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 3)
    
    def forward(self, x):
        return self.linear(x)

# Create model and optimizer
model = SimpleModel()
optimizer = torch.optim.SGD(model.parameters(), lr=0.01)

ARGS = {
    'function': dummy_training_function,
    'starting_batch_size': 128
}
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
find_executable_batch_size Ran
ran; our contract draft was wrong, not the code
thompsonj/nanoGCG/nanogcg/gcg.py
code served (permissive licence) · get_code("4a4125358e03ea60")
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 function. 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 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 simple function that takes batch_size as first argument
def dummy_train(batch_size, model, optimizer):
    """A simple training function that accepts batch_size as first argument"""
    x = torch.randn(batch_size, 4)
    y = torch.randn(batch_size, 3)
    
    optimizer.zero_grad()
    output = model(x)
    loss = nn.functional.mse_loss(output, y)
    loss.backward()
    optimizer.step()
    
    return loss.item()

# Create a minimal model
class SimpleModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 3)
    
    def forward(self, x):
        return self.linear(x)

# Instantiate model and optimizer
model = SimpleModel()
optimizer = torch.optim.SGD(model.parameters(), lr=0.01)

# Define ARGS dictionary with all parameters for find_executable_batch_size
ARGS = {
    'function': dummy_train,
    'starting_batch_size': 128
}
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 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
forward Ran
ran; our contract draft was wrong, not the code
fra31/rlhf-trojan-competition-submission/method/attacks.py
code served (permissive licence) · get_code("855a5a17a02b08d8")
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, 3) 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 model that satisfies the function's usage
class MockModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 3)
    
    def forward(self, input_ids=None, inputs_embeds=None, attention_mask=None):
        # The function calls model(...).logits, so we need to return an object with .logits
        if inputs_embeds is not None:
            x = inputs_embeds
        elif input_ids is not None:
            # Embed input_ids: shape [batch_size] -> [batch_size, 4]
            x = self.linear.weight[input_ids % self.linear.weight.shape[0]]
        else:
            x = torch.randn(1, 4)
        
        # Apply linear layer to get logits
        logits = self.linear(x)
        
        # Return an object with .logits attribute
        class Output:
            pass
        output = Output()
        output.logits = logits
        return output

model = MockModel()

# Create input tensors with distinct sizes for different dimensions
input_ids = torch.tensor([[1, 2, 3], [0, 1, 2]], dtype=torch.long)  # shape: [2, 3]
inputs_embeds = torch.randn(2, 4)  # shape: [2, 4] - batch_size=2, embed_dim=4
attention_mask = torch.ones(2, 3, dtype=torch.long)  # shape: [2, 3]

ARGS = {
    "model": model,
    "input_ids": input_ids,
    "inputs_embeds": inputs_embeds,
    "attention_mask": attention_mask,
    "batch_size": 512
}
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, 3) — shape (2, 3) 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
gcg_suffix Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
aounon/certified-llm-safety/gcg.py
code served (permissive licence) · get_code("8bbdca63196e835b")
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 str. 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 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 tokenizer stand-in
class MinimalTokenizer:
    def __init__(self):
        self.vocab_size = 100
        self.special_tokens = {
            '[CLS]': 101,
            '[SEP]': 102,
        }
    
    def encode(self, text, add_special_tokens=False):
        # Return a simple sequence of token ids
        # Add [CLS] at start and [SEP] at end if add_special_tokens
        base_tokens = [i % self.vocab_size for i in range(len(text) % 10 + 3)]
        if add_special_tokens:
            return [101] + base_tokens + [102]
        return base_tokens
    
    def decode(self, token_tensor):
        # Convert tensor to string representation
        if isinstance(token_tensor, torch.Tensor):
            tokens = token_tensor.tolist()
            if isinstance(tokens, list) and len(tokens) > 0 and isinstance(tokens[0], list):
                tokens = tokens[0]
        else:
            tokens = token_tensor
        return " ".join([f"token_{t}" for t in tokens])

# Create a minimal safety classifier model
class MinimalSafetyClassifier(nn.Module):
    def __init__(self, vocab_size=100, hidden_dim=4, num_labels=2):
        super().__init__()
        self.embedding = nn.Embedding(vocab_size, hidden_dim)
        self.classifier = nn.Linear(hidden_dim, num_labels)
    
    def forward(self, inputs_embeds=None, labels=None):
        # inputs_embeds: (batch_size, seq_len, hidden_dim)
        # Pool over sequence dimension
        pooled = inputs_embeds.mean(dim=1)  # (batch_size, hidden_dim)
        logits = self.classifier(pooled)  # (batch_size, num_labels)
        
        output = type('Output', (), {})()
        output.logits = logits
        
        if labels is not None:
            loss_fn = nn.CrossEntropyLoss()
            output.loss = loss_fn(logits, labels)
        else:
            output.loss = None
        
        return output

# Instantiate components
tokenizer = MinimalTokenizer()
model = MinimalSafetyClassifier(vocab_size=100, hidden_dim=4, num_labels=2)
word_embeddings = model.embedding
embedding_matrix = word_embeddings.weight  # (vocab_size, hidden_dim)

input_prompt = "This is a test prompt"

ARGS = {
    "input": input_prompt,
    "model": model,
    "tokenizer": tokenizer,
    "word_embeddings": word_embeddings,
    "embedding_matrix": embedding_matrix,
    "num_adv": 2,
    "num_iters": 2,
    "top_k": 5,
    "batch_size": 3,
}
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 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
generate_mini_batch Ran
ran; our contract draft was wrong, not the code
ed-zh/parden/utils.py
pointer only (licence: NONE) · get_code("e88ba59fcb846ef1")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, ed-zh/parden 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.

get_alt_prompt_ids Ran
ran; our contract draft was wrong, not the code
amanb2000/magic_words/magic_words/easy_gcg.py
code served (permissive licence) · get_code("c4c28b82836a4d42")
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 int, shape (2, 5) 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 parameters for get_alt_prompt_ids
num_prompt_tokens = 5
top_k = 3
batch_size = 2

# Create prompt_ids: [1, num_prompt_tokens]
prompt_ids = torch.tensor([[10, 20, 30, 40, 50]], dtype=torch.int64)

# Create X: [1, num_prompt_tokens, top_k]
# Each position has top_k alternative token IDs
X = torch.randint(0, 100, (1, num_prompt_tokens, top_k), dtype=torch.int64)

ARGS = {
    "prompt_ids": prompt_ids,
    "X": X,
    "batch_size": batch_size,
}
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 int, shape (2, 5) — shape (2, 5) 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
get_embedding_matrix Ran
ran on a synthesized input
sj21j/Regularized_Relaxation/helper.py
code served (permissive licence) · get_code("8e6c241c57e9b7d0")
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 Parameter, ndim 2, 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
from transformers import LlamaForCausalLM, FalconForCausalLM, MistralForCausalLM, MptForCausalLM

torch.manual_seed(0)

# Create a minimal LlamaForCausalLM mock
class MinimalLlamaForCausalLM(LlamaForCausalLM):
    def __init__(self):
        # Skip parent __init__ to avoid config requirements
        nn.Module.__init__(self)
        self.model = nn.Module()
        self.model.embed_tokens = nn.Embedding(128, 64)

# Create a minimal FalconForCausalLM mock
class MinimalFalconForCausalLM(FalconForCausalLM):
    def __init__(self):
        nn.Module.__init__(self)
        self._embedding_layer = nn.Embedding(128, 64)
    
    def get_input_embeddings(self):
        return self._embedding_layer

# Create a minimal MistralForCausalLM mock
class MinimalMistralForCausalLM(MistralForCausalLM):
    def __init__(self):
        nn.Module.__init__(self)
        self.model = nn.Module()
        self.model.embed_tokens = nn.Embedding(128, 64)

# Create a minimal MptForCausalLM mock
class MinimalMptForCausalLM(MptForCausalLM):
    def __init__(self):
        nn.Module.__init__(self)
        self._embedding_layer = nn.Embedding(128, 64)
    
    def get_input_embeddings(self):
        return self._embedding_layer

# Test with LlamaForCausalLM
model = MinimalLlamaForCausalLM()

ARGS = {
    "model": model
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch, transformers — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Parameter, ndim 2, dtype family float — no output shape is stated: observe_signature.py recorded Tensor ndim 2, 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
get_embedding_weights Ran
ran; our contract draft was wrong, not the code
amanb2000/magic_words/magic_words/easy_gcg.py
code served (permissive licence) · get_code("f7b4f2c24a3317d7")
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 Parameter, ndim 2, 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
from transformers.models.llama.modeling_llama import LlamaForCausalLM
from transformers import LlamaConfig

torch.manual_seed(0)

# Create a minimal LlamaForCausalLM model
config = LlamaConfig(
    vocab_size=256,
    hidden_size=64,
    num_hidden_layers=2,
    num_attention_heads=2,
    intermediate_size=128,
    max_position_embeddings=512,
)
model = LlamaForCausalLM(config)

ARGS = {
    "model": model
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch, transformers — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Parameter, ndim 2, dtype family float — no output shape is stated: observe_signature.py recorded Tensor ndim 2, 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
get_future_mask Ran
ran, honoured the contract we drafted
amanb2000/magic_words/magic_words/easy_gcg.py
code served (permissive licence) · get_code("d849de4df6ec1de0")
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 (1, 8) 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 model that has a device attribute
class MinimalModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 4)
    
    @property
    def device(self):
        return self.linear.weight.device

model = MinimalModel()

# Create question_ids and answer_ids tensors with distinct shapes
question_ids = torch.randint(0, 100, (1, 3))  # shape [1, 3]
answer_ids = torch.randint(0, 100, (1, 5))    # shape [1, 5]

ARGS = {
    "question_ids": question_ids,
    "answer_ids": answer_ids,
    "model": model
}
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 (1, 8) — shape (1, 8) 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
get_invalid_token_ids Ran
ran, honoured the contract we drafted
mcgill-nlp/adversarialtriggers/adversarial_triggers/trainer/trigger_trainer.py
code served (permissive licence) · get_code("ac107ad22088a015")
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 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.

from transformers import AutoTokenizer

# Create a minimal stand-in tokenizer class that mimics PreTrainedTokenizer behavior
class MockTokenizer:
    def __init__(self):
        self.vocab_size = 100
        self.bos_token_id = 0
        self.eos_token_id = 1
        self.pad_token_id = 2
        self.unk_token_id = 3
        # Map token IDs to decodable strings
        self._id_to_token = {}
        for i in range(self.vocab_size):
            if i < 4:
                # Special tokens
                self._id_to_token[i] = f"<special_{i}>"
            elif i < 50:
                # ASCII printable tokens (letters, numbers, punctuation)
                self._id_to_token[i] = chr(33 + (i - 4) % 94)  # ASCII 33-126
            else:
                # Non-ASCII tokens (Chinese characters, emoji, etc.)
                self._id_to_token[i] = chr(0x4E00 + i - 50)  # CJK Unified Ideographs
    
    def decode(self, token_ids):
        """Decode a list of token IDs to a string."""
        if isinstance(token_ids, list):
            return "".join(self._id_to_token.get(tid, "?") for tid in token_ids)
        return self._id_to_token.get(token_ids, "?")

tokenizer = MockTokenizer()

ARGS = {
    "tokenizer": tokenizer
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
transformers — 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 int — 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
get_logits Ran
ran; our contract draft was wrong, not the code
fra31/rlhf-trojan-competition-submission/method/attacks.py
code served (permissive licence) · get_code("9a336610f22b79b2")
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 3, dtype family float, shape (2, 5, 3) 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)

class SimpleModel(nn.Module):
    def __init__(self, vocab_size=100, hidden_size=4, num_labels=2):
        super().__init__()
        self.embedding = nn.Embedding(vocab_size, hidden_size)
        self.linear = nn.Linear(hidden_size, num_labels)
        self.device_attr = 'cpu'
    
    @property
    def device(self):
        return torch.device(self.device_attr)
    
    def forward(self, input_ids=None, inputs_embeds=None, attention_mask=None):
        if input_ids is not None:
            x = self.embedding(input_ids)
        else:
            x = inputs_embeds
        
        if attention_mask is not None:
            x = x * attention_mask.unsqueeze(-1).float()
        
        logits = self.linear(x)
        
        class Output:
            pass
        
        output = Output()
        output.logits = logits
        return output

model = SimpleModel(vocab_size=100, hidden_size=4, num_labels=3)

input_ids = torch.randint(0, 100, (2, 5))
inputs_embeds = torch.randn(2, 5, 4)
attn_mask = torch.ones(2, 5, dtype=torch.int32)
batch_size = 512

ARGS = {
    'model': model,
    'input_ids': input_ids,
    'inputs_embeds': None,
    'batch_size': batch_size,
    'attn_mask': attn_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 Tensor, ndim 3, dtype family float, shape (2, 5, 3) — shape (2, 5, 3) 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
get_nonascii_toks Ran
ran, honoured the contract we drafted
grayswanai/nanogcg/nanogcg/gcg.py
code served (permissive licence) · get_code("726e8111ce3c1903")
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 1, dtype family int, shape (7,) 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

class MockTokenizer:
    def __init__(self):
        self.vocab_size = 10
        self.bos_token_id = 0
        self.eos_token_id = 1
        self.pad_token_id = 2
        self.unk_token_id = 3
        self._vocab = {
            0: "[BOS]",
            1: "[EOS]",
            2: "[PAD]",
            3: "[UNK]",
            4: "hello",
            5: "world",
            6: "🌍",
            7: "test",
            8: "µ",
            9: "©"
        }
    
    def decode(self, token_ids):
        if isinstance(token_ids, list) and len(token_ids) > 0:
            return self._vocab.get(token_ids[0], "unknown")
        return "unknown"

torch.manual_seed(0)

tokenizer = MockTokenizer()
device = 'cpu'

ARGS = {
    'tokenizer': tokenizer,
    'device': device
}
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 1, dtype family int, shape (7,) — shape (7,) 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
get_nospace_tokens Ran
ran; our contract draft was wrong, not the code
fra31/rlhf-trojan-competition-submission/method/attacks.py
code served (permissive licence) · get_code("aa73ffad17ad20cf")
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
from transformers import AutoTokenizer

# Create a minimal stand-in tokenizer class that implements the required methods
class StandInTokenizer:
    def __init__(self):
        self.vocab_size = 32001
        # Create a simple vocabulary where token i maps to a string representation
        self.vocab = {}
        for i in range(self.vocab_size):
            # Make some tokens have spaces, others without
            if i < 100:
                self.vocab[i] = f" token_{i}"
            elif i < 260:
                self.vocab[i] = f"token_{i}"
            else:
                self.vocab[i] = f"word_{i}"
    
    def decode(self, token_ids):
        """Decode token IDs to string"""
        result = ""
        for tid in token_ids:
            result += self.vocab.get(tid, f"unk_{tid}")
        return result
    
    def convert_ids_to_tokens(self, token_ids):
        """Convert token IDs to token strings"""
        tokens = []
        for tid in token_ids:
            # Return token with a space prefix for some tokens (simulating BPE behavior)
            if tid < 100:
                tokens.append("▁" + self.vocab[tid].lstrip())
            else:
                tokens.append(self.vocab[tid])
        return tokens

tokenizer = StandInTokenizer()

ARGS = {
    "tokenizer": tokenizer,
    "voc_size": 32001,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch, transformers — 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
insert_trigger Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
fra31/rlhf-trojan-competition-submission/method/attacks.py
code served (permissive licence) · get_code("be197b73817c3f69")
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 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

torch.manual_seed(0)

# Construct valid arguments for insert_trigger function
clean_tkns = torch.randint(0, 100, (2, 10))  # batch_size=2, seq_len=10
trigger_tkns = torch.randint(0, 100, (1, 3))  # 1 trigger token sequence of length 3
attn_mask = torch.ones((2, 10), dtype=torch.bool)  # attention mask matching clean_tkns shape
mode = 'trigger'  # can also be 'reply'

ARGS = {
    'clean_tkns': clean_tkns,
    'trigger_tkns': trigger_tkns,
    'attn_mask': attn_mask,
    'mode': mode
}
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 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
instantiate_prompt Ran
ran; our contract draft was wrong, not the code
amanb2000/magic_words/magic_words/easy_gcg.py
code served (permissive licence) · get_code("ee4a998eb4a5b23d")
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 int, shape (1, 8) 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)

# Build a minimal model with a device attribute
class MinimalModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 4)
    
model = MinimalModel()
model.device = 'cpu'

# Build a minimal tokenizer with vocab_size attribute
class MinimalTokenizer:
    def __init__(self, vocab_size):
        self.vocab_size = vocab_size

tokenizer = MinimalTokenizer(vocab_size=100)

# Define blacklist
blacklist = [0, 1, 2, 50, 99]

# Define num_tokens
num_tokens = 8

ARGS = {
    "model": model,
    "tokenizer": tokenizer,
    "blacklist": blacklist,
    "num_tokens": num_tokens
}
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 int, shape (1, 8) — shape (1, 8) 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
mellowmax Ran
ran; our contract draft was wrong, not the code
this paper's copy was not recorded; identical code first harvested from schwinnl/circuit-breakers-eval
pointer only; the stored copy get_code serves, from schwinnl/circuit-breakers-eval, is pointer only (licence: NONE) · get_code("932da9d6ec274164")
How it ran

The body of this sample is withheld: this paper's copy of the code was not recorded (its link names no repository or source path), so no licence was read for it. 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.

project_rows_to_simplex Ran
ran on a synthesized input
sj21j/Regularized_Relaxation/pgd.py
code served (permissive licence) · get_code("ccf45483abe6b7a6")
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)

# Create a small 2D tensor for testing
# Shape: (2, 4) - 2 rows, 4 columns
# Values should be positive or at least reasonable for simplex projection
matrix = torch.tensor([
    [0.5, 0.2, 0.1, 0.2],
    [0.1, 0.3, 0.4, 0.2]
], dtype=torch.float32)

ARGS = {
    "matrix": matrix
}
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
sample_ids_from_grad Ran
ran; our contract draft was wrong, not the code
this paper's copy was not recorded; identical code first harvested from grayswanai/nanogcg
pointer only · get_code("56640da5aa960a42")
How it ran

The body of this sample is withheld: this paper's copy of the code was not recorded (its link names no repository or source path), so no licence was read for it. 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.

sample_ids_from_grad Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
thompsonj/nanoGCG/nanogcg/gcg.py
code served (permissive licence) · get_code("3d96d44d2ce14f72")
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 int, shape (3, 5) 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)

# Small tensors with distinct dimensions
n_optim_ids = 5
vocab_size = 8

# ids: shape (n_optim_ids,) - sequence of token ids being optimized
ids = torch.tensor([1, 2, 3, 4, 5], dtype=torch.long)

# grad: shape (n_optim_ids, vocab_size) - gradient with respect to embeddings
grad = torch.randn(n_optim_ids, vocab_size)

# search_width: number of candidate sequences to return
search_width = 3

# topk: topk for sampling (not actually used in the function body, but required)
topk = 256

# n_replace: number of token positions to update per sequence
n_replace = 1

# not_allowed_ids: token ids that should not be used
not_allowed_ids = torch.tensor([0, 7], dtype=torch.long)

# start_idx: starting index for sampling
start_idx = 0

ARGS = {
    "ids": ids,
    "grad": grad,
    "search_width": search_width,
    "topk": topk,
    "n_replace": n_replace,
    "not_allowed_ids": not_allowed_ids,
    "start_idx": start_idx,
}
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 int, shape (3, 5) — shape (3, 5) 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
should_reduce_batch_size Ran
ran, violated the contract we drafted
grayswanai/nanogcg/nanogcg/gcg.py
code served (permissive licence) · get_code("2ae3afb9e485c484")
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 torch

# Test case 1: RuntimeError with CUDA out of memory message
exception_cuda_oom = RuntimeError("CUDA out of memory.")

# Test case 2: RuntimeError with cuDNN not supported message
exception_cudnn = RuntimeError("cuDNN error: CUDNN_STATUS_NOT_SUPPORTED.")

# Test case 3: RuntimeError with CPU allocator message
exception_cpu_oom = RuntimeError("DefaultCPUAllocator: can't allocate memory")

# Test case 4: RuntimeError with non-matching message
exception_other = RuntimeError("Some other error message")

# Test case 5: RuntimeError with multiple args (should not match)
exception_multi_args = RuntimeError("CUDA out of memory.", "extra arg")

# Test case 6: Non-RuntimeError exception
exception_non_runtime = ValueError("CUDA out of memory.")

ARGS = {
    "exception": exception_cuda_oom
}
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 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
simplex_projection Ran
ran on a synthesized input
sj21j/Regularized_Relaxation/pgd.py
code served (permissive licence) · get_code("88162fb08fbc4e3a")
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 1, dtype family float, shape (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)

# Create a small simplex projection input tensor
# The function expects a 1D tensor of values to project onto the simplex
s = torch.tensor([0.5, -0.2, 0.8, 0.1])

# epsilon parameter with a small default value
epsilon = 1e-12

ARGS = {
    "s": s,
    "epsilon": epsilon,
}
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 1, dtype family float, shape (4,) — shape (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
GCG Not yet run
unverified (harvested, no recorded run)
grayswanai/nanogcg/nanogcg/gcg.py
code served (permissive licence) · get_code("56ecfab9afa7f5d4")
How it ran

no invocation recorded.

GCG Not yet run
unverified (harvested, no recorded run)
thompsonj/nanoGCG/nanogcg/gcg.py
code served (permissive licence) · get_code("19335ae7cecba250")
How it ran

no invocation recorded.

GCGConfig Not yet run
unverified (harvested, no recorded run)
thompsonj/nanoGCG/nanogcg/gcg.py
code served (permissive licence) · get_code("12ad826809223d64")
How it ran

no invocation recorded.

GCGResult Not yet run
unverified (harvested, no recorded run)
thompsonj/nanoGCG/nanogcg/gcg.py
code served (permissive licence) · get_code("83a5e2270cf28813")
How it ran

no invocation recorded.

Metric Not yet run
unverified (harvested, no recorded run)
mcgill-nlp/adversarialtriggers/adversarial_triggers/trainer/trigger_trainer.py
code served (permissive licence) · get_code("ea93b766b4220f03")
How it ran

no invocation recorded.

ModelWorker Not yet run
unverified (harvested, no recorded run)
mcgill-nlp/adversarialtriggers/adversarial_triggers/trainer/trigger_trainer.py
code served (permissive licence) · get_code("7a57a282eb260bdb")
How it ran

no invocation recorded.

ProbeSamplingConfig Not yet run
unverified (harvested, no recorded run)
grayswanai/nanogcg/nanogcg/gcg.py
code served (permissive licence) · get_code("06c48f95ad71eeb3")
How it ran

no invocation recorded.

TriggerDataset Not yet run
unverified (harvested, no recorded run)
mcgill-nlp/adversarialtriggers/adversarial_triggers/trainer/trigger_trainer.py
code served (permissive licence) · get_code("2ca4e25741ed5c74")
How it ran

no invocation recorded.

TriggerTrainer Not yet run
unverified (harvested, no recorded run)
mcgill-nlp/adversarialtriggers/adversarial_triggers/trainer/trigger_trainer.py
code served (permissive licence) · get_code("8a7d360fcc062ddc")
How it ran

no invocation recorded.

batch_compute_score Not yet run
unverified (harvested, no recorded run)
amanb2000/magic_words/magic_words/easy_gcg.py
code served (permissive licence) · get_code("00c5d6ebb885337e")
How it ran

no invocation recorded.

calc_loss Not yet run
unverified (harvested, no recorded run)
sj21j/Regularized_Relaxation/pgd.py
code served (permissive licence) · get_code("bbec7a51e90453b0")
How it ran

no invocation recorded.

compute_score Not yet run
unverified (harvested, no recorded run)
amanb2000/magic_words/magic_words/easy_gcg.py
code served (permissive licence) · get_code("13866ab049e2380b")
How it ran

no invocation recorded.

create_example Not yet run
unverified (harvested, no recorded run)
mcgill-nlp/adversarialtriggers/adversarial_triggers/trainer/trigger_trainer.py
code served (permissive licence) · get_code("7c2fecd166e014b6")
How it ran

no invocation recorded.

easy_gcg_qa_ids Not yet run
unverified (harvested, no recorded run)
amanb2000/magic_words/magic_words/easy_gcg.py
code served (permissive licence) · get_code("5c805aa7bede7abd")
How it ran

no invocation recorded.

filter_ids Not yet run
unverified (harvested, no recorded run)
grayswanai/nanogcg/nanogcg/gcg.py
code served (permissive licence) · get_code("d6bcee2f6eaa08f3")
How it ran

no invocation recorded.

filter_ids Not yet run
unverified (harvested, no recorded run)
thompsonj/nanoGCG/nanogcg/gcg.py
code served (permissive licence) · get_code("d8b335ad38108209")
How it ran

no invocation recorded.

filter_triggers Not yet run
unverified (harvested, no recorded run)
mcgill-nlp/adversarialtriggers/adversarial_triggers/trainer/trigger_trainer.py
code served (permissive licence) · get_code("a090e5ff02ef9ba4")
How it ran

no invocation recorded.

flush_memory Not yet run
unverified (harvested, no recorded run)
ed-zh/parden/utils.py
pointer only (licence: NONE) · get_code("7d27a4d4ed0c2348")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, ed-zh/parden 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. No invocation recorded.

get_prompt_grads Not yet run
unverified (harvested, no recorded run)
amanb2000/magic_words/magic_words/easy_gcg.py
code served (permissive licence) · get_code("00acd6d7ab2a8438")
How it ran

no invocation recorded.

init_trigger Not yet run
unverified (harvested, no recorded run)
fra31/rlhf-trojan-competition-submission/method/attacks.py
code served (permissive licence) · get_code("cb1b3fcdda5461cd")
How it ran

no invocation recorded.

rs_on_tokens Not yet run
unverified (harvested, no recorded run)
fra31/rlhf-trojan-competition-submission/method/attacks.py
code served (permissive licence) · get_code("2e3657f835661222")
How it ran

no invocation recorded.

Showing the first 60. An agent gets every one from get_harvested_code_for_paper("2307.15043").

Also present in other papers' code

Of 61 samples lifted from this paper's linked repositories, 61 carry a function identity and 0 do not. Of the 60 distinct functions with an identity, 2 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 2 later) and 58 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
mellowmax
brick of this paper's assembly: helper
1 other paper
1 later
2406.04313 (2024-06)
Improving Alignment and Robustness with Circuit Breakers
sample_ids_from_grad
brick of this paper's assembly: update_rule
1 other paper
1 later
2403.01251 (2024-03)
Accelerating Greedy Coordinate Gradient and General Prompt Optimization via Probe Sampling

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

Because "out-of-the-box" large language models are capable of generating a great deal of objectionable content, recent work has focused on aligning these models in an attempt to prevent undesirable generation. While there has been some success at circumventing these measures-so-called "jailbreaks" against LLMs-these attacks have required significant human ingenuity and are brittle in practice. Attempts at automatic adversarial prompt generation have also achieved limited success. In this paper, we propose a simple and effective attack method that causes aligned language models to generate objectionable behaviors. Specifically, our approach finds a suffix that, when attached to a wide range of queries for an LLM to produce objectionable content, aims to maximize the probability that the model produces an affirmative response (rather than refusing to answer). However, instead of relying on manual engineering, our approach automatically produces these adversarial suffixes by a combination of greedy and gradient-based search techniques, and also improves over past automatic prompt generation methods. Surprisingly, we find that the adversarial prompts generated by our approach are highly transferable, including to black-box, publicly released, production LLMs. Specifically, we train an adversarial attack suffix on multiple prompts (i.e., queries asking for many different types of objectionable content), as well as multiple models (in our case, Vicuna-7B and 13B). When doing so, the resulting attack suffix induces objectionable content in the public interfaces to ChatGPT, Bard, and Claude, as well as open source LLMs such as LLaMA-2-Chat, Pythia, Falcon, and others. Interestingly, the success rate of this attack transfer is much higher against the GPT-based models, potentially owing to the fact that Vicuna itself is trained on outputs from ChatGPT. In total, this work significantly advances the state-of-the-art in adversarial attacks against aligned language models, raising important questions about how such systems can be prevented from producing objectionable information. Code is available at github.com/llm-attacks/llm-attacks.

For agents

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

get_harvested_code_for_paper("2307.15043")
get_code_for_paper("2307.15043")
have("2307.15043")

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

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

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

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

Connect an agent — have() is free.