LLM-MCTS 开源项目使用教程

LLM-MCTS 开源项目使用教程

llm-mcts [NeurIPS 2023] We use large language models as commonsense world model and heuristic policy within Monte-Carlo Tree Search, enabling better-reasoned decision-making for daily task planning problems. llm-mcts 项目地址: https://gitcode.com/gh_mirrors/ll/llm-mcts

1. 项目介绍

LLM-MCTS(Large Language Models as Commonsense Knowledge for Large-Scale Task Planning)是一个基于大型语言模型(LLM)和蒙特卡洛树搜索(MCTS)的开源项目。该项目旨在利用LLM作为常识世界模型和启发式策略,结合MCTS算法,实现更合理的日常任务规划决策。

LLM-MCTS的主要特点包括:

  • 使用LLM作为常识世界模型,提供MCTS所需的先验信念。
  • 利用LLM的启发式策略指导搜索,显著提高搜索效率。
  • 适用于复杂、新颖的任务,实验表明其性能优于单独使用MCTS或LLM生成的策略。

2. 项目快速启动

2.1 安装项目

首先,克隆项目仓库并安装依赖:

git clone --recurse-submodules https://github.com/1989Ryan/llm-mcts.git
cd llm-mcts
pip install -r requirement.txt

2.2 生成数据

生成任务目标数据:

python vh/data_gene/gen_data/vh_init.py \
  --port "[Port Number]" \
  --task [choose your task] \
  --mode [choose one difficulty] \
  --usage [training or testing] \
  --num-per-apartment [a number]

生成专家数据:

python vh/data_gene/testing_agents/gene_data.py \
  --mode [difficulty] \
  --dataset_path [the path to the file generated in the previous step] \
  --base-port [port number]

预处理专家数据:

python mcts/virtualhome/expert_data.py

2.3 运行项目

添加OpenAI API密钥:

/mcts/virtualhome/llm_model.py/mcts/virtualhome/llm_policy.py中添加你的OpenAI API密钥。

生成世界模型:

python mcts/virtualhome/llm_model.py

运行LLM-MCTS:

python mcts/virtualhome/mcts_agent.py \
  --exploration_constant 24 \
  --max_episode_len 50 \
  --max_depth 20 \
  --round 0 \
  --simulation_per_act 2 \
  --simulation_num 100 \
  --discount_factor 0.95 \
  --uct_type PUCT \
  --mode simple \
  --seen_item \
  --seen_apartment \
  --model gpt-3.5-turbo-0125

3. 应用案例和最佳实践

3.1 应用案例

LLM-MCTS可以应用于多种复杂任务规划场景,例如:

  • 多跳旅行规划:利用LLM的常识世界模型和MCTS的搜索能力,规划最优旅行路线。
  • 物体重新排列:在虚拟环境中,通过LLM-MCTS实现高效的物体重新排列策略。

3.2 最佳实践

  • 数据生成:确保生成的数据质量高,以提高模型训练效果。
  • 参数调优:根据具体任务调整MCTS的参数,如探索常数、最大深度等,以获得最佳性能。
  • 模型选择:根据任务需求选择合适的LLM模型,如GPT-3.5-turbo-0125。

4. 典型生态项目

  • VirtualHome:该项目提供了虚拟环境,用于生成任务数据和测试任务规划算法。
  • OpenAI API:LLM-MCTS依赖OpenAI的API来访问大型语言模型,如GPT-3.5。
  • MC-LAVE-RL:MCTS的实现参考了该项目,提供了基础的MCTS算法框架。

通过这些生态项目的支持,LLM-MCTS能够更好地实现复杂任务的规划和决策。

llm-mcts [NeurIPS 2023] We use large language models as commonsense world model and heuristic policy within Monte-Carlo Tree Search, enabling better-reasoned decision-making for daily task planning problems. llm-mcts 项目地址: https://gitcode.com/gh_mirrors/ll/llm-mcts

创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

贾彩知Maura

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值