Digital and Software Environments › Long-Horizon Task Simulation
World Models HandbookAll chapters Digital and Software Environments › Long-Horizon Task SimulationOne section · Sections in this chapter4 / 9 ↓
Reading tools Definitions & inline links
Choose your expertise level to adjust how many terms are explained. Beginners see more tooltips, experts see fewer to maintain reading flow. Hover over underlined terms for instant definitions.
Article links
Make inline references clickable
Our issue-tracker task uses three actions. Real workflows can contain many more, including branches and dependencies: create a ticket, identify a duplicate, update the assignee, then verify the final record. The exact action count depends on the interface and task definition. Long-horizon simulation asks how prediction errors affect that sequence, not just whether the final screen looks plausible.
The reason long horizons are hard is compounding error. Suppose a transition model has per-step accuracy , defined as the probability of predicting a single step correctly, and per-step error probability , defined as the complementary probability that the model predicts a single step incorrectly. These two quantities are related by:
where:
- : the probability that the model predicts a single step correctly
- : the per-step error probability, defined so that
If correctness events were independent with the same probability , the probability of tracing steps correctly would be
since each of the steps must succeed independently. Here is the rollout horizon (the number of steps in the trace). The intuition is simple: every step is an independent chance to be wrong, and the chance of getting every one of steps right is the product of their individual success probabilities. With : we can compute this quantity for ten-step and fifty-step rollouts:
where:
- : the per-step success probability of the transition model, equal to
- : the per-step error probability; for , the model is wrong about one in every twenty steps
- : the probability that a rollout of steps is traced correctly under the assumption that step errors are independent
- : the rollout horizon, i.e. the number of steps in the trace
Under this independent, constant-probability model, nineteen out of twenty correct predictions per step still yield a low chance of an entirely correct long trace. At fourteen steps the probability of at least one error is about fifty-one percent; at fifty it is about ninety-two percent. These are clean-prediction probabilities, not task-success measurements. A real model's errors can be correlated and concentrated on decisive actions, so a measured marginal one-step accuracy cannot generally be exponentiated. For example, if an entire episode is either wholly correct or wholly wrong, every step can have marginal accuracy while the all-correct episode probability remains , not .
The same product can be plotted directly instead of evaluated at two points. The next cell evaluates on a horizon grid and records the ten-step and fifty-step checkpoints that the chapter quotes. The chart cell that follows only renders those precomputed values.
import numpy as np
# Closed-form evaluation of the independent-error product (1 - eps)^k.
# No sampling is involved, so no random seed is required. The three error rates
# span an optimistic regime (0.01), the chapter's working value (0.05), and a
# pessimistic regime (0.20). The horizon grid runs from one to one hundred
# steps, and the checkpoints are the ten-step and fifty-step horizons quoted in
# the text.
error_rates = [0.01, 0.05, 0.20]
horizons = np.arange(1, 101)
success_curves = {eps: (1.0 - eps) ** horizons for eps in error_rates}
checkpoints = [10, 50]
Where the Errors Compound
The independent product is an illustration, not a bound on actual software tasks. Three mechanisms deserve separate attention.
First, an incorrect predicted observation can redirect planning. If a model treats an unfilled field as filled, later predictions may use an incorrect state estimate. This can propagate through an autoregressive rollout, but need not corrupt every later prediction: dynamics, new observations, and policies can attenuate or correct the error. Interleaving observations helps only when they expose the relevant discrepancy.
Second, some effects cannot be reversed by a simple inverse action. A completed order may require cancellation or a refund, which is a new workflow rather than a reset. For high-impact actions, verify preconditions, permissions, and user authorization before acting as well as checking effects afterward; post-hoc detection cannot undo all harm.
Third, queues, caches, and webhooks can delay effects beyond the immediate response. Include pending events and timing in the full state when modelling them. Delayed consequences can make a screen-only representation non-Markovian without contradicting a sufficient full-state Markov model. They also complicate credit assignment and the choice of when a verifier should check.
These mechanisms concern different failures: propagation of a mistaken estimate, costly recovery from an irreversible effect, and incomplete observation of delayed work. A single drift score cannot diagnose all three.
Snapshots, Reset, and Replay
In a controlled local environment, snapshots and replay can support inexpensive branching. A valid snapshot contains all relevant state within the controlled boundary, including pending work, time conventions, and random-generator state when needed. Restoring only a database is insufficient if an external queue or client buffer still differs. Chandy and Lamport's distributed snapshot algorithm illustrates why process and channel state both matter. With that qualification, a branch samples
where:
- : the next state sampled on the counterfactual branch
- : the true transition kernel
- : the fixed snapshot state
- : the alternative action replayed from the snapshot
This compares alternative actions from an equivalent controlled starting condition. As discussed earlier in Part VII, it can support search and belief-space planning. Snapshot storage and replay still have a cost, and experimental isolation is part of the design rather than an automatic property of software.
A production snapshot cannot retract an email or erase a payment's external consequences. Some internal changes are reversible, while others need compensating workflows, audit records, or approval. The reliable-world-model discussion in Part XII builds on this boundary between controlled experimentation and real intervention.
Hierarchical Decomposition
One way to organize a checkout flow is as a sequence of milestones with local actions beneath them. "Open the cart" and "confirm shipping address" can be separate milestones. The useful boundaries depend on the application and task; the analogy does not establish how every human or agent plans.
If a task has milestones with about actions each, a planner can make local rollouts of roughly actions rather than one rollout of . This reduces the horizon of an individual planning call, not the total number of actions or the probability of an entirely error-free task. Local repair works when milestone boundaries are meaningful and errors do not invalidate earlier dependent work. Milestone outcomes and high-level decisions can themselves be uncertain. See the earlier hierarchical planning discussion in Part VII.
Interface structure can suggest milestones, preconditions, and postconditions. Using that structure may reduce a planner's search space. Whether it reduces data requirements or improves task completion is an empirical question, especially when the documented flow omits exceptions.
Reset and Verification Together
Verification and local replanning address different parts of the loop. A reliable observation can correct the variables it reveals; replanning can change the actions chosen from that revised belief. Neither repairs hidden variables automatically. The verification schedule should reflect information quality, action risk, and cost.
An agent can alternate prediction, action, observation, correction, and replanning instead of committing to one long imagined trajectory. This can limit uncorrected drift in observed variables. It is not a guarantee of stability for arbitrarily long tasks: missed effects, unavailable evidence, repeated errors, and unrecoverable actions remain possible.
The next calculation isolates one limited benefit: under independent errors with probability 0.05 per step, a segment of steps is more likely to be predicted cleanly when is shorter. It does not calculate the success of a hundred-step task. If every one of those hundred predictions must be correct, then splitting them into twenty five-step segments still gives . Task success with correction additionally depends on detection, repair, cost, and the consequences of mistakes.
# Independent, constant-error illustration: these are clean segment
# probabilities, not whole-task success probabilities under correction.
task_horizon = 100
verified_epsilon = 0.05
verify_intervals = [1, 2, 5, 10, 25, 50, 100]
interval_success = {
v: (1.0 - verified_epsilon) ** min(v, task_horizon)
for v in verify_intervals
}
no_verification_success = (1.0 - verified_epsilon) ** task_horizon
segmented_full_clean = interval_success[5] ** (task_horizon // 5)
assert np.isclose(segmented_full_clean, no_verification_success)