Concepts / State Aggregation

State Aggregation

The history of function approximation in reinforcement learning includes gradient-descent methods, bootstrapping, state aggregation, and convergence analysis.

  • Programming

Why Approximate Values

Reinforcement-learning problems can contain many possible states. A separate learned value for every state can therefore become difficult to organize. Function approximation addresses this challenge by representing values with a smaller set of adjustable components. It also supports generalization: related states can share information through the approximation instead of being treated as completely unrelated cases.

State aggregation is an early function-approximation technique. It compresses a large state space into group-level value estimates. Instead of storing 1000 independently learned values, a representation can assign those states to groups and store one estimated value for each group.

A Short Historical Line

The development of function approximation in reinforcement learning was not one single invention. It brought together several related ideas: gradient-descent methods for adjusting approximations, bootstrapping methods such as semi-gradient TD(0), state aggregation for organizing states compactly, and mathematical results about when linear TD(0) converges.

The least-mean-square algorithm, or LMS, introduced by Widrow and Hoff in 1960, is described as the prototypical incremental gradient-descent algorithm in the source.

Sutton's early work on semi-gradient TD(0) established an important bootstrapping direction in reinforcement learning. Later convergence analysis addressed when linear TD(0) converges, although the specific conditions and results are not detailed in this source pack.

Mapping States to Groups

Imagine a prediction problem with 1000 possible states but only 10 stored numbers. State aggregation assigns each state to one group. Every state mapped to that group uses the group's estimated value. A state therefore does not receive an independently learned value; it borrows the value associated with the group containing it.

maps tomaps tomaps tousesState 201Group 3states 201–300Group valueone shared estimateState 250State 300
Which individual states belong to the same aggregated group, and how does that group share one estimated value?

Locating state 250

Which stored value represents state 250 when states 1 through 1000 are divided into 10 consecutive groups of 100 states?

Find the group: The third group covers states 201 through 300.

Use the shared estimate: State 250 uses the value stored for the group covering states 201 through 300.

Apply the representation rule: States 201 through 300 all use that same group-level estimate, so state 250 has no separate stored component.

State 250 is represented by the single value for the 201-through-300 group.

The 1000-State Walk

The source task uses states numbered 1 through 1000 from left to right. Each episode starts near the middle, at state 500. From the current state, the agent can move to one of the 100 states on the left or one of the 100 states on the right, with equal probability. Near an edge, some of those neighboring states do not exist; the probability assigned to missing neighbors instead becomes a probability of terminating on that side.

walk continuespossible movementpossible movementwalk continuesLeft terminalreward -1States 1–100group 1State 500episode startRight terminalreward +1States 901–1000group 10
How are the 1000 states arranged between the terminal states, and how does an episode move through this chain toward a terminal reward?
EventReward or consequence
Termination on the left-1
Termination on the right+1
A non-terminating transition0

Rewards in the 1000-state random-walk task

A state's value reflects how the random walk tends to end when it begins from that state. The task uses 10 consecutive groups of 100 states: group 1 contains states 1 through 100, group 2 contains states 101 through 200, and the pattern continues through group 10.

One Update, One Group

The current state's group determines both the estimate used and the component updated. If the current state is 250, the relevant group is the group for states 201 through 300. An update associated with state 250 changes that group's component, so the revised estimate applies to every state in that same group.

belongs toselectsshared effectState 250visited stateGroup 3states 201–300Group 3 valueupdated componentStates 201–300use revised estimate
When one state is visited, how does the update flow through its group and change the value used for all states in that group?

This update is local in the parameter representation but shared in its effect on states. In the stochastic-gradient description, the gradient is 1 for the current state's group component and 0 for every other component. Thus, the update selects one group component rather than changing all group values.

Why the Graph Has Steps

A state-by-state value function could change from one state to the next. State aggregation cannot express those individual changes inside a group, because every state in that group shares one estimate. When the estimates are plotted across all 1000 states, each group appears as a flat section. At a group boundary, the estimate can change abruptly, producing the characteristic staircase shape.

