GlitchPatch: Repairing Glitch Tokens in Frozen Language Models via Local Retokenization

📅 2026-10-03
📈 Citations: 0
✨ Influential: 0
📄 PDF
🤖 AI Summary
This study addresses the issue that freezing vocabulary fault tokens in large language models leads to output anomalies that cannot be rectified by modifying internal parameters. To overcome this, we propose a zero-intrusive repair framework based on local retokenization. This work pioneers an external input-side repair mechanism that leverages Behavioral Path Optimization (BPO) to eliminate the side effects of deleted merge rules. Specifically, replacement sequences are optimized offline and compiled into a rule table, while online inference merely performs ID matching and substitution, keeping model weights entirely unchanged. Experimental evaluations across ten models demonstrate an average repair rate of 85.10%, reducing the fault rate to 2.27%. The proposed approach significantly outperforms existing baselines without introducing additional computational overhead.
📝 Abstract
Glitch tokens are anomalous vocabulary entries that can cause large language models (LLMs) to produce outputs inconsistent with their inputs. Existing repair methods require access to model internals, making them impractical for frozen checkpoints. We investigate whether glitch tokens can be repaired outside the model by optimizing the input tokenization. An empirical study on BPE merge-rule deletion reveals that (1)deleting a glitch token's merge rule can fix a substantial fraction of failures, yet disrupting normal tokens sharing intermediate merge nodes causes the overall glitch rate to rise, and (2)different decomposition granularities yield non-monotonic fix rates while collateral damage on normal tokens grows monotonically. Motivated by these findings, we propose GlitchPatch, a repair framework for frozen language models based on local retokenization, consisting of two stages: the offline stage uses Behavioral Path Optimization (BPO) to find the behaviorally optimal replacement token sequence for each glitch token and compiles validated replacements into a rule table; the online stage substitutes only the IDs of matched glitch tokens in the canonical token sequence, with no modification to model parameters or internal states. Experiments on ten models spanning six tokenizer families show that GlitchPatch achieves an 85.10% mean fix rate, outperforming the strongest baseline by 14.37 percentage points, and reduces the average glitch rate from 14.88% to 2.27%. GlitchPatch achieves a 0.00% RR in full-vocabulary evaluation and leaves rule-unmatched inputs unchanged by design. We further evaluate the practical impact of repair from the perspectives of time cost, language understanding, and capability, supporting its deployment feasibility. We hope this work provides a practical option for improving tokenizer reliability.
Problem

Research questions and friction points this paper is trying to address.

glitch tokens
frozen language models
tokenization
large language models
Innovation

Methods, ideas, or system contributions that make the work stand out.

Glitch tokens
Local retokenization
Frozen language models
Behavioral Path Optimization
Tokenizer repair
K
Kunsheng Tang
University of Science and Technology of China
P
Peigui Qi
University of Science and Technology of China
Y
Yide Song
University of Washington
P
Peijun Huang
Wuhan University
W
Weiming Zhang
University of Science and Technology of China
Nenghai Yu
Nenghai Yu
University of Science and Technology of China
Computer VisionArtificial IntelligenceInformation Hiding