Technical Note: Q-Learning

CHRISTOPHER J.C.H. WATKINSPETER DAYAN

article2004Machine-mediated learning2,391 citations

Proves that Q-learning converges with probability one to optimal action-values in discrete Markov decision processes, establishing the mathematical foundation for model-free reinforcement learning.

Listen

In complex, dynamic environments, automated systems must frequently learn to make optimal decisions without an upfront manual or exact mathematical model of their surroundings. Traditional dynamic programming methods require knowing all system transition probabilities and expected payoffs in advance, whereas learning such models on the fly often leads to high computational costs and early operational errors. The article addresses this challenge by establishing the mathematical foundations for Q-learning, an incremental, model-free reinforcement learning technique that allows an agent to optimize long-term performance solely through direct experience.

The primary objective of the article is to present and formally prove a rigorous convergence theorem for Q-learning. Specifically, it demonstrates that successive, experience-based updates to discrete action values will converge to the true optimal action-values with probability one in controlled, finite Markov decision environments.

To establish this result, the authors construct a theoretical surrogate environment called the action-replay process. This framework models past experiences as a decreasing stack of historical episodes through which the learning updates operate via backwards induction. By connecting the surrogate process to standard stochastic approximation principles, the analysis formally proves that the behavior and rewards within the replay structure asymptotically match those of the true operational environment.

The findings confirm three core principles. First, discrete Q-learning guarantees convergence to the unique optimal strategy with probability one, provided that every state-action pair is visited infinitely often and learning rate parameters diminish under standard conditions. Second, the convergence guarantee successfully extends to non-discounted tasks that possess absorbing termination states, as well as to operational variants where multiple values are updated simultaneously within each iteration. Third, the analysis illustrates that remembering and repeatedly sampling historical episodes bridges the gap between pure incremental learning and full certainty-equivalence modeling, offering a spectrum of practical implementations.

These results provide vital theoretical backing for deploying reinforcement learning in automated control, industrial robotics, and adaptive software without the risk of divergent decision rules. Organizations can confidently use model-free algorithms to discover optimal operational policies without incurring the heavy upfront costs and computational burdens of complete environment mapping. However, decision-makers must recognize that the convergence guarantee strictly assumes finite, discrete lookup tables and exhaustive exploration; it does not directly cover multi-step eligibility traces or complex function approximations. Future initiatives should focus on developing alternative proofs for multi-step reward updates and exploring practical memory-reuse strategies during real-time implementation.

  • Paper: Q-learning, CHRISTOPHER J.C.H. WATKINS et al. (1992). Reading Watkins and Dayan's foundational convergence proof for Q-learning provides the exact mathematical framework that this technical note summarizes and extends.
  • Paper: Learning to Predict by the Methods of Temporal Differences, Richard S. Sutton (1988). Understanding Sutton's introduction of temporal-difference prediction is essential for grasping the foundational learning mechanisms underpinning Q-learning.
  • Paper: Reinforcement Learning: A Survey, Leslie Pack Kaelbling et al. (1996). This comprehensive survey of reinforcement learning establishes the broader algorithmic context of Markov decision processes and model-free updating that Q-learning builds upon.
Cover for Technical Note: Q-Learning

Abstract

Q-learning (Watkins, 1989) is a simple way for agents to learn how to act optimally in controlled Markovian domains. It amounts to an incremental method for dynamic programming which imposes limited computational demands. It works by successively improving its evaluations of the quality of particular actions at particular states.

This paper presents and proves in detail a convergence theorem for Q-learning based on that outlined in Watkins (1989). We show that Q-learning converges to the optimum action-values with probability 1 so long as all actions are repeatedly sampled in all states and the action-values are represented discretely. We also sketch extensions to the cases of non-discounted, but absorbing, Markov environments, and where many Q values can be changed each iteration, rather than just one.

