Joint Optimization for Greedy Longest-match Tokenization
This work addresses the suboptimality of traditional subword segmentation methods like Byte Pair Encoding (BPE), which rely on heuristic rules and ignore the greedy longest-match decoding strategy used during inference, leading to inefficient compression. The paper formulates vocabulary learning as an integer programming problem that jointly optimizes token selection and segmentation decisions, introducing a greedy consistency constraint to align training and deployment tokenization. To enable scalable optimization, the authors propose a linear programming relaxation approach that facilitates end-to-end training tailored for greedy decoding. Experiments show that, with 32K and 64K vocabularies, their method reduces token counts by up to 0.78% compared to BPE, closing 89.6%–99.4% of the gap to the theoretical optimal compression, while achieving solutions within only 0.008%–0.176% of the LP lower bound.