SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2508.20718 · EMNLP · 2025

Addressing Tokenization Inconsistency in Steganography and Watermarking Based on Large Language Models

Yugo Murawaki, Ruiyi Yan

arXiv · PDF · Open in the Atlas

Code that ran

18 of 28 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; 5 honoured the contract we drafted, 1 violated it and 0 have no contract verdict; 12 failures of our instrument; 10 no recorded run), measured 2026-11-24; 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/2508.20718.json · badge: /api/ran/2508.20718.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
ryehr/Consistency canonical (classifier label)
classifier basis: census
18 ran · 10 no recorded run
FunctionStatusWhere it lives
BFS_Forest Ran
ran; our contract draft was wrong, not the code
ryehr/Consistency/legacy/Steganography_AC.py
code served (permissive licence) · get_code("387c8b512864a0af")
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.

from collections import deque

class node(object):
    def __init__(self, index, word, weight, neighbour):
        self.index = index
        self.word = word
        self.weight = weight
        self.neighbour = neighbour

# Create a small graph structure for testing
# We'll create 5 nodes in a simple tree structure
nodes_dict = {}

# Node 0: root, connected to nodes 1 and 2
node_0 = node(index=0, word="root", weight=1.0, neighbour=[1, 2])
nodes_dict[0] = node_0

# Node 1: connected to nodes 3 and 4
node_1 = node(index=1, word="child1", weight=0.8, neighbour=[3, 4])
nodes_dict[1] = node_1

# Node 2: connected to node 4
node_2 = node(index=2, word="child2", weight=0.7, neighbour=[4])
nodes_dict[2] = node_2

# Node 3: leaf node
node_3 = node(index=3, word="leaf1", weight=0.5, neighbour=[])
nodes_dict[3] = node_3

# Node 4: leaf node
node_4 = node(index=4, word="leaf2", weight=0.6, neighbour=[])
nodes_dict[4] = node_4

# Forest_nodes is a list of indices that are part of the forest we're traversing
# Starting from node 0, we can reach nodes 0, 1, 2, 3, 4
Forest_nodes = [0, 1, 2, 3, 4]

