# Quantum agents in the Gym: a variational quantum algorithm for deep Q-learning

짐에서의 양자 에이전트: 심층 Q-러닝을 위한 변분 양자 알고리즘

Andrea Skolik, Sofiene Jerbi, Vedran Dunjko · arXiv · 2021년 3월 28일

- **연구 문제** 강화학습에서 변분 양자 회로를 Q-함수 근사기로 쓸 때 데이터 인코딩과 readout 관측량이 성능을 어떻게 결정하는지를 다룹니다.
- **연구 방법** Q-learning의 신경망 근사기를 하드웨어 효율 ansatz 기반 PQC로 바꾸고, 출력 범위를 학습 가능한 가중치로 조정합니다.
- **주요 결과** Cart Pole 절제에서 데이터 재업로딩과 학습 가능한 입력 스케일을 함께 쓴 설정은 최적 설정에서 3000 에피소드 이내에 환경을 해결했고, 고정 출력 범위 \[0,1\]은 5000 에피소드 동안 낮은 점수에 머물렀습니다.

## VQA 기반 강화학습의 질문

강화학습은 고정된 데이터셋 대신 환경과의 상호작용으로 샘플을 얻고, 그 결과로 정책을 학습합니다. 이 논문은 변분 양자 알고리즘(VQA)이 강화학습에서 고전 신경망과 경쟁할 수 있는지를 묻습니다. 특히 값 기반 학습인 Q-learning에서 Q-함수를 파라미터화된 양자 회로(PQC)로 근사할 때, 데이터 인코딩과 readout 관측량이 성능을 어떻게 좌우하는지가 핵심 질문입니다. 저자들은 이전 연구가 PQC 기반 Q-learning의 기본 가능성은 보였지만, 연속 상태 환경인 Cart Pole 같은 과제를 해결하는 구조 선택은 충분히 다루지 않았다고 짚습니다.

## PQC를 Q-함수 근사기로 사용하는 방법

Q-learning은 각 상태-행동 쌍의 Q-값을 학습하고, 행동 선택에는 argmax 또는 ε-greedy 정책을 씁니다. 원래 Q-table은 표 형태로 값을 저장하지만, DQN은 신경망으로 Q-값을 근사합니다. 본 논문은 이 DQN 틀에서 신경망을 PQC로 바꿉니다. Q-network PQC는 하드웨어 효율 ansatz로 구성되며, 상태는 이산 공간에서는 비트열로, 연속 공간에서는 각 성분을 arctan으로 스케일한 뒤 X 회전 각도로 인코딩합니다. Q-값은 관측량 O\_a에 대한 기댓값 Q(s,a)=⟨0\|U†OaU\|0⟩에 행동별 출력 가중치 w\_oa를 곱해 계산됩니다. 이 출력 가중치는 PQC의 고정된 측정 범위 \[−1,1\]을 최적 Q-값 범위에 맞추기 위해 학습 가능한 파라미터로 도입됩니다.

