NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

From History to State: Constant-Context Skill Learning for LLM Agents

Haoyang Xie, Xinyuan Wang, Yancheng Wang, Puda Zhao, Feng JuNeurIPS 2026

TL;DR

Imagine if, every time you brewed morning coffee, you had to re-read the coffee maker's manual and recite every physical movement you had made since waking up. That is essentially how most Large Language Model (LLM) agents operate today—burning tokens by re-reading massive prompts and ever-growing execution histories at every step. This paper shows how to move "muscle memory" out of the prompt and directly into lightweight model weights, allowing local, privacy-preserving agents to execute complex workflows with a tiny, constant-sized context window.

What Problem Does This Paper Address?

As LLM agents graduate from simple chatbots to personal assistants that manage browsers, files, and local tools, they hit a sharp privacy-cost-capability trilemma. Cloud-hosted frontier models execute multi-step tasks reliably, but sending personal emails, code, and documents to external APIs is a privacy nightmare. Smaller local models keep data private, yet often stumble on long-horizon tasks.

Worst of all, standard agent frameworks (like ReAct) treat behavior as a context-management problem: at every single turn, the model re-reads long skill instructions alongside an expanding log of every past observation and action. For recurring workflows—like ordering groceries or organizing files—this is wildly inefficient. Not only do token costs snowball, but models also get "lost in the middle" of bloated histories. The authors ask: Can an agent internalize how to do a recurring task in its weights, while keeping only the bare minimum step-by-step progress in its prompt?

Methods

The authors introduce constant-context skill learning, a "context-to-weights" pipeline built around three stages while keeping the base LLM completely frozen:

Figure 1: Context-to-weights skill learning pipeline.
  1. Deterministic State Tracking (New Interface): Instead of feeding the LLM a growing transcript of past events, a lightweight, rule-based algorithm (not an LLM!) parses observations and actions into a compact state block ($b_t$). This block holds only essential variables—like current subgoal, items held, or checked locations. At any step, the model sees a constant-bounded input: the task goal, current observation, one-step history, and $b_t$.
  2. Task-Family Supervised Fine-Tuning / SFT (Standard Tool, New Setup): Workflows sharing an environment and procedural structure are grouped into "task families." For each family, a tiny Low-Rank Adaptation (LoRA) module—updating just ~2% of parameters—is trained on expert trajectories to output direct executable actions (skipping verbose "reasoning traces" entirely).
  3. Subgoal-Guided Reinforcement Learning / RL (Novel Alignment): Imitation learning alone can leave agents stranded if they make a mistake online. The authors refine each LoRA skill module using Group Relative Policy Optimization (GRPO). Crucially, the reward function is directly aligned with the state tracker: advancing fields in the state block yields deterministic progress rewards, while invalid or repetitive actions incur penalties.
Figure 2: Qualitative ALFWorld household trace with rendered state blocks.

Datasets

No new datasets are introduced; instead, the authors evaluate on three established text-based interactive benchmarks that mirror recurring personal workflows:

  • ALFWorld: Household assistance across six task families (navigating rooms, finding, heating/cleaning, and placing objects).
  • WebShop: Online shopping assistance (searching a 1,000-product catalog, inspecting pages, selecting item options, and purchasing).
  • SciWorld: Procedural tool use in virtual science labs (conducting multi-step experiments and reporting answers).

Key Insights and Ideas

  • State beats history—even before training: In WebShop ablations, giving an untrained model just the current observation yields a dismal 1.2% success rate. Adding the compact state block jumps success to 23.6% before a single weight is updated, proving that structured progress state is the true signal buried inside long histories.
  • Aligning state representation with RL rewards creates a flywheel: Because RL subgoal rewards are triggered by the exact same tracker variables displayed in the prompt's state block, the model is explicitly incentivized to read and trust that compact state as its execution compass.
  • No reasoning traces means massive output savings: Because procedural logic lives in the LoRA weights, the agent emits raw actions rather than lengthy "Thought:" monologues, slashing completion tokens per turn from ~50–70 down to ~5–10.
  • LLMs can write the trackers offline: To avoid writing rule-based trackers by hand for every new app, the authors prompted a frontier model offline to generate the state schema, parser, and reward rules for WebShop—achieving 65.8% success with zero LLM overhead at runtime.

Key Results

Tested across Qwen3 (4B, 8B, 14B) and Llama-3.1-8B—with all training runs fitting on a single 80GB A100 GPU—the framework delivers top-tier accuracy at a fraction of the token budget:

  • Task Success: With Qwen3-8B, SFT+RL hits 89.6% unseen success on ALFWorld, 76.8% on WebShop, and 66.4% unseen success (79.7 score) on SciWorld. This matches or beats heavy RL baselines (like GiGPO and EMPO2) that require multiple H100 GPUs and long prompts.
  • Token Efficiency: Compared to full-history ReAct on Qwen3-8B, prompt tokens per turn drop by 4–7× (e.g., from 3,093 to 488 on WebShop, and 1,320 to 180 on ALFWorld unseen). Total tokens per episode plummet by 10–12× on ALFWorld (34k to ~3k), 14× on WebShop (46.5k to 3.4k), and 2–3× on SciWorld.

Limitations and Future Work

  • Engineering overhead per workflow: Trackers and reward schemas are task-family specific. While offline LLM code generation works (65.8% SR on WebShop), it still trails human-crafted trackers (76.8% SR). Compiling emerging SKILL.md-style agent specifications automatically into trackers is a prime next step.
  • Text-only evaluation: Experiments are confined to text environments; extending constant-context state blocks to visual GUI and multimodal agents remains open.
  • No zero-shot skill transfer: Every new workflow family requires training a dedicated LoRA adapter. While adapters are small (0.5–0.7 GB on disk) and prevent catastrophic forgetting on the frozen base model, the system cannot generalize procedural weights to entirely novel tools out of the box.

Summary updated

BibTeX
@inproceedings{xie2026from,
  author = {Haoyang Xie and Xinyuan Wang and Yancheng Wang and Puda Zhao and Feng Ju},
  title = {{From History to State: Constant-Context Skill Learning for LLM Agents}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=F9AmFBisYk},
}
Figure