Table of Contents

  • 1. Introduction
  • 2. The task for Q-learning
  • 3. The convergence proof
  • 3.1. Lemmas
  • 3.2. The theorem
  • 4. Discussions and conclusions
  • Acknowledgments
  • Notes
  • Appendix
  • The action-replay process
  • References

Knowls

  1. Knowl 1 — Convergence Theorem of Tabular Q-Learning

    theoretical result

    Let a controlled Markov process have a finite state space XX, a finite action space AA, bounded immediate rewards rnR|r_n| \le \mathcal{R}, and a discount factor γ[0,1)\gamma \in [0, 1). Let Qn(x,a)Q_n(x, a) denote the tabular action-value estimates at step nn, and let ni(x,a)n^i(x, a) denote the episode index at which action aa is executed in state xx for the ii-th time.

    If every state-action pair (x,a)X×A(x, a) \in X \times A is visited infinitely often and the sequence of learning rates αn[0,1)\alpha_n \in [0, 1) satisfies the standard stochastic approximation conditions:

    i=1αni(x,a)=andi=1[αni(x,a)]2<xX,aA,\sum_{i=1}^\infty \alpha_{n^i(x, a)} = \infty \quad \text{and} \quad \sum_{i=1}^\infty \left[\alpha_{n^i(x, a)}\right]^2 < \infty \quad \forall x \in X, a \in A,

    then as nn \to \infty, Qn(x,a)Q_n(x, a) converges to the unique optimal action-values Q(x,a)Q^*(x, a) with probability 1 for all xXx \in X and aAa \in A, regardless of the initial values Q0(x,a)Q_0(x, a) and regardless of whether the sampled transitions form a continuous trajectory.

  2. Knowl 2 — Tabular Q-Learning Algorithm

    algorithm

    Tabular Q-learning is an asynchronous, model-free reinforcement learning algorithm that iteratively estimates optimal action-values Q(x,a)Q^*(x, a) directly from observed experience without estimating the underlying transition or reward models.

    Input: Discount factor γ[0,1)\gamma \in [0, 1), arbitrary initial values Q0(x,a)Q_0(x, a) for all xX,aAx \in X, a \in A, learning rate sequence αn[0,1)\alpha_n \in [0, 1)
    Initialize episode step n=1n = 1
    for each episode step n=1,2,n = 1, 2, \dots
        Observe current state xnXx_n \in X
        Select and execute action anAa_n \in A
        Observe subsequent state ynXy_n \in X and immediate reward rnr_n
        Vn1(yn)=maxbAQn1(yn,b)V_{n-1}(y_n) = \max_{b \in A} Q_{n-1}(y_n, b)
        for each xXx \in X and aAa \in A
            if x=xnx = x_n and a=ana = a_n then
                Qn(x,a)=(1αn)Qn1(x,a)+αn(rn+γVn1(yn))Q_n(x, a) = (1 - \alpha_n) Q_{n-1}(x, a) + \alpha_n (r_n + \gamma V_{n-1}(y_n))
            else
                Qn(x,a)=Qn1(x,a)Q_n(x, a) = Q_{n-1}(x, a)

    The update requires only local look-up table storage Q(x,a)Q(x, a) and can be applied to non-continuous experience tuples (xn,an,yn,rn)(x_n, a_n, y_n, r_n) where yn1y_{n-1} is not necessarily xnx_n.

  3. Knowl 3 — Action-Value Function and Model-Free Optimal Policy Extraction

    definition

    In a controlled Markov process with finite state space XX, action space AA, transition probabilities Pxy[a]=Pr(yx,a)P_{xy}[a] = \Pr(y \mid x, a), mean immediate rewards Rx(a)R_x(a), and discount factor γ[0,1)\gamma \in [0, 1), the value function Vπ(x)V^\pi(x) under a stationary policy π:XA\pi: X \to A is:

    Vπ(x)=Rx(π(x))+γyXPxy[π(x)]Vπ(y).V^\pi(x) = R_x(\pi(x)) + \gamma \sum_{y \in X} P_{xy}[\pi(x)] V^\pi(y).

    The action-value function Qπ(x,a)Q^\pi(x, a) is defined as the expected total discounted reward of taking action aa in state xx and subsequently following policy π\pi:

    Qπ(x,a)=Rx(a)+γyXPxy[a]Vπ(y).Q^\pi(x, a) = R_x(a) + \gamma \sum_{y \in X} P_{xy}[a] V^\pi(y).

    The optimal action-value function Q(x,a)Qπ(x,a)Q^*(x, a) \equiv Q^{\pi^*}(x, a) and optimal state value V(x)maxaAQ(x,a)V^*(x) \equiv \max_{a \in A} Q^*(x, a) satisfy the Bellman optimality equation:

    Q(x,a)=Rx(a)+γyXPxy[a]maxbAQ(y,b).Q^*(x, a) = R_x(a) + \gamma \sum_{y \in X} P_{xy}[a] \max_{b \in A} Q^*(y, b).

    Once Q(x,a)Q^*(x, a) is known, an optimal stationary policy π\pi^* can be extracted directly without knowledge of the model parameters Pxy[a]P_{xy}[a] or Rx(a)R_x(a) via the greedy rule:

    π(x)=argmaxaAQ(x,a).\pi^*(x) = \arg\max_{a \in A} Q^*(x, a).
  4. Knowl 4 — Action-Replay Process Equivalence to Q-Learning Estimates

    model/method

    The Action-Replay Process (ARP) is an artificial controlled Markov decision process constructed from an observed history of transition tuples (xt,at,yt,rt,αt)(x_t, a_t, y_t, r_t, \alpha_t) and initial values Q0(x,a)Q_0(x, a). States in the ARP are pairs (x,n)(x, n) (denoting process state xXx \in X at history level/step nn) plus a terminal absorbing state.

    When executing action aa at state (x,n)(x, n) in the ARP, the process searches backward through past episodes tnt \le n matching (x,a)(x, a). At the most recent matching episode tt, a coin with head probability αt\alpha_t is flipped:

    • On heads, the episode is replayed: reward rtr_t is emitted, and the process transitions to state (yt,t1)(y_t, t - 1).
    • On tails, episode tt is discarded and the search continues for the next prior match.
    • If no prior match exists (reaching level 00), the ARP transitions to the absorbing state and emits terminal reward Q0(x,a)Q_0(x, a).

    By backwards induction on the levels nn, the optimal action-value function of the ARP, denoted QARP((x,n),a)Q^*_{\text{ARP}}((x, n), a), is identically equal to the QQ-learning iterate:

    QARP((x,n),a)=Qn(x,a)xX,aA,n0.Q^*_{\text{ARP}}((x, n), a) = Q_n(x, a) \quad \forall x \in X, a \in A, n \ge 0.
  5. Knowl 5 — Q-Learning Convergence in Undiscounted Absorbing MDPs

    theoretical result

    Tabular Q-learning converges almost surely to Q(x,a)Q^*(x, a) in undiscounted Markov decision processes (γ=1\gamma = 1) provided the environment contains one or more absorbing goal states that trap the agent with probability 1 under any policy.

    Formally, if for every state xXx \in X there exists a step count u(x)u(x) and probability p(x)>0p(x) > 0 such that the agent reaches a goal state within u(x)u(x) actions regardless of the action sequence, let u=maxxu(x)u^* = \max_{x} u(x) and p=minxp(x)>0p^* = \min_{x} p(x) > 0. Then the value under any policy is uniformly bounded:

    Vπ(x)uRp,|V^\pi(x)| \le \frac{u^* \mathcal{R}}{p^*},

    where R\mathcal{R} is the reward bound (rnR|r_n| \le \mathcal{R}). The guaranteed absorption bounds the effective horizon, replacing the role of γ<1\gamma < 1 in ensuring that the finite-horizon truncation error vanishes as horizon ss \to \infty.

  6. Knowl 6 — Convergence Under Simultaneous Multi-State Q-Updates

    theoretical result

    The convergence of tabular Q-learning to Q(x,a)Q^*(x, a) with probability 1 extends directly to asynchronous settings where multiple state-action pairs (x,a)(x, a) are updated simultaneously in each iteration nn, rather than updating only the single pair (xn,an)(x_n, a_n) visited by the trajectory.

    As long as the stochastic approximation conditions:

    i=1αni(x,a)=andi=1[αni(x,a)]2<\sum_{i=1}^\infty \alpha_{n^i(x, a)} = \infty \quad \text{and} \quad \sum_{i=1}^\infty \left[\alpha_{n^i(x, a)}\right]^2 < \infty

    hold for each state-action pair (x,a)(x, a), the Action-Replay Process accommodates multiple actions per level without altering the optimal action-value equivalence Qn(x,a)=QARP((x,n),a)Q_n(x, a) = Q^*_{\text{ARP}}((x, n), a) or the asymptotic convergence.

  7. Knowl 7 — Value Discrepancy Bound for Perturbed Finite-Horizon Markov Chains

    theoretical result

    Let an ss-step non-stationary Markov chain have transition matrices Pxyi[a]P^i_{xy}[a] and expected reward functions Rxi(a)R^i_x(a) for steps i=1,,si = 1, \dots, s, and let a target Markov chain have transition matrix Pxy[a]P_{xy}[a] and expected rewards Rx(a)R_x(a) bounded by Rx(a)R|R_x(a)| \le \mathcal{R}.

    If for a given η>0\eta > 0 the step-wise parameters satisfy:

    Rxi(a)Rx(a)<ηandPxyi[a]Pxy[a]<ηRi{1,,s},x,yX,aA,|R^i_x(a) - R_x(a)| < \eta \quad \text{and} \quad |P^i_{xy}[a] - P_{xy}[a]| < \frac{\eta}{\mathcal{R}} \quad \forall i \in \{1, \dots, s\}, x, y \in X, a \in A,

    then the expected undiscounted return of executing any sequence of ss actions (a1,,as)(a_1, \dots, a_s) from state xx in the concatenated chain, Qˉ(x,a1,,as)\bar{Q}'(x, a_1, \dots, a_s), and in the target process, Qˉ(x,a1,,as)\bar{Q}(x, a_1, \dots, a_s), satisfies:

    Qˉ(x,a1,,as)Qˉ(x,a1,,as)<s(s+1)2η.|\bar{Q}'(x, a_1, \dots, a_s) - \bar{Q}(x, a_1, \dots, a_s)| < \frac{s(s+1)}{2} \eta.

    The value discrepancy between two approximately equal Markov processes grows at most quadratically with the horizon length ss.

  8. Knowl 8 — Representation and Multi-Step Update Limitations

    limitation

    The convergence theorem of Watkins and Dayan (1992) has two stated theoretical limitations:

    1. Look-Up Table Requirement: The proof relies fundamentally on discrete look-up table representations where each state-action pair Q(x,a)Q(x, a) is stored independently. The convergence guarantee does not hold for general parameterized function approximators, where Q-learning can fail to converge.
    2. Single-Step Temporal Differences: The proof is restricted to 1-step updates where targets use rn+γmaxbQn1(yn,b)r_n + \gamma \max_b Q_{n-1}(y_n, b). It does not extend directly to multi-step return or eligibility trace extensions such as TD(λ)\text{TD}(\lambda) or Q(λ)Q(\lambda) (for λ>0\lambda > 0), which require alternative stochastic approximation techniques.