ARGS = {
    "Forest_nodes": Forest_nodes,
    "Nodes": nodes_dict
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple — 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
auroc Ran
ran; our contract draft was wrong, not the code
ryehr/Consistency/src/tokenization_consistency/metrics.py
code served (permissive licence) · get_code("b4056ca2c7273447")
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 auroc function takes two parameters:
# - positive_scores: an iterable of numeric scores for positive examples
# - negative_scores: an iterable of numeric scores for negative examples

# Create small lists of scores
positive_scores = [0.9, 0.85, 0.95, 0.8]
negative_scores = [0.3, 0.2, 0.4, 0.25]

ARGS = {
    "positive_scores": positive_scores,
    "negative_scores": negative_scores,
}
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
bits_to_int Ran
ran, honoured the contract we drafted
ryehr/Consistency/src/tokenization_consistency/coding.py
code served (permissive licence) · get_code("3dbcb9239a7c5714")
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

# bits_to_int takes a string of bits and converts it to an integer
# The function calls int(bits, 2), so we need a string containing binary digits

ARGS = {
    "bits": "1010"
}
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
connected_components Ran
ran, honoured the contract we drafted
ryehr/Consistency/src/tokenization_consistency/pools.py
code served (permissive licence) · get_code("1e9caf3fe5683350")
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 2, 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.

def connected_components(adjacency: list[list[int]]) -> list[list[int]]:
    seen: set[int] = set()
    components: list[list[int]] = []
    for root in range(len(adjacency)):
        if root in seen:
            continue
        component: list[int] = []
        stack = [root]
        seen.add(root)
        while stack:
            node = stack.pop()
            component.append(node)
            for neighbour in adjacency[node]:
                if neighbour not in seen:
                    seen.add(neighbour)
                    stack.append(neighbour)
        components.append(sorted(component))
    return components


adjacency = [
    [1, 2],
    [0, 2],
    [0, 1],
    [4],
    [3, 5],
    [4]
]

ARGS = {
    "adjacency": adjacency
}
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 list, ndim 2, 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
detokenize Ran
ran; our contract draft was wrong, not the code
ryehr/Consistency/src/tokenization_consistency/tokenization.py
code served (permissive licence) · get_code("3e44617c05f9e47c")
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 torch.nn as nn

torch.manual_seed(0)

# Build a minimal tokenizer stand-in that has a decode method
class SimpleTokenizer:
    def decode(self, token_ids, **kwargs):
        # Simple mock implementation: just stringify the token ids
        return f"decoded: {token_ids}"

tokenizer = SimpleTokenizer()

# Test case 1: token_ids as a list
token_ids_list = [101, 2054, 2003, 102]

# Test case 2: token_ids as a torch tensor
token_ids_tensor = torch.tensor([101, 2054, 2003, 102])

# Create ARGS dict with both parameter combinations
ARGS = {
    'tokenizer': tokenizer,
    'token_ids': token_ids_list
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type 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
find_MWIS Ran
ran; our contract draft was wrong, not the code
ryehr/Consistency/legacy/Steganography_AC.py
code served (permissive licence) · get_code("3ffd6721b8bfdc72")
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. 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 collections import deque

class node(object):
    def __init__(self, index, word, weight, neighbour):
        self.index = index
        self.word = word
        self.weight = weight
        self.neighbour = neighbour

# Create a small graph structure for testing
# We'll create 5 nodes with specific connections
nodes_dict = {}

# Node 0: neighbours with 1, 2
nodes_dict[0] = node(index=0, word="word0", weight=1.0, neighbour=[1, 2])

# Node 1: neighbours with 0, 3
nodes_dict[1] = node(index=1, word="word1", weight=2.0, neighbour=[0, 3])

# Node 2: neighbours with 0, 4
nodes_dict[2] = node(index=2, word="word2", weight=3.0, neighbour=[0, 4])

# Node 3: neighbours with 1
nodes_dict[3] = node(index=3, word="word3", weight=4.0, neighbour=[1])

# Node 4: neighbours with 2
nodes_dict[4] = node(index=4, word="word4", weight=5.0, neighbour=[2])

ARGS = {
    "Nodes": nodes_dict
}
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 list — a list 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
find_connected_components Ran
ran; our contract draft was wrong, not the code
ryehr/Consistency/legacy/Steganography_AC.py
code served (permissive licence) · get_code("732a129f77e46327")
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. 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.

class Node:
    def __init__(self, node_id):
        self.id = node_id
        self.neighbour = []

# Create a small graph with connected components
node0 = Node(0)
node1 = Node(1)
node2 = Node(2)
node3 = Node(3)
node4 = Node(4)

# Component 1: 0 - 1 - 2
node0.neighbour = [1]
node1.neighbour = [0, 2]
node2.neighbour = [1]

# Component 2: 3 - 4
node3.neighbour = [4]
node4.neighbour = [3]

Nodes = [node0, node1, node2, node3, node4]

ARGS = {
    "Nodes": Nodes
}
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 list — a list 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
int_to_bits Ran
ran; our contract draft was wrong, not the code
ryehr/Consistency/src/tokenization_consistency/coding.py
code served (permissive licence) · get_code("5ffb963b558d4020")
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

torch.manual_seed(0)

ARGS = {
    "value": 42,
    "bit_length": 8,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type 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
is_consistent Ran
ran; our contract draft was wrong, not the code
ryehr/Consistency/src/tokenization_consistency/tokenization.py
code served (permissive licence) · get_code("6b381d638094c710")
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
from unittest.mock import Mock

torch.manual_seed(0)

# Create a mock tokenizer that satisfies the function's usage
class MockTokenizer:
    def decode(self, token_ids, **kwargs):
        # Convert token_ids to a simple string representation
        return " ".join(str(tid) for tid in token_ids)
    
    def __call__(self, text):
        # Tokenize: split by spaces and convert to token IDs
        tokens = text.split()
        token_ids = [int(t) if t.isdigit() else hash(t) % 1000 for t in tokens]
        return {'input_ids': token_ids}

tokenizer = MockTokenizer()

# Create token_ids as a sequence of integers
token_ids = [1, 2, 3, 4]

# Define the ARGS dictionary with all parameters for is_consistent
ARGS = {
    'tokenizer': tokenizer,
    'token_ids': token_ids
}
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
maximum_weight_independent_set Ran
ran, violated the contract we drafted
ryehr/Consistency/src/tokenization_consistency/pools.py
code served (permissive licence) · get_code("6ee52ae650174e0a")
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

# Construct a small graph for testing maximum_weight_independent_set
# The adjacency list represents an undirected graph
# adjacency[i] = list of neighbors of node i

# Simple example: a path graph with 5 nodes: 0-1-2-3-4
adjacency = [
    [1],           # node 0 connects to 1
    [0, 2],        # node 1 connects to 0, 2
    [1, 3],        # node 2 connects to 1, 3
    [2, 4],        # node 3 connects to 2, 4
    [3]            # node 4 connects to 3
]

# Weights for each node
weights = [1.0, 2.0, 3.0, 2.5, 1.5]

ARGS = {
    "adjacency": adjacency,
    "weights": weights
}
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
mean Ran
ran; our contract draft was wrong, not the code
ryehr/Consistency/src/tokenization_consistency/metrics.py
code served (permissive licence) · get_code("4ef553fc5d98847b")
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 math

def mean(values) -> float:
    values = [v for v in values if v is not None and (not math.isnan(v))]
    return sum(values) / len(values) if values else float('nan')

ARGS = {
    "values": [1.5, 2.5, 3.5, 4.5]
}
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 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
perplexity Ran
ran, honoured the contract we drafted
ryehr/Consistency/src/tokenization_consistency/metrics.py
code served (permissive licence) · get_code("7052cf29d24fe56c")
How it ran

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

import torch
import torch.nn as nn

torch.manual_seed(0)

# Create a minimal model that satisfies the function's requirements
class MinimalLanguageModel(nn.Module):
    def __init__(self, vocab_size=10, hidden_dim=4):
        super().__init__()
        self.embedding = nn.Embedding(vocab_size, hidden_dim)
        self.linear = nn.Linear(hidden_dim, vocab_size)
        self.device_attr = torch.device('cpu')
    
    @property
    def device(self):
        return self.device_attr
    
    def forward(self, input_ids):
        embedded = self.embedding(input_ids)
        logits = self.linear(embedded)
        
        # Return an object with a logits attribute
        class Output:
            pass
        
        output = Output()
        output.logits = logits
        return output

# Create a minimal tokenizer that satisfies the function's requirements
class MinimalTokenizer:
    def __init__(self):
        self.vocab_size = 10
    
    def __call__(self, text, return_tensors=None):
        # Return a dict with 'input_ids' key containing token ids
        # Create a simple encoding: map text to token ids
        token_ids = [hash(c) % self.vocab_size for c in text]
        # Ensure at least 2 tokens for the function to work
        if len(token_ids) < 2:
            token_ids = [1, 2]
        
        tensor = torch.tensor([token_ids], dtype=torch.long)
        
        if return_tensors == 'pt':
            return {'input_ids': tensor}
        return {'input_ids': tensor}

# Instantiate the model and tokenizer
model = MinimalLanguageModel(vocab_size=10, hidden_dim=4)
model.eval()
tokenizer = MinimalTokenizer()
text = "hello world test"
max_length = None

ARGS = {
    'model': model,
    'tokenizer': tokenizer,
    'text': text,
    'max_length': max_length
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type float, ndim 0, dtype family float, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
recovery_distribution Ran
ran; our contract draft was wrong, not the code
ryehr/Consistency/src/tokenization_consistency/investigation.py
code served (permissive licence) · get_code("a90482521c45be59")
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.

from collections import Counter

# Construct valid arguments for recovery_distribution
# The function takes a list of int or None values, and an optional max_n parameter

# Create a sample distances list with various integer values and None
distances = [0, 1, 1, 2, 3, 3, 3, None, None, 5]

# Create the ARGS dictionary with all parameters
ARGS = {
    'distances': distances,
    'max_n': 5
}
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 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
retokenize Ran
ran, honoured the contract we drafted
ryehr/Consistency/src/tokenization_consistency/tokenization.py
code served (permissive licence) · get_code("5b46c539ade01f31")
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 (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)

class MockTokenizer:
    def __call__(self, text, return_tensors=None):
        # Simulate tokenizer output with shape (1, seq_length)
        input_ids = torch.tensor([[101, 2054, 2003, 102]], dtype=torch.long)
        return {'input_ids': input_ids}

tokenizer = MockTokenizer()
text = "What is this"
device = None

ARGS = {
    'tokenizer': tokenizer,
    'text': text,
    '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 (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
score_tokens Ran
ran; our contract draft was wrong, not the code
ryehr/Consistency/src/tokenization_consistency/watermark.py
code served (permissive licence) · get_code("f1eb7814aeb2ccd0")
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
from abc import ABC, abstractmethod

class DummyWatermarkScheme(ABC):
    name = 'dummy'

    def __init__(self, vocab_size: int, key: int, device, context_width: int = 1):
        self.vocab_size = vocab_size
        self.key = int(key)
        self.device = device
        self.context_width = context_width
        self.generator = torch.Generator(device=device)

    def _seed_from(self, values) -> int:
        return int(min((int(v) for v in values)))

    def _context_seed(self, prefix_ids) -> int:
        window = prefix_ids[-self.context_width:] if self.context_width > 0 else prefix_ids
        return self._seed_from(window)

    def step(self, prefix_ids, logits: torch.Tensor, blocked=(), rng: torch.Generator | None = None) -> tuple[int, float]:
        return (0, 0.0)

    def token_score(self, prefix_ids, token_id: int) -> float:
        # Simple scoring based on token_id and prefix
        return float(token_id) * 0.1 + float(len(prefix_ids)) * 0.01

    def strength(self, scores) -> float:
        if not scores:
            return 0.0
        return sum(scores) / len(scores)

    @staticmethod
    def _blocked_logits(logits: torch.Tensor, blocked) -> torch.Tensor:
        if not blocked:
            return logits
        logits = logits.clone()
        logits[torch.tensor(sorted(blocked), device=logits.device, dtype=torch.long)] = -float('inf')
        return logits

torch.manual_seed(0)

scheme = DummyWatermarkScheme(vocab_size=100, key=42, device='cpu', context_width=1)
token_ids = [5, 10, 15, 20, 7]

ARGS = {
    'scheme': scheme,
    'token_ids': token_ids,
}
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
summarize Ran
ran; our contract draft was wrong, not the code
ryehr/Consistency/src/tokenization_consistency/investigation.py
code served (permissive licence) · get_code("b4e26afc7a14e237")
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.

from collections import Counter
from dataclasses import dataclass, field

@dataclass
class SampleStats:
    """Per-sample counters; sum these across samples to get the paper's tables."""
    generated_tokens: int = 0
    retokenized_tokens: int = 0
    text_level_inconsistent: bool = False
    spans_available: bool = True
    num_sit: int = 0
    num_cit: int = 0
    candidates_seen: int = 0
    candidate_its: int = 0
    candidate_mass: float = 0.0
    candidate_it_mass: float = 0.0
    recovery_distances: list[int | None] = field(default_factory=list)

# Create sample stats instances with diverse values
sample1 = SampleStats(
    generated_tokens=100,
    retokenized_tokens=10,
    text_level_inconsistent=True,
    spans_available=True,
    num_sit=5,
    num_cit=3,
    candidates_seen=50,
    candidate_its=25,
    candidate_mass=10.5,
    candidate_it_mass=5.2,
    recovery_distances=[1, 2, None, 3, 1]
)

sample2 = SampleStats(
    generated_tokens=150,
    retokenized_tokens=15,
    text_level_inconsistent=False,
    spans_available=False,
    num_sit=8,
    num_cit=4,
    candidates_seen=75,
    candidate_its=40,
    candidate_mass=15.3,
    candidate_it_mass=7.8,
    recovery_distances=[2, None, 1, 4, 2, None]
)

sample3 = SampleStats(
    generated_tokens=120,
    retokenized_tokens=12,
    text_level_inconsistent=True,
    spans_available=True,
    num_sit=6,
    num_cit=2,
    candidates_seen=60,
    candidate_its=30,
    candidate_mass=12.1,
    candidate_it_mass=6.0,
    recovery_distances=[1, 3, 2]
)

samples = [sample1, sample2, sample3]

ARGS = {
    'samples': samples
}
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 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
usable_vocab_size Ran
ran, honoured the contract we drafted
ryehr/Consistency/src/tokenization_consistency/models.py
code served (permissive licence) · get_code("9c8e4cc94318e9f1")
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

torch.manual_seed(0)

class MockTokenizer:
    """Stand-in tokenizer with get_vocab method."""
    def __init__(self, vocab_size=100):
        self.vocab_size = vocab_size
    
    def get_vocab(self):
        # Return a dict with vocab_size entries
        return {f"token_{i}": i for i in range(self.vocab_size)}

class MockModel(nn.Module):
    """Stand-in model with get_output_embeddings method."""
    def __init__(self, output_embedding_size=150):
        super().__init__()
        # Create an embedding layer with output_embedding_size tokens
        self.output_embeddings = nn.Embedding(output_embedding_size, 64)
    
    def get_output_embeddings(self):
        return self.output_embeddings

# Create a tokenizer with vocab size 100
tokenizer = MockTokenizer(vocab_size=100)

# Create a model with output embedding size 150 (wider than tokenizer vocab)
model = MockModel(output_embedding_size=150)

ARGS = {
    "model": model,
    "tokenizer": tokenizer,
}
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
write_run_metadata Ran
ran; our contract draft was wrong, not the code
ryehr/Consistency/src/tokenization_consistency/io_utils.py
code served (permissive licence) · get_code("7082b6ec7f7b94ef")
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 PosixPath. 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 dataclasses import dataclass
from pathlib import Path
import tempfile

@dataclass
class MockArgs:
    learning_rate: float = 0.001
    batch_size: int = 32
    num_epochs: int = 10
    model_name: str = "test_model"

# Create a temporary directory for output
temp_dir = tempfile.mkdtemp()
output_path = Path(temp_dir) / "run_metadata.json"

ARGS = {
    'path': output_path,
    'args': MockArgs(),
    'extra_metric_1': 0.95,
    'extra_metric_2': 'test_run',
    'extra_metric_3': [1, 2, 3]
}
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 PosixPath — a PosixPath output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a PosixPath 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
Attack Not yet run
unverified (harvested, no recorded run)
ryehr/Consistency/legacy/Attack_watermark.py
code served (permissive licence) · get_code("4641dca1ac6eb907")
How it ran

no invocation recorded.

build_pool Not yet run
unverified (harvested, no recorded run)
ryehr/Consistency/src/tokenization_consistency/pools.py
code served (permissive licence) · get_code("095cfc085919059d")
How it ran

no invocation recorded.

build_scheme Not yet run
unverified (harvested, no recorded run)
ryehr/Consistency/src/tokenization_consistency/watermark.py
code served (permissive licence) · get_code("eb377f276544ba23")
How it ran

no invocation recorded.

detect_logits Not yet run
unverified (harvested, no recorded run)
ryehr/Consistency/legacy/Attack_watermark.py
code served (permissive licence) · get_code("f17126ea771603c1")
How it ran

no invocation recorded.

detect_sample Not yet run
unverified (harvested, no recorded run)
ryehr/Consistency/legacy/Attack_watermark.py
code served (permissive licence) · get_code("60c2a54ff9a5f505")
How it ran

no invocation recorded.

extract Not yet run
unverified (harvested, no recorded run)
ryehr/Consistency/src/tokenization_consistency/steganography.py
code served (permissive licence) · get_code("8d89fac0921013bf")
How it ran

no invocation recorded.

generate Not yet run
unverified (harvested, no recorded run)
ryehr/Consistency/src/tokenization_consistency/watermark.py
code served (permissive licence) · get_code("4abde2ebde77264f")
How it ran

no invocation recorded.

investigate_sample Not yet run
unverified (harvested, no recorded run)
ryehr/Consistency/src/tokenization_consistency/investigation.py
code served (permissive licence) · get_code("977a377dfb7a62eb")
How it ran

no invocation recorded.

load_model_and_tokenizer Not yet run
unverified (harvested, no recorded run)
ryehr/Consistency/src/tokenization_consistency/models.py
code served (permissive licence) · get_code("e037ac1be5c9f57f")
How it ran

no invocation recorded.

random_replacement_attack Not yet run
unverified (harvested, no recorded run)
ryehr/Consistency/src/tokenization_consistency/attacks.py
code served (permissive licence) · get_code("3a5b6ac4ead1ed5d")
How it ran

no invocation recorded.

Also present in other papers' code

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

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 have significantly enhanced the capacities and efficiency of text generation. On the one hand, they have improved the quality of text-based steganography. On the other hand, they have also underscored the importance of watermarking as a safeguard against malicious misuse. In this study, we focus on tokenization inconsistency (TI) between the sender and the receiver in steganography and watermarking, where TI can undermine robustness. Our investigation reveals that the problematic tokens responsible for TI exhibit two key characteristics: infrequency and temporariness. Based on these findings, we propose two tailored solutions for TI elimination: a stepwise verification method for steganography and a post-hoc rollback method for watermarking. Experiments show that (1) compared to traditional disambiguation methods in steganography, directly addressing TI leads to improvements in fluency, imperceptibility, and antisteganalysis capacity; (2) for watermarking, addressing TI enhances detectability and robustness against attacks. The code is available at https://github.com/ryehr/Consistency.

For agents

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

get_harvested_code_for_paper("2508.20718")
get_code_for_paper("2508.20718")
have("2508.20718")

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

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

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

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

Connect an agent — have() is free.