Fast Online Q(lambda)

Marco A. Wiering, Jürgen SchmidhuberMachine Learning 1998

Abstract

Standard online Q(λ)-learning implementations suffer from high computational costs, often scaling with the size of the state-action space ($O(|S||A|)$). This paper presents a "Fast Online Q(λ)" algorithm that reduces per-step update complexity to $O(|A|)$ by employing a lazy learning strategy. By postponing Q-value updates until a state is actually visited, the algorithm achieves the same mathematical results as standard methods with significantly improved efficiency, making it suitable for large-scale reinforcement learning tasks.

Introduction

In reinforcement learning (RL), agents seek to maximize cumulative rewards through interaction with an environment. Q-learning is a fundamental technique in this domain, but its basic form updates only the most recent state-action pair (SAP). To accelerate learning, researchers utilize Q(λ), which incorporates eligibility traces. These traces allow rewards to propagate back to multiple previously visited states.

However, a significant bottleneck exists for "truly online" learning. In such settings, the agent must update values after every step. Traditional implementations require a sweep through all visited states, a list that can grow to the size of the entire state-action space. This $O(|S||A|)$ complexity makes online Q(λ) impractical for complex environments. This paper addresses this limitation by introducing a mathematically equivalent but computationally leaner approach.

Methods: The Lazy Update Innovation

The core contribution of this work is the "Fast Online Q(λ)" algorithm, which leverages the principle of lazy learning. Instead of performing a global sweep to update every SAP's Q-value at every time step, the algorithm only updates the Q-values for the actions available in the agent's current state.

Mathematical Decomposition

The algorithm maintains a global variable ($\Delta$) to track cumulative temporal difference (TD) errors and a global trace factor ($\phi^t$). Each SAP stores its own local trace and a "timestamp"—the value of the global $\Delta$ at its last update. When an agent enters a state, it performs a Local Update. It calculates the exact change the Q-value would have accumulated since its last visit by comparing the current global $\Delta$ with the stored timestamp.

Visualization of the decomposition of eligibility traces into global and local components.

As shown in the figure above, the standard eligibility trace $l(s,a)$ can be decomposed into a global decay component $\phi^t$ and a local component $l'(s,a)$. This decoupling allows the agent to "catch up" on missed updates only when necessary, specifically when the state is revisited.

Handling Numerical Stability

A practical challenge in this approach is that global variables like $\Delta$ and $\phi^t$ can eventually exceed machine floating-point precision. To mitigate this, the authors include a "Global Update Addendum." This process periodically resets global variables and "settles the bill" for all stored traces, ensuring numerical stability without sacrificing the overall speedup.

Experimental Analysis

The paper validates the algorithm through theoretical complexity analysis and empirical tests:

  • Worst-Case Complexity: In environments where every step visits a new SAP, the proposed algorithm maintains a constant update cost, whereas previous methods (e.g., Peng & Williams) exhibit linear growth in cost over time.
  • Maze Tasks: Practical performance was demonstrated using maze environments, confirming that the "Fast" version produces identical learning trajectories to standard Q(λ) while operating much faster.
  • Function Approximation: The method extends to local function approximators (such as CMACs), where the speedup is proportional to the locality of the model.

Key Insights

  • Computational Necessity: The fundamental insight is that the exact value of a state is only required when the agent is actually in that state making a decision.
  • Equivalence: The algorithm is "truly online" and mathematically equivalent to the standard Peng & Williams Q(λ) algorithm, ensuring that no accuracy is traded for speed.
  • Scalability: By reducing complexity to $O(|A|)$, the algorithm becomes independent of the total number of states, a critical requirement for scaling RL to real-world problems.

Conclusion and Future Work

Fast Online Q(λ) provides a robust solution to the computational overhead of eligibility traces in online reinforcement learning. While it significantly improves time complexity, it does not reduce space complexity, as traces for all visited states must still be stored. Furthermore, the "lazy" update trick is less effective for global function approximators (like deep neural networks) where every update potentially affects all outputs. Future research may explore ways to combine these efficiency gains with more complex, non-local models.

Summary updated

BibTeX
@article{wiering1998fast,
  author = {Marco A. Wiering and Jürgen Schmidhuber},
  title = {{Fast Online Q(lambda)}},
  journal = {Machine Learning},
  year = {1998},
  doi = {10.1023/a:1007562800292},
}
Figure