Skip to main content

An algorithm-focused interface for common language model training, continual learning, and reinforcement learning techniques

Project description

Training Hub

Training Hub is an algorithm-focused interface for common LLM training, continual learning, and reinforcement learning techniques developed by the Red Hat AI Innovation Team.

PyPI version License Documentation (in progress)

Training Hub quickstart examples

New to Training Hub? Read our comprehensive introduction: Get Started with Language Model Post-Training Using Training Hub

Support Matrix

Algorithm InstructLab-Training RHAI Innovation Mini-Trainer PEFT Unsloth verl Status
Supervised Fine-tuning (SFT) - - - - Implemented
Continual Learning (OSFT) 🔄 🔄 - - Implemented
Low-Rank Adaptation (LoRA) + SFT - - - - Implemented
LoRA + GRPO (Adapter-Based RLVR) - - - Implemented
GRPO (Full Fine-Tuning RLVR) - - - - Implemented
Direct Preference Optimization (DPO) - - - - 🔄 Planned

Legend:

  • ✅ Implemented and tested
  • 🔄 Planned for future implementation
  • - Not applicable or not planned

Implemented Algorithms

Supervised Fine-tuning (SFT)

Fine-tune language models on supervised datasets with support for:

  • Single-node and multi-node distributed training
  • Configurable training parameters (epochs, batch size, learning rate, etc.)
  • InstructLab-Training backend integration
from training_hub import sft

result = sft(
    model_path="Qwen/Qwen2.5-1.5B-Instruct",
    data_path="/path/to/data",
    ckpt_output_dir="/path/to/checkpoints",
    num_epochs=3,
    effective_batch_size=8,
    learning_rate=1e-5,
    max_seq_len=256,
    max_tokens_per_gpu=1024,
)

Orthogonal Subspace Fine-Tuning (OSFT)

OSFT allows you to fine-tune models while controlling how much of its existing behavior to preserve. Currently we have support for:

  • Single-node and multi-node distributed training
  • Configurable training parameters (epochs, batch size, learning rate, etc.)
  • RHAI Innovation Mini-Trainer backend integration

Here's a quick and minimal way to get started with OSFT:

from training_hub import osft

result = osft(
    model_path="/path/to/model",
    data_path="/path/to/data.jsonl", 
    ckpt_output_dir="/path/to/outputs",
    unfreeze_rank_ratio=0.25,
    effective_batch_size=16,
    max_tokens_per_gpu=2048,
    max_seq_len=1024,
    learning_rate=5e-6,
)

Low-Rank Adaptation (LoRA) + SFT

Parameter-efficient fine-tuning using LoRA with supervised fine-tuning. Features:

  • Memory-efficient training with significantly reduced VRAM requirements
  • Single-GPU and multi-GPU distributed training support
  • Unsloth backend for 2x faster training and 70% less memory usage
  • Support for QLoRA (4-bit quantization) for even lower memory usage
  • Compatible with messages and Alpaca dataset formats
from training_hub import lora_sft

result = lora_sft(
    model_path="Qwen/Qwen2.5-1.5B-Instruct",
    data_path="/path/to/data.jsonl",
    ckpt_output_dir="/path/to/outputs",
    lora_r=16,
    lora_alpha=32,
    num_epochs=3,
    learning_rate=2e-4
)

LoRA + GRPO (Adapter-Based RLVR)

Train LoRA adapters on tool-calling agents using Group Relative Policy Optimization with reinforcement learning from verifiable rewards. Features:

  • Single-turn and multi-turn tool-call verification with automatic per-turn decomposition
  • Two backends: OpenPipe ART + Unsloth GRPO (single-GPU, fast iteration) and verl (multi-GPU, scales to 70B+)
  • Built-in reward functions for tool-call correctness, or bring your own
  • Zero API cost training using ground-truth trace decomposition
from training_hub import lora_grpo

# Single GPU (ART backend)
result = lora_grpo(
    model_path="Qwen/Qwen3-4B",
    data_path="./tool_call_traces.jsonl",
    ckpt_output_dir="./grpo_output",
    backend="art",
    lora_r=32,
    lora_alpha=64,
    num_iterations=15,
)

# Multi GPU (verl backend)
result = lora_grpo(
    model_path="Qwen/Qwen3-4B",
    data_path="./tool_call_traces.jsonl",
    ckpt_output_dir="./grpo_output",
    backend="verl",
    n_gpus=4,
)

GRPO (Full Fine-Tuning RLVR)

Full-parameter GRPO training via the verl backend. Trains all model weights instead of LoRA adapters. Same data formats and reward functions as LoRA + GRPO.

from training_hub import grpo

result = grpo(
    model_path="Qwen/Qwen3-8B",
    data_path="./tool_call_traces.jsonl",
    ckpt_output_dir="./grpo_full_output",
    n_gpus=8,
    num_iterations=8,
)

Installation

Basic Installation

