Lune

NeurIPS2025Top-tier venue

Self-Generated In-Context Examples Improve LLM Agents for Sequential Decision-Making Tasks

Vishnu Sarukkai, Zhiqiang Xie, Kayvon Fatahalian

Abstract

Improving Large Language Model (LLM) agents for sequential decision-making tasks typically requires extensive task-specific knowledge engineering-custom prompts, curated examples, and specialized observation/action spaces. We investigate a different approach where agents automatically improve by learning from their own successful experiences without human intervention. Our method constructs and refines a database of self-generated trajectories that serve as in-context examples for future tasks. Even naive accumulation of successful trajectories yields substantial performance gains across three diverse benchmarks: ALFWorld (73% to 89%), Wordcraft (55% to 64%), and InterCode-SQL (75% to 79%). These improvements exceed those achieved by upgrading from gpt-4o-mini to gpt-4o and match the performance of allowing multiple attempts per task. We further enhance this approach with two innovations: database-level curation using population-based training to propagate high-performing example collections, and exemplar-level curation that selectively retains trajectories based on their empirical utility as in-context examples. With these enhancements, our method achieves 93% success on ALFWorld-surpassing approaches that use more powerful LLMs and hand-crafted components. Our trajectory bootstrapping technique demonstrates that agents can autonomously improve through experience, offering a scalable alternative to labor-intensive knowledge engineering.

Our work assumes a ReAct-style agent [9] that retrieves different examples for each decision point based on their relevance to the current situation [10,11]. We build on this foundation by focusing specifically on how to construct and refine the underlying database of self-generated examples. How can we identify which trajectories enhance performance on new tasks versus those that hinder performance? This database construction problem requires addressing both the collection of highquality trajectories and the strategic curation of the most valuable ones for future retrieval at each decision point in the agent's reasoning and acting loop.

Ask Lune

Know this paper in minutes, not an afternoon.

Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.

2 top-tier papers have cited it since. Know what they found before your reviewers do.

Questions to start from

Lune can draw on

the full paper · the top-tier papers that cite it · related work

Get the answer

Free to start. No credit card required.

Lineage

  • SkillGen: Learning Domain Skills for In-Context Sequential Decision Making cites Reflexion: language agents with verbal reinforcement learning
  • SkillGen: Learning Domain Skills for In-Context Sequential Decision Making cites Language Models are Few-Shot Learners
  • Direct Preference Optimization: Your Language Model is Secretly a Reward Model cites Language Models are Few-Shot Learners
  • Reflexion: language agents with verbal reinforcement learning cites Chain-of-Thought Prompting Elicits Reasoning in Large Language Models
  • Agentic Plan Caching: Test-Time Memory for Fast and Cost-Efficient LLM Agents cites SWE-bench: Can Language Models Resolve Real-world Github Issues?
  • Agentic Plan Caching: Test-Time Memory for Fast and Cost-Efficient LLM Agents cites Chain-of-Thought Prompting Elicits Reasoning in Large Language Models
Builds onCited byLeft to right by year; the more cited, the higher.

Cited by top-tier papers2

  1. Agentic Plan Caching: Test-Time Memory for Fast and Cost-Efficient LLM AgentsQizheng Zhang, Michael Wornow, Kunle OlukotunNeurIPS 2025 · 27 citations
  2. SkillGen: Learning Domain Skills for In-Context Sequential Decision MakingRuomeng Ding, Wei Cheng, Minglai Shao, Chen ZhaoAAAI 2026

Builds on26

  1. Language Models are Few-Shot LearnersTom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah et al.NeurIPS 2020 · 64,255 citations
  2. Chain-of-Thought Prompting Elicits Reasoning in Large Language ModelsJason Wei, Xuezhi Wang, Dale Schuurmans, Maarten Bosma et al.NeurIPS 2022 · 22,562 citations
  3. Direct Preference Optimization: Your Language Model is Secretly a Reward ModelRafael Rafailov, Archit Sharma, Eric Mitchell, Christopher D. Manning et al.NeurIPS 2023 · 10,924 citations
  4. Reflexion: language agents with verbal reinforcement learningNoah Shinn, Federico Cassano, Ashwin Gopinath, Karthik Narasimhan et al.NeurIPS 2023 · 5,828 citations
  5. SWE-bench: Can Language Models Resolve Real-world Github Issues?Carlos E. Jimenez, John Yang, Alexander Wettig, Shunyu Yao et al.ICLR 2024 · 2,082 citations

Related papers

  1. TRAD: Enhancing LLM Agents with Step-Wise Thought Retrieval and Aligned DecisionRuiwen Zhou, Yingxuan Yang, Muning Wen, Ying Wen et al.SIGIR 2024 · 5 citations
  2. AutoManual: Constructing Instruction Manuals by LLM Agents via Interactive Environmental LearningMinghao Chen, Yihang Li, Yanting Yang, Shiyu Yu et al.NeurIPS 2024 · 67 citations
  3. Prospector: Improving LLM Agents with Self-Asking and Trajectory RankingByoungjip Kim, Youngsoo Jang, Lajanugen Logeswaran, Geon-Hyeong Kim et al.EMNLP Findings 2024 · 3 citations
  4. AutoPlan: Automatic Planning of Interactive Decision-Making Tasks With Large Language ModelsSiqi Ouyang, Lei LiEMNLP Findings 2023 · 9 citations
  5. AgentGen: Enhancing Planning Abilities for Large Language Model based Agent via Environment and Task GenerationMengkang Hu, Pu Zhao, Can Xu, Qingfeng Sun et al.KDD 2025 · 6 citations
Dusk over the sea between two cliffs drawn in fine vertical lines