Skip to content
BIASED

The language model as a policy

Tokens and turns, prompting as conditioning, temperature, the cloning prior, and gaps before a good agent.

A prior, not randomness

Model-based RL (previous note) still started from a blank policy and improved it over huge numbers of episodes. A language model arrives with a prior: after pretraining and instruction tuning it already puts mass on plausible next moves. With a GPT-2 vocabulary, 50,2578≈4.07×103750{,}257^{8}\approx 4.07\times 10^{37} strings of length 8; a uniform policy never finds search[Dunmore]. Key idea. An LM is already a stochastic policy πθ(w∣w<j)\pi_\theta(w\mid w_{<j}). Write history into the context, parse a span of the generation as an action, and you have the agent function of What an agent is.

Tokens and turns

Two levels. Turn level: a POMDP — observation oto_t is text, action is a string yy mapped by a parser ϕ\phi to a∈Aa\in\mathcal A or invalid, with

π(a∣ct)=∑y:ϕ(y)=aπθ(y∣ct).\pi(a\mid c_t)=\sum_{y:\phi(y)=a}\pi_\theta(y\mid c_t).

Token level: each next token is an action, the prefix is the state, reward arrives at the end — the MDP used when training LMs with RL. The context ct=template(instructions,ht)c_t=\mathrm{template}(\mathrm{instructions},h_t) stands in for a belief; the window is the limit (Context and memory).

Prompting as conditioning

Changing the prompt changes πθ(⋅∣c)\pi_\theta(\cdot\mid c) without changing θ\theta. The system prompt states the task; few-shot demos select a latent behaviour (after nn examples with likelihood ratio 44, P(k1∣c)=1/(1+4−n)P(k_1\mid c)=1/(1+4^{-n}) hits 0.80.8, 0.9410.941, 0.9850.985); the chat template separates roles — and observations can inject instructions (Agent security). In the vacuum toy, one extra sentence about waiting raises score from ≈1.495\approx 1.495 to ≈1.760\approx 1.760 by selecting a different agent program.

Temperature

Temperature divides logits: Pτ(w)∝exp⁡(zw/τ)P_\tau(w)\propto\exp(z_w/\tau). Low τ\tau is nearly deterministic but can loop; τ≈1\tau\approx 1 is for diverse samples; high τ\tau inflates the invalid tail. With logits Right 33, NoOp 1.51.5, Suck 11, Left 0.50.5 and 10001000 junk tokens at −8-8, invalid mass is ≈0.011\approx 0.011 at τ=1\tau=1 and ≈0.658\approx 0.658 at τ=2\tau=2. Temperature 00 is still not bitwise deterministic on a shared GPU batch.

The cloning prior

Pretraining is behaviour cloning of writers; instruction tuning clones an assistant (including tool calls). The KL-regularized optimum reweights the prior: π⋆(a∣c)∝π0(a∣c)exp⁡(r/β)\pi^\star(a\mid c)\propto\pi_0(a\mid c)\exp(r/\beta). With π0=(0.6,0.3,0.1)\pi_0=(0.6,0.3,0.1), rewards (0,1,0)(0,1,0), β=0.5\beta=0.5, one gets π⋆≈(0.206,0.760,0.034)\pi^\star\approx(0.206,0.760,0.034) — unreachable actions stay at zero. Free-form plans can read well yet fail grounding (VirtualHome: 7.79%7.79\% executable before mapping to admissible actions).

What is still missing

Still missing for a good agent: grounding (schemas, constrained decoding, SayCan-style affordances), feedback (observe results in context or train on rewards), and memory beyond the window. Inside the policy, hard reasoning needs room to write intermediate tokens — next: chain of thought.

Check your understanding

The same questions as in Pulse. Answers are shared between modes.

Full notes

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