Coverage note — None was omitted; all key theoretical definitions, convergence results, algorithmic rules, proof mechanisms (Action-Replay Process), extensions, and stated limitations are fully covered.

References

  1. 1.Barto, A.G., Bradtke, S.J. & Singh, S.P. (1991). Real-time learning and control using asynchronous dynamic programming. (COINS technical report 91-57). Amherst: University of Massachusetts.
  2. 2.Barto, A.G. & Singh, S.P. (1990). On the computational economics of reinforcement learning. In D.S. Touretzky, J. Elman, T.J. Sejnowski & G.E. Hinton, (Eds.), Proceedings of the 1990 Connectionist Models Summer School. San Mateo, CA: Morgan Kaufmann.
  3. 3.Bellman, R.E. & Dreyfus, S.E. (1962). Applied dynamic programming. RAND Corporation.
  4. 4.Chapman, D. & Kaelbling, L.P. (1991). Input generalization in delayed reinforcement learning: An algorithm and performance comparisons. Proceedings of the 1991 International Joint Conference on Artificial Intelligence (pp. 726-731).
  5. 5.Kushner, H. & Clark, D. (1978). Stochastic approximation methods for constrained and unconstrained systems. Berlin, Germany: Springer-Verlag.
  6. 6.Lin, L. (1992). Self-improving reactive agents based on reinforcement learning, planning and teaching. Machine Learning, 8.
  7. 7.Mahadevan & Connell (1991). Automatic programming of behavior-based robots using reinforcement learning. Proceedings of the 1991 National Conference on AI (pp. 768-773).
  8. 8.Ross, S. (1983). Introduction to stochastic dynamic programming. New York, Academic Press.
  9. 9.Sato, M., Abe, K. & Takeda, H. (1988). Learning control of finite Markov chains with explicit trade-off between estimation and control. IEEE Transactions on Systems, Man and Cybernetics, 18, pp. 677-684.
  10. 10.Sutton, R.S. (1984). Temporal credit assignment in reinforcement learning. PhD Thesis, University of Massachusetts, Amherst, MA.
  11. 11.Sutton, R.S. (1988). Learning to predict by the methods of temporal difference. Machine Learning, 3, pp. 9-44.
  12. 12.Sutton. R.S. (1990). Integrated architectures for learning, planning, and reacting based on approximating dynamic programming. Proceedings of the Seventh International Conference on Machine Learning. San Mateo, CA: Morgan Kaufmann.
  13. 13.Watkins, C.J.C.H. (1989). Learning from delayed rewards. PhD Thesis, University of Cambridge, England.
  14. 14.Werbos, P.J. (1977). Advanced forecasting methods for global crisis warning and models of intelligence. General Systems Yearbook, 22, pp. 25-38.

