Skip to main content

Hugo: RL-LLM Toolkit

Democratizing Reinforcement Learning with Large Language Models

PyPI CI codecov Downloads 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 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


Star ⭐ this repo if you find it useful!

Star History: https://star-history.com/#tonipcv/hugo

Metadata

Release files for hugo-rl-llm 0.2.2

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

Source distribution (sdist)

Source distribution for hugo-rl-llm 0.2.2
File Size Uploaded Provenance
hugo_rl_llm-0.2.2.tar.gz 202.1 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for hugo-rl-llm 0.2.2
File Interpreter ABI Platform
hugo_rl_llm-0.2.2-py3-none-any.whl Python 3 none any Details

Total release size: 308.2 kB

Release files / hugo_rl_llm-0.2.2.tar.gz

Download URL hugo_rl_llm-0.2.2.tar.gz
Size 202.1 kB
Tags Source
SHA-256 checksum
How to use checksums
a40444560efd3c2bc839a9f6c7a4091f3f8bb5cea7e7a4c224bb5aa6eb49633f
BLAKE2b-256 checksum
How to use checksums
ee3d05bfef82b29fb296d5ba3225bcb0968362d6ec2676d71d84316519a14e27
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.3

Release files / hugo_rl_llm-0.2.2-py3-none-any.whl

Download URL hugo_rl_llm-0.2.2-py3-none-any.whl
Size 106.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f67ad0dba4e61d4a4b96131b80b19805df64ea5310f6246b6c30b81a545e4c13
BLAKE2b-256 checksum
How to use checksums
080d2b4987c455a03238118e7c6c9fb94c264e62fa534fe5362f454443e2dc69
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.3

Security for hugo-rl-llm 0.2.2

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.

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