Skip to main content

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 Backends GPU Support Install Extra
Supervised Fine-tuning (SFT) InstructLab-Training Multi-GPU, multi-node base
Continual Learning (OSFT) RHAI Innovation Mini-Trainer Multi-GPU, multi-node base
Low-Rank Adaptation (LoRA) + SFT Unsloth Single-GPU, multi-GPU, multi-node [lora]
LoRA + GRPO (Adapter-Based RLVR) ART + Unsloth, verl Single-GPU (ART), multi-GPU, multi-node (verl) [grpo,lora]
GRPO (Full Fine-Tuning RLVR) verl Multi-GPU, multi-node [grpo]
GEPA (Genetic-Pareto Prompt Optimization) GEPA, MLflow CPU (API-based) [gepa]
Embedding Fine-Tuning SentenceTransformers Single-GPU, multi-GPU, CPU [embedding]
Classifier Fine-Tuning HuggingFace Transformers Single-GPU, multi-GPU, CPU base

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,
)

GEPA (Genetic-Pareto Prompt Optimization)

Gradient-free prompt optimization using evolutionary search with Pareto-based selection and LLM-driven reflection. GEPA evolves textual prompts to maximize task performance without modifying model weights, so it needs no local GPU — it optimizes prompts by calling an LLM endpoint (hosted API or local vLLM/OpenAI-compatible server via api_base). Features:

  • Genetic-Pareto search with LLM reflection to propose improved prompts
  • Works with any model reachable through LiteLLM (hosted APIs or local endpoints)
  • Two backends: gepa (direct gepa.optimize()) and mlflow (MLflow prompt registry, scorers, and tracking)
from training_hub import gepa

result = gepa(
    seed_candidate={"system_prompt": "You are a helpful assistant. Answer the question."},
    task_lm="openai/gpt-4o-mini",
    data_path="./eval_data.jsonl",
    output_dir="./gepa_output",
    reflection_lm="openai/gpt-4o",
    max_metric_calls=200,
)

Embedding Fine-Tuning

Contrastive fine-tuning of sentence embedding models (e.g. all-MiniLM-L6-v2) so that inputs with the same label cluster together in embedding space. Designed for semantic routing / classification — route a query to one of N specialist lanes by nearest-anchor cosine similarity — but applicable to any task that benefits from tighter embedding clusters (retrieval, deduplication, clustering). Features:

  • Three contrastive losses: batch_all_triplet, batch_hard_triplet, and mnrl (Multiple Negatives Ranking Loss)
  • GROUP_BY_LABEL batch sampling so every batch contains multiple labels with at least two samples per label (required for triplet mining)
  • Auto-converts label datasets to (anchor, positive) pairs for MNRL
  • Custom loss_fn support for extensibility
  • Saves in standard sentence-transformers format
from training_hub import embedding_sft

result = embedding_sft(
    model_path="sentence-transformers/all-MiniLM-L6-v2",
    data_path="routing_train.jsonl",    # {"text": "...", "label": 0}
    ckpt_output_dir="./routing_model",
    loss_type="batch_all_triplet",
    num_epochs=20,
    batch_size=32,
    learning_rate=2e-5,
)

Classifier Fine-Tuning

Fine-tunes a classification head on any recognized backbone (HF Trainer + cross-entropy) — the best choice for a fixed label set (highest accuracy; raw per-class logits, calibratable at evaluation time). A thin, convention-based harness over the HF Auto-class family: it covers the common "decision model" primitives through native HF classes with no per-model code and no vendored packages. Features:

  • Three tasks via a task selector: sequence_classification (default), multiple_choice, and token_classification
  • Encoders (ModernBERT/DeBERTa/BERT) full fine-tuned; decoder backbones via LoRA (use_peft)
  • Custom architectures with no vendoring: trust_remote_code + pinned revision (any HF auto_map), model_class (pip-packaged backbones), and loss_fn (custom objective)
  • String labels auto-encoded to ints; saves an inference-ready checkpoint + label_mapping.json
from training_hub import classifier_sft

result = classifier_sft(
    model_path="answerdotai/ModernBERT-base",
    data_path="intents.parquet",         # {"text": "...", "category": "billing"}
    ckpt_output_dir="./intent_clf",
    text_column="text",
    label_column="category",
    num_epochs=10,
    batch_size=32,
    learning_rate=2e-5,
)

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.

GEPA Support

For gradient-free prompt optimization (includes the MLflow backend):

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

Note: GEPA optimizes prompts via LLM API calls and does not require CUDA. To optimize against a local model, run a vLLM (or other OpenAI-compatible) server and pass its URL via the api_base parameter.

Embedding Support

For contrastive embedding fine-tuning (sentence-transformers backend):

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

Note: Embedding fine-tuning uses sentence-transformers>=5.0. It runs on CPU for small models (e.g. all-MiniLM-L6-v2, 23M params) and accelerates on a single or multi-GPU when CUDA is available.

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.

Metadata

Release files for training-hub 0.12.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 training-hub 0.12.0
File Size Uploaded Provenance Actions
training_hub-0.12.0.tar.gz 1.5 MB With provenance Details for training_hub-0.12.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for training-hub 0.12.0
File Interpreter ABI Platform Actions
training_hub-0.12.0-py3-none-any.whl Python 3 none any Details for training_hub-0.12.0-py3-none-any.whl

Total release size: 1.7 MB

Release files / training_hub-0.12.0.tar.gz

Download URL training_hub-0.12.0.tar.gz
Size 1.5 MB
Tags Source
SHA-256 checksum
How to use checksums
2e4eddc6fb7454f902f86f4f5f781e8d4818553da62a71c189914d3fd314464d
BLAKE2b-256 checksum
How to use checksums
81efe33f593b981665442c39d1a83b0de696e599a4526cf0fbe32fb06ec1407d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 12, 2026.

Transparency log

Release files / training_hub-0.12.0-py3-none-any.whl

Download URL training_hub-0.12.0-py3-none-any.whl
Size 176.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0fcfed743594f1bf864763bf6d5e9d16593dd8e8b0a91214a6686a6f43b7ad62
BLAKE2b-256 checksum
How to use checksums
bc1cf15750bb4ea60acc978259baec11a59283c074f69746dcb064663c5c3c20
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 12, 2026.

Transparency log

Security for training-hub 0.12.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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for training_hub-0.12.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 12, 2026.

Transparency log

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