Notes

Stochastic Environment

A stochastic environment has built-in unpredictability. You can take the same action in what appears to be the same situation and still get a different next state, reward, or both—not because the agent made a mistake, but because chance is part of the world.

What the randomness means
Technically, the environment is described by a probability distribution: P(next state, reward | current state, action). Rather than mapping an action to one guaranteed outcome, it assigns probabilities to possible outcomes. A warehouse robot might command “move forward” and usually advance one metre, but occasionally slip, be delayed by another robot, or stop short. A trading action can lead to different returns even under identical signals because the market changes.

Learning from samples, not guarantees
The agent never gets the full probability distribution directly. It experiences individual samples from it and must learn what works on average. This is why reinforcement learning estimates expected return rather than trusting a single lucky or unlucky result. In a stochastic environment, a good action can produce a poor outcome once; that does not make it a bad action.

  • DQN reduces this uncertainty by repeatedly sampling experience and learning average action values.
  • PPO collects many trajectories, so its policy update reflects patterns across variable outcomes rather than one rollout.
  • Evaluation therefore uses several episodes and reports a mean and spread, not just the highest observed score.

Why it changes the problem
Randomness makes exploration and credit assignment harder: a reward drop could come from a weak decision or plain bad luck. It also exposes brittle policies. An agent trained only in a deterministic simulator can memorize a precise action sequence, then fail when friction, delays, or opponent behaviour vary slightly in deployment. Good RL practice builds relevant variation into training—for example, randomizing MuJoCo physics parameters—and evaluates across random seeds. Crucially, stochastic environment is different from a stochastic policy: the former means the world is random; the latter means the agent deliberately randomizes its action choices. Both can exist at once, and separating them helps diagnose whether failure comes from uncertainty in the world or inconsistency in the agent’s decisions.

A stochastic environment is one in which the same state and action can lead to different next states or rewards according to a probability distribution. Randomness may arise from the environment itself, other agents, or noisy outcomes. It matters because an RL agent must learn policies that maximize expected return, estimate uncertainty from repeated experience, and remain effective despite unpredictable transitions and rewards.

Imagine practising basketball outdoors: you can take the same shot from the same spot, but a gust of wind, a slippery ball, or a tiny change in your movement can make the result different each time. You cannot count on identical actions producing identical outcomes.

A stochastic environment is like that for a learning system. Its choices matter, but chance also affects what happens next and what reward it receives. A delivery robot may choose the best route, for example, yet still encounter unexpected traffic. This matters because the system must learn habits that work well on average, not expect perfect, repeatable results every time.