Chapter 13: Reinforcement Learning and Quantum Reinforcement Learning

Chapter 13: Reinforcement Learning and Quantum Reinforcement Learning#

This chapter is a placeholder. Reinforcement learning, the third kind of learning of Chapter 8, in which an agent acts in an environment and learns a policy from rewards, has quantum versions in which the policy or the value function is a parametrized circuit, the environment is a quantum system to be controlled, or both. A later edition will develop them here, with the same discipline as the preceding chapters: the classical algorithm derived first, the quantum element added, and both run on the same problems. The present text states the scope and the intended structure.

\[ \newcommand{\bm}[1]{\boldsymbol{#1}} \newcommand{\wick}[1]{\overline{#1}} \newcommand{\matr}[1]{\boldsymbol{#1}} \newcommand{\bfv}[1]{\boldsymbol{#1}} \renewcommand{\vec}[1]{\boldsymbol{#1}} \newcommand{\uvec}[1]{\boldsymbol{\hat{#1}}} \newcommand{\op}[1]{\widehat{#1}} \newcommand{\Op}[1]{\boldsymbol{\widehat{#1}}} \newcommand{\OP}[1]{\boldsymbol{\widehat{#1}}} \newcommand{\Det}[1]{|\boldsymbol{#1}|} \newcommand{\bigO}{\mathcal{O}} \newcommand{\var}{\mathrm{Var}} \newcommand{\cov}{\mathrm{Cov}} \newcommand{\real}[1]{\mathrm{Re}\left\{#1\right\}} \newcommand{\ud}[1]{d#1} \newcommand{\udd}[1]{d^2#1} \newcommand{\mean}[1]{\langle #1 \rangle} \newcommand{\overlap}[2]{\langle #1 | #2 \rangle} \newcommand{\bracket}[3]{\langle #1 | #2 | #3 \rangle} \newcommand{\projection}[2]{| #1 \rangle \langle #2 |} \newcommand{\brab}[1]{\big\langle #1 \big|} \newcommand{\ketb}[1]{\big| #1 \big\rangle} \newcommand{\bket}[1]{\vert #1\rangle} \newcommand{\bbra}[1]{\langle #1\vert} \newcommand{\ketbra}[2]{\vert #1\rangle\langle #2\vert} \newcommand{\braket}[2]{\langle #1\vert #2\rangle} \]
# Put every BookPrograms/chapter*/ and BookPrograms/common/ on sys.path
import sys, pathlib
root = pathlib.Path.cwd().resolve()
while not (root / 'BookPrograms').is_dir() and root.parent != root:
    root = root.parent
sys.path[:0] = sorted(str(p) for p in (root / 'BookPrograms').iterdir() if p.is_dir())
import numpy as np

Scope of this chapter#

This chapter is a placeholder for material to be written. It is kept in the book so that the structure announced in Section The plan of Part II is visible, and so that the labels and the program folder (LectureMaterial/BookPrograms/chapter13/) are reserved.

Reinforcement learning is the third kind of learning named in Section What machine learning is. An agent observes the state \(s_t\) of an environment, chooses an action \(a_t\) according to a policy \(\pi(a\vert s;\vec{\theta})\), receives a reward \(r_t\), and must adjust \(\vec{\theta}\) so as to maximize the expected cumulative reward. There are no labeled samples: the data are generated by the agent’s own actions, and the central quantities are the value function of a state, the action-value function, and the policy gradient, which has the same parameter-shift form as the gradients of Chapter 11 when the policy is a circuit.

Quantum reinforcement learning comes in three forms, and the chapter will treat them in this order.

  • Quantum agents for classical environments: the policy or the action-value function is a parametrized circuit of the kind of Chapter 11, with the state encoded as data, trained by policy-gradient or \(Q\)-learning updates; the questions are the ones of Section Variational circuits reconsidered, trainability, classical surrogates and total cost, in a setting where the data are generated online.

  • Classical agents for quantum environments: the environment is a quantum system to be controlled, prepared or measured, the state is a description of it or of the measurement record, and the reward is a fidelity or an estimation accuracy. This is the form closest to the many-body and quantum-control interests of this book and the one in which, following the argument of Section Variational circuits reconsidered, we expect the most durable results: reinforcement learning for state preparation, gate design, error correction and adaptive experiment design.

  • Quantum agents for quantum environments: agent and environment are both quantum and may be entangled, which is the setting of the quantum-enhanced learning-from-experiments results of Sections Variational circuits reconsidered and A priority list for the next years.

The intended sections are: Markov decision processes and the Bellman equations; value-based and policy-based classical algorithms (\(Q\)-learning, policy gradients, actor–critic) summarized from the reinforcement-learning part of the machine-learning text [MLbook] and implemented in common/; the variational circuit as a policy, with its gradient by the parameter-shift rule and its connection to the Fourier picture of Section The output as a Fourier series; reinforcement learning for quantum control, with the state-preparation and gate-design problems of Part I as environments; adaptive measurement and experiment design; and a closing comparison with the classical baselines. Each section will follow the pattern of the preceding chapters, with every number produced by a program and both the classical and the quantum version run on the same problem.

Exercises#

  1. A first environment. Write a two-state, two-action Markov decision process with known transition probabilities and rewards, solve the Bellman equations for its value function by iteration, and verify the solution by simulation.