NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

FLEXITOKENS: Flexible Tokenization for Evolving Language Models

Abraham Toluwase Owodunni, Orevaoghene Ahia, Sachin Kumar

TL;DR

FlexıTokens introduces a learnable, byte-level tokenization scheme that moves away from the "one-size-fits-all" rigidity of traditional subword tokenizers. By using a novel hinge-like loss function, the model can dynamically adjust its compression rate during fine-tuning, effectively "learning" how to segment text for new languages, scripts, and specialized domains like medicine without over-fragmenting the input.

What Problem Does This Paper Address?

Most Large Language Models (LLMs) rely on static subword tokenizers like Byte Pair Encoding (BPE). These tokenizers are "frozen" after pretraining; they don't adapt when you fine-tune the model on a new domain. This leads to over-fragmentation: a medical term or a word in an unseen language might be chopped into dozens of meaningless character-level tokens, spiking computational costs and tanking performance.

While recent "tokenizer-free" models attempt to learn tokenization via gradients, they typically enforce a fixed compression rate (e.g., always turn 4 bytes into 1 token). The authors argue this is just a new form of rigidity. A medical abstract might benefit from longer, more complex tokens, while a programming language might need more granular ones. We need a tokenizer that can "breathe" with the data.

Methods

FlexıTokens is built on the Hourglass Transformer architecture. Instead of a fixed vocabulary, the model takes raw bytes as input. It consists of three main parts:

  1. Tokenization Submodule: A lightweight transformer that predicts "boundaries" between bytes to group them into variable-length segments.
  2. Language Modeling Block: Processes these segments as tokens.
  3. Upsampling Layer: Converts token representations back to byte-level probabilities for the final prediction.

The "secret sauce" is the FlexıTokens Hinge Loss. Unlike previous methods that used a Binomial loss to force a specific compression rate, FlexıTokens defines a "slack" range $[\beta, \alpha]$. As long as the model's compression rate stays within this window, it isn't penalized. This allows the model to find the optimal tokenization density for the specific task at hand during fine-tuning.

Datasets

The researchers validated their approach across a diverse multilingual and multi-domain landscape:

  • Pretraining: Sampled from FineWeb and FineWeb 2, covering six languages across four scripts (Latin, Cyrillic, Devanagari, and Telugu).
  • Downstream Evaluation:
    • XNLI: Natural language inference.
  • SIB-200: Topic classification.
  • WikiANN: Named entity recognition.
  • Medical Abstracts: Specialized domain adaptation.
  • Urdu (OOD): Specifically tested on Urdu to see how the model handles a completely unseen script.

Key Insights and Ideas

  • Tokenization is a Moving Target: The paper demonstrates that the "optimal" tokenization changes during a model's lifecycle. FlexıTokens allows the model to "re-tokenize" its world as it learns new domains.
  • The "Slack" Matters: By not penalizing the model for being "too efficient" (high compression), the model naturally learns to group semantically meaningful units (like "hypertrophic" in medical text) into single tokens rather than fragments.
  • Script Agnosticism: Because the boundary predictor is a neural module rather than a fixed rule-set, it adapts to unseen scripts (like Urdu) far better than BPE, which often falls back to character-level fragmentation for unknown characters.
  • Scaling the "Frontend": Interestingly, adding more layers to the tokenization module (the "frontend") improves performance more than just adding layers to the core LM, suggesting that better "perception" of tokens is a high-leverage area for byte-level models.

Key Results

  • Performance Gains: FlexıTokens achieved up to 10% improvement on downstream tasks compared to standard subword and fixed-rate gradient-based tokenizers.
  • Zero-Shot Script Adaptation: On Urdu (an unseen script), FlexıTokens outperformed BPE by 3 points on XNLI, largely because it avoided the massive over-fragmentation BPE suffers from on new scripts.
  • Efficiency: The model consistently produced fewer tokens per sample than baselines while maintaining or improving accuracy, leading to faster inference.
  • Qualitative Success: After adaptation to the medical domain, the model successfully learned to treat complex medical terms as single units, aligning its internal "vocabulary" with the specialized domain.

Limitations and Future Work

The authors acknowledge a few hurdles:

  • Computational Budget: The experiments were capped at 1B parameters. While the results are promising, it remains to be seen how these flexible boundaries behave at the 70B+ parameter scale.
  • Morphological Complexity: The current method might struggle with "templatic" languages (like Arabic or Hebrew) where vowels are interspersed between consonant roots, making linear boundary prediction difficult.
  • Hyperparameter Sensitivity: The $\alpha$ and $\beta$ bounds currently require some manual tuning based on an "anchor language" (English). Automating this "sweet spot" discovery is a clear next step for the research.

Summary updated

BibTeX
@inproceedings{owodunni2026flexitokens,
  author = {Abraham Toluwase Owodunni and Orevaoghene Ahia and Sachin Kumar},
  title = {{FLEXITOKENS: Flexible Tokenization for Evolving Language Models}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2026},
  doi = {10.18653/v1/2026.findings-acl.848},
}
Figure