Ask HN: How well do you understand what's going on inside RL?

Reinforcement learning: you see it all the time in the context of LLMs and chess agents. We often hear that it trains on rewards without labeled data, but how much of the actual algorithms under the hood could you explain?

8 points | by natsu529 1 hour ago

2 comments

  • twoCoffees 1 hour ago
    Original comment: its all literally bellman

    Edit: It all boils down to applying the Bellman equation on an MDP to estimate the values of certain actions in certain states. The classical techniques range from explicit solving of finite MDPs via dynamic programming to DL stuff like DQNs. There are of course many more recent developments like PPO, GPPO etc. but the main idea and problem stays the same - what learning architecture and approach is best at solving the credit assignment problem which is fundamental in RL, and is also what makes it hard.

    • natsu529 1 hour ago
      Credit assignment is exactly the part I find hardest to build intuition for. Do you have a favorite resource on it?
      • twoCoffees 59 minutes ago
        Well the reference works were my favorites - Reinforcement Learning: An Introduction (Sutton & Barto) and Reinforcement Learning: State-of-the-Art (Wiering, Otterlo).

        I was a bit incomplete in the previous answer. The reason why RL is hard is not just credit assignment - in finite MDPs you solve that explicitly, but only because you full know the MDP. In actual MDP you DO NOT know the MDP (model free) and then think about how that changes the paradigm.

        In supervised learning you know the target, in unsupervised you discover structure based on some priors, but in RL your prior is so general (nondeterministic state transitions under nondeterministic actions for nondeterministic rewards) that the learning problem is just damn hard in and of itself.

        You might not know how many relevant states in the environment you should discriminate against and on the basis of what. You don't know how your actions work in these states because you don't even know how many states there are and you can't reasonably try every possible action in every possible state, and therefore you do not know the underlying environment dynamic. You are shooting at a target that is moving with you even when the environment is static. Your estimates are uncertain to say the least so you have to do a lot of Monte Carlo stuff, but that can be expensive, takes a long time, has high variance etc. The rewards themselves might not be deterministic, your data (experience) is not i.i.d., the environment might be inaccessible and expensive to sample, and I mean the list goes on and on.

        One of the main reasons why RL post-training works good for coding and math is that these are self contained and verifiable - you can think of every next symbol as an action producing, your state can be simply the character sequence up until now, and your reward can be stuff like whether the thing compiles, improves on a certain metric etc.

        • natsu529 41 minutes ago
          Thanks, this is super helpful. I hadn't thought much about the fact that you don't know the MDP in practice. Starting with Sutton & Barto.
    • natsu529 1 hour ago
      Haha, mostly. Q-learning/DQN are basically Bellman updates.
  • natsu529 1 hour ago
    [dead]