Skip to content
BIASED

Context and memory

Block 1 of 6~2 min

Append-only and the budget

The ReAct loop appends every thought, action and observation. With prefix ss and dd tokens per step, step tt reads Lt=s+(t−1)dL_t = s + (t-1)d, so a whole run of TT steps costs

∑t=1TLt=Ts+d T(T−1)2\sum_{t=1}^{T} L_t = T s + d\,\frac{T(T-1)}{2}

input tokens — quadratic in TT. For s=3000s=3000, d=1500d=1500, window W=128000W=128000 with 4000 reserved for the reply, the last fitting step is t=81t=81; eighty steps already read about 4.98 million tokens, and the last step alone reads 121 500. Three failures arrive together: the run hits the window, each later step is more expensive, and (next) the model uses a long context worse than a short one.

Key idea. Treat the context as a budget the runtime spends on purpose: only what the next step needs, in an order the model and the cache can use, with old material summarised and anything that must survive moved to a store outside the window.

Answers are saved on the server and tied to this browser until you sign in.