Open-source framework for Reinforcement Learning integrated with Large Language Models
Project description
RL-LLM Toolkit
Democratizing Reinforcement Learning with Large Language Models
๐ Overview
RL-LLM Toolkit is an open-source framework that integrates Reinforcement Learning with Large Language Models to create intelligent agents accessible to beginners and researchers. By simulating human feedback via LLMs, we reduce RLHF costs by up to 50% while maintaining training quality.
Key Features
- ๐ฎ Gymnasium-Compatible Environments: Easy-to-use RL environments for games, finance, and robotics
- ๐ค LLM-Powered Rewards: Generate dense rewards using local or API-based LLMs
- ๐ State-of-the-Art Algorithms: PPO, DQN, and more with modular architecture
- ๐ง Plug-and-Play Design: Swap algorithms, environments, and LLMs effortlessly
- ๐ Educational Focus: Interactive Jupyter notebooks and comprehensive tutorials
- ๐ Hugging Face Integration: Share models and datasets with the community
๐ฏ Quick Start
# Install the toolkit
pip install rl-llm-toolkit
# Run a simple example
python -m rl_llm_toolkit.examples.cartpole
๐ฆ Installation
From PyPI (Coming Soon)
pip install rl-llm-toolkit
From Source
git clone https://github.com/tonipcv/hugo.git
cd hugo
pip install -e .
Optional Dependencies
# For LLM integration
pip install -e ".[llm]"
# For development
pip install -e ".[dev]"
# For all features
pip install -e ".[all]"
๐ก Usage Example
from rl_llm_toolkit import RLEnvironment, PPOAgent, LLMRewardShaper
from rl_llm_toolkit.llm import OllamaBackend
# Create environment
env = RLEnvironment("CartPole-v1")
# Set up LLM-based reward shaping
llm = OllamaBackend(model="llama3")
reward_shaper = LLMRewardShaper(llm, prompt_template="custom_template")
# Train agent
agent = PPOAgent(env, reward_shaper=reward_shaper)
agent.train(total_timesteps=100000)
# Evaluate
agent.evaluate(episodes=10, render=True)
๐๏ธ Architecture
rl-llm-toolkit/
โโโ rl_llm_toolkit/ # Core package
โ โโโ agents/ # RL algorithms (PPO, DQN, etc.)
โ โโโ environments/ # Custom environments
โ โโโ llm/ # LLM integrations
โ โโโ rewards/ # Reward shaping utilities
โ โโโ utils/ # Helper functions
โ โโโ cli/ # Command-line tools
โโโ examples/ # Example scripts and notebooks
โโโ tests/ # Test suite
โโโ docs/ # Documentation
๐ Examples
- CartPole with LLM Feedback: Train a classic control agent with GPT-4 reward shaping
- Crypto Trading Bot: Build a trading agent using historical data and LLM market analysis
- Multi-Agent Game: Coordinate multiple agents in a competitive environment
๐ค Contributing
We welcome contributions! See CONTRIBUTING.md for guidelines.
๐ Roadmap
Now (0-3 months)
- โ Core RL framework with PPO/DQN
- โ Basic LLM integration (Ollama, OpenAI)
- ๐ Interactive examples and tutorials
- ๐ Comprehensive documentation
Next (3-6 months)
- Offline RL support
- Financial trading environments
- Hugging Face model hub integration
- Community leaderboards
Later (6-12 months)
- Real-time collaboration features
- Video reasoning integration
- Advanced multi-agent systems
- Research partnerships
๐ License
MIT License - see LICENSE for details.
๐ Acknowledgments
Inspired by projects like PufferLib, Neural MMO, and the broader open-source RL community.
๐ฌ Contact
- Twitter/X: @your_handle
- Discord: Join our community
- Issues: GitHub Issues
Star โญ this repo if you find it useful!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file rl_llm_toolkit-0.2.0.tar.gz.
File metadata
- Download URL: rl_llm_toolkit-0.2.0.tar.gz
- Upload date:
- Size: 101.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bff53b096b2f1b4df344f57397455ea788364b4eaacdf849933d8964be901c1a
|
|
| MD5 |
cdefe9af2d82245d339018e1db3fc50b
|
|
| BLAKE2b-256 |
6215b09fa5c021c5221a2ab6277817e6a003539fe004198711a1be48c8d461d4
|
File details
Details for the file rl_llm_toolkit-0.2.0-py3-none-any.whl.
File metadata
- Download URL: rl_llm_toolkit-0.2.0-py3-none-any.whl
- Upload date:
- Size: 66.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5f53ec60604f9024017c0c392712701270ded6a3beec202395ad7917faf45e2b
|
|
| MD5 |
3d9caa5e4a35a07c9c1d1814d6ebc9fc
|
|
| BLAKE2b-256 |
13d0207d489f2e3b10f48de749a857f41d07455d6827ba8956a01b3123896af3
|