Converting tokens to characters: A bridge between LLMs and human text interaction
This paper introduces algorithms to convert token-level LLMs to character-level ones, solving the "prompt boundary problem" where models show unwanted sensitivity to characters at prompt boundaries. The solution enables accurate character-level probability computation and conditional text generation while maintaining model performance.
-----
https://arxiv.org/abs/2412.03719
π€ Original Problem:
β LLMs internally work with tokens but users interact with characters, causing issues like the "prompt boundary problem" where adding a space can drastically change the output
β Current token-based approaches struggle with character-level constraints and precise probability calculations
-----
π§ Solution in this Paper:
β Introduces a mathematical framework to convert token-level models to character-level ones through "covering" - a set of token strings that form valid decodings of a character string
β Develops both exact and approximate beam search algorithms to efficiently compute character-level probabilities
β Implements a novel "token healing" mechanism that finds optimal tokenizations matching the prompt
β Creates a character-level interface that maintains the efficiency of token-level processing
-----
π‘ Key Insights:
β Token-level models can be accurately converted to character-level ones without performance loss
β Beam search with small beam sizes (K=8) provides good approximation
β High-probability tokenizations tend to concentrate around canonical forms
-----
π Results:
β Achieves 46.3 characters/second processing speed on Llama 3.1 8B
β Maintains accuracy within 0.00021 excess bits/character
β Shows inverse relationship between beam size and error rate
β Demonstrates better performance on newer models like Llama compared to GPT2










