{"about":{"site":"https://codewithpapers.app","non_affiliation":"Code with Papers and Syntology are not affiliated with, endorsed by, or sponsored by Papers with Code, Meta, or the pwc-archive mirror.","licence":"CC BY-SA 4.0","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","attribution":"https://codewithpapers.app/attribution","modified":"archive material modified by Syntology; see the attribution page"},"url":"/paper/adversarial-tokenization","title":"Adversarial Tokenization","arxiv_id":"2503.02174","date":"2025-03-04","proceeding":null,"authors":["Renato Lui Geh","Zilei Shao","Guy Van Den Broeck"],"abstract":"Current LLM pipelines account for only one possible tokenization for a given string, ignoring exponentially many alternative tokenizations during training and inference. For example, the standard Llama3 tokenization of penguin is [p,enguin], yet [peng,uin] is another perfectly valid alternative. In this paper, we show that despite LLMs being trained solely on one tokenization, they still retain semantic understanding of other tokenizations, raising questions about their implications in LLM safety. Put succinctly, we answer the following question: can we adversarially tokenize an obviously malicious string to evade safety and alignment restrictions? We show that not only is adversarial tokenization an effective yet previously neglected axis of attack, but it is also competitive against existing state-of-the-art adversarial approaches without changing the text of the harmful request. We empirically validate this exploit across three state-of-the-art LLMs and adversarial datasets, revealing a previously unknown vulnerability in subword models.","url_abs":"https://arxiv.org/abs/2503.02174v1","url_pdf":"https://arxiv.org/pdf/2503.02174v1.pdf","source":{"archive":"pwc-archive (Hugging Face), CC BY-SA 4.0","snapshot":"2025-07-28","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","row_kind":"abstracts"},"code_links":[],"tasks":[{"task_slug":null,"task_name":"valid"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"syntology_url":"https://syntology.ai/paper/2503.02174","atlas_url":"https://app.syntology.ai/?focus=2503.02174","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2503.02174"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-25T09:33:49+00:00","read_at_is":"when the build read Syntology's graph, not when any sample ran","claim":"Per-sample execution status on synthesized fixtures; not a correctness claim about the paper. Samples come from repositories linked to the paper, official or community; repo_kind says which.","repos":[{"provenance":"deterministic:regex_extraction","url":"https://github.com/RenatoGeh/advtok","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"ran":7,"unverified":3},"by_repo_kind":{"found_in_text":{"samples":10,"ran":7,"repositories":1}},"repo_kind_vocabulary":{"official":"The archive marks this repository official for the paper","named_in_paper":"The archive records that the paper mentions this repository; it is not marked official","listed":"In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper","found_in_text":"Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted","community":"Not in the archive's code links for this paper; a community repository Syntology harvested"},"n_pointer_only_for_licence":0,"samples":[{"code_sha256_prefix":"153adcfd1f73fde9","entry":"loglikelihood","repo":"RenatoGeh/advtok","repo_kind":"found_in_text","path":"advtok/utils.py","file_url":"https://github.com/RenatoGeh/advtok/blob/HEAD/advtok/utils.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"153adcfd1f73fde9"}},{"code_sha256_prefix":"394daa323705ff2a","entry":"loglikelihood_from_tensor","repo":"RenatoGeh/advtok","repo_kind":"found_in_text","path":"advtok/utils.py","file_url":"https://github.com/RenatoGeh/advtok/blob/HEAD/advtok/utils.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"394daa323705ff2a"}},{"code_sha256_prefix":"4f39062df4e38213","entry":"lstate","repo":"RenatoGeh/advtok","repo_kind":"found_in_text","path":"advtok/mdd.py","file_url":"https://github.com/RenatoGeh/advtok/blob/HEAD/advtok/mdd.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"4f39062df4e38213"}},{"code_sha256_prefix":"2bef89d5972c0cdd","entry":"ostate","repo":"RenatoGeh/advtok","repo_kind":"found_in_text","path":"advtok/mdd.py","file_url":"https://github.com/RenatoGeh/advtok/blob/HEAD/advtok/mdd.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"2bef89d5972c0cdd"}},{"code_sha256_prefix":"290393d58001e156","entry":"template_llama_guard","repo":"RenatoGeh/advtok","repo_kind":"found_in_text","path":"advtok/evaluate.py","file_url":"https://github.com/RenatoGeh/advtok/blob/HEAD/advtok/evaluate.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"290393d58001e156"}},{"code_sha256_prefix":"62eddc88cf62859b","entry":"template_str","repo":"RenatoGeh/advtok","repo_kind":"found_in_text","path":"advtok/jailbreak.py","file_url":"https://github.com/RenatoGeh/advtok/blob/HEAD/advtok/jailbreak.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"62eddc88cf62859b"}},{"code_sha256_prefix":"9172d7ca48721d0f","entry":"tstate","repo":"RenatoGeh/advtok","repo_kind":"found_in_text","path":"advtok/mdd.py","file_url":"https://github.com/RenatoGeh/advtok/blob/HEAD/advtok/mdd.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"9172d7ca48721d0f"}},{"code_sha256_prefix":"6691a6d2078a8b7c","entry":"classifier","repo":"RenatoGeh/advtok","repo_kind":"found_in_text","path":"advtok/evaluate.py","file_url":"https://github.com/RenatoGeh/advtok/blob/HEAD/advtok/evaluate.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"6691a6d2078a8b7c"}},{"code_sha256_prefix":"54832ac6f194bec1","entry":"loglikelihood_batch","repo":"RenatoGeh/advtok","repo_kind":"found_in_text","path":"advtok/utils.py","file_url":"https://github.com/RenatoGeh/advtok/blob/HEAD/advtok/utils.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"54832ac6f194bec1"}},{"code_sha256_prefix":"2dae319dc85a5fb4","entry":"template_shield_gemma","repo":"RenatoGeh/advtok","repo_kind":"found_in_text","path":"advtok/evaluate.py","file_url":"https://github.com/RenatoGeh/advtok/blob/HEAD/advtok/evaluate.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"2dae319dc85a5fb4"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}