SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2605.12813 · ICML · 2026

REALISTA: Realistic Latent Adversarial Attacks that Elicit LLM Hallucinations

René Vidal, Hamed Hassani, Liangzu Peng, Buyun Liang, Jinqi Luo, Fengrui Tian, Kwan Ho, Ryan Chan, Darshan Thaker, Kaleab Kinfu

arXiv · PDF · Open in the Atlas

Code that ran

16 of 25 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 2 honoured the contract we drafted, 1 violated it and 0 have no contract verdict; 13 failures of our instrument; 9 no recorded run), measured 2026-11-23; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2605.12813.json · badge: /api/ran/2605.12813.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
Buyun-Liang/REALISTA community
Papers with Code archive
16 ran · 9 no recorded run
FunctionStatusWhere it lives
_choice_headers Ran
ran; our contract draft was wrong, not the code
Buyun-Liang/REALISTA/src/realista.py
code served (permissive licence) · get_code("2f58159205f333ca")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned list, ndim 1, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

# ground_truth_idx should be an integer index (0-3 for 4 choices)
ground_truth_idx = 0

# target_choice_index should be an integer index (0-3 for 4 choices)
target_choice_index = 2

ARGS = {
    'ground_truth_idx': ground_truth_idx,
    'target_choice_index': target_choice_index,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 1, dtype family float — a list output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
_choice_token_ids Ran
ran; our contract draft was wrong, not the code
Buyun-Liang/REALISTA/src/realista.py
code served (permissive licence) · get_code("c56d7e3b9a495229")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned dict. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

torch.manual_seed(0)

# The function _choice_token_ids takes a single parameter: model_type
# It looks up model_type in the CHOICE_TOKEN_IDS dictionary
# Valid model_type values are: 'llama3_8b', 'llama3_3b', 'qwen2_5_7b', 'qwen2_5_14b'

ARGS = {
    'model_type': 'llama3_8b'
}
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 dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
_prob_cells Ran
ran; our contract draft was wrong, not the code
Buyun-Liang/REALISTA/src/realista.py
code served (permissive licence) · get_code("86e1206f2614ec22")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned str. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np

torch.manual_seed(0)

# Analyze the function: _prob_cells takes 'probs' parameter
# The function iterates over probs and formats each p as a percentage
# So probs should be an iterable of numeric values between 0 and 1

# Create a small list of probabilities
probs = [0.25, 0.5, 0.75, 0.1]

ARGS = {
    "probs": probs
}
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 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
_select_best_trial Ran
ran; our contract draft was wrong, not the code
Buyun-Liang/REALISTA/src/realista.py
code served (permissive licence) · get_code("687f1f1da535773b")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned dict. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np

torch.manual_seed(0)

# Construct result_dict_ls - a list of result dictionaries
# Each dict needs 'iter_best' and 'obj_best' keys based on function usage
result_dict_ls = [
    {
        'iter_best': 0,
        'obj_best': 0.5,
        'trial_id': 0
    },
    {
        'iter_best': 3,
        'obj_best': 0.8,
        'trial_id': 1
    },
    {
        'iter_best': 5,
        'obj_best': 0.9,
        'trial_id': 2
    },
    {
        'iter_best': 0,
        'obj_best': 0.6,
        'trial_id': 3
    }
]

ARGS = {
    'result_dict_ls': result_dict_ls
}
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 dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
_select_stage1_initializations Ran
ran; our contract draft was wrong, not the code
Buyun-Liang/REALISTA/src/realista.py
code served (permissive licence) · get_code("dd218e17560cd7be")
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 unittest.mock import MagicMock


class MockLLM(nn.Module):
    """Mock LLM that generates JSON responses for feasibility checking."""
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 4)
    
    def generate(self, messages, max_new_tokens=30, temperature=1.0):
        """Return a JSON string with equivalence_score."""
        return '{"equivalence_score": "1"}'


class MockArgs:
    """Mock args object with required attributes."""
    def __init__(self):
        self.verbose = True
        self.mmlu_subject = "physics"