shares across groupshares across groupshares across groupGroup 1states 1–100One valueflat sectionGroup 2states 101–200One valuenext flat sectionGroup 3states 201–300One valuenext flat section
Why does assigning one value to each group produce flat steps instead of a separate smoothly changing value for every state?

The staircase is not necessarily a failure of learning. It is a visible consequence of the representation: the model has only one adjustable value available for each group.

Gradient Monte-Carlo with Groups

The reported experiment applied gradient Monte-Carlo learning to the 1000-state task using the 10-group representation. The learning process adjusted the group-level estimates rather than creating 1000 separate estimates. Because an episode ends with either the left terminal reward of -1 or the right terminal reward of +1, the episode outcome supplies the task's learning signal for the values represented by the visited groups.

ends atprovidesadjustsEpisodevisited statesTerminal reward-1 or +1Episode returnlearning signalVisited groupsshared components adjusted
How does the terminal return provide an error signal that adjusts the shared value for the visited aggregate?

After 100,000 episodes with a step size of α = 2 × 10^-5, the learned approximate value function was close to the global minimum of the mean squared value error. It still displayed the staircase pattern, because the representation permits only one value per group.

Common Mistakes

  • Treating state aggregation as if it stored one independent value for every state.

    The representation stores one value for the entire group containing states 201 through 300.

    Fix: First identify the current state's group, then use that group's shared component.

  • Assuming an update for state 250 affects only state 250.

    The updated component is shared by every state mapped to that group.

    Fix: Describe the update as changing the group component and therefore the estimate used by all states in that group.

  • Interpreting the staircase graph as proof that learning failed.

    The aggregated representation cannot express separate within-group values.

    Fix: Recognize the flat sections and jumps as consequences of the ten-group representation.

  • Confusing a terminal reward with the reward on every transition.

    A non-terminating transition gives reward zero; the terminal rewards occur at the left and right ends.

    Fix: Keep the reward assignments separate: left termination is -1, right termination is +1, and non-termination is 0.

Check Your Understanding

EASY

In the 10-group representation, suppose the current state is 275. Identify the group whose component is used, explain which states share the revised estimate after an update, and state why the resulting graph has a flat section across those states.

Hints
  • Locate state 275 among the consecutive groups of 100 states.
  • An update changes the component for the current state's group.
  • All states in that group use the same component.
MEDIUM

Explain why gradient Monte-Carlo learning can approach a low mean squared value error in the reported experiment while still producing a staircase-shaped value function.

Hints
  • Separate the quality of the learned group estimates from the detail allowed by the representation.
  • Recall that the experiment used 10 groups for 1000 states.
  • A group has only one estimated value.

Key Takeaways

  1. Function approximation and generalization help reinforcement learning organize value information across large state spaces.
  2. State aggregation maps many states to one group-level value, reducing 1000 state components to 10 in the random-walk example.
  3. The current state's group determines both the estimate used and the component updated; the update is local to that component but shared by all states in the group.
  4. The 1000-state task has terminal rewards of -1 on the left and +1 on the right, with zero reward for non-terminating transitions.
  5. The staircase graph is an expected consequence of grouped representation, and the historical context includes LMS, semi-gradient TD(0), state aggregation, and convergence analysis for linear TD(0).

Key Takeaways

  • State aggregation compresses a large state space by assigning many states to shared groups.
  • A visited state's group supplies its estimate and receives the update, so the change is shared across every state in that group.
  • In the 1000-state random walk, ten groups represent the states, with terminal rewards of -1 and +1 at opposite edges.
  • The grouped representation produces flat sections and abrupt jumps, creating a staircase-shaped value function.
  • Gradient-descent methods, LMS, semi-gradient TD(0), state aggregation, and linear TD(0) convergence analysis form connected parts of the history of function approximation in reinforcement learning.