![Figure 1: PQC architecture used in this work. Each layer consists of a parametrized rotation along theY and Z axes on each qubit, and a daisy chain of CZ gates…](https://refivu.com/papers/61131563-04fb-4585-b080-efba1e8d4a85/figures/figure-2c14a2025b49786af9d611a7bc2d07be.png?thumb=512)

**Figure 1** : PQC architecture used in this work. Each layer consists of a parametrized rotation along theY and Z axes on each qubit, and a daisy chain of CZ gates. The green boxes correspond to data encoding gates that en- code data as parameters of X rotations. When data re- uploading is used, the whole circuit pictured is repeated in each layer, without data re-uploading only the varia- tional part without the initial X rotations is repeated.

[원문](https://arxiv.org/abs/2103.15084v3) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) · Andrea Skolik, Sofiene Jerbi, Vedran Dunjko · Quantum agents in the Gym: a variational quantum algorithm for deep Q-learning · 원문 그림 인용 · 원본 PDF 7쪽에서 그림 영역을 추출했습니다.

## 출력 범위 문제와 학습 가능한 출력 가중치

PQC 출력은 측정 연산자에 의해 범위가 고정됩니다. 반면 신경망은 학습 중 출력 범위를 바꿀 수 있습니다. Q-learning에서 최적 Q-값은 환경 보상과 할인율 γ에 따라 다양한 범위를 가질 수 있으므로, 범위가 맞지 않으면 학습이 포화될 수 있습니다. 저자들은 단일 상태 예시에서 Q-값이 1로 제한될 때 모든 행동의 Q-값이 같아져 이후 갱신이 바뀌지 않는 상황을 보입니다. 이에 대한 대안으로 PQC 출력에 고정 계수를 곱하는 방법과 출력 범위 자체를 학습하는 방법을 비교하며, 논문은 후자를 택합니다. 고정 계수는 초기화에 민감하고 큰 범위에서는 회전 각도 변화가 작아질 수 있다는 이유입니다.

## 정책 기반 분리 결과의 Q-learning 확장

4절에서 저자들은 정책 경사 기반 RL에서 알려진 고전-양자 분리 결과가 Q-learning에도 적용되는지 검토합니다. 기반은 DLP(이산 로그 문제) 분류 과제이며, 원문은 이 문제가 고전적으로 효율적으로 풀리기 어렵지만 Shor 알고리즘으로 양자 학습자가 다항 시간에 풀 수 있다고 설명합니다. SL-DLP 환경에서는 할인율을 0으로 두면 두 행동의 Q-값이 보상 1 또는 −1로 정해지므로, 최적 정책을 알면 최적 Q-값을 직접 얻을 수 있습니다. 저자들은 이 조건을 넘어서는 일반적 결론은 아직 확보하지 못했다고 명시합니다.

## Frozen Lake에서의 검증

Frozen Lake는 16개의 이산 상태와 4개 행동을 가진 4x4 격자 환경입니다. 상태는 4큐빗 계산 기저 상태로 인코딩하며, 이 실험에서는 데이터 재업로딩과 학습 가능한 입력 가중치를 쓰지 않습니다. 출력은 각 큐빗의 Z 기댓값을 \[0,1\]로 스케일해 사용합니다. 깊이 5, 10, 15 회로에서 10개 에이전트를 학습한 결과, 모든 설정이 환경을 해결했고 깊이가 클수록 수렴 시간이 짧아졌습니다. 이 환경에서는 최적 Q-값을 정확히 계산할 수 있어 평균 절대 오차(MAE)로 Q-값과 최적값의 차이를 추적했습니다. 15층 설정의 MAE가 가장 낮았지만 10층과 15층의 차이는 5층과 10층의 차이보다 작았습니다.

이 비교는 이산 환경과 해당 회로 설정에 한정됩니다.

![Figure 2: Gym environments solved by the quantum model. a) Frozen Lake environment, where an agent needs to learn to navigate from the top left of a grid to re…](https://refivu.com/papers/61131563-04fb-4585-b080-efba1e8d4a85/figures/figure-5e8aff5927a7d12f6d57807dcf3b8a64.png?thumb=512)

**Figure 2** : Gym environments solved by the quantum model. a) Frozen Lake environment, where an agent needs to learn to navigate from the top left of a grid to retrieve the Frisbee at the bottom right without falling into any of the holes (dark squares), b) Cart Pole envi- ronment, which consists of learning to balance a pole on a cart which moves left and right on a frictionless track.

[원문](https://arxiv.org/abs/2103.15084v3) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) · Andrea Skolik, Sofiene Jerbi, Vedran Dunjko · Quantum agents in the Gym: a variational quantum algorithm for deep Q-learning · 원문 그림 인용 · 원본 PDF 13쪽에서 그림 영역을 추출했습니다.

![Figure 3: Agents with varying depth playing the Frozen Lake environment, and their closeness to the optimal Q- values. The environment is solved when the agent…](https://refivu.com/papers/61131563-04fb-4585-b080-efba1e8d4a85/figures/figure-7d75f470e223e1902f67e4b5affba67b.png?thumb=512)

**Figure 3** : Agents with varying depth playing the Frozen Lake environment, and their closeness to the optimal Q- values. The environment is solved when the agent reaches the goal (receives a score of 1) for 100 contiguous episodes. a) Average score over 10 agents for circuits of depth 5, 10, and 15, respectively. All agents manage to solve the environment, higher circuit depth leads to lower time to convergence. Shaded area shows standard deviation from the mean. b) Mean absolute error between agents’ Q-values and the optimal Q-valuesQ∗ for all (s,a ) pairs over time steps in episodes, where one time step corresponds to one transition in the environment. Shaded region shows standard error of the mean.

[원문](https://arxiv.org/abs/2103.15084v3) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) · Andrea Skolik, Sofiene Jerbi, Vedran Dunjko · Quantum agents in the Gym: a variational quantum algorithm for deep Q-learning · 원문 그림 인용 · 원본 PDF 14쪽에서 그림 영역을 추출했습니다.

![Table 2: Hyperparameter settings of PQCs in ﬁg. 3, ﬁg. 4 and ﬁg. 5](https://refivu.com/papers/61131563-04fb-4585-b080-efba1e8d4a85/figures/figure-5d621475788b7a9f54c66c52ca50d3ef.png?thumb=512)

**Table 2** : Hyperparameter settings of PQCs in ﬁg. 3, ﬁg. 4 and ﬁg. 5

[원문](https://arxiv.org/abs/2103.15084v3) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) · Andrea Skolik, Sofiene Jerbi, Vedran Dunjko · Quantum agents in the Gym: a variational quantum algorithm for deep Q-learning · 원문 그림 인용 · 원본 PDF 25쪽에서 그림 영역을 추출했습니다.

## Cart Pole에서의 인코딩과 출력 범위 절제

Cart Pole은 4차원 연속 상태와 두 행동을 가진 환경이며, 평균 점수 195 이상을 해결 기준으로 합니다. 최적 정책의 Q-값은 γ=0.99에서 최대 약 86 수준으로 계산되어, 계산 기저 측정 기댓값의 범위보다 훨씬 큽니다. 그래서 여기서는 4큐빗 PQC, 학습 가능한 입력 스케일, 데이터 재업로딩, 학습 가능한 출력 가중치를 함께 평가합니다. 절제 결과에서 데이터 재업로딩과 입력 스케일을 함께 쓴 에이전트는 최적 설정에서 3000 에피소드 이내에 환경을 해결했고, 두 기법 중 하나만 쓴 경우는 5000 에피소드 안에서 해결하지 못했습니다. 출력 범위를 \[0,1\]로 고정한 에이전트는 5000 에피소드 동안 낮은 점수에 머물렀고, 학습 가능한 출력 가중치를 쓴 에이전트는 두 하이퍼파라미터 설정에서 모두 성공했습니다.

![Figure 8: Visualization of the approximate Q-function learned by a quantum Q-learning agent solving Cart Pole. Due to the4 dimensions of the state space in Car…](https://refivu.com/papers/61131563-04fb-4585-b080-efba1e8d4a85/figures/figure-8805cf261574affddb33352e2406c0f4.png?thumb=512)

**Figure 8** : Visualization of the approximate Q-function learned by a quantum Q-learning agent solving Cart Pole. Due to the4 dimensions of the state space in Cart Pole, we represent the Q-values associated to the actions “left” (green) and “right” (blue) on3 subspaces of the state space by ﬁxing unrepresented dimensions to0 in each plot. As opposed to the analogue values (i.e., unnormalized policy) learned by policy-gradient PQC agents in this environment \[20\], the approximate Q-values appear nicely-behaved, likely due to the stronger constraints that Q-learning has on well-performing function approximations.

[원문](https://arxiv.org/abs/2103.15084v3) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) · Andrea Skolik, Sofiene Jerbi, Vedran Dunjko · Quantum agents in the Gym: a variational quantum algorithm for deep Q-learning · 원문 그림 인용 · 원본 PDF 24쪽에서 그림 영역을 추출했습니다.

## PQC와 신경망의 파라미터 수 비교

저자들은 파라미터 수 증가가 PQC와 신경망 DQN에서 같은 방향으로 작동하는지 비교합니다. PQC는 5층에서 30층까지, 62개에서 362개 파라미터 범위를 평가했으며, 신경망은 은닉층 유닛 수를 바꾼 두 은닉층 구조를 사용했습니다. 원문 결과에서 가장 좋은 PQC는 25층 302개 파라미터로 평균 500 에피소드 만에 해결했습니다. 가장 좋은 신경망은 각 은닉층 20개 유닛의 562개 파라미터 구성으로 평균 250 에피소드 만에 해결했습니다. 개별 에이전트 비교에서는 5층 62개 파라미터 PQC가 206 에피소드, 30유닛 두 은닉층 신경망이 186 에피소드로 해결했습니다. 이 결과는 파라미터 수보다 하이퍼파라미터와 인코딩 선택이 성능에 더 큰 영향을 준다는 저자들의 해석을 뒷받침합니다.

![Table 3: Hyperparameter settings of PQCs in ﬁg. 6 a)](https://refivu.com/papers/61131563-04fb-4585-b080-efba1e8d4a85/figures/figure-8a739b8314529509ab5a4a03723bbb7e.png?thumb=512)

**Table 3** : Hyperparameter settings of PQCs in ﬁg. 6 a)

[원문](https://arxiv.org/abs/2103.15084v3) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) · Andrea Skolik, Sofiene Jerbi, Vedran Dunjko · Quantum agents in the Gym: a variational quantum algorithm for deep Q-learning · 원문 그림 인용 · 원본 PDF 26쪽에서 그림 영역을 추출했습니다.

![Table 4: Hyperparameter settings of NNs in ﬁg. 6 b)](https://refivu.com/papers/61131563-04fb-4585-b080-efba1e8d4a85/figures/figure-bbb705fb29f5d141f2f7f584c024883d.png?thumb=512)

**Table 4** : Hyperparameter settings of NNs in ﬁg. 6 b)

[원문](https://arxiv.org/abs/2103.15084v3) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) · Andrea Skolik, Sofiene Jerbi, Vedran Dunjko · Quantum agents in the Gym: a variational quantum algorithm for deep Q-learning · 원문 그림 인용 · 원본 PDF 26쪽에서 그림 영역을 추출했습니다.

## 적용 범위와 남은 질문

이 결과는 Frozen Lake와 Cart Pole이라는 두 OpenAI Gym 과제, 제시된 하드웨어 효율 ansatz와 설정 탐색 범위에서 얻은 것입니다. Frozen Lake에서 Q-값 정확도를 직접 비교할 수 있었던 이유는 이산 상태 공간에 해석적 최적 Q-값이 있기 때문입니다. Cart Pole에서는 같은 방식의 비교가 어려워 학습 속도와 점수로 평가했습니다. 분리 결과는 SL-DLP 같은 제한된 환경에서 최적 정책을 알 때 최적 Q-값을 계산하는 조건에 기대며, 정책 경사 기반 분리 결과가 Q-learning 업데이트 전체에 성립하는지는 아직 답하지 않은 질문입니다.

## 논문 정보

- **저자**: Andrea Skolik, Sofiene Jerbi, Vedran Dunjko
- **학회·저널**: arXiv · 프리프린트
- **최초 공개일**: 2021년 3월 28일
- **등록일**: 2026년 11월 6일
- **수정일**: 2022년 5월 16일
- **버전**: v3
- **arXiv**: 2103.15084
- **DOI**: 10.22331/q-2022-05-24-720
- **분류**: quant-ph
- **원문 이용 조건**: [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/)
- **제공 범위**: 논문 정보, 해설, 허용된 원문 그림

[논문 원문 ↗](https://arxiv.org/abs/2103.15084v3) · [원문 PDF ↗](https://arxiv.org/pdf/2103.15084v3)

AI 해설은 논문 원문과 별개의 설명이며 오류가 있을 수 있습니다. 원문과 그림은 각 출처의 이용 조건과 따로 표시된 권리를 따릅니다.

## 초록

Quantum machine learning (QML) has been identified as one of the key fields that could reap advantages from near-term quantum devices, next to optimization and quantum chemistry. Research in this area has focused primarily on variational quantum algorithms (VQAs), and several proposals to enhance supervised, unsupervised and reinforcement learning (RL) algorithms with VQAs have been put forward. Out of the three, RL is the least studied and it is still an open question whether VQAs can be competitive with state-of-the-art classical algorithms based on neural networks (NNs) even on simple benchmark tasks. In this work, we introduce a training method for parametrized quantum circuits (PQCs) that can be used to solve RL tasks for discrete and continuous state spaces based on the deep Q-learning algorithm. We investigate which architectural choices for quantum Q-learning agents are most important for successfully solving certain types of environments by performing ablation studies for a number of different data encoding and readout strategies. We provide insight into why the performance of a VQA-based Q-learning algorithm crucially depends on the observables of the quantum model and show how to choose suitable observables based on the learning task at hand. To compare our model against the classical DQN algorithm, we perform an extensive hyperparameter search of PQCs and NNs with varying numbers of parameters. We confirm that similar to results in classical literature, the architectural choices and hyperparameters contribute more to the agents' success in a RL setting than the number of parameters used in the model. Finally, we show when recent separation results between classical and quantum agents for policy gradient RL can be extended to inferring optimal Q-values in restricted families of environments.

## 원문 인용

Andrea Skolik, Sofiene Jerbi, Vedran Dunjko (2021). Quantum agents in the Gym: a variational quantum algorithm for deep Q-learning. arXiv:2103.15084v3. https://doi.org/10.22331/q-2022-05-24-720

**BibTeX**

```
@article{skolik2021quantum,
  title = {{Quantum agents in the Gym: a variational quantum algorithm for deep Q-learning}},
  author = {Andrea Skolik and Sofiene Jerbi and Vedran Dunjko},
  year = {2021},
  eprint = {2103.15084},
  archivePrefix = {arXiv},
  doi = {10.22331/q-2022-05-24-720},
  url = {https://arxiv.org/abs/2103.15084v3}
}
```

## 이 논문의 용어

- [Q-learning](https://refivu.com/terms/e20b416cb2f7-q-learning)
- [Mean Squared Error](https://refivu.com/terms/e8df98e6d7b7-mean-squared-error)
- [experience replay](https://refivu.com/terms/5ee9a599e6c6-experience-replay)
- [mean absolute error](https://refivu.com/terms/2117321fb36f-mean-absolute-error)
- [DQN](https://refivu.com/terms/6263174655b5-dqn)
- [policy gradient](https://refivu.com/terms/abaf88e7ce4d-policy-gradient)
- [target network](https://refivu.com/terms/b4a667f3d792-target-network)
- [discount factor](https://refivu.com/terms/e8f6e4641c4b-discount-factor)
- [Q-table](https://refivu.com/terms/322e0a189161-q-table)
- [barren plateau](https://refivu.com/terms/0706a3103800-barren-plateau)
- [frozen lake](https://refivu.com/terms/a7a6ffece9bb-frozen-lake)
- [data re-uploading](https://refivu.com/terms/d6f8f7b5a439-data-re-uploading)
- [hardware-efficient ansatz](https://refivu.com/terms/658de0379931-hardware-efficient-ansatz)

## 다른 논문 해설

- [Diffusion-based Reinforcement Learning for Edge-enabled AI-Generated Content Services](https://refivu.com/papers/1f3360a8-f142-465a-88d4-2944cf4943bd-diffusion-based-reinforcement-learning-for-edge-enabled-ai.md)
- [Deep Multiagent Reinforcement Learning: Challenges and Directions](https://refivu.com/papers/4e3f1d3b-94ab-4d97-b560-149d99954193-deep-multiagent-reinforcement-learning-challenges-and.md)
- [Deep Q-Learning based Reinforcement Learning Approach for Network Intrusion Detection](https://refivu.com/papers/0e0fba9c-de99-433f-a5f5-56cc10aa2ef8-deep-q-learning-based-reinforcement-learning-approach-for.md)
- [Online Model-Free Reinforcement Learning for the Automatic Control of a Flexible Wing Aircraft](https://refivu.com/papers/ba36d890-9284-4305-a476-e058d78348ca-online-model-free-reinforcement-learning-for-the-automatic.md)
- [Variational Quantum Circuits for Deep Reinforcement Learning](https://refivu.com/papers/f6af79b4-b092-4c2a-8589-70b19b37fcc5-variational-quantum-circuits-for-deep-reinforcement-learning.md)
- [DRPC: Distributed Reinforcement Learning Approach for Scalable Resource Provisioning in Container-based Clusters](https://refivu.com/papers/1d580a2a-e026-414c-88f7-6b9c39939552-drpc-distributed-reinforcement-learning-approach-for.md)
- [Real-World Humanoid Locomotion with Reinforcement Learning](https://refivu.com/papers/8e42e14f-83b7-4879-ab8c-1bd8a7bcea8a-real-world-humanoid-locomotion-with-reinforcement-learning.md)
- [Automatic acoustic detection of birds through deep learning: the first Bird Audio Detection challenge](https://refivu.com/papers/ffc7e794-5a19-4eef-a9d9-5a912594e0d1-automatic-acoustic-detection-of-birds-through-deep-learning.md)
- [Taxon and trait recognition from digitized herbarium specimens using deep convolutional neural networks](https://refivu.com/papers/e5ba6ec9-008d-4521-9364-6dca94651f8e-taxon-and-trait-recognition-from-digitized-herbarium.md)
- [Hiding Data in Images Using Cryptography and Deep Neural Network](https://refivu.com/papers/5f176b74-deef-4194-9cc9-ff65d30db05b-hiding-data-in-images-using-cryptography-and-deep.md)

---

AI 해설에는 오류가 있을 수 있습니다. [Refivu](https://refivu.com/papers/61131563-04fb-4585-b080-efba1e8d4a85-quantum-agents-in-the-gym-a-variational-quantum)