# Build stage1_result_dict with multiple candidates
stage1_result_dict = {
    "concept_1": {
        "feasibility": True,
        "score_metric": 0.85,
        "attack_prompt": "What is the velocity of an object with mass 5kg?"
    },
    "concept_2": {
        "feasibility": True,
        "score_metric": 0.92,
        "attack_prompt": "What is the speed of an object with mass 5kg?"
    },
    "concept_3": {
        "feasibility": False,
        "score_metric": 0.88,
        "attack_prompt": "How fast does an object move?"
    },
    "concept_4": {
        "feasibility": True,
        "score_metric": 0.78,
        "attack_prompt": "Calculate the velocity given mass 5kg?"
    },
}

# Build cur_task_dict with question and multiple choice options
cur_task_dict = {
    "question": "What is the velocity of an object with mass 5kg and applied force 10N?",
    "choices": [
        "2 m/s",
        "5 m/s",
        "10 m/s",
        "20 m/s"
    ],
    "answer": 1
}

# Create mock LLM
feasibility_checker_llm = MockLLM()

# Create mock args
args = MockArgs()

# Define ARGS dictionary with all parameters
ARGS = {
    "stage1_result_dict": stage1_result_dict,
    "cur_task_dict": cur_task_dict,
    "trial_num": 2,
    "score_key": "score_metric",
    "feasibility_checker_LLM": feasibility_checker_llm,
    "args": args,
    "require_feasibility_check": True
}
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
feasibility_check Ran
ran, violated the contract we drafted
Buyun-Liang/REALISTA/src/realista.py
code served (permissive licence) · get_code("66d6ca7c75949643")
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
import torch.nn as nn
import json


class MockFeasibilityEvaluator(nn.Module):
    """Mock model that simulates the feasibility evaluator."""
    
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(10, 1)
    
    def generate(self, messages, max_new_tokens=30, temperature=1.0):
        """Simulate generating a response with JSON format."""
        # Return a valid JSON response
        return json.dumps({"equivalence_score": "1"})


# Set seed for reproducibility
torch.manual_seed(0)

# Construct arguments
ARGS = {
    "query_x": "What is the capital of France and its population?",
    "query_x0": "What is the capital of France?",
    "choices": [
        "Paris with 2.2 million people",
        "Lyon with 500,000 people",
        "Marseille with 860,000 people",
        "Nice with 340,000 people"
    ],
    "subject": "geography",
    "ground_truth_idx": 0,
    "feasibility_evaluator_model": MockFeasibilityEvaluator()
}
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
format_probs Ran
ran; our contract draft was wrong, not the code
Buyun-Liang/REALISTA/src/realista.py
code served (permissive licence) · get_code("f78445a8d4feec00")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned str. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np

torch.manual_seed(0)

# The function takes 'probs' which should be iterable with 4 elements
# Each element is a probability (numeric value between 0 and 1)
# The function uses zip with ['A', 'B', 'C', 'D'] and iterates over probs

# We can pass either a list, numpy array, or torch tensor
# Let's use a simple list of 4 probabilities
probs_list = [0.25, 0.35, 0.20, 0.20]

ARGS = {
    'probs': probs_list
}
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 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
get_full_input_embeds Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
Buyun-Liang/REALISTA/src/realista.py
code served (permissive licence) · get_code("0e6755ce2c27c984")
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)

class StandInTokenizer:
    def __call__(self, text, return_tensors=None, add_special_tokens=False):
        # Return a simple mock tokenizer output
        class TokenizerOutput:
            def __init__(self):
                self.input_ids = torch.tensor([[1, 2, 3, 4]])
            def to(self, device):
                self.input_ids = self.input_ids.to(device)
                return self
        return TokenizerOutput()

class StandInModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.embed_tokens = nn.Embedding(num_embeddings=10, embedding_dim=4)
        self.device = 'cpu'
    
    @property
    def model(self):
        return self
    
    def to(self, device):
        self.device = device
        return super().to(device)

# Build the model
model = StandInModel()
model.device = 'cpu'

# Build the tokenizer
tokenizer = StandInTokenizer()

# Build the task dict with subject and choices
cur_task_dict = {
    'subject': 'biology',
    'choices': ['Option A text', 'Option B text', 'Option C text', 'Option D text']
}

