Git Product home page Git Product logo

grounding_llms_with_online_rl's Introduction

Grounding Large Language Models with Online Reinforcement Learning

This repository contains the code used for our paper Grounding Large Language Models with Online Reinforcement Learning. We perform functional grounding of LLMs' knowledge in BabyAI-Text: Main schema

We then perform an in-depth anaylsis of the generalization abilities of our trained agents: Generalization schema

We release our BabyAI-Text environment along with the code to perform our experiments (both training agents and evaluating their performance). We rely on the Lamorel library to use LLMs.

Our repository is structured as follows:

๐Ÿ“ฆ Grounding_LLMs_with_online_RL
โ”ฃ ๐Ÿ“‚ babyai-text -- our BabyAI-Text environment
โ”ฃ ๐Ÿ“‚ experiments -- code for our experiments
โ”ƒ โ”ฃ ๐Ÿ“‚ agents -- implementation of all our agents
โ”ƒ โ”ƒ โ”ฃ ๐Ÿ“‚ bot -- bot agent leveraging BabyAI's bot
โ”ƒ โ”ƒ โ”ฃ ๐Ÿ“‚ random_agent -- agent playing uniformly random
โ”ƒ โ”ƒ โ”ฃ ๐Ÿ“‚ drrn -- DRRN agent from here
โ”ƒ โ”ƒ โ”ฃ ๐Ÿ“‚ ppo -- agents using PPO
โ”ƒ โ”ƒ โ”ƒ โ”ฃ ๐Ÿ“œ symbolic_ppo_agent.py -- SymbolicPPO adapted from BabyAI's PPO
โ”ƒ โ”ƒ โ”ƒ โ”— ๐Ÿ“œ llm_ppo_agent.py -- our LLM agent grounded using PPO
โ”ƒ โ”ฃ ๐Ÿ“‚ configs -- Lamorel configs for our experiments
โ”ƒ โ”ฃ ๐Ÿ“‚ slurm -- utils scripts to launch our experiments on a SLURM cluster
โ”ƒ โ”ฃ ๐Ÿ“œ train_language_agent.py -- train agents using BabyAI-Text (LLMs and DRRN) -> contains our implementation of PPO loss for LLMs as well as additional heads on top of LLMs
โ”ƒ โ”ฃ ๐Ÿ“œ train_symbolic_ppo.py -- train SymbolicPPO on BabyAI (with BabyAI-Text's tasks)
โ”ƒ โ”ฃ ๐Ÿ“œ post-training_tests.py -- generalization tests of trained agents
โ”ƒ โ”ฃ ๐Ÿ“œ test_results.py -- utils to format results
โ”ƒ โ”— ๐Ÿ“œ clm_behavioral-cloning.py -- code to perform Behavioral Cloning on an LLM using trajectories

Installation steps

  1. Create conda env
conda create -n dlp python=3.10.8; conda activate dlp
  1. Install PyTorch
conda install pytorch==1.12.1 torchvision==0.13.1 torchaudio==0.12.1 cudatoolkit=11.3 -c pytorch
  1. Install packages required by our package
pip install -r requirements.txt
  1. Install BabyAI-Text: See installation details in the babyai-text package
  2. Install Accelerate
cd v0.13.2/accelerate-0.13.2; pip install -e .; cd ../..
  1. Install Lamorel
git clone https://github.com/ClementRomac/lamorel.git; cd lamorel/lamorel; pip install -e .; cd ../..

Launch

Please use Lamorel along with our configs.

grounding_llms_with_online_rl's People

Contributors

clementromac avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.