Coder Social home page Coder Social logo

james4ever0 / mcts-for-llm Goto Github PK

View Code? Open in Web Editor NEW

This project forked from shunzh/mcts-for-llm

0.0 0.0 0.0 40.8 MB

This is a pip package implementing Reinforcement Learning algorithms in non-stationary environments supported by the OpenAI Gym toolkit.

Python 100.00%

mcts-for-llm's Introduction

Monte-Carlo Tree Search for Large Language Models

This repository is a fork of Dyna Gym and extends its functionality to focus on using Monte-Carlo tree search for decoding large language models (LLMs).

Installation

First, create a new Conda environment (optional):

conda create --name mcts-for-llm python=3.10
conda activate mcts-for-llm

We tested on python 3.10.0. Other versions may work as well.

Then, git clone this repo and install the package:

pip install -e .

Examples

Using GPT-2 and UCT for Language Alignment with Positive Sentiment Reward

Run the following command to generate texts using the GPT-2 model, guided by UCT (Upper Confidence Bound applied to Trees) for language alignment. Positive sentiment is used as the reward.

python examples/uct_language_alignment.py

Classic Planning Domains (Non-LLM)

This repository also includes some classic planning domains derived from the original Dyna Gym repo. These examples don't use LLMs but may be useful for debugging purposes.

python examples/uct_nscartpole_v0.py
python examples/uct_nscartpole_v1.py
...

mcts-for-llm's People

Contributors

erwanlecarpentier avatar gitjournalapp avatar shunzh avatar namin 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.