# Build question_embeds: should be shape (batch_size, seq_len, embedding_dim)
question_embeds = torch.randn(1, 5, 4, dtype=torch.float32)

ARGS = {
    'model': model,
    'tokenizer': tokenizer,
    'cur_task_dict': cur_task_dict,
    'question_embeds': question_embeds
}
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
get_probs Ran
ran, honoured the contract we drafted
Buyun-Liang/REALISTA/src/realista.py
code served (permissive licence) · get_code("33179574bc5bb0fb")
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
import torch.nn as nn

torch.manual_seed(0)

# Create a mock args object with model_type attribute
class Args:
    def __init__(self, model_type):
        self.model_type = model_type

args = Args(model_type='llama3_8b')

# Create mock outputs with logits tensor
# The function accesses outputs.logits[0, -1, :] 
# So we need shape (batch, seq_len, vocab_size)
# Using batch=2, seq_len=3, vocab_size=512
class Outputs:
    def __init__(self):
        self.logits = torch.randn(2, 3, 512)

outputs = Outputs()

ARGS = {
    'args': args,
    'outputs': outputs
}
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
get_prompt Ran
ran; our contract draft was wrong, not the code
Buyun-Liang/REALISTA/src/realista.py
code served (permissive licence) · get_code("4c2b9df401898003")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned tuple, ndim 1, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np

torch.manual_seed(0)

# Build the cur_task_dict argument
cur_task_dict = {
    'subject': 'machine_learning',
    'choices': [
        'Neural networks are used for classification',
        'Decision trees cannot handle non-linear data',
        'Support vector machines maximize margin',
        'Random forests combine multiple decision trees'
    ]
}

