Manuscript Offprint

arXiv:2610.01828

The Asymptotics of Language Model Alignment with Memory

Haricharan Balasundaram, V. Arvind Rameshwar

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

Haricharan Balasundaram ∗^{*}

School of Electrical and Computer Engineering,

Georgia Institute of Technology, Atlanta, GA

Email: haricharanb@gatech.edu

V. Arvind Rameshwar

Department of Electrical Engineering,

IIT Madras, Chennai, India

Email: arvind@ee.iitm.ac.in

Abstract—Language model (LM) alignment broadly aims to perturb a given LM Q into an aligned LM q such that i) the outputs produced by q and Q are ‘close’ in probability, ii) q has a higher expected reward than Q. Two common techniques for LM alignment are: KL-constrained RL, which requires knowledge of the LM distribution and is computationally expensive, and the best-of-n algorithm, which requires only sampling from the LM. The work of [1] established asymptotic closeness between the distributions produced by the two alignment methods for an m-length i.i.d. token sequence output by the LM, in the limit as m increases to infinity. However, the i.i.d. assumption is not representative of practical LMs, whose output sequences often have memory. In this paper, we extend the asymptotic closeness result to the case when the m-length token sequence outputted by the LM is Markovian. Further, for finite-length output sequences – particularly, when m = 1 – we provide a complete characterization of LM distributions and reward functions for which the KL-divergence between the distributions produced by the two alignment methods is zero – a question first posed in [1].

I. INTRODUCTION

Large Language Models (LLMs) have become a central paradigm for generating natural language text and LLM-based systems are increasingly being adopted in practice [2]–[4]. Given a prompt x, an autoregressive LLM defines a conditional probability distribution P(⋅∣x)\mathbb{P}(\cdot|x) over output token sequences, with P(s∣x)\mathbb{P}(s|x) denoting the probability assigned to the response s. LLMs are pretrained on large text corpora and may subsequently be adapted through task-specific fine-tuning or preference-based post-training [5], [6].

LLMs sometimes generate unrealistic and undesirable outputs. For instance, the outputs might contain factually incorrect information or reflect biases in the training data [5], [7]. Sometimes, more specific properties of the generated output text, including fluency, linguistic style, and the avoidance of undesirable repetition, are targeted to be improved [8]–[11]. Desirable outputs are associated with a large ‘reward’ and undesirable outputs are associated with a small ‘reward’. It is thus desirable to perturb the LLM probability distribution to an aligned distribution that has a higher expected reward.

While several techniques for LLM alignment [6], [12]–[17] exist in the literature, two of the most popular techniques, which are also grounded in theory, are i) KL-constrained reinforcement learning (RL), and ii) best-of-n alignment. KL-constrained RL returns an aligned distribution (which we sometimes call the “KL-constrained RL distribution”) whose reward is maximized while ensuring that the KL-divergence between the reference LLM distribution, i.e., the LLM distribution before alignment, and the aligned LLM distribution is small. In best-of-n alignment, the algorithm instead samples n times from the reference LLM distribution, picking the maximum-reward output among n outputs generated. Unlike KL-constrained RL that returns a deterministic, analytical solution, the best-of-n algorithm returns a random response, the distribution of which we simply call the “best-of-n distribution”.

In the light of analytical results on the best-of-n algorithm, the work of [1] establishes a connection between the KL-constrained RL and the best-of-n distributions in the restricted setting where: i) the LLM generates sequences consisting of m i.i.d. tokens as the response for each prompt, and ii) the reward of the length-m sequence can be decomposed as the sum of the reward over individual tokens. Under these assumptions, the KL-constrained RL and the best-of-n distributions, when n=Θ(exp⁡(m))n = \Theta(\exp(m)), are asymptotically close as m grows to infinity. In other words, the optimal KL-constrained RL policy, which requires knowledge of the reference LLM distribution, is asymptotically close to the computationally efficient best-of-n policy, which requires no such knowledge.

While the purpose of the two assumptions is to derive analytical connections between the two alignment methods for a simple, toy setting, the assumptions are not representative of the outputs of practical LLMs, which display a Markov dependence of responses conditioned on previous contexts [18]. An interesting question to ask, in this light, is: Is the connection between the two alignment methods a consequence of the i.i.d. nature of the tokens, or does it hold even in the presence of memory among outputs? A related question about removing i.i.d. LLM output assumption in [1] was posed in the same paper. We take up this question in our work, analyzing the setting of Markov LLM output distributions.

Furthermore, the work of [1, Section 5] also observed empirically that when the LLM distribution and the reward function are both randomly generated, the KL-divergence between the distributions produced by the two alignment methods is “small” even for “small” m values, when the

∗^{*}This work was carried out in part when the author was a student at IIT Madras.

LLM outputs are i.i.d. A second question to be asked in this regard, also posed in [1] is: For small m values, what LLM distributions and reward functions give rise to small KL-divergence between the distributions returned by the two alignment methods? In particular, what is the dependence of this KL-divergence on the vocabulary size? We spend the latter part of this paper providing partial progress on this question, when m = 1.

Our Contributions. Our main contributions are hence an affirmative answer to the first question in the presence of memory, i.e., when the LLM outputs are Markov and when the reward function can be decomposed as the sum of local rewards of contexts, there is indeed an asymptotic closeness result between the KL-constrained RL and best-of-n distributions. We mention that such local reward criteria arise naturally in controlled decoding and token-level objectives, including attribute control and repetition penalties [9], [11], [19]. When m = 1, we also identify classes of LLM reference distributions and reward functions for which the distributions produced by the two alignment methods are close in KL-divergence. In addition, for certain special classes, we characterize how the KL-divergence between the two alignment methods depends on the vocabulary size, thereby making progress on the second question as well.

Due to the paucity of space, some proofs are relegated to the appendices.

References (29)

  • Asymptotics of language model alignment
  • The rapid adoption of generative AI
  • Generative ai at work
  • Artificial intelligence index report 2026
  • On the opportunities and risks of foundation models
  • Training language models to follow instructions with human feedback
  • On the dangers of stochastic parrots: Can language models be too big?
  • Controlling linguistic style aspects in neural language generation
  • Plug and play language models: A simple approach to controlled text generation
  • The curious case of neural text degeneration
  • Neural text generation with unlikelihood training
  • Deep reinforcement learning from human preferences
  • Learning to summarize with human feedback
  • Calibrating sequence likelihood improves conditional language generation
  • Training a Helpful and Harmless Assistant with Reinforcement Learning from Human Feedback
  • Theoretical guarantees on the best-of-n alignment policy
  • Variational best-of-n alignment
  • Large language models as markov chains
  • GeDi: Generative discriminator guided sequence generation
  • An empirical study of smoothing techniques for language modeling
  • Relative entropy policy search
  • Mismatched guesswork
  • Berlin, Heidelberg: Springer Berlin Heidelberg, 2010
  • The kullback-leibler divergence rate between markov sources
  • Philadelphia, PA: Society for Industrial and Applied Mathematics, 2000
  • Wiley, 2 ed., 2006
  • Exact expressions for kullback–leibler divergence for univariate distributions
  • Inequalities of Karamata, Schur and Muirhead, and some applications
  • From Coding to Learning