Citation

MLA
Watkins, C. J. C. H., and P. Dayan. “Technical Note: Q-Learning”. Machine Learning, vol. 8, nos. 3-4, 1992, pp. 279–92, https://doi.org/10.1023/A:1022676722315.
APA
Watkins, C. J. C. H., & Dayan, P. (1992). Technical Note: Q-Learning. Machine Learning, 8(3-4), 279–292. https://doi.org/10.1023/A:1022676722315
Chicago
Watkins, C. J. C. H., and P. Dayan. 1992. “Technical Note: Q-Learning”. Machine Learning 8 (3-4): 279–92. https://doi.org/10.1023/A:1022676722315.
Harvard
Watkins, C.J.C.H. and Dayan, P. (1992) “Technical Note: Q-Learning”, Machine Learning, 8(3-4), pp. 279–292. Available at: https://doi.org/10.1023/A:1022676722315.
Vancouver
1. Watkins CJCH, Dayan P (1992) Technical Note: Q-Learning. Machine Learning 8:279–292

BibTeX

@article{Watkins_1992, title={Technical Note: Q-Learning}, volume={8}, ISSN={1573-0565}, url={http://dx.doi.org/10.1023/A:1022676722315}, DOI={10.1023/a:1022676722315}, number={3-4}, journal={Machine Learning}, publisher={Springer Science and Business Media LLC}, author={Watkins, Christopher J.C.H. and Dayan, Peter}, year={1992}, month=May, pages={279–292} }
Metadata:Crossref

Access the Paper

This paper is available from its original source. Click below to access the PDF.

Open PDF