# Define ARGS mapping all parameters
ARGS = {
    'cur_task_dict': cur_task_dict,
    'is_reasoning': False
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 1, dtype family float — a tuple output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
hallucination_judge_score Ran
ran, honoured the contract we drafted
Buyun-Liang/REALISTA/src/realista.py
code served (permissive licence) · get_code("256bbe4baa3a523f")
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 int, ndim 0, dtype family int, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn
import json

torch.manual_seed(0)

class MockHallucinationEvaluator(nn.Module):
    """Mock evaluator that simulates an LLM evaluator."""
    
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(1, 1)  # dummy layer
    
    def generate(self, messages, max_new_tokens=15, temperature=0.0):
        """Simulate generating a hallucination score response."""
        # Return a valid JSON response with a score between 1-5
        return json.dumps({"score": 2})

input_query = "What is the capital of France?"

target_response = "The capital of France is Paris, a beautiful city known for the Eiffel Tower."

ground_truth = "The capital of France is Paris."

hallucination_evaluator = MockHallucinationEvaluator()

ARGS = {
    "input_query": input_query,
    "target_response": target_response,
    "ground_truth": ground_truth,
    "hallucination_evaluator": hallucination_evaluator,
}
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 int, ndim 0, dtype family int, 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
latent_from_delta Ran
ran; our contract draft was wrong, not the code
Buyun-Liang/REALISTA/src/realista.py
code served (permissive licence) · get_code("1ea47c37afad7783")
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 (4, 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)

# Z0: latent vector (base latent)
Z0 = torch.randn(4, 5)

# delta: coefficients for the weighted sum
delta = torch.randn(3)

# D_Z0: basis vectors (directions in latent space)
# Shape should be (num_deltas, *Z0_shape) = (3, 4, 5)
D_Z0 = torch.randn(3, 4, 5)

ARGS = {
    "Z0": Z0,
    "delta": delta,
    "D_Z0": D_Z0,
}
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 (4, 5) — shape (4, 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
obj_fun Ran
ran; our contract draft was wrong, not the code
Buyun-Liang/REALISTA/src/realista.py
code served (permissive licence) · get_code("7fbc99fb0076b337")
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)

# Build a minimal model that supports inputs_embeds and returns outputs with logits
class MinimalModel(nn.Module):
    def __init__(self, embed_dim, vocab_size):
        super().__init__()
        self.linear = nn.Linear(embed_dim, vocab_size)
    
    def forward(self, inputs_embeds):
        # inputs_embeds shape: (batch_size, seq_len, embed_dim)
        # output logits shape: (batch_size, seq_len, vocab_size)
        logits = self.linear(inputs_embeds)
        
        # Create a simple output object with logits attribute
        class Output:
            pass
        
        output = Output()
        output.logits = logits
        return output

# Create model
embed_dim = 4
vocab_size = 500
model = MinimalModel(embed_dim, vocab_size)

# Create args object with model_type
class Args:
    def __init__(self, model_type):
        self.model_type = model_type

args = Args(model_type='llama3_8b')

# Create full_input_embeds: (batch_size=1, seq_len=3, embed_dim=4)
full_input_embeds = torch.randn(1, 3, 4, requires_grad=True)

# target_choice_index: 0 for 'A', 1 for 'B', 2 for 'C', 3 for 'D'
target_choice_index = 1

# device
device = 'cpu'

ARGS = {
    'args': args,
    'full_input_embeds': full_input_embeds,
    'target_choice_index': target_choice_index,
    'model': model,
    '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 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
project_l1_nonneg Ran
ran; our contract draft was wrong, not the code
Buyun-Liang/REALISTA/src/realista.py
code served (permissive licence) · get_code("dfdbcd1b1d4dcc87")
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)

# delta: a tensor that will be projected onto the constraint set
# The function uses: torch.clamp, .sum(), torch.sort, torch.cumsum, torch.arange, indexing
# epsilon: a scalar threshold for the L1 norm constraint

delta = torch.tensor([2.5, 1.3, 0.8, -0.5], dtype=torch.float32)
epsilon = 3.0

ARGS = {
    "delta": delta,
    "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
projection Ran
ran; our contract draft was wrong, not the code
Buyun-Liang/REALISTA/src/realista.py
code served (permissive licence) · get_code("90c470e61ee1a1fd")
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 tensor that will be projected
# The function expects a 1D tensor of deltas to project
delta = torch.tensor([2.5, 1.3, 0.8, -0.5], dtype=torch.float32)

# epsilon is the L1 norm constraint
epsilon = 2.0

ARGS = {
    "delta": delta,
    "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
reconstruct_from_latent Ran
ran; our contract draft was wrong, not the code
Buyun-Liang/REALISTA/src/realista.py
code served (permissive licence) · get_code("09e38826e42900b7")
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)

class MockTokenizer:
    def __init__(self):
        self.vocab_size = 100
    
    def __call__(self, text, return_tensors=None, add_special_tokens=False):
        # Return a simple mock with input_ids
        class TokenizerOutput:
            def __init__(self, ids):
                self.input_ids = ids
            
            def to(self, device):
                self.input_ids = self.input_ids.to(device)
                return self
        
        # Return small token sequences
        ids = torch.randint(0, self.vocab_size, (1, 3))
        return TokenizerOutput(ids)
    
    def decode(self, token_id, skip_special_tokens=False):
        # Return a character that won't trigger early termination
        return "a"

class MockModel(nn.Module):
    def __init__(self, vocab_size=100, hidden_dim=8):
        super().__init__()
        self.vocab_size = vocab_size
        self.hidden_dim = hidden_dim
        self.device_val = 'cpu'
        
        # Embedding layer
        self.embedding = nn.Embedding(vocab_size, hidden_dim)
        
        # Mock transformer layer for generating logits
        self.linear = nn.Linear(hidden_dim, vocab_size)
    
    @property
    def device(self):
        return self.device_val
    
    @property
    def model(self):
        # Return self as the model attribute
        class ModelWrapper:
            def __init__(self, parent):
                self.parent = parent
            
            def embed_tokens(self, token_ids):
                return self.parent.embedding(token_ids).to(torch.float16)
        
        return ModelWrapper(self)
    
    def get_input_embeddings(self):
        return self.embedding
    
    def forward(self, inputs_embeds, attention_mask, past_key_values=None, use_cache=False, output_hidden_states=False):
        # Generate logits from embeddings
        # inputs_embeds shape: (batch, seq_len, hidden_dim)
        logits = self.linear(inputs_embeds.to(torch.float32))
        
        class ModelOutput:
            def __init__(self, logits_val):
                self.logits = logits_val
                self.past_key_values = None
        
        return ModelOutput(logits)

# Create mock objects
model = MockModel(vocab_size=100, hidden_dim=8)
tokenizer = MockTokenizer()

# Create latent tensor: (batch_size=1, seq_len=5, hidden_dim=8)
latent = torch.randn(1, 5, 8, dtype=torch.float16)

ARGS = {
    'model': model,
    'tokenizer': tokenizer,
    'latent': latent,
    'prompt_len': 10,
    'seed': 42,
}
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
AttackResultRecorder Not yet run
unverified (harvested, no recorded run)
Buyun-Liang/REALISTA/src/realista.py
code served (permissive licence) · get_code("548d217c9fe4923e")
How it ran

no invocation recorded.

GPT Not yet run
unverified (harvested, no recorded run)
Buyun-Liang/REALISTA/src/realista.py
code served (permissive licence) · get_code("431ed128bf63eb08")
How it ran

no invocation recorded.

PLD Not yet run
unverified (harvested, no recorded run)
Buyun-Liang/REALISTA/src/realista.py
code served (permissive licence) · get_code("54e15db7b9a7752b")
How it ran

no invocation recorded.

_print_choice_legend Not yet run
unverified (harvested, no recorded run)
Buyun-Liang/REALISTA/src/realista.py
code served (permissive licence) · get_code("14355910d5b8c376")
How it ran

no invocation recorded.

_print_final_result Not yet run
unverified (harvested, no recorded run)
Buyun-Liang/REALISTA/src/realista.py
code served (permissive licence) · get_code("a82b86806665d63e")
How it ran

no invocation recorded.

_print_header Not yet run
unverified (harvested, no recorded run)
Buyun-Liang/REALISTA/src/realista.py
code served (permissive licence) · get_code("ebcfec676c7f1aca")
How it ran

no invocation recorded.

generate_full_response Not yet run
unverified (harvested, no recorded run)
Buyun-Liang/REALISTA/src/realista.py
code served (permissive licence) · get_code("794eab336f0599d6")
How it ran

no invocation recorded.

obj_fun_with_prompt Not yet run
unverified (harvested, no recorded run)
Buyun-Liang/REALISTA/src/realista.py
code served (permissive licence) · get_code("cb54a7a753780f37")
How it ran

no invocation recorded.

set_seed Not yet run
unverified (harvested, no recorded run)
Buyun-Liang/REALISTA/src/realista.py
code served (permissive licence) · get_code("9b76becfd7ca34c7")
How it ran

no invocation recorded.

Also present in other papers' code

Of 25 samples lifted from this paper's linked repositories, 25 carry a function identity and 0 do not. Of the 25 distinct functions with an identity, 0 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 0 later) and 25 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-23.

Repositories linked to this paper

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

Abstract

Large language models (LLMs) achieve strong performance across many tasks but remain vulnerable to hallucinations, making it important to systematically evaluate their reliability under realistic adversarial inputs. We formulate hallucination elicitation as a constrained optimization problem, where the goal is to find semantically coherent adversarial prompts that are equivalent to benign user prompts. Existing attack methods remain limited: discrete prompt-based attacks preserve semantic equivalence and coherence but search only over a limited set of prompt variations, while continuous latent-space attacks explore a richer space but often decode into prompts that are no longer valid rephrasings. To address these limitations, we propose REALISTA, a realistic latentspace attack framework. REALISTA constructs an input-dependent dictionary of valid editing directions, each corresponding to a semantically equivalent and coherent rephrasing, and optimizes continuous combinations of these directions in latent space. This design combines the optimization flexibility of continuous attacks with the semantic realism of discrete rephrasing-based attacks. Experiments demonstrate that REALISTA achieves superior or comparable performance to state-ofthe-art realistic attacks on open-source LLMs and, crucially, succeeds in attacking large reasoning models under free-form response settings, where prior realistic attacks fail. Code is available at ht tps://github.com/Buyun-Liang/REALISTA.

For agents

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

get_harvested_code_for_paper("2605.12813")
get_code_for_paper("2605.12813")
have("2605.12813")

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

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

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

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

Connect an agent — have() is free.