<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Home on Decisions &amp; Dragons</title><link>https://www.decisionsanddragons.com/</link><description>Recent content in Home on Decisions &amp; Dragons</description><generator>Hugo</generator><language>en-us</language><lastBuildDate>Wed, 02 Jul 2025 23:43:37 -0400</lastBuildDate><atom:link href="https://www.decisionsanddragons.com/index.xml" rel="self" type="application/rss+xml"/><item><title>Should we abandon RL? Is it the right approach?</title><link>https://www.decisionsanddragons.com/posts/should_we_abandon_rl/</link><pubDate>Wed, 02 Jul 2025 23:43:37 -0400</pubDate><guid>https://www.decisionsanddragons.com/posts/should_we_abandon_rl/</guid><description>&lt;p>No, we should not abandon reinforcement learning. I get it though — RL algorithms are brittle, difficult to scale, and complicated. However, this question is predicated on a misconception. RL is not an approach. RL is a &lt;em>problem definition&lt;/em>.&lt;/p>
&lt;p>RL is the problem of determining how an agent should make decisions in an unfamiliar environment. It must act to both learn about its environment and pursue its objective. It must learn from its experiences, rather than a human-curated dataset.&lt;/p>
&lt;p>We don&amp;rsquo;t abandon problems. They are imposed upon us and we ignore them at our peril. Asking if a problem is &amp;ldquo;right&amp;rdquo; isn&amp;rsquo;t a coherent question. What is a coherent question is whether a problem is &lt;em>important&lt;/em> or &lt;em>relevant&lt;/em>.&lt;/p>
&lt;p>RL is an important problem. If you care about building systems that can act and learn in the world like people do, then the RL problem is impossible to avoid. The question is not whether we should abandon RL, but how we can make better algorithms to solve it.&lt;/p></description></item><item><title>Why is it better to subtract a baseline in REINFORCE?</title><link>https://www.decisionsanddragons.com/posts/why_is_it_better_to_subtract_a_baseline-in-reinforce/</link><pubDate>Thu, 08 May 2025 15:06:56 -0400</pubDate><guid>https://www.decisionsanddragons.com/posts/why_is_it_better_to_subtract_a_baseline-in-reinforce/</guid><description>&lt;p>Suppose we have a softmax policy over five actions. In the current state, an oracle tells us that the true Q-values are -1, -2, -3, -4, and -5. The first action is the best, even though it is negative, so we should increase the probability of it. We sample an action from our policy. It&amp;rsquo;s the first! What a stroke of luck!&lt;/p>
&lt;p>Or is it? Unfortunately, our algorithm is REINFORCE. It decreases the probability of selecting the winning action. Why? Because the REINFORCE stochastic gradient is the product of the Q-value estimate and the gradient of the log probability of the action: $\nabla \log \pi(a | s) Q^\pi(s, a)$. Since the Q-value is negative, REINFORCE decreases the action&amp;rsquo;s probability.&lt;/p>
&lt;p>Unless we&amp;rsquo;re using a baseline. For example, if we subtracted a baseline of -3, then we would multiply the gradient of the log probability by $(-1 - -3) = 2$: a positive weight. In this case, REINFORCE correctly increases the probability of the action.&lt;/p></description></item><item><title>Why does experience replay require off-policy learning and how is it different from on-policy learning?</title><link>https://www.decisionsanddragons.com/posts/off_policy_replay/</link><pubDate>Sat, 04 May 2024 11:39:36 -0400</pubDate><guid>https://www.decisionsanddragons.com/posts/off_policy_replay/</guid><description>&lt;p>When you use an experience replay buffer, you save the most recent $k$ experiences of the agent, and sample data from that buffer for training. Typically, the agent does a step of training to update its policy for every step in the environment. At any moment in time, the vast majority of experiences in the buffer are generated with a different &amp;ndash; earlier &amp;ndash; policy than the current policy. And if the policy used to collect data is different than the policy being evaluated or improved, then you need an off-policy method.&lt;/p></description></item><item><title>What is the "horizon" in reinforcement learning?</title><link>https://www.decisionsanddragons.com/posts/horizon/</link><pubDate>Sun, 21 Apr 2024 16:49:00 -0400</pubDate><guid>https://www.decisionsanddragons.com/posts/horizon/</guid><description>&lt;p>In reinforcement learning, an agent receives reward on each time step. The goal, loosely speaking, is to maximize the future reward received. But that doesn’t fully define the goal, because each decision can affect what reward the agent can receive the future. Consequently, we’re left with the question &amp;ldquo;how does potential future reward affect our decision right now?&amp;rdquo; The &amp;ldquo;horizon&amp;rdquo; refers to how far into the future the agent will optimize its reward. You can have finite-horizon objectives, or even infinite-horizon objectives.&lt;/p></description></item><item><title>Why doesn't Q-learning work with continuous actions?</title><link>https://www.decisionsanddragons.com/posts/q_learning_discrete_only/</link><pubDate>Sun, 21 Apr 2024 15:36:15 -0400</pubDate><guid>https://www.decisionsanddragons.com/posts/q_learning_discrete_only/</guid><description>&lt;p>Q-learning requires finding the action with the maximum Q-value in two places: (1) In the learning update itself; and (2) when extracting the policy from the learned Q-values. When there are a small number of discrete actions, you can simply enumerate the Q-values for each and pick the action with the highest value. However, this approach does not work with continuous actions, because there are an infinite number of actions to evaluate!&lt;/p></description></item><item><title>Why is the DDPG gradient the product of the Q-function gradient and policy gradient?</title><link>https://www.decisionsanddragons.com/posts/ddpg_grad/</link><pubDate>Sat, 20 Apr 2024 12:51:21 -0400</pubDate><guid>https://www.decisionsanddragons.com/posts/ddpg_grad/</guid><description>&lt;p>The &lt;a href="https://arxiv.org/abs/1509.02971">DDPG&lt;/a> and &lt;a href="https://proceedings.mlr.press/v32/silver14.pdf">DPG paper&lt;/a> before it express the gradient of the objective $J(\pi)$ as the product of the policy and Q-function gradients:&lt;/p>
&lt;p>$$
\nabla_\theta J(\pi) = E_{s \sim \rho^\pi} \left[\nabla_\theta \pi_\theta(s) \nabla_a Q(s, a) \rvert_{a \triangleq \pi_\theta(s)} \right].
$$&lt;/p>
&lt;p>This expression looks a little scary, but it&amp;rsquo;s conveying a straightforward concept: the gradient is the average of the Q-function&amp;rsquo;s gradient with respect to the policy parameters, evaluated at the policy&amp;rsquo;s selected action. That may not be obvious because the product of &amp;ldquo;gradients&amp;rdquo; (spoiler: there is some notation abuse) is the result of applying the multivariable chain rule of differentiation. If we were to reverse this step, the expected value would simplify to the more explicit expression $\nabla_\theta Q(s, \pi_\theta(s))$.&lt;/p></description></item><item><title>If Q-learning is off-policy, why doesn't it require importance sampling?</title><link>https://www.decisionsanddragons.com/posts/q_learning_doesnt_need_importance_sampling/</link><pubDate>Tue, 02 Apr 2024 23:43:37 -0400</pubDate><guid>https://www.decisionsanddragons.com/posts/q_learning_doesnt_need_importance_sampling/</guid><description>&lt;p>In off-policy learning, we evaluate the value function for a policy other than the one we are following in the environment. This difference creates a mismatch in state-action distributions. To account for this difference, some actor-critic methods use importance sampling. However, Q-learning does not. There is a simple reason for that: In Q-learning, we only use samples to tell us about the effect of actions on the environment, not to estimate how good the policy action selection is. Let&amp;rsquo;s make that more concrete with a simple example and re-derive the Q-learning and importance sampling approaches.&lt;/p></description></item><item><title>What is the difference between V(s) and Q(s,a)?</title><link>https://www.decisionsanddragons.com/posts/q_vs_v/</link><pubDate>Sat, 30 Mar 2024 23:24:52 -0400</pubDate><guid>https://www.decisionsanddragons.com/posts/q_vs_v/</guid><description>&lt;p>State value function $V(s)$ expresses how well the agent expects to do when it acts normally. $Q(s, a)$ is a counterfactual function that expresses how well the agent expects to do if it first takes some potentially alternative action before acting normally.&lt;/p></description></item><item><title>Why does the policy gradient include a log probability term?</title><link>https://www.decisionsanddragons.com/posts/why_does_the_policy_gradient_include_log_prob/</link><pubDate>Fri, 29 Mar 2024 20:07:54 -0400</pubDate><guid>https://www.decisionsanddragons.com/posts/why_does_the_policy_gradient_include_log_prob/</guid><description>&lt;p>Actually, it doesn&amp;rsquo;t! What you&amp;rsquo;re probably thinking of is the &lt;a href="https://people.cs.umass.edu/~barto/courses/cs687/williams92simple.pdf">REINFORCE&lt;/a> &lt;em>estimate&lt;/em> of the policy gradient. How we derive the REINFORCE estimate you&amp;rsquo;re familiar with and &lt;em>why&lt;/em> we use it is something I found to be poorly explained in literature. Fortunately, it is not a hard concept to learn!&lt;/p></description></item><item><title>What is the difference between model-based and model-free RL?</title><link>https://www.decisionsanddragons.com/posts/model_free_vs_model_based/</link><pubDate>Fri, 29 Mar 2024 19:50:17 -0400</pubDate><guid>https://www.decisionsanddragons.com/posts/model_free_vs_model_based/</guid><description>&lt;p>In reinforcement learning, the agent is not assumed to know how the environment will be affected by its actions. Model-based and model-free reinforcement learning tackle this problem in different ways. In model-based reinforcement learning, the agent learns a model of how the environment is affected by its actions and uses this model to determine how to act. In model-free reinforcement learning, the agent learns how to act without ever learning to precisely predict how the environment will be affected by its actions.&lt;/p></description></item><item><title>About</title><link>https://www.decisionsanddragons.com/about/</link><pubDate>Tue, 26 Mar 2024 20:17:59 -0400</pubDate><guid>https://www.decisionsanddragons.com/about/</guid><description>&lt;p>Reinforcement learning (RL) is an elegant problem definition for autonomous agents that learn from their own interactions with an environment. But the methods to solve this simple problem definition are not so simple. To solve this problem you must simultaneously tackle many subproblems that are all complex enough to warrant their own subfields in AI, such as perception, prediction, planning, and memory.&lt;/p>
&lt;p>Unlike other forms of machine learning, we cannot feed an algorithm a well curated dataset. An agent must form its own data from interactions. Even worse, this data is temporally correlated and does not explicitly include the correct response. The agent must reason about its data to determine the correct response and it must actively explore the environment to ensure it has good data coverage. If that wasn&amp;rsquo;t hard enough, it must do all this even when it doesn&amp;rsquo;t have much data to go on. The world waits for no &lt;del>man&lt;/del> agent, and it must make do with what it has.&lt;/p></description></item><item><title>Math Notation Cheatsheet</title><link>https://www.decisionsanddragons.com/notation/</link><pubDate>Tue, 26 Mar 2024 20:17:59 -0400</pubDate><guid>https://www.decisionsanddragons.com/notation/</guid><description>&lt;p>In this section I outline the meaning of the mathematical notation I use. When appropriate (and possible), I also describe the meaning in simple python.&lt;/p>
&lt;h2 id="general-math-and-statistics">General math and statistics&lt;/h2>
&lt;h4 id="fx-triangleq-mx--b">$f(x) \triangleq mx + b$&lt;/h4>
&lt;p>The $\triangleq$ indicates that the expression on the left is &lt;em>defined&lt;/em> to be the expression on the right, rather than an equivalence that is derived from mathematical rules.&lt;/p>
&lt;h4 id="a-b">$(a, b)$&lt;/h4>
&lt;p>The set of real numbers between $a$ and $b$, excluding those values.&lt;/p></description></item><item><title>Revisions</title><link>https://www.decisionsanddragons.com/revisions/</link><pubDate>Tue, 26 Mar 2024 20:17:59 -0400</pubDate><guid>https://www.decisionsanddragons.com/revisions/</guid><description>&lt;p>I have a tendency to make a lot of typos. My brain reads what I meant, not what I typed. On an occasion, I may also make an error (:gasp:) or state something too imprecisely.&lt;/p>
&lt;p>I don&amp;rsquo;t have collaborators for this site to check for any kind of errors. Therefore, if you spot an error of any sort, please let me know by reporting it on my &lt;a href="https://github.com/jmacglashan/decisions_and_dragons/issues">Github issues page&lt;/a> or contact me some other way (see the &lt;a href="https://www.decisionsanddragons.com/about">about&lt;/a> page).&lt;/p></description></item></channel></rss>