Search arXiv⌕ Search

arXiv subjects

Sami Wolf

Publications and source records attributed to Sami Wolf.

2 recordsLinked to original sources

Retokenization Reveals the Gap Between Semantics and Behavior

Language models are trained under a deterministic canonical tokenization, yet every byte string admits exponentially many non-canonical token sequences that decode to it. Although such sequences never occur during training, models exhibit partial invariance to them, and in some settings, such as character-level word games, non-canonical inputs even improve accuracy. This invariance is nevertheless fragile: byte-identical prompts can induce divergent behavior, and adversarial tokenizations were found to circumvent safety alignment. We give a mechanistic account of this fragility and introduce a family of consistency-training objectives that enforce agreement across retokenizations of the prompt while keeping the output space canonically tokenized. We prove that retokenizing only the prompt leaves the training optimum unchanged, whereas retokenizing the target raises the irreducible entropy of the target distribution. Across three model families, consistency-tuned models are more robust to adversarial tokenization, at some loss of benchmark accuracy, while transfer to other attacks depends on the objective. Probing shows that the attack suppresses the linearly decodable refusal signal in the residual stream, and that after consistency training the signal persists under attack in its original subspace.

cs.CL↗

Mixing Times of Glauber Dynamics on Masked Language Models

Masked language models (MLMs) define local conditional distributions over tokens but do not, in general, correspond to any consistent joint distribution over sequences. This raises a fundamental question: what global distributional behavior is induced when such conditionals are used iteratively for generation? We address this question by modeling iterative masked-token resampling as a Glauber dynamics Markov chain on the discrete space of token sequences. We first show that MLM conditionals are intrinsically incompatible: we introduce a rectangle test that certifies this incompatibility and empirically verify its prevalence across modern MLMs. We then provide a theoretical analysis of the induced Markov chain. Under bounded cross-token influence, we establish a high-temperature contraction result implying $O(n\log n)$ mixing time where $n$ is the sequence length. In contrast, we prove that under a uniform local margin condition, the chain exhibits metastability, with exponentially slow escape from semantic basins at low temperatures. Empirically, we demonstrate a phase transition in mixing behavior as a function of temperature and sequence length, consistent with the theoretical predictions. We further characterize the induced stationary behavior through semantic trajectories, identifying persistent structures such as long-lived traps and recurrent semantic basins, with political content serving as a measurable case study.

cs.LG↗