This installs the base package, but doesn't install the CUDA-related dependencies which are required for GPU training.

pip install training-hub

Development Installation

git clone https://github.com/Red-Hat-AI-Innovation-Team/training_hub
cd training_hub
pip install -e .

For developers: See the Development Guide for detailed instructions on setting up your development environment, running local documentation, and contributing to Training Hub.

LoRA Support

For LoRA training with optimized dependencies:

pip install training-hub[lora]
# or for development
pip install -e .[lora]

Note: The LoRA extras include Unsloth optimizations and PyTorch-optimized xformers for better performance and compatibility.

GRPO Support

For LoRA + GRPO training (both ART and verl backends):

pip install training-hub[grpo,lora]

Note: When combining [grpo] with [cuda] extras, install them sequentially to avoid dependency solver conflicts:

pip install training-hub[grpo,lora]
pip install training-hub[cuda]

The [grpo] extras constrain torch, vllm, and transformers versions for verl compatibility, which may conflict with versions pulled by [cuda]. Sequential installation lets the solver pick compatible versions.

CUDA Support

For GPU training with CUDA support:

pip install training-hub[cuda] --no-build-isolation
# or for development
pip install -e .[cuda] --no-build-isolation

Note: If you encounter build issues with flash-attn, install the base package first:

# Install base package (provides torch, packaging, wheel, ninja)
pip install training-hub
# Then install with CUDA extras
pip install training-hub[cuda] --no-build-isolation

# For development installation:
pip install -e . && pip install -e .[cuda] --no-build-isolation

If you're using uv, you can use the following commands to install the package:

# Installs training-hub from PyPI
uv pip install training-hub && uv pip install training-hub[cuda] --no-build-isolation

# For development:
git clone https://github.com/Red-Hat-AI-Innovation-Team/training_hub
cd training_hub
uv pip install -e . && uv pip install -e .[cuda] --no-build-isolation

Coding Agent Plugin

Training Hub is available as a plugin for two coding agents, bringing LLM training capabilities directly into your coding workflow.

Claude Code

Via org marketplace (recommended — includes all Red Hat AI plugins):

/plugin marketplace add Red-Hat-AI-Innovation-Team/plugins
/plugin install training-hub@Red-Hat-AI-Innovation-Team/plugins

Via this repo directly:

/plugin marketplace add Red-Hat-AI-Innovation-Team/training_hub
/plugin install training-hub@Red-Hat-AI-Innovation-Team/training_hub

From a local clone:

git clone https://github.com/Red-Hat-AI-Innovation-Team/training_hub.git
/plugin marketplace add /path/to/training_hub
Codex CLI
codex plugin marketplace add Red-Hat-AI-Innovation-Team/plugins

Then install the plugin from the marketplace. See .codex-plugin/INSTALL.md for manual installation.

After Installing

Invoke the setup-guide skill to configure your training algorithm, model, and data.

Skill Description
setup-guide Guided first-time configuration
training-guide Run LLM training or fine-tuning
memory-estimation Estimate GPU memory requirements

Getting Started

For comprehensive tutorials, examples, and documentation, see the examples directory.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

training_hub-0.9.0.tar.gz (1.3 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

training_hub-0.9.0-py3-none-any.whl (100.4 kB view details)

Uploaded Python 3

File details

Details for the file training_hub-0.9.0.tar.gz.

File metadata

  • Download URL: training_hub-0.9.0.tar.gz
  • Upload date:
  • Size: 1.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for training_hub-0.9.0.tar.gz
Algorithm Hash digest
SHA256 93a0c7936cbb3403f1cec2c1ef8e043c30df3e38eb1d54a67275741f9f20c13a
MD5 b68c599675ba67e1186e0438188e48a4
BLAKE2b-256 cf534ef2993f8a62be0c839ed50463c2e5ff9d436e1b6e4ca21b3209f1275b30

See more details on using hashes here.

Provenance

The following attestation bundles were made for training_hub-0.9.0.tar.gz:

Publisher: pypi.yaml on Red-Hat-AI-Innovation-Team/training_hub

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file training_hub-0.9.0-py3-none-any.whl.

File metadata

  • Download URL: training_hub-0.9.0-py3-none-any.whl
  • Upload date:
  • Size: 100.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for training_hub-0.9.0-py3-none-any.whl
Algorithm Hash digest
SHA256 93a5526d93735607c3b23ec4acdfed7ca46a8b4c689d6573458ff54c20072fba
MD5 0aa83702c93aaf9f9b53a3f3abf2fd87
BLAKE2b-256 67cd1a365a0faaaaeba28fac6dc5613ef370765f0a4f9a5d779b6e58e43b2dab

See more details on using hashes here.

Provenance

The following attestation bundles were made for training_hub-0.9.0-py3-none-any.whl:

Publisher: pypi.yaml on Red-Hat-AI-Innovation-Team/training_hub

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page