Paper · 2025-12-21 · cs.CL
From Word to World: Can Large Language Models be Implicit Text-based World Models?
Treats an LLM as a text-world simulator: given the dialogue history and the action, it predicts the next observation and a success flag. Fine-tuned Qwen2.5-7B reaches 99.87% (ALFWorld) and 98.60% (SciWorld) exact-match next-state accuracy, with consistency ratios of 0.91 to 0.96 on three structured environments. Author-reported agent gains: action checks, synthetic data, RL warm-starts.
World modelLLM agentNeural scaling lawsworld-modelagent-trainingevaluationtext-environments
arXivPDFCodeMarkdown12 min read
AI-compiled by claude-haiku-5-5 on 2026-10-19, not yet reviewed by a human. Every claim cites its source; check it when a detail matters.
In plain words
Agents learn by acting, but acting in real environments is slow, limited and hard to scale. A world model is a stand-in: it predicts what the environment would say back after an action, so an agent can practise or check a move without touching the real thing. This paper asks whether a large language model can play that stand-in role for text-based environments such as household tasks, science labs, text adventures and online shopping. The model reads what happened so far and the agent's latest action, then writes the next message the environment would show.
The authors test three things: whether the simulator is accurate step by step, whether its accuracy holds over long sequences and as data and model size change, and whether it helps an agent. It helps most where the environment rules are regular. It is weaker in open-ended settings, and it drifts when the agent behaves differently from the agents whose logs trained it.
TL;DR
- Treats next-state prediction in a text environment as a language-modelling task and fine-tunes a base LLM on logged agent-environment dialogues §3.1 §4.
- A fine-tuned Qwen2.5-7B is near-exact on ALFWorld and SciWorld, lower on TextWorld and WebShop, and is only partly accurate on StableToolBench tab. 1.
- Long rollouts stay consistent on structured environments, but drop on WebShop tab. 2.
- The authors report that world-model data and warm-starts help agents. These gains are shown as figures and a verification table, and the paper gives no table of numbers for the synthetic-data and warm-start gains §7 fig. 6 fig. 7.
- Weigh it as a study with author-reported results. The repository holds evaluation and data-construction scripts, not the training code.
Problem
Agentic RL needs many diverse environments, but real ones are non-adaptive, hard to scale and cover few situations §1. A world model could supply simulated experience, yet it is unclear whether an LLM can serve that role reliably or when it is accurate enough to help §1.
The paper restricts itself to text environments, which give a controlled setting §1. Two assumptions matter. First, text environments are partially observable: the agent sees only part of the state, so the world model may be given a fuller initial context §3.1. Second, the paper evaluates consistency over multi-turn trajectories, not single steps only §3.1 §4.
Method
Formal setting. The agent follows the ReAct pattern. At step n it reads the initial observation and the history of reasoning, actions and observations, then emits a reasoning trace and an action §3.1 eq. 1. The world model is the complementary map: from the initial observation and the agent's actions it returns the next state and a binary reward, where 1 means task success and 0 means unfinished or failed §3.1 eq. 2. Running the two together gives a world-model trajectory §3.1 eq. 3 eq. 4. The real environment yields a reference trajectory eq. 5, against which the world model is scored §3.1.
Training. Each real trajectory becomes a dialogue in which agent actions and environment responses alternate §4 Training eq. 5. The world model is fine-tuned with supervised learning to predict the next environment response from the dialogue history and the current action [§4 Training]. The paper does not state whether loss is computed on every turn or only on the environment turns; the released data files were not in the repository (see Paper vs code).
Initial context. For ALFWorld and SciWorld the world model receives the full initial state as well as the task text, since random initialisation otherwise makes next states hard to predict even for humans §4 Initialization Context app. A.4. TextWorld exposes only part of its initial state. WebShop and StableToolBench are open-ended and receive no initial state [§4 Initialization Context] app. A.4.
Fidelity metric. Given a real prefix, the model predicts the next state and reward. A prediction counts as correct only when the pair matches the ground truth exactly §4 Metrics. On TextWorld this is a lower bound because several surface forms can describe one state. On StableToolBench the authors also report word-level F1 §4 Metrics tab. 1.
Consistency metrics. An agent is run in three settings: (1) the real environment (Real), (2) the world model (WM), and (3) real environment with the world-model actions replayed (W2R). The consistency ratio is CR = W2R / Real §4 Metrics. CR can exceed 1 when world-model rollouts succeed more often than real ones §4 Metrics.
Agent utility. Three uses are tested. First, pre-execution checks: before an irreversible WebShop checkout the agent simulates the outcome in the world model and executes only if the prediction is success, with verification budgets of 0, 2, 4, 10 and 50 §7 tab. 4. Second, synthetic trajectories: 1,000 successful trajectories from the real environment and from the world model are compared as SFT data §7.1 app. A.2. Third, warm-starts: a world-model-style SFT stage (WM-SFT) runs before agent SFT and RL §7.2 app. A.3.
# World-model rollout [§3.1] [eq. 1] [eq. 2] [eq. 3]
# Input: agent_history, wm_history (both start with the system prompt)
# Output: 1 if the world model signals success, else 0
def rollout(agent_history, wm_history, max_steps):
# Start from the first observation shown to the agent [§3.1]
observation = agent_history[-1]["content"]
for step in range(max_steps):
# Agent writes its reasoning and action [§3.1] [eq. 1]
# [code: scripts/interact_with_world_model/run.py#L155-L157]
reasoning, action = agent_react(agent_history, observation)
# World model answers with the next observation [§3.1] [eq. 2]
# [code: scripts/interact_with_world_model/run.py#L157]
observation, done = world_model_step(wm_history, action)
if done:
return 1
return 0# Next-state exact match [§4 Metrics]
# Input: real prefixes and the ground-truth next message for each
# Output: accuracy pooled over all prefixes
def next_state_accuracy(prefixes, ground_truths):
# Greedy decoding: one prediction per prefix [§4 Metrics]
# [code: scripts/single_step_accuracy/run.py#L85-L92]
predictions = [generate_greedy(p) for p in prefixes]
# A prefix is correct only if the stripped texts are identical
# [code: scripts/single_step_accuracy/run.py#L102]
correct = [
pred.strip() == truth.strip()
for pred, truth in zip(predictions, ground_truths)
]
return sum(correct) / len(correct)# Replay world-model actions in the real environment (W2R) [§4 Metrics]
# Input: world-model action sequence for one item, real environment
# Output: 1 if the real environment reaches a successful end
def replay_in_real_env(actions, real_env):
# Send each action in order
# [code: scripts/interact_with_world_model/cal_wm2real.py#L169-L170]
for action in actions:
result = real_env.step(action)
# Stop as soon as the real environment reports the episode is done
# [code: scripts/interact_with_world_model/cal_wm2real.py#L183-L187]
if result.done:
return result.reward in (1, 100)
# An episode that never ends counts as a failure
# [code: scripts/interact_with_world_model/cal_wm2real.py#L189-L193]
return 0Hyperparameters
| Name | Value | Where | Notes |
|---|---|---|---|
| Learning rate | 1.0e-5 | app. A.1 | Constant schedule with warmup |
| Warmup steps | 10 | app. A.1 | |
| Epochs | 5 | app. A.1 | |
| Global train batch size | 128 | app. A.1 | Config gives 2 per device x 16 accumulation x 4 GPUs = 128 README.md |
| Max gradient norm | 100 | app. A.1 | README.md |
| Precision | bf16 | app. A.1 | |
| Max sequence length | 12288 (cutoff_len) | not stated in paper | README.md |
| Training examples cap | 40K ALFWorld, SciWorld, TextWorld; 70K WebShop; 160K StableToolBench | §4 Data app. A.1 | Enforced as LLaMA-Factory max_samples README.md; file sizes differ (see Pitfalls) |
| Backbones | Qwen2.5-7B (base), Llama-3.1-8B (base) | §4 Finetuning Models | |
| Qwen size sweep | 0.5B, 1.5B, 3B, 7B | app. A.1 | Only 7B and 8B checkpoints are listed in the code README |
| Hardware | 4 x H100-80GB | app. A.1 | |
| Trajectory collection agent | GPT-4o (gpt-4o-2024-11-20), temperature 1.0, top-p 1.0, max 50 turns | app. A.1 tab. 9 | Behaviour policy for world-model training data |
| Dataset sizes | ALFWorld, SciWorld, TextWorld 40K; WebShop 70K; StableToolBench 160K single-turn | §4 Data app. A.1 | Trajectory counts as stated by the paper |
| Test games | 200 per environment | app. A.1 | Code file names suggest different counts (see Pitfalls) |
| World-model decoding (code) | Temperature 0, top-p 1, max 512 new tokens | run.py | Not stated in paper |
| Agent decoding (code) | Temperature 1, top-p 1, max 4096 tokens; GPT-5 and Claude use API defaults | run.py | Not stated in paper |
| Max steps per rollout (code) | 50 | run.py | Not stated in paper |
| Single-step decoding (code) | Greedy (temperature 0), max 2000 tokens | run.py | Not stated in paper |
| WM-SFT warm-up data | 1,000 trajectories, same SFT settings as world-model training | app. A.3 | |
| Agent SFT warm-up data | 1,000 real trajectories | app. A.3 | |
| RL (agent) | GRPO via AgentGym-RL; learning rate 1e-6; KL coefficient 0.001 (low-variance KL); 8 rollouts per prompt; batch 16; 20 rounds; 10 epochs | app. A.3 | Command given in the appendix |
| Synthetic-vs-real data | 1,000 successful trajectories per source; collector is a Qwen2.5-7B-Instruct policy trained with direct RL | app. A.2 | Synthetic success is the world model's own prediction |
Results
Author-reported. The fidelity setup is one fine-tuned model per environment, evaluated on held-out test prefixes. Prompt baselines use zero-shot or 3-shot prompts §5.1 tab. 1. Consistency uses seven API agents §5.2 tab. 2.
| Setting | Metric | Baseline | This paper | Source |
|---|---|---|---|---|
| ALFWorld next-state | EM % | 77.04 (Claude-sonnet-4.5, 3-shot) | 99.87 (Qwen2.5-7B SFT); 99.71 (Llama-3.1-8B SFT) | tab. 1 |
| SciWorld next-state | EM % | 73.08 (Claude-sonnet-4.5, 3-shot) | 98.60 (Qwen); 98.64 (Llama) | tab. 1 |
| TextWorld next-state | EM % | 49.12 (Claude-sonnet-4.5, 3-shot) | 70.60 (Qwen); 70.45 (Llama) | tab. 1 |
| WebShop next-state | EM % | 66.09 (Gemini-2.5-flash, 3-shot) | 79.05 (Qwen); 77.24 (Llama) | tab. 1 |
| StableToolBench | EM % / word F1 % | 0.00 EM for every prompt baseline; best F1 13.94 (GPT-4o-mini, zero-shot) | 48.90 EM / 79.15 F1 (Qwen) | tab. 1 |
| Consistency ratio, average over agents | CR (ALFWorld / SciWorld / TextWorld / WebShop) | not applicable | 0.96 / 0.91 / 0.92 / 0.67 (Qwen); 0.98 / 0.89 / 0.88 / 0.76 (Llama) | tab. 2 |
| WebShop pre-execution checks | Success % | GPT-4o: 29.36 (no checks) | 36.70 at 50 checks | tab. 4 |
| WebShop pre-execution checks | Success % | GPT-4-turbo: 17.73 (no checks) | 33.33 at 2 checks | tab. 4 |
| Mixed-agent training (SciWorld) | CR | GPT-4o-mini: 0.49 (single-agent data) | 0.81 (mixed-agent data) | tab. 3 |
| ALFWorld OOD (Qwen, average over agents) | Success % | Real: 53.55 (OOD-Seen), 56.59 (OOD-Unseen) | WM: 48.71 (OOD-Seen), 53.97 (OOD-Unseen) | app. C fig. 4 |
Findings in words: data scaling saturates near 20K trajectories on structured environments, while WebShop keeps improving up to about 70K and StableToolBench shows no saturation at 160K §6.1 fig. 2. A 1.5B model already captures the structured dynamics, while open-ended settings benefit from more capacity §6.2 fig. 3. Mixed-environment training helps most environments, but StableToolBench is worse in the mixture §6.4 fig. 5. Synthetic trajectories are competitive with real ones on SciWorld and WebShop, and mixing both gives the best results §7.1 fig. 6. WM-SFT before agent SFT and RL gives higher final success on ALFWorld and SciWorld §7.2 fig. 7. The synthetic-data and warm-start gains are only plotted; the text gives no numbers for them.
Paper vs code
Code is the official repository https://github.com/X1AOX1A/Word2World at commit
e8dc240269fb222de3c242b09c70bfbf0b4ac1c9, linked from the paper's abstract
page. It contains evaluation and data-construction scripts, not the
training code. Training configs target LLaMA-Factory, and AgentGym-RL is
vendored in the repository.
- Single-step accuracy counts whole messages, pooled over every turn. The paper calls it exact match on the next state and reward §4 Metrics. The code builds one sample per assistant turn and compares the stripped text of the whole reply run.py [code: scripts/single_step_accuracy/run.py#L102]. Long trajectories therefore weigh more than short ones.
- Decoding settings are only in the code. The paper states no decoding settings for evaluation. The code uses greedy decoding for single-step accuracy run.py, temperature 0 for the world model and temperature 1 for the agent, with GPT-5 and Claude on API defaults run.py [code: scripts/interact_with_world_model/run.py#L63-L75].
- Success marker. The world model ends an episode by appending the literal " [SUCCESS]" to its observation. The code strips the marker and sets the success flag run.py. The paper only says the reward is binary §3.1 eq. 2. Whether the training data contains the marker is not verifiable here: the data files are not in the repository.
- Maximum rollout length. The code caps world-model rollouts at 50 steps run.py [code: scripts/interact_with_world_model/run.py#L155]. The README lowers the real-env vLLM limit to 20 turns to avoid exceeding the context length README.md. The paper states no limit for these rollouts.
- Real-environment success. The code counts a real episode as successful when the reward is 1 or 100 cal_wm2real.py. The paper does not give this threshold, and the code accepts both values.
- W2R denominator. The summary accuracy divides successes by (total minus errors), so errored items are dropped rather than counted as failures cal_wm2real.py. The paper does not mention this.
- Test-set sizes. The appendix lists 200 test games for each environment app. A.1. The code's test files are named with 195 (ALFWorld), 195 (SciWorld), 173 (TextWorld), 109 (WebShop) and 2000 (StableToolBench) items [code: scripts/single_step_accuracy/run.sh#L12-L24]. The file names may count items rather than samples; the code does not explain them.
- ALFWorld splits. The code names the test splits valid_seen and valid_unseen run.sh. The paper's OOD-Seen and OOD-Unseen splits are described in words §6.3, and the mapping between the two naming schemes is not stated.
- Action renaming. The code README says ALFWorld actions were renamed (put to move) and a help action added to match AgentGym, and that old downloads can give lower evaluation scores README.md. The paper does not mention this.
- Initial context for SciWorld. The world-model system prompt contains the environment description and then the user instruction [code: scripts/collect_init_context/collect_wm_instruct_sciworld.py#L190-L205], which matches §4 Initialization Context. The same check for ALFWorld was not done.
- Training budget. The paper's batch size (128), learning rate (1e-5), epochs (5), warmup (10), bf16 and max grad norm (100) match the example LLaMA-Factory config app. A.1 README.md. The code also sets a 12288-token cutoff, which the paper does not state README.md.
- Model sizes. The paper sweeps Qwen2.5 at 0.5B, 1.5B, 3B and 7B app. A.1. The code README lists only 7B and Llama-3.1-8B checkpoints README.md. The smaller checkpoints are not in the code.
- Not found in the scripts. I searched
scripts/for the WebShop pre-execution verifier, the StableToolBench word-F1 computation and the synthetic-vs-real data generation. None was found. The WM-SFT warm-up stage is not inscripts/either. These results therefore cannot be reproduced from this repository alone.
Pitfalls
- Text and table disagree on F1. The fidelity paragraph says SFT models reach "49% F1 on StableToolBench" §5.1. In the table, 48.90 and 49.25 are the exact-match column; the F1 column is 79.15 and 78.97 tab. 1. Use the table.
- CR claim is overstated. The text says GPT-4.1, GPT-5 and Claude "reliably exceed 90%" §5.2. In the table, GPT-5 and Claude score 0.89 and 0.88 on SciWorld, and all three score 0.58 to 0.82 on WebShop tab. 2.
- A WebShop rollout number has no table. The text says grounding WebShop rollouts with real search results raises consistency from 56% to nearly 100% §5.2. No table in the paper gives this figure, and I did not find it in the repository.
- Synthetic data is filtered by the world model. Success for world-model trajectories is the model's own predicted outcome, not a real check app. A.2. The same false-positive risk applies to pre-execution checks §7.
- Data cost hides in the abstract. The training trajectories come from GPT-4o rollouts: 40K each for three environments, 70K for WebShop §4 Data. Reproducing the dataset therefore needs a commercial API, its usage terms, and large sampling budgets.
- "40K trajectories" is a cap. In the released config, the ALFWorld dataset file name suggests 54,006 entries, and the cap is set at 40,000 samples (max_samples) README.md README.md. The README table gives file sizes of 54,006, 40,630, 58,805, 70,790 and 175,183 for the five environments. The unit (trajectory or turn) is not stated in the code.
- Agent behaviour shift. Weaker agents such as GPT-4o-mini drift outside the expert's distribution, and their consistency ratios fall below 70% §5.2. Mixed- agent training raises GPT-4o-mini's CR from 0.49 to 0.81 tab. 3. Evaluation on a new agent can therefore show low consistency for reasons other than the world model.
- Verification budget is non-monotonic. Extra checks change the agent's context and can reduce success, so the paper recommends 2 to 10 checks §7 tab. 4. Optimal budgets may differ for other environments; the paper tests only WebShop.
- Decoding and evaluation randomness. Agent sampling at temperature 1 makes single runs noisy run.py. The paper reports single numbers without variance.
- Partial observability is handled by context. The world model is given a fuller initial state than the agent for ALFWorld and SciWorld §3.1 app. A.4. The paper gives no ablation without that state for either environment.
Lineage
- Builds on: the ReAct agent format §3.1; initial-state context, similar to RAWM app. A.4; AgentGym environments and trajectory collection app. A.1; AgentGym-RL GRPO training app. A.3; LLaMA-Factory SFT app. A.1.
- Compared against: zero-shot and 3-shot prompting of GPT, Gemini and Claude models tab. 1; prior work on next-state prediction, which the paper says focuses on accuracy rather than long-horizon consistency §3.1.
- Superseded by: not stated.
Source and license
Adapted from “From Word to World: Can Large Language Models be Implicit Text-based World Models?” by Yixia Li, Hongru Wang, Jiahao Qiu, Zhenfei Yin, Dongdong Zhang, Cheng Qian, Zeping Li, Pony Ma, Guanhua Chen, Heng Ji (arXiv:2512.18832), used under CC BY 4.0. Changes: condensed and restructured for implementation, with tables, equations and algorithms taken from the paper and its code, each cited to its source. Not affiliated with or endorsed by the authors. Code citations refer to https://github.com/X1AOX1A/Word2World at commit e8dc240269fb (none found (no LICENSE file at repository root)). Any quoted code is shown under that license.