SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2406.11687 · 2024

Tokenization Falling Short: On Subword Robustness in Large Language Models

arXiv · PDF · Open in the Atlas

Code that ran

8 of 9 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; 1 honoured the contract we drafted, 0 violated it and 0 have no contract verdict; 7 failures of our instrument; 1 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/2406.11687.json · badge: /api/ran/2406.11687.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
floatai/tkeval canonical (classifier label)
classifier basis: census
8 ran · 1 no recorded run
FunctionStatusWhere it lives
argmax Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
floatai/tkeval/src/utils.py
code served (permissive licence) · get_code("1d233f39e0fd58dd")
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 int64, 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 numpy as np
import hashlib

def argmax(array):
    """argmax with deterministic pseudorandom tie breaking."""
    max_indices = np.arange(len(array))[array == np.max(array)]
    idx = int(hashlib.sha256(np.asarray(array).tobytes()).hexdigest(), 16) % len(max_indices)
    return max_indices[idx]


# Create a small numpy array with some values
# Include a case where there are ties (multiple max values) to test the tie-breaking logic
array = np.array([1.0, 5.0, 3.0, 5.0, 2.0])

ARGS = {
    "array": array
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type int64, 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
get_prompt Ran
ran; our contract draft was wrong, not the code
floatai/tkeval/src/utils.py
code served (permissive licence) · get_code("3d2dcc489e259a67")
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
from typing import Dict, List, Any, Union, Optional

# Set random seed for reproducibility
torch.manual_seed(0)

# Construct valid arguments for get_prompt
ARGS = {
    "letter_set": ["a", "b", "c", "d"],
    "correct_words": ["able", "cab", "dab"],
    "incorrect_words": ["xyz", "qwerty"],
    "score": 42,
    "current_round": 2,
    "total_rounds": 5
}
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
hash_args Ran
ran; our contract draft was wrong, not the code
floatai/tkeval/evaluation/lm-evaluation-harness/lm_eval/api/model.py
code served (permissive licence) · get_code("20a7cc804eb22661")
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. 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 hashlib
import json

# Construct valid arguments for hash_args function
# The function takes attr (attribute name) and args (tuple/list of arguments)
# and creates a JSON string to hash

attr = "test_attribute"
args = ("value1", 42, [1, 2, 3], {"key": "value"})

ARGS = {
    "attr": attr,
    "args": args
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type 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
parse_eval_args Ran
ran; our contract draft was wrong, not the code
floatai/tkeval/evaluation/lm-evaluation-harness/lm_eval/__main__.py
pointer only (licence: MIT); the stored copy get_code serves, from BatsResearch/crosslingual-test-time-scaling, is pointer only (licence: NONE) · get_code("400ea4f64ccce5ef")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from BatsResearch/crosslingual-test-time-scaling, and GitHub detected no licence in that repository when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

remove_after_return Ran
ran; our contract draft was wrong, not the code
floatai/tkeval/evaluation/bigcode-evaluation-harness/bigcode_eval/utils.py
code served (permissive licence) · get_code("29ee1d8c120f674a")
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 re

def remove_after_return(code):
    """
    Takes as input a code, and removes everything that is after the return.
    That is, the first line that does not start with a space character
    """
    pattern = '[^\\n]+(\\n|$)'
    end_last_match = None
    for match in re.finditer(pattern, code):
        start_match, end_match = match.span()
        if end_last_match is not None and start_match < len(code) and (code[start_match].strip() != ''):
            return code[0:start_match]
        end_last_match = end_match
    return code

# Test code with indentation and a non-indented line (simulating return)
test_code = """    def foo():
    x = 1
    return x
print('this should be removed')
more_code = 2"""

ARGS = {
    "code": test_code
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
sample_gpt_task Ran
ran; our contract draft was wrong, not the code
floatai/tkeval/evaluation/bigcode-evaluation-harness/finetuning/APPS/apps_dataset.py
code served (permissive licence) · get_code("794f4a8bb713bf26")
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

torch.manual_seed(0)

# Create a minimal tokenizer stand-in that has the required methods
class MinimalTokenizer:
    def __init__(self):
        self.eos_token_id = 2
    
    def __call__(self, text):
        # Return a simple dict with input_ids
        # Use simple token IDs based on text length
        token_count = len(text.split()) + 1
        return {'input_ids': list(range(token_count))}

# Create raw samples: tuples of (question, source, answer, answer_type)
raw_samples = [
    ("What is 2+2?", "Math problem", "4", "multiple choice"),
    ("What is the capital of France?", "Geography", "Paris", "short answer")
]

max_tokens = 100
tokenizer = MinimalTokenizer()

ARGS = {
    'raw_samples': raw_samples,
    'max_tokens': max_tokens,
    '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 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
update_code_gens Ran
ran; our contract draft was wrong, not the code
floatai/tkeval/evaluation/bigcode-evaluation-harness/bigcode_eval/utils.py
code served (permissive licence) · get_code("0de883f1fa31ab88")
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 warnings

torch.manual_seed(0)

# Stand-in Task class
class MockTask:
    def __init__(self):
        self.stop_words = ["<end>"]
    
    def postprocess_generation(self, code, sample_idx, tokenizer):
        return f"postprocessed_{code}"

# Stand-in Tokenizer class
class MockTokenizer:
    def __init__(self):
        self.name_or_path = 'bigcode/starcoder'
        self.eos_token = "<end>"
        self.bos_token_id = 50256
        self.bos_token = "<bos>"
        self.special_tokens_map = {
            'additional_special_tokens': ['<special1>', '<special2>']
        }
    
    def decode(self, token_ids, skip_special_tokens=False, clean_up_tokenization_spaces=False):
        if isinstance(token_ids, list):
            return f"decoded_from_{len(token_ids)}_tokens"
        return "decoded_output"
    
    def get_prefix_tokens(self):
        return []

# Create instances
task = MockTask()
tokenizer = MockTokenizer()
limit_start = 0
prefix = "def hello"
instruction_tokens = ["<start>", "<end>", "<assistant>"]
postprocess = True

# Create code_gens dict
code_gens = {
    "0": [],
    "1": []
}

# Create gen_token_dict with sample token sequences
gen_token_dict = {
    "0": [
        [tokenizer.bos_token_id, 100, 101, 102],
        [50256, 103, 104, 105]
    ],
    "1": [
        [tokenizer.bos_token_id, 200, 201, 202]
    ]
}

ARGS = {
    "task": task,
    "tokenizer": tokenizer,
    "limit_start": limit_start,
    "prefix": prefix,
    "instruction_tokens": instruction_tokens,
    "postprocess": postprocess,
    "code_gens": code_gens,
    "gen_token_dict": gen_token_dict
}
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
word_scorer Ran
ran, honoured the contract we drafted
floatai/tkeval/src/utils.py
code served (permissive licence) · get_code("f48fdeea774497b1")
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 numpy as np
from typing import Dict, List, Any, Union, Optional

torch.manual_seed(0)

# Construct arguments for word_scorer function
word_list = ["hello", "cat", "dog", "bird", "elephant"]
word = "hello"

ARGS = {
    "word_list": word_list,
    "word": word
}
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 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
complete_code Not yet run
unverified (harvested, no recorded run)
floatai/tkeval/evaluation/bigcode-evaluation-harness/bigcode_eval/utils.py
code served (permissive licence) · get_code("5274bc5bf6e54c72")
How it ran

no invocation recorded.

Also present in other papers' code

Of 9 samples lifted from this paper's linked repositories, 9 carry a function identity and 0 do not. Of the 9 distinct functions with an identity, 9 are also present in other papers whose code we hold (3 with at least one paper dated earlier, 3 the same month, 3 later) and 0 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
hash_args 44 other papers
13 dated earlier, 2 the same month, 27 later, 1 same year, order not determinable, 1 undated
2005.14165 (2020-05)
Language Models are Few-Shot Learners
2110.04374 (2021-10)
A Few More Examples May Be Worth Billions of Parameters
2303.17003 (2023-03)
Evaluating GPT-3.5 and GPT-4 Models on Brazilian University Admission Exams
and 41 more not named here
parse_eval_args 15 other papers
2 dated earlier, 11 later, 1 same year, order not determinable, 1 undated
2005.14165 (2020-05)
Language Models are Few-Shot Learners
2024.findings-emnlp.86 (2024 (year only))
Tokenization Falling Short: On Subword Robustness in Large Language Models
2405.07938 (2024-05)
EconLogicQA: A Question-Answering Benchmark for Evaluating Large Language Models in Economic Sequential Reasoning
and 12 more not named here
remove_after_return 4 other papers
1 dated earlier, 1 the same month, 1 later, 1 same year, order not determinable
2308.07124 (2023-08)
OctoPack: Instruction Tuning Code Large Language Models
2024.findings-emnlp.86 (2024 (year only))
Tokenization Falling Short: On Subword Robustness in Large Language Models
2406.12809 (2024-06)
Can Large Language Models Always Solve Easy Problems if They Can Solve Harder Ones?
and 1 more not named here
argmax 2 other papers
1 the same month, 1 same year, order not determinable
2024.findings-emnlp.86 (2024 (year only))
Tokenization Falling Short: On Subword Robustness in Large Language Models
2406.07424 (2024-06)
MINERS: Multilingual Language Models as Semantic Retrievers
complete_code 1 other paper
1 same year, order not determinable
2024.findings-emnlp.86 (2024 (year only))
Tokenization Falling Short: On Subword Robustness in Large Language Models
get_prompt 1 other paper
1 same year, order not determinable
2024.findings-emnlp.86 (2024 (year only))
Tokenization Falling Short: On Subword Robustness in Large Language Models
sample_gpt_task 1 other paper
1 same year, order not determinable
2024.findings-emnlp.86 (2024 (year only))
Tokenization Falling Short: On Subword Robustness in Large Language Models
update_code_gens 1 other paper
1 same year, order not determinable
2024.findings-emnlp.86 (2024 (year only))
Tokenization Falling Short: On Subword Robustness in Large Language Models
word_scorer 1 other paper
1 same year, order not determinable
2024.findings-emnlp.86 (2024 (year only))
Tokenization Falling Short: On Subword Robustness in Large Language Models

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

Language models typically tokenize raw text into sequences of subword identifiers from a predefined vocabulary, a process inherently sensitive to typographical errors, length variations, and largely oblivious to the internal structure of tokens--issues we term the curse of tokenization. In this study, we delve into these drawbacks and demonstrate that large language models (LLMs) remain susceptible to these problems. This study systematically investigates these challenges and their impact on LLMs through three critical research questions: (1) complex problem solving, (2) token structure probing, and (3) resilience to typographical variation. Our findings reveal that scaling model parameters can mitigate the issue of tokenization; however, LLMs still suffer from biases induced by typos and other text format variations. Our experiments show that subword regularization such as BPE-dropout can mitigate this issue. We release our evaluation code and data at https://github.com/FloatAI/TKEval.

For agents

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

get_harvested_code_for_paper("2406.11687")
get_code_for_paper("2406.11687")
have("2406.11687")

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

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

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

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

Connect an agent — have() is free.