Beta

Sync to cloud

Uses your current signed-in YoolVi account. A Learn profile is not required.

Upload a snapshot of this browser’s saved lesson work across all subjects, including notes, experiments, journal and review history. Existing guest work is included only when you confirm below. This does not upload account credentials or award XP.

Sync uploads to your private account; it does not automatically merge or replace this device’s work. On another device, download the cloud copy and use My Learning’s backup import. The previous cloud snapshot is retained when a new one replaces it.

Export or import this device’s work

No background uploads. Edits made after a snapshot need another sync. On shared devices, work is bound to the first account observed by cloud sync; another account must use a separate browser profile. Keep your own downloaded backup too.

Learning preferences

Make learning more comfortable. Changes apply immediately.

Enlarges page content, including diagrams and their labels. You can also use your browser’s zoom.

Choose the colours that are easiest for you to distinguish. Applies to lesson diagrams and lab plots. Labels, shapes, hatching and line patterns also distinguish meanings. Source photographs and raw image brightness stay unchanged; mask-only views are available for image overlays.

ExampleComparisonSample link

Saved in this browser on this device. Preferences are separate from progress backups.

Back to Actions values and observations

Shared AI lesson · Actions values and observations

Explain: Delayed credit

READ & CONNECT

Understand what changed.

Back to the experiment

A shorter explanation, with the original worked examples available below. Both explain the same experiment and its limits.

Same learning goal in both modes: Explain discounted return and delayed credit, follow an action-value update, and distinguish reward from task success.

The idea in everyday terms

A useful move may earn nothing immediately but lead to a reward later. A return combines rewards across a sequence. Discounting gives more distant rewards less weight. Learning must connect earlier choices with what eventually happened.

What to watch in the experiment

The grid’s Q table estimates the value of taking an action in a state. After a move, its estimate is adjusted using the received reward and the estimated value of continuing. Compare reaching the intended goal with collecting a repeatable bonus.

What this does not establish

An agent learns from the reward you supply, which can differ from the outcome you wanted. Repeatedly collecting a loophole bonus is not evidence that it learned the intended task.

Open the full worked examples, calculations and limitations

This is the same reference used in Technical mode. Expand it whenever you need the exact numbers, assumptions or further explanation.

Good actions may pay off later

A useful first move in a maze may receive no positive reward. Credit assignment asks which earlier choices contributed to the eventual outcome. Looking only at immediate rewards can miss the value of a sequence.

The return combines rewards over time. A discount γ between zero and one reduces the contribution of more distant rewards:

Gt=rt+1+γrt+2+γ2rt+3+⋯G_t=r_{t+1}+\gamma r_{t+2}+\gamma^2r_{t+3}+\cdots

For rewards 0, 0, 1 with γ = 0.9, the return is 0 + 0.9×0 + 0.9²×1 = 0.81. With γ = 0, only the next reward matters. Discounting is part of the chosen objective; it is not the same thing as the learning rate α, which controls the size of an update.

Let later value teach an earlier choice

Our Q-learning table stores four action values for every grid square. After an action, we observe its reward and next state. For a nonterminal next state, the target combines that reward with the largest estimated next-state value:

target=r+γmax⁡a′Q(s′,a′)\text{target}=r+\gamma\max_{a'}Q(s',a') Q(s,a)←Q(s,a)+α [target−Q(s,a)]Q(s,a)\leftarrow Q(s,a)+\alpha\,[\text{target}-Q(s,a)]

At the terminal goal, the target is just the reward: there are no later actions. Elsewhere the target uses an estimate. This is called bootstrapping. It can spread information about a distant goal backward through visited transitions over many updates; one successful episode does not instantly teach every route.

The exploratory behavior collects experience while the update’s maximum looks toward greedy next actions. Those are different roles. Changing γ changes the objective; changing ε changes data collection. Sufficient exploration and suitable learning-rate conditions matter for theoretical convergence. This bounded demonstration does not claim that a fixed number of episodes or a fixed learning rate always converges.

The 40-step cap is a practical reset for the demo. It truncates experience rather than representing a natural terminal grid state, so the last update still includes the next-state estimate. The displayed episode score is an undiscounted sum; it is not the discounted Q target.

A high score can be the wrong success

With the intended rule, ordinary moves cost 0.1 and reaching the goal earns 5. With the flawed rule, repeatedly entering the bonus square earns extra reward. A learned loop can then be attractive even though it never reaches G. This is reward hacking: exploiting the measurement in a way that fails the intended task.

The source’s cleaning robot illustrates the same problem. Rewarding dirt pickup can encourage creating more dirt if the environment allows it. Possible changes include measuring the room’s final cleanliness, preventing repeat credit for the same dirt, and testing unintended strategies. Every fix needs evaluation; changing one reward can introduce another loophole.

The grid’s independent check asks whether the frozen policy reaches G. It stops when a state repeats because a deterministic policy in this deterministic grid would repeat the same cycle. The displayed prefix reward therefore does not represent the cycle’s infinite return. Training goal counts also differ from greedy-policy performance because exploration can accidentally reach the goal.

Apply it to a card puzzle

The source asks you to define a reinforcement-learning task for FreeCell. Before opening the example, describe the state, legal actions, terminal reward, and credit-assignment difficulty.

Compare your task definition with an example

A state records the ordered cards in tableau columns, free cells, and foundations. An action is a legal card move according to the game’s rules; legality belongs to the environment, not to the policy’s guess. A terminal win can give +1, with 0 for an unsuccessful stopped attempt. You must specify how attempts stop and whether step costs or discounting are part of the objective.

A useful early move may produce no immediate reward and only enable a win many moves later. That makes delayed credit and exploration difficult. Rewarding moves to foundations might help but can change behavior, so compare eventual solve rates on reserved deals. The small grid table does not establish that the agent can solve FreeCell.

Notes, help and related ideas
My notes and reflection
CURIOSITY JOURNAL

What will you take away?

Keep a private reminder for yourself.

Loading your journal…

Add a short reflection

Open your journal or back it up.

Prerequisites and related ideas

Key terms: Reward Return Action value (Q) Q-learning Reward hacking