Abstract
MANTa (Module for Adaptive Neural TokenizAtion) is a differentiable, gradient-based tokenizer that learns to segment text into "blocks" end-to-end with a language model. It bridges the gap between brittle subword tokenizers (like BPE) and slow byte-level models, offering high robustness to typos and domain shifts while remaining significantly faster than traditional byte-level approaches.
Introduction
Most modern Large Language Models (LLMs) rely on static subword tokenization methods such as BPE or WordPiece. While efficient, these tokenizers are "frozen" after pre-training and suffer from two major flaws: brittleness to character-level noise (e.g., typos) and domain rigidity, where specialized terminology is often over-segmented. While byte-level models offer robustness, they are computationally expensive due to increased sequence lengths. MANTa addresses this by learning an adaptive segmentation on the fly, providing the robustness of bytes with the efficiency of subwords.
Methodology
MANTa introduces a differentiable pipeline that replaces standard lookup tables with a learned segmentation process.
The architecture consists of several key components:
- Frontier Predictor: A small Transformer utilizing sliding window attention to predict the probability of each input byte being a "frontier" (boundary).
- Soft Assignment: Byte-to-block mapping is modeled as a cumulative sum of frontiers, using a Poisson Binomial distribution (approximated by a truncated Gaussian) for differentiability.
- Pooling & Convolution: Byte embeddings are weighted by assignment probabilities and processed via 1-D convolution and max-pooling to create block embeddings.
- Bottleneck Heuristic: To ensure sequence compression, the model is incentivized to group bytes into multi-byte units by enforcing a minimum 4x compression ratio.
Experimental Evaluation
The authors evaluated MANTa-LM on a variety of benchmarks including the C4 corpus for pre-training, the GLUE suite for general language understanding, and MedNLI for domain adaptation in clinical contexts. Robustness was specifically tested using the TOXICCOMMENTS dataset and synthetic datasets with varying levels of character-level noise.
Results and Discussion
MANTa-LM demonstrates a favorable trade-off between speed and performance. It is approximately 4x faster than byte-level models like ByT5, while being only 2.3x slower than standard subword-based T5. On the TOXICCOMMENTS dataset, MANTa-LM achieved 93.2% accuracy, outperforming standard T5 (91.5%) and the specialized Charformer (92.7%).
Explainable Segmentation
A unique advantage of MANTa is that it produces an explicit, interpretable segmentation. As training progresses, the model learns to identify meaningful boundaries through the language modeling objective.
As shown in the figure above, the model starts with a broad, uncertain attention over blocks and gradually converges to sharp, meaningful segmentations that correspond to words or subword units. This end-to-end optimization allows the tokenizer to adapt to specialized domains like medical text, where it outperformed subword-based counterparts by better handling out-of-vocabulary jargon.
Conclusion and Limitations
MANTa provides a robust alternative to static tokenization by integrating the segmentation process into the model's gradient-based learning. However, limitations remain: the decoder in this study still operates byte-by-byte, leading to generative overhead. Additionally, the compression factor is currently a manual heuristic, and the approach has primarily been tested on English. Future work will explore dynamic compression rates and multilingual applications.
Summary updated