【RLchina第五讲】Control as Inference(下)

简介: 【RLchina第五讲】Control as Inference(下)
  • QV 之间的关系


  到这我们已经得到了策略,更进一步我们考虑Q V 之间的关系。考虑对动作空间下的边缘概率分布积分有:

image.png

但是往往环境是随机的,所以我们有:

image.png

 上述的这个反向传播值函数是很特别的,与以往的Q 值函数更新公式不同的地方在于,对于未来状态的状态值函数做了一个softmax这样的东西,这就使得不会突出考虑最大的那个值函数,也能够增加更多的探索。对于随机环境来说会有比较好的效果。


隐目标函数下的最大熵强化学习

image.png


优化目标为这两者的KL散度:


image.png

两边取负号,并将其展开可得:

image.png

此时最小化KL散度变成了最大化期望奖励和策略的熵。对于最后一步T TT,把末尾项展开,把策略扔到计算期望的函数里面,可以得到如下形式:


image.png

image.pngimage.png


整理可得:

image.png

image.png

可以看出,基于图概率下的策略搜索和基于变分推断做KL散度得到的策略结果是一样的。这也充分说明之前做的police inference就是在解决这个潜在目标函数下的优化问题。


随机环境下的优化

image.png

此时的KL散度优化目标可以写为:

image.pngimage.png

由于存在image.png这一项,在无模型的设定里,这一项是比较难优化的。

最大熵强化学习与变分推断


  变分推断是用一个简单的变分分布去近似后验分布,在最大熵RL里面的轨迹概率为:


image.png

这里我们将需要去近似这个分布的概率设置为:


image.png


最后一个不等式是通过Jensen’s inequality推导得到的。再依据p ( τ ) q ( τ )的定义,带入上述方程中,我们可以得到如下不等式:

image.png

上述用图模型思考强化学习问题的时候,目标函数会带一个entropy


Soft Q-Learning

image.png

image.pngimage.png


为了与标准的Q-Learning算法对比,我们给出标准的Q-Learning算法的更新公式:

image.png

  • Liu Q , Wang D . Stein Variational Gradient Descent: A General Purpose Bayesian Inference Algorithm[C]// 2016.
  • Haarnoja, T., Tang, H., Abbeel, P., and Levine, S. (2017). Reinforcement learning with deep energy- based policies. In International Conference on Machine Learning (ICML).


最大熵策略梯度

image.png

目标函数可以定义为:


image.png

对其求梯度有:


image.pngimage.png

image.png

Soft Actor-Critic


  SAC就是将优势函数也进行参数化,变成一个off-policy的算法。优化目标为:

image.png

 对Q 值函数一样,有:

image.png

对其求导有:


image.png

策略优化目标为:

image.png

伪代码:

参考文献


  1. Pattern recognition and machine learning by Bishop 2006
  2. Levine, S., 2018. Reinforcement learning and control as probabilistic inference: Tutorial and review. arXiv preprint arXiv:1805.00909
  3. Haarnoja, T., Tang, H., Abbeel, P., and Levine, S. (2017). Reinforcement learning with deep energy- based policies. In International Conference on Machine Learning (ICML).
  4. Tuomas Haarnoja*, Aurick Zhou*, Kristian Hartikainen*, George Tucker, Sehoon Ha, Jie Tan, Vikash Kumar, Henry Zhu, Abhishek Gupta, Pieter Abbeel, Sergey Levine. Soft Actor-Critic Algorithms and Applications. arXiv preprint, 2018.
  5. Kappen. (2009). Optimal control as a graphical model inference problem: frames control as an inference problem in a graphical model
  6. Ziebart. (2010). Modeling interaction via the principle of maximal causal entropy: connection between soft optimality and maximum entropy modeling.
相关文章
|
机器学习/深度学习 算法 安全
密码学系列之五:MD5、SHA1——一文搞懂哈希函数
密码学系列之五:MD5、SHA1——一文搞懂哈希函数
9741 0
|
Android开发
Android基础知识:请解释Service是什么,它与IntentService的区别是什么?
Android基础知识:请解释Service是什么,它与IntentService的区别是什么?
317 0
已解决 BrokenPipeError: [Errno 32] Broken pipe
已解决 BrokenPipeError: [Errno 32] Broken pipe
9036 0
已解决 BrokenPipeError: [Errno 32] Broken pipe
|
4月前
|
存储 缓存 资源调度
# Qwen3-8B 的 TTFT 性能分析:16K 与 32K 输入 Prompt 的推算公式与底层原理详解
Qwen3-8B 是通义实验室推出的 80 亿参数大模型,支持最长 32,768 token 上下文,适用于长文本处理场景。通过 FP8 量化、CUDA Kernel 优化及 RoPE 位置编码技术,提升推理效率与稳定性。模型在 16K 输入下 TTFT 约 150-200ms,32K 输入下约 250-300ms,适用于文档摘要与长对话交互。
1273 8
|
5月前
|
存储 编解码 Prometheus
大模型推理加速实战:vLLM 部署 Llama3 的量化与批处理优化指南
本文详解如何通过量化与批处理优化,在vLLM中高效部署Llama3大模型。涵盖内存管理、推理加速及混合策略,提升吞吐量并降低延迟,适用于大规模语言模型部署实践。
1426 2
|
开发者 Python
【Python】已解决:TypeError: __init__() got an unexpected keyword argument ‘port’
【Python】已解决:TypeError: __init__() got an unexpected keyword argument ‘port’
2446 0
【Python】已解决:TypeError: __init__() got an unexpected keyword argument ‘port’
|
安全 开发工具 C++
Atom编辑器:曾经的效率提升利器,终将被新技术取代
Atom编辑器:曾经的效率提升利器,终将被新技术取代
422 0
|
Java 应用服务中间件 编译器
详解JAVA远程debug
详解JAVA远程debug
500 0
|
存储 算法
精益求精——斐波那契数列的logn解法
精益求精——斐波那契数列的logn解法
416 0
|
机器学习/深度学习
大模型中的Scaling Law是什么?
【2月更文挑战第9天】大模型中的Scaling Law是什么?
17692 3
大模型中的Scaling Law是什么?
下一篇
oss云网关配置