TL;DR
Masked Language Models (MLMs) like BERT define local conditional probabilities that are mathematically incompatible with any single joint distribution over text sequences. By modeling iterative token resampling as a Glauber dynamics Markov chain, this paper reveals a temperature-dependent phase transition: high temperatures lead to rapid $O(n \log n)$ mixing, while low temperatures trap the model in long-lived, metastable "semantic basins."
What Problem Does This Paper Address?
Autoregressive models (like GPT) generate text token-by-token, explicitly defining a joint probability distribution over an entire sequence. Masked Language Models (like BERT), however, are trained to predict a missing token given its surrounding context. While excellent for representation learning, MLMs only define local conditional distributions.
When researchers use MLMs for text generation—such as via iterative resampling or within modern discrete diffusion models—they are essentially running a Markov Chain Monte Carlo (MCMC) sampler. But because MLMs are trained via pseudo-likelihood, a fundamental question remains: What global distributional behavior is actually induced by these local conditionals? Do they form a mathematically consistent joint distribution, and how does the text evolve over thousands of resampling steps?
Methods
The authors tackle this by formalizing iterative masked-token resampling as Glauber dynamics (a single-site MCMC method originally from statistical physics) on the discrete space of token sequences, scaled by a temperature parameter $\tau$.
To study this system, they introduce several key techniques:
- The Rectangle Test: A novel method to certify whether local conditionals can actually glue together into a valid joint distribution. It measures path-dependence by comparing the log-probability ratios of swapping two tokens via two different paths.
- Path Coupling & Drift Conditions: Mathematical frameworks used to prove theoretical upper bounds (fast mixing) and lower bounds (slow mixing) of the Markov chain.
- Semantic Trajectory Tracking: To visualize the long-term behavior of the chain, the authors project 10,000-step sentence embedding trajectories into 2D space using Principal Component Analysis (PCA).
Datasets
The experiments primarily utilize text passages from the MS MARCO dataset to initialize the Markov chains and sample random text for the rectangle test.
Key Insights and Ideas
- Intrinsic Incompatibility: Every tested MLM failed the rectangle test. This proves that MLM conditionals are fundamentally incompatible; they do not describe a single, clean energy landscape but rather a complex, path-dependent space.
- The Temperature Crossover: The text space undergoes a stark phase transition. At high temperatures ($\tau \gtrsim 1.5$), the chain quickly randomizes and forgets its starting point. At low temperatures ($\tau \le 0.5$), it gets stuck in "semantic traps" for thousands of steps.
- Collective Stability: Traps aren't always perfect local maxima. The authors discovered "approximate traps" where individual tokens are suboptimal, but they mutually reinforce each other so strongly that the chain cannot easily escape.
- Semantic Attractors: Over long runs, chains lose their initial identity and repeatedly drift into specific topical basins. For instance, regardless of the starting topic, chains frequently gravitated toward news-like or political text fragments.
Key Results
- Rectangle Test Failure: Across BERT, RoBERTa, and ModernBERT, the rectangle test yielded significant incompatibility scores (mean $|\delta|$ between 0.64 and 0.80). In contrast, GPT-2 (which possesses a true joint distribution) scored exactly 0.000.
- Phase Transition Verified: The authors empirically mapped a clear temperature-length phase diagram showing the boundary between fast coupling and infinite budgets.
- Discovery of Metastable Traps: At lower temperatures, the text becomes trapped in semantic basins. For example, a chain initialized with a sentence about an overnight train eventually drifted and became tightly clustered around a completely different semantic trap regarding a police report.
- Nonsensical vs. Coherent Traps: Some traps were highly specific, factually incorrect, yet stable sentences (e.g., a bizarrely persistent trap about "ornamental guacamole... served with boiled cigars").
Limitations and Future Work
A primary limitation is that the theoretical high-temperature contraction bound is not perfectly tight; empirically, BERT mixes much faster than the worst-case theory predicts. The authors conjecture this is because the chain quickly leaves highly coherent, adversarial states and spends most of its time in incoherent configurations where cross-token influence is low.
Additionally, the characterization of semantic basins relies on zero-shot topic classifiers (BART-MNLI). Future work includes developing a context-averaged mathematical argument to tighten the mixing bounds and conducting finer-grained semantic analyses of the recurrent basins.
Summary updated