Open-source framework for Reinforcement Learning integrated with Large Language Models
Project description
Hugo: 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 from PyPI
pip install hugo-rl-llm
# Run the CLI
hugo --help
# Or run a simple example module
python -m rl_llm_toolkit.examples.cartpole
📦 Installation
From PyPI
pip install hugo-rl-llm
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
flowchart LR
subgraph Agents
A1[PPOAgent]:::node
A2[DQNAgent]:::node
A3[CQL/IQL]:::node
A4[MADDPG]:::node
end
subgraph Environments
E1[Gymnasium IDs]
E2[CryptoTradingEnv]
E3[StockTradingEnv]
E4[SimpleReacherEnv]
E5[GridWorldEnv]
end
subgraph RewardShaping
R1[LLMRewardShaper]
R2[Prompt Templates]
R3[Cache]
end
subgraph LLMBackends
L1[Ollama]
L2[OpenAI]
end
Agents <--> Environments
Agents --> R1
R1 --> LLMBackends
R1 -->|combine with env_reward| Agents
classDef node fill:#eef,stroke:#66f,stroke-width:1px;
❓ Why Hugo?
- LLM Rewards Nativos: integração direta com Ollama e OpenAI, com templates prontos e cache.
- Lean & Research-Oriented: sem bloat; arquitetura clara, fácil de estender.
- Domínios Diversos: trading (cripto/ações), robótica (reacher) e gridworld prontos.
- Benchmarks & Métricas: estabilidade, eficiência amostral e performance assintótica.
- Colaboração: sessões e buffers compartilhados para cenários multiagente/experimentos.
- CLI Produtiva: descoberta (
list-*), quickstart e validação (--dry-run).
Comparativo rápido:
- Stable-Baselines3: produção madura, porém sem LLM shaping nativo.
- TorchRL: poderoso e amplo; Hugo é mais direto para RL + LLM.
- OpenRLHF / RL4LMs: foco em LLMs; Hugo cobre RL clássico + LLM em vários domínios.
🎓 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
- Issues: https://github.com/tonipcv/hugo/issues
- Discussions: https://github.com/tonipcv/hugo/discussions
- Email: contact@xaseai.com
Star ⭐ this repo if you find it useful!
Star History: https://star-history.com/#tonipcv/hugo
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 hugo_rl_llm-0.2.2.tar.gz.
File metadata
- Download URL: hugo_rl_llm-0.2.2.tar.gz
- Upload date:
- Size: 202.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a40444560efd3c2bc839a9f6c7a4091f3f8bb5cea7e7a4c224bb5aa6eb49633f
|
|
| MD5 |
050b7fb60479aeee0175814f8eaf2e65
|
|
| BLAKE2b-256 |
ee3d05bfef82b29fb296d5ba3225bcb0968362d6ec2676d71d84316519a14e27
|
File details
Details for the file hugo_rl_llm-0.2.2-py3-none-any.whl.
File metadata
- Download URL: hugo_rl_llm-0.2.2-py3-none-any.whl
- Upload date:
- Size: 106.1 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 |
f67ad0dba4e61d4a4b96131b80b19805df64ea5310f6246b6c30b81a545e4c13
|
|
| MD5 |
9bd8b31ce4739c24e14b1715c533399b
|
|
| BLAKE2b-256 |
080d2b4987c455a03238118e7c6c9fb94c264e62fa534fe5362f454443e2dc69
|