Effective Context in Transformers: An Analysis of Fragmentation and Tokenization
Amirmehdi Jafari Fesharaki, Mohammadamin Rami, Aslan Tchamkerten
NeurIPS page · Open on the map
Category: Interpretability & Model Adaptation › Transformer Length and Memory Scaling · Type: theory · Keywords: Transformer context window, tokenization, fragmentation, finite-context prediction, loss guarantee
Areas: Long Context › Long-context mechanisms › Context compression
Summary
The paper analyzes how different token representations (bytes, characters, subword tokens) affect the predictive power of finite-context Transformers, showing that fragmentation can hurt performance and that tokenization can extend effective context.
Explained to a 5-year-old
We look at how computers break words into pieces. Sometimes breaking into many tiny pieces makes it harder to guess the next piece, even if we have more information. Other times, grouping pieces together helps the computer guess better. This happens because the computer only sees a limited amount of text at once. Knowing this helps us choose better ways to split text for computers.
Explained to a 5-year-old, longer
Computers read text by looking at pieces of it, like letters, words, or groups of letters. They have a memory limit, so they can only remember a few pieces at a time. If we break the text into very small pieces, like individual letters, the computer might not understand the whole word. This can make it harder for the computer to guess what comes next. On the other hand, if we group letters into bigger chunks, like syllables, the computer can see more meaning at once. Sometimes a big chunk contains information that the computer would need many small pieces to find. The paper shows that sometimes using many tiny pieces is actually worse, even if we give the computer more time to look. It also shows that clever grouping can make a small memory act like a bigger one. This is like having a short rope that can reach far if it is tied in the right way. The researchers studied simple models that copy patterns, like games where you predict the next symbol. They proved that the way we cut up the information matters for how well the computer can predict. Understanding this helps us design better ways to split text for computers.
For a technical reader
The paper investigates how the granularity of input tokens (bytes, characters, subwords) influences a Transformer’s ability to predict the next symbol when only a fixed-size context window is available. It shows that splitting symbols into finer units can increase the optimal prediction loss, even if the context window is enlarged, because the representation can fragment the relevant history. Conversely, a well-designed tokenizer can make a short token window effectively cover a longer source history, provided the tokenizer reliably spans the needed context and compresses the data. The authors provide a theoretical loss bound that quantifies this trade-off and a diagnostic to measure how much source context a token window actually contains. These insights help engineers choose tokenizations that maximize predictive power within limited context, without needing to retrain larger models.
Problem
How does the choice of representation (e.g., bytes, characters, subword tokens) affect what a Transformer with a fixed context window can predict? Specifically, we ask whether smaller units can degrade performance and whether larger units can extend effective context.
Method
The authors study Markov sources to compare lossless recodings of the same data into bytes, characters, and subword tokens. They introduce the concept of fragmentation to show that splitting symbols can increase optimal finite-context log-loss, and they provide a loss guarantee for greedy tokenization that relates token-window coverage and compression rate.
Contributions
The paper introduces the notion of fragmentation to demonstrate an intrinsic limitation of finer representations under finite context, and it provides a theoretical guarantee for tokenization that quantifies when larger token units can effectively extend context. These results give a finite-context perspective on why representation choice matters for Transformers.
Limitations and assumptions
Analysis is limited to Markov sources and assumes a fixed context window; real-world Transformers may have additional mechanisms.
Practical relevance
The findings inform the design of tokenizers and help practitioners understand how representation choices affect model performance within limited context.
This page was written by language models from the title and abstract of each paper, and the answers were checked by two other models. It can be wrong: check the paper itself. Suggest a correction