Skip to main content

RL-LLM Toolkit

Democratizing Reinforcement Learning with Large Language Models

License: MIT Python 3.10+

🚀 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


Star ⭐ this repo if you find it useful!

Metadata

Release files for rl-llm-toolkit 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for rl-llm-toolkit 0.2.0
File Size Uploaded Provenance
rl_llm_toolkit-0.2.0.tar.gz 101.6 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for rl-llm-toolkit 0.2.0
File Interpreter ABI Platform
rl_llm_toolkit-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 167.9 kB

Release files / rl_llm_toolkit-0.2.0.tar.gz

Download URL rl_llm_toolkit-0.2.0.tar.gz
Size 101.6 kB
Tags Source
SHA-256 checksum
How to use checksums
bff53b096b2f1b4df344f57397455ea788364b4eaacdf849933d8964be901c1a
BLAKE2b-256 checksum
How to use checksums
6215b09fa5c021c5221a2ab6277817e6a003539fe004198711a1be48c8d461d4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.3

Release files / rl_llm_toolkit-0.2.0-py3-none-any.whl

Download URL rl_llm_toolkit-0.2.0-py3-none-any.whl
Size 66.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5f53ec60604f9024017c0c392712701270ded6a3beec202395ad7917faf45e2b
BLAKE2b-256 checksum
How to use checksums
13d0207d489f2e3b10f48de749a857f41d07455d6827ba8956a01b3123896af3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.3

Security for rl-llm-toolkit 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page