← Back to Reinforcement Learning Mind Map
🎮 Reinforcement LearningID: dyna

Dyna Architecture (Dyna-Q)

Dyna 架构 (Dyna-Q)
🎯Core Definition
The Dyna architecture (Dyna-Q) hybridizes model learning with model-free learning: after each real interaction it updates Q on real experience, then treats the learned world model as a 'free environment' to generate nn imagined rollouts and applies the same Q-learning update to the mixture. Pseudocode essentials: ``` while True: a ← ε-greedy(s) # real experience: policy picks action r, s' ← env(s, a) # environment interaction Q(s,a) ← Q(s,a) + α[r + γ·max_a' Q(s',a') − Q(s,a)] # real update model(s,a) ← (r, s') # update the model repeat n times: # imagined rollouts mixed in s̃ ← random visited state; ã ← random action (r̃, s̃') ← model(s̃, ã) # simulate with the model Q(s̃,ã) ← Q(s̃,ã) + α[r̃ + γ·max Q(s̃',·) − Q(s̃,ã)] # imagined update ``` Real and imagined updates use the identical Q-learning rule; the model only expands the source of experience.
💡Use Cases
the canonical introduction to model-enhanced learning in tabular/simple environments; classic interview question 'simplest model-based paradigm' and 'first use of a model in RL'. Deep-RL counterpart: MBPO (Model-Based Policy Optimization) — model rollout data mixed into the replay buffer to train SAC/PPO.
⚡Key Problems Solved
slow convergence with scarce real experience; Dyna 'amplifies' each real sample into nn imagined samples, speeding Q-learning convergence markedly. Limitation: imagined states are sampled from the pool of previously visited states, so their distribution can mismatch states the policy actually reaches, amplifying model bias.
🎯Core Interview Exam Points
Fundamentals · Production Scenarios · Deep Dive
Core Def
Explain the core definition, underlying mechanism/math, and key principles of Dyna Architecture (Dyna-Q).
Use Cases
In production engineering, what are the primary use cases for Dyna Architecture (Dyna-Q) and what core pain points does it solve?
🔥 High-Frequency Deep-Dive Questions
1
What is the core idea of Dyna-Q? Write the key pseudocode steps.
2
How are states/actions sampled for imagined rollouts? Problems if the imagined distribution mismatches reality?
3
How does n (imagined steps per interaction) affect convergence speed and compute?
4
Dyna vs Priority Sweeping: what differs?
5
What is Dyna's deep-RL counterpart (e.g. how MBPO mixes model rollouts)?
Updated 2026-08-12
🎯
Verify Mastery: Practice Exam Questions for "Dyna Architecture (Dyna-Q)"
Take pitfall multiple-choice questions with derivation options; mistakes are automatically logged.
🚀 Start Card Practice ➔
← Previous CardWorld Model LearningNext Card →Model Predictive Control (MPC)

🔗 More Reinforcement Learning Knowledge Cards

引用出处: TalentMe 450+ 工业级 AI 架构考点知识库 (Tech Vault) · 遵循 CC-BY-4.0 知识共享协议
URL: https://talentme.airsota.com/resources/tech/roadmap/mindmap/RL/card/dyna
中文速览与面试要点

Dyna 架构 (Dyna-Q) (Dyna Architecture (Dyna-Q))

定义: Dyna 架构(Dyna-Q)是模型学习与无模型学习的混合范式:每次真实交互后,先用真实经验更新 Q,再把学到的世界模型当"免费环境"生成 n 次想象 rollout,与真实经验混合同步做 Q-learning 更新。伪代码要点: ``` while True: a ← ε-greedy(s) # 真实经验: 策略选动作 r, s' ← env(s, a) # 环境交互 Q(s,a) ← Q(s,a) + α[r + γ·max_a' Q(s',a') − Q(s,a)] # 真实更新 model(s,a) ← (r, s') # 更新世界模型 repeat n 次: # 想象 rollout 混合 s̃ ← 随机已访问状态; ã ← 随机动作 (r̃, s̃') ← model(s̃, ã) # 用模型模拟 Q(s̃,ã) ← Q(s̃,ã) + α[r̃ + γ·max Q(s̃',·) − Q(s̃,ã)] # 想象更新 ``` 其中真实更新与想象更新使用完全相同的 Q-learning 规则,模型只负责扩充经验来源。 使用场景: 表格型/简单环境的模型增强入门范式;面试常问"最简 Model-Based 范式"与"模型在 RL 中的第一个用途";深度 RL 中对应物为 MBPO(Model-Based Policy Optimization:模型 rollout 数据混入 replay buffer 训练 SAC/PPO)。 解决的问题: 真实经验有限时收敛慢;Dyna 把每条真实样本"放大"成 n 个想象样本,显著加速 Q-learning 收敛。局限:想象状态从已访问状态池随机采样,分布可能与策略实际到达的状态不匹配,模型偏差会被放大。

核心要点

  • Dyna-Q 的核心思想是什么?写出伪代码的关键步骤。
  • 想象 rollout 中状态/动作如何采样?分布与真实不一致会有什么问题?
  • n(每次交互的想象步数)如何影响收敛速度与计算开销?
  • Dyna 与 Priority Sweeping 有什么区别?
  • Dyna 在深度 RL 中的对应物是什么?(如 MBPO 如何混合模型 rollout)