Manuscript Offprint

arXiv:2610.05817

Nash Equilibrium Text: A Game-Theoretic Decoding Framework for Text Generation

Alireza Jafari, Arman Adibi, Mohammad Ghavamzadeh, Hadi Daneshmand

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Alireza Jafari

Department of Computer Science

University of Virginia

Charlottesville, VA, USA

jrp5td@virginia.edu

Mohammad Ghavamzadeh

Qualcomm AI Research

San Diego, CA, USA

mohammad.ghavamzadeh51@gmail.com

Arman Adibi

School of Computer and Cyber Sciences

Augusta University

Augusta, GA, USA

aadibi@augusta.edu

Hadi Daneshmand

Department of Computer Science

University of Virginia

Charlottesville, VA, USA

dhadi@virginia.edu

ABSTRACT

Text revision has become an integral component of large language models. This paper formulates revision such that it admits a Nash equilibrium: Token positions are players, vocabulary items are actions, and each player's utility is the language model's log conditional probability. We motivate the revision by showing that Nash equilibria can have exponentially higher likelihood than autoregressive outputs as the sequence length grows. We further propose Nash decoding, an algorithm that reaches an ε\varepsilon-Nash equilibrium in O(1/ε)O(1/\varepsilon) time given access to the joint probability of tokens conditioned on a prompt. In practice, we run Nash decoding using conditional probability estimates from large language models and evaluate the resulting equilibria on question-answering benchmarks. On CLAPNQ, PubMedQA, and CoQA, Nash equilibria obtained from masked language models achieve higher F1 and ROUGE scores than autoregressive models up to 18×18\times larger, without any fine-tuning or retraining, at the cost of additional test-time computation. Code is available at https://github.com/alireza-jafari/Nash-Decoding.

1 INTRODUCTION

“The first draft of anything is shit,” Ernest Hemingway reportedly remarked (Samuelson, 1984). The first draft of this manuscript was no exception. Accomplished writers, at least before the advent of LLMs, have devoted considerable effort to revision. Hemingway, for instance, rewrote the final page of A Farewell to Arms 39 times (Plimpton, 1958). This raises a scientific question:

When does the revision terminate, and what is the equilibrium text that editing converges to?

Revision has become the core in text generation with language models where the first draft often is the standard de facto autoregressive text obeying

xi+1(AR)=arg⁡max⁡x∈Vp(x∣x≤i(AR);prompt),(1)x_{i+1}^{(\mathrm{A R})}=\arg\max_{x\in\mathcal{V}}p(x\mid x_{\leq i}^{(\mathrm{A R})};\mathrm{prompt}), \tag{1}

where p denotes the probability function (Radford et al., 2019) and xix_i are tokens selected from a vocabulary V. Autoregressive generation calls for revision because each token is produced without access to the tokens that follow. Existing approaches to revision fall into four broad families: (1) remasking tokens in diffusion and masked language models (Ghazvininejad et al., 2019; Sahoo et al., 2024; Shi et al., 2024); (2) reinforcement learning with external feedback (Ouyang et al., 2022; OpenAI, 2024; Guo et al., 2025); (3) Markov chain Monte Carlo (MCMC) sampling (Karan & Du, 2026; Zhao et al., 2026; Xu et al., 2025; Wang & Cho, 2019); and (4) hybrid decoding

Prompt: What famous city is the capital of Spain?

Autoregressive decoding: The city of Barcelona is the capital of Spain.

Nash decoding:

Figure

The game starts

Barcelona → Madrid

The city of Madrid is the capital of Spain.

Figure 1: Revision Game. Each token position is a player whose choice is evaluated given all context tokens. Autoregressive decoding leaves earlier tokens fixed, whereas the tokens are revised in the revision game. We used GPT-2 small for conditional probability estimates. At a Nash equilibrium, no player can increase its conditional probability by changing its token. Details are reported in Appendix A.

techniques (Xia et al., 2017; Lee et al., 2018; Gu et al., 2019; Welleck et al., 2023). We focus on revision driven solely by conditional probabilities without external feedback. Such revision need not reach an equilibrium; the text may continue to change indefinitely. We therefore formulate revision as a game that admits an equilibrium.

Revision game: Given a prompt, nn players are the positions i∈[n]i \in [n], and each player's action is a token from V\mathcal{V} and player ii receives utility log⁡p(xi∣x−i;prompt)\log p(x_i \mid x_{-i}; \text{prompt}), where x−ix_{-i} denotes all tokens except xix_i. Since p(xi∣x−i;prompt)=p(x1,…,xn∣prompt)/p(x−i∣prompt)p(x_i \mid x_{-i}; \text{prompt}) = p(x_1, \ldots, x_n \mid \text{prompt}) / p(x_{-i} \mid \text{prompt}) and the denominator does not depend on xix_i, this is an exact potential game with potential log⁡p(x1,…,xn∣prompt)\log p(x_1, \ldots, x_n \mid \text{prompt}) (Monderer & Shapley, 1996). Being finite, the game admits at least one pure Nash equilibrium x(nash)=(x1(nash),…,xn(nash))x^{(\text{nash})} = (x_1^{(\text{nash})}, \ldots, x_n^{(\text{nash})}), which satisfies

∀i∈[n]:xi(nash)=arg⁡max⁡x∈Vp(x∣x−i(nash);prompt).(2)\forall i\in[n]:\quad x_{i}^{(\mathrm{n a s h})}=\arg\max_{x\in\mathcal{V}}p\big(x\mid x_{-i}^{(\mathrm{n a s h})};\mathrm{p r o m p t}\big). \tag{2}

In other words, a sequence is a Nash equilibrium when no single position can increase its conditional probability by changing its token. Comparing to Equation 1, the above conditioning is on x−ix_{-i} rather than x<ix_{<i}.

As an example, we simulate this revision game between tokens using GPT-2 prompted by the question “What famous city is the capital of Spain?”. Figure 1 shows revisions of the first draft generated by autoregressive decoding that is “The city of Barcelona is the capital of Spain.” As the game proceeds, the token “Barcelona” is revised to “Madrid”, increasing the likelihood of the full generated text by a factor of 1.2611.26^{1}. We will show that Nash equilibria can attain substantially higher likelihood than autoregressive generations: the ratio p(x(nash)∣prompt)p(x(AR)∣prompt)\frac{p(x^{(\text{nash})}|\text{prompt})}{p(x^{(\text{AR})}|\text{prompt})} can grow exponentially in n.

Computing an exact pure Nash equilibrium in general potential games is PLS-complete (Fabrikant et al., 2004). In contrast, we propose a revision mechanism called Nash decoding that obtains an ϵ\epsilon-Nash equilibrium in O(1/ε)O(1/\varepsilon) time. Furthermore, the conditional probability of revised text monotonically increases through the revision.

Empirically, we show that masked language models can be used to compute a Nash equilibrium. Thus, we evaluate the question-answering performance of Nash equilibria against autoregressive generation on question-answering benchmarks. At the cost of additional computation, iterative Nash updates allow a masked language model to surpass the F1 and ROUGE of autoregressive models with 18 times as many parameters on CoQA (Reddy et al., 2019), PubMedQA (Jin et al., 2019), and CLAPNQ (Rosenthal et al., 2025) datasets. We also report negative results showing that scores of equilibrium vary and depend on the initialization and the underlying model.

1^{1}In this example, the increase in probability happens to coincide with improved factual correctness; in general, higher probability does not ensure correctness.

References (100)

Couldn't load all references. Reload the page to try again.