{"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/tokenization-is-more-than-compression","title":"Tokenization Is More Than Compression","arxiv_id":"2402.18376","date":"2024-02-28","proceeding":null,"authors":["Craig W. Schmidt","Varshini Reddy","Haoran Zhang","Alec Alameddine","Omri Uzan","Yuval Pinter","Chris Tanner"],"abstract":"Tokenization is a foundational step in natural language processing (NLP) tasks, bridging raw text and language models. Existing tokenization approaches like Byte-Pair Encoding (BPE) originate from the field of data compression, and it has been suggested that the effectiveness of BPE stems from its ability to condense text into a relatively small number of tokens. We test the hypothesis that fewer tokens lead to better downstream performance by introducing PathPiece, a new tokenizer that segments a document's text into the minimum number of tokens for a given vocabulary. Through extensive experimentation we find this hypothesis not to be the case, casting doubt on the understanding of the reasons for effective tokenization. To examine which other factors play a role, we evaluate design decisions across all three phases of tokenization: pre-tokenization, vocabulary construction, and segmentation, offering new insights into the design of effective tokenizers. Specifically, we illustrate the importance of pre-tokenization and the benefits of using BPE to initialize vocabulary construction. We train 64 language models with varying tokenization, ranging in size from 350M to 2.4B parameters, all of which are made publicly available.","url_abs":"https://arxiv.org/abs/2402.18376v2","url_pdf":"https://arxiv.org/pdf/2402.18376v2.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":[{"paper_slug":"tokenization-is-more-than-compression","repo_url":"https://github.com/kensho-technologies/pathpiece","is_official":1,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"none","reach":{"status":"ok","spdx":"NOASSERTION"}},{"paper_slug":"tokenization-is-more-than-compression","repo_url":"https://github.com/kensho-technologies/timtc_vocabs_models","is_official":1,"mentioned_in_paper":0,"mentioned_in_github":0,"framework":"pytorch","reach":{"status":"ok","spdx":"NOASSERTION"}}],"tasks":[{"task_slug":"data-compression","task_name":"Data Compression"}],"methods":[{"method_slug":"bpe","method_name":"BPE"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2402.18376","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2402.18376"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-24T18:15:14+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":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/kensho-technologies/pathpiece","reach":{"status":"ok","spdx":"NOASSERTION"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/kensho-technologies/timtc_vocabs_models","reach":{"status":"ok","spdx":"NOASSERTION"}}],"summary":{"ran":3,"unverified":3},"by_repo_kind":{"official":{"samples":6,"ran":3,"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":6,"samples":[{"code_sha256_prefix":"75019ec4231ea1c2","entry":"init_on_device","repo":"kensho-technologies/timtc_vocabs_models","repo_kind":"official","path":"models/1.3b/bpe_merge_3_40960/meta_init_context.py","file_url":"https://github.com/kensho-technologies/timtc_vocabs_models/blob/HEAD/models/1.3b/bpe_merge_3_40960/meta_init_context.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NOASSERTION","inline_ok":false,"mcp_get_code":{"code_sha256":"75019ec4231ea1c2"}},{"code_sha256_prefix":"1586b639a5abd0b0","entry":"init_to_zero","repo":"kensho-technologies/timtc_vocabs_models","repo_kind":"official","path":"models/1.3b/bpe_merge_3_40960/flash_attn_triton.py","file_url":"https://github.com/kensho-technologies/timtc_vocabs_models/blob/HEAD/models/1.3b/bpe_merge_3_40960/flash_attn_triton.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"1586b639a5abd0b0"}},{"code_sha256_prefix":"df635f66e5017c2f","entry":"rms_norm","repo":"kensho-technologies/timtc_vocabs_models","repo_kind":"official","path":"models/1.3b/bpe_merge_3_40960/norm.py","file_url":"https://github.com/kensho-technologies/timtc_vocabs_models/blob/HEAD/models/1.3b/bpe_merge_3_40960/norm.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NOASSERTION","inline_ok":false,"mcp_get_code":{"code_sha256":"df635f66e5017c2f"}},{"code_sha256_prefix":"69a085d27f83db2a","entry":"flash_attn_fn","repo":"kensho-technologies/timtc_vocabs_models","repo_kind":"official","path":"models/1.3b/bpe_merge_3_40960/attention.py","file_url":"https://github.com/kensho-technologies/timtc_vocabs_models/blob/HEAD/models/1.3b/bpe_merge_3_40960/attention.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"69a085d27f83db2a"}},{"code_sha256_prefix":"cd623891235b1d02","entry":"scaled_multihead_dot_product_attention","repo":"kensho-technologies/timtc_vocabs_models","repo_kind":"official","path":"models/1.3b/bpe_merge_3_40960/attention.py","file_url":"https://github.com/kensho-technologies/timtc_vocabs_models/blob/HEAD/models/1.3b/bpe_merge_3_40960/attention.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NOASSERTION","inline_ok":false,"mcp_get_code":{"code_sha256":"cd623891235b1d02"}},{"code_sha256_prefix":"a27f1a3818430d86","entry":"triton_flash_attn_fn","repo":"kensho-technologies/timtc_vocabs_models","repo_kind":"official","path":"models/1.3b/bpe_merge_3_40960/attention.py","file_url":"https://github.com/kensho-technologies/timtc_vocabs_models/blob/HEAD/models/1.3b/bpe_merge_3_40960/attention.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"a27f1a3818430d86"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}