From Where Words Come: Efficient Regularization of Code Tokenizers Through Source Attribution

📅 2026-04-15
📈 Citations: 0
Influential: 0
📄 PDF

career value

191K/year
🤖 AI Summary
This work addresses the inefficiency and security risks in existing code tokenizers, which often produce numerous under-trained or redundant tokens due to imbalanced distributions of repositories and programming languages in their training data. To mitigate this issue, the authors propose Source-Aware Byte Pair Encoding (SA-BPE), a novel approach that explicitly incorporates source diversity into the BPE training process. By refining the objective function, introducing a merge-skipping strategy, and applying regularization mechanisms, SA-BPE significantly reduces the number of under-trained tokens while preserving the standard BPE inference pipeline. Experimental results demonstrate that the method substantially improves token utilization and tokenization efficiency, enhances model robustness, and is well-suited for deployment in real-world production environments.

Technology Category

Application Category

📝 Abstract
Efficiency and safety of Large Language Models (LLMs), among other factors, rely on the quality of tokenization. A good tokenizer not only improves inference speed and language understanding but also provides extra defense against jailbreak attacks and lowers the risk of hallucinations. In this work, we investigate the efficiency of code tokenization, in particular from the perspective of data source diversity. We demonstrate that code tokenizers are prone to producing unused, and thus under-trained, tokens due to the imbalance in repository and language diversity in the training data, as well as the dominance of source-specific, repetitive tokens that are often unusable in future inference. By modifying the BPE objective and introducing merge skipping, we implement different techniques under the name Source-Attributed BPE (SA-BPE) to regularize BPE training and minimize overfitting, thereby substantially reducing the number of under-trained tokens while maintaining the same inference procedure as with regular BPE. This provides an effective tool suitable for production use.
Problem

Research questions and friction points this paper is trying to address.

code tokenization
data source diversity
under-trained tokens
BPE
tokenizer efficiency
Innovation

Methods, ideas, or system contributions that make the work stand out.

Source-Attributed BPE
tokenizer regularization
code tokenization
merge skipping
under-trained tokens
🔎 Similar Papers
No similar papers found.