Exploration, credit assignment & reward design
Make useful behavior discoverable and measurable.
Detailed technical articles are available in English and Chinese. This locale shows the English article with localized navigation.
Study guide & lesson outline
LEARNING CONTRACTUnderstand → implement → investigate
Goal: explain the mechanism in this lesson, reproduce one example and test a failure case. Reading alone does not mark mastery.
- Understand: state assumptions, shapes/units and a counterexample.
- Implement: reproduce a numerical example and inspect boundaries.
- Investigate: compare one alternative under a matched budget.
Understand the mechanism
Exploration determines which actions generate training evidence. Credit assignment determines which earlier choices receive credit for a later result. Sparse terminal rewards can be trustworthy but difficult to learn from. Dense intermediate rewards provide more signal but may introduce shortcuts. Separate the intended task utility from the implemented reward function and audit the gap.
Text / 原始公式
Task utility ≠ proxy reward Potential shaping: r′=r+γΦ(s′)−Φ(s) Policy-invariance claims require the relevant assumptions.
Mechanism map & worked derivation
| Symbol | Meaning |
|---|---|
| sₜ | Observed task context, not necessarily full environment state |
| aₜ | Selected tool action with explicit arguments |
| oₜ₊₁ | Returned observation, including errors |
- Use a two-arm bandit with unknown rewards. Greedy selection after a lucky first observation can stop collecting evidence about the other arm.
- For ε-greedy with two arms and
, a non-greedy arm is selected with probability 0.05 if exploration samples uniformly over both arms. State this convention. - For delayed rewards, construct two trajectories with the same final reward but different wasted actions. Decide whether task utility actually penalizes the extra actions before adding a cost term.
Separate mock control-flow tests from real-policy evaluation. A readable trace is not proof of external task completion.
Original exercise & analysis
For a coding agent, compare “number of tests passed” with “number of tool calls completed”. Construct an agent that maximizes each proxy without fixing the bug. Add hidden tests and a separate test-integrity check; keep the original task evaluation unchanged.
A reward metric improving faster than held-out task success is a warning sign, not proof of stronger intelligence.
Why not reward every intermediate step?
The agent may learn to produce more steps rather than finish the task. Dense rewards need a causal relationship to the desired outcome and independent validation.