Computation, Not Memory: Chain-of-Thought and State Tracking in LLM Agents
Organizations: University of Toronto
Abstract
Language-model agents often reason before they act, and the value of monitoring that reasoning depends on how it relates to their actions. We ask how an agent's actions depend on its reasoning when the correct action depends on a changing state. In a small file-system task, background events announce which file's lock has been toggled but not its new value. The agent therefore has to reconstruct the current locks from its history before it can move files safely. With Qwen3-8B and Qwen3.5-9B, we separate two roles of reasoning: generating it before each action, and retaining earlier reasoning in the prompt. Most of the reduction in lock-violating commands comes from reasoning written at the moment of action. Retaining earlier reasoning adds little to rule-following, although it helps one model complete the task. The benefit depends on what the reasoning says. Filler text, reasoning written for another history and an accurate table of the state do not reproduce it. When we give the agent reasoning written for a history that differs in one lock value, the agent acts on that reasoning even against its own history. Without reasoning, linear probes recover the state from the model's activations about as well as a text classifier recovers it from the transcript. However, decoding accuracy does not predict which interventions change the agent's actions. In this setting, the benefit of reasoning for rule-following comes mainly from generating it at each step. The state that can be decoded without reasoning is a limited guide to how the agent acts.
Figures & tables
| Model | Arm | AUROC | Viol./Att. | Rate per attempt (%) | Viol. per 100 prompts |
|---|---|---|---|---|---|
| Qwen3-8B | no reasoning | 0.866 | 21/43 | 48.8 [34.0, 64.1] | — |
| filler | 0.847 | 27/58 | 46.6 [32.8, 60.4] | [ , 3.4] † | |
| other-history reasoning | 0.572 | 23/28 | 82.1 [65.6, 95.5] | [ , 3.3] † | |
| state table (oracle) | 1.000 | 32/101 | 31.7 [22.8, 41.3] | [0.5, 5.1] | |
| own reasoning | 0.935 | 3/52 | 5.8 [0.0, 13.0] | [ , ] | |
| Qwen3.5-9B | no reasoning | 0.759 | 21/52 | 40.4 [27.1, 53.1] | — |
Appendix figures & tables24 assets
Supplementary material from the paper’s appendix.
Appendix
| Model | Condition | Violations / attempts | Rate % [95% CI] | Attempts / episode |
|---|---|---|---|---|
| Qwen3-8B | direct/cmd | 130 / 570 | 22.8 [19.5, 26.2] | 1.14 |
| think/cmd | 14 / 737 | 1.9 [1.0, 3.0] | 1.47 | |
| think/body | 17 / 740 | 2.3 [1.2, 3.5] | 1.48 | |
| think/full | 10 / 696 | 1.4 [0.6, 2.4] | 1.39 | |
| Qwen3.5-9B | direct/cmd | 72 / 474 | 15.2 [11.6, 18.8] | 1.58 |
| think/cmd | 20 / 415 | 4.8 [2.8, 7.0] | 1.38 |
| Model | Condition | Strict success | Stricter | Goal locked | Logs left | Archived | Lock on log |
|---|---|---|---|---|---|---|---|
| Qwen3-8B | direct/cmd | 0.44 | 0.34 | 0.75 | 0.29 | 0.82 | 0.40 |
| think/cmd | 0.76 | 0.76 | 0.87 | 0.09 | 1.43 | 0.00 | |
| think/body | 0.74 | 0.74 | 0.87 | 0.09 | 1.43 | 0.00 | |
| think/full | 0.76 | 0.76 | 0.86 | 0.11 | 1.36 | 0.00 | |
| Qwen3.5-9B | direct/cmd | 0.35 | 0.35 | 0.57 | 0.34 | 1.10 | 0.00 |
| think/cmd | 0.53 | 0.53 | 0.72 | 0.23 | 1.28 | 0.00 |
| Qwen3-8B (114 pairs) | Qwen3.5-9B (104 pairs) | ||||||
|---|---|---|---|---|---|---|---|
| History | Reasoning written for | Moves | Moves | ||||
| locked | locked version | 0 | 8.7 | 0 | 4.3 | ||
| locked | unlocked version | 43 | 41 | 1.5 | |||
| unlocked | locked version | 0 | 5.4 | 0 | 3.2 | ||
| unlocked | unlocked version | 45 | 41 | 0.8 | |||
| Lock variable | Layer | Probe | Shuffled labels | TF-IDF | Last value | Replay |
|---|---|---|---|---|---|---|
| alpha.log | 16 | .792 | .504 | .754 | .774 | 1.000 |
| beta.log | 4 | .800 | .465 | .792 | .788 | 1.000 |
| gamma.log | 12 | .762 | .490 | .751 | .776 | 1.000 |
| report.txt | 20 | .811 | .501 | .803 | .703 | 1.000 |
| Mean | .791 | .490 | .775 | .760 | 1.000 |
| Run | Model | Conditions | Episodes | Budget | Context | At budget | Max tokens | GPU time |
|---|---|---|---|---|---|---|---|---|
| Main (chat) | Qwen3-8B | 3 think + direct | 500 | 4,000 | 32,768 a | 2.7–6.9% | 13,571 | 5.4 h |
| Second run (chat) | Qwen3-8B | 3 think + direct | 300 | 2,500 | 24,576 | 6.8–28.7% | 10,357 | 2.8 h |
| Second model (chat) | Qwen3.5-9B | 3 think + direct | 300 | 1,200 | 16,384 | 2.0–4.8% | 7,752 | 0.8 h |
| Plain text | Qwen3-8B | think/cmd, think/full, direct | 300 | 1,200 / 400 | 16,384 | 1.8% / 15.8% | 3,779 | 0.2 h |
| Plain text | Qwen3-8B-Base | think/cmd, think/full, direct | 300 | 400 | 16,384 | 1% | 1,408 | 0.1 h |
| Scale (chat) | Qwen3-0.6B–14B | think/body + direct | 300 | 2,500 | 24,576 | 4.9–29.2% | 3,028 | 2.0 h |
CoT Reasoning
Chain-of-thought (CoT) reasoning studies how language models use intermediate steps, visible or latent, to solve multi-step tasks.
See all 223 papers