Skip to main content
AI
  • Get started with AI

    • Red Hat AI

      Accelerate the development and deployment of enterprise AI solutions.

    • AI learning hub

      Explore learning materials and tools, organized by task.

    • AI interactive demos

      Click through scenarios with Red Hat AI, including training LLMs and more.

    • AI/ML learning paths

      Expand your Red Hat OpenShift AI knowledge using these learning resources.

    • AI quickstarts

      Focused AI use cases designed for fast deployment on Red Hat AI platforms.

    • No-cost AI training

      Foundational Red Hat AI training.

  • Featured resources

    • Red Hat OpenShift AI
    • Open source AI for developers
    • AI product application development
    • Open source-powered AI/ML for hybrid cloud
    • AI and Node.js cheat sheet

Red Hat AI Factory with NVIDIA

Red Hat AI Factory with NVIDIA is a co-engineered, enterprise-grade AI solution for building, deploying, and managing AI at scale across hybrid cloud environments.

Learn
  • Self-guided

    • Documentation

      Find answers, get step-by-step guidance, and learn how to use Red Hat products.

    • Learning paths

      Explore curated walkthroughs for common development tasks.

    • Guided learning

      Receive custom learning paths powered by our AI assistant.

    • See all learning
  • Hands-on

    • Developer Sandbox

      Spin up Red Hat's products and technologies without setup or configuration.

    • Interactive labs

      Learn by doing in these hands-on, browser-based experiences.

    • Interactive demos

      Click through product features in these guided tours.

  • Browse by topic

    • AI/ML
    • Automation
    • Java
    • Kubernetes
    • Linux
    • See all topics
  • Training & certifications

    • Courses and exams
    • Certifications
    • Skills assessments
    • Red Hat Academy
    • Learning subscription
    • Explore training
Build
  • Get started

    • Red Hat build of Podman Desktop

      A downloadable, local development hub to experiment with our products and builds.

    • Developer Sandbox

      Spin up Red Hat's products and technologies without setup or configuration.

  • Download products

    • Red Hat Enterprise Linux
    • Red Hat AI
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform
    • See all products
  • Featured

    • Red Hat build of OpenJDK
    • Red Hat JBoss Enterprise Application Platform
    • Red Hat OpenShift Dev Spaces
    • Red Hat Developer Toolset
  • References

    • E-books
    • Documentation
    • Cheat sheets
    • Architecture center
Community
  • Get involved

    • Events
    • Live AI events
    • Red Hat Summit
    • Red Hat Accelerators
    • Community discussions
  • Follow along

    • Articles & blogs
    • Developer newsletter
    • Videos
    • Github
  • Get help

    • Customer service
    • Customer support
    • Regional contacts
    • Find a partner

Join the Red Hat Developer program

Download Red Hat products and project builds, access support documentation, learning content, and more.

ConsoleDocsSupport Search
New For you

Recommended

We'll recommend resources you may like as you browse. Try these suggestions for now.

  • Product downloads
  • Cheat sheets
  • Red Hat Developer learning portal
  • Developer blog
  • E-books
  • Developer Sandbox
Log in

Get more with a Red Hat Developer account

  • Product downloads
  • Console access
  • Event registration
  • Training & trials
Explore more account benefitsLog in or register

A subscription may be required for some services.

Contact us

Get started with language model post-training using Training Hub

Introducing Training Hub: An open source, algorithm-centered library for LLM training

November 19, 2025
Mustafa Eyceoz
Related topics:
Artificial intelligenceOpen sourcePython
Related products:
Red Hat AI

    Open source language models can deliver incredible performance because of their smaller size and efficient cost, but they might not deliver the required results for more targeted use cases. There is, however, one more key benefit that open source models have over their frontier model counterparts: customizability. Often, you can fit an open source model to your specific use case via post-training, which offers better and cheaper performance than even frontier models can provide. while running securely and safely for private data, offline platforms, and so on.

    This leads to the question: how do you actually get started with language model post-training? Many methods are available today, spanning dozens of libraries with diverging requirements, APIs, setup, usage, and more. How can you learn and resolve all of these differences while also trying to learn what method works best for a given task, data, or hardware? On top of this, what if you are trying to run multiple methods in sequence or to include them in the same project or application?

    Therein lies the value of Training Hub, an open source library with algorithm-level abstractions for common, modern post-training techniques. It pulls from a collection of community implementations and provides a common, pythonic interface from Supervised Fine-Tuning to Reinforcement Learning.

    An intuitive, uniform entrypoint

    Training Hub is a Python-based library built by Red Hat’s AI Innovation team. It helps developers focus on language model post-training algorithms without having to manage the unique constraints and overhead of discovering, understanding, and running a number of independent libraries of varying complexity.

    More specifically, Training Hub provides a mapping of algorithms to community libraries and official backend implementations, and also a common interface for running the post-training algorithms (Figure 1).

    A flow chart that maps four top-level algorithms for AI model fine-tuning to their respective backend implementations: Supervised Fine-Tuning (SFT) maps to Instructlab Training; Orthogonal Subspace Fine-Tuning (OSFT) maps to Red Hat AI Innovation Mini Trainer; Low Rank Adaptation (LoRA) maps to Hugging Face PEFT (Parameter-Efficient Fine-Tuning); Group Relative Policy Optimization (GRPO) maps to Volcano Engine Reinforcement Learning (VERL).
    Figure 1: Training Hub uses multiple community libraries and official implementations for each available algorithm.

    Every algorithm is exposed and runnable as a simple Python function, with a set of common arguments (base model, data, learning rate, batch size, GPU/node distributed setup, and so on), alongside a set of algorithm-specific arguments. For example, running standard Supervised Fine-Tuning (SFT) is as simple as calling the sft function with desired model, data, and hyperparameters:

    from training_hub import sft
    
    sft(
        model_path="/path/to/model",
        data_path="/path/to/data",
        ckpt_output_dir="/path/to/checkpoints",
        num_epochs=3,
        learning_rate=1e-5,
        effective_batch_size=16
    )

    If you wanted to run the same algorithm, but with a different backend implementation (perhaps the default community library doesn’t support a model or data format you need during training, or another library includes an enticing optimization for certain hardware), switching out the backend is as simple as just asking for it! For the same algorithm, the interface remains constant:

    from training_hub import sft
    
    sft(
        model_path="/path/to/model",
        data_path="/path/to/data",
        ckpt_output_dir="/path/to/checkpoints",
        num_epochs=3,
        learning_rate=1e-5,
        effective_batch_size=16,
        backend="alternate-backend" #<-implemented
    )

    If you instead wanted to run a continual learning method like Orthogonal Subspace Fine-Tuning (OSFT), you would run the osft function with the same arguments, just adding one new algorithm-specific argument, unfreeze-rank-ratio, which dictates what percent of the most critical model weights remain frozen:

    from training_hub import osft
    
    osft(
        model_path="/path/to/model",
        data_path="/path/to/data",
        ckpt_output_dir="/path/to/checkpoints",
        num_epochs=3,
        learning_rate=1e-5,
        effective_batch_size=16,
        unfreeze_rank_ratio=0.3 #<--- OSFT-specific
    )

    Plug-and-play development

    With Training Hub, adding new algorithms and new implementations for existing algorithms is incredibly simple.

    Every algorithm has an entrypoint function under its name (sft, osft, etc.) and an Algorithm class defining the core train function, the required_params, and the optional_params.

    There are then Backend classes that define how to execute_training for a given implementation—that is, how to parse the input arguments and run the training job using the community implementation selected (or defaulted). For any given algorithm, there can be any number of backend providers. For example, if you wanted to add a Hugging Face library, VERL, Unsloth, Llama Factory, etc., as a backend implementation for a given algorithm, you can define a new Backend class for the library. It will then be usable under the same common algorithm-centered interface as the rest of the implementations.

    If you want to add a new algorithm, simply create a file under the algorithms directory defining a new Algorithm class and the entrypoint function (lora, grpo, cpt, etc.).

    Outside of documentation, algorithms and backends can also be discovered directly through the library:

    from training_hub import AlgorithmRegistry
    
    # List all available algorithms
    algorithms = AlgorithmRegistry.list_algorithms()
    print("Available algorithms:", algorithms) # ['sft', 'osft']
    
    # List backends for SFT
    sft_backends = AlgorithmRegistry.list_backends('sft')
    print("SFT backends:", sft_backends) # ['instructlab-training']
    
    # Get algorithm class directly
    SFTAlgorithm = AlgorithmRegistry.get_algorithm('sft')

    What's more, you can dynamically register, list, and use new algorithms and backends on the fly, enabling you to make use of the library in whatever way is most convenient to your workflow.

    The first home for OSFT

    The Training Hub is also home to the first official Orthogonal Subspace Fine-Tuning (OSFT) implementation available openly! This parameter-efficient method addresses continual learning and iterative updates in a language model. By analyzing component matrices via adaptive singular value decomposition (SVD), the method identifies the critical directions in the model and the corresponding weights. It instead only updates in orthogonal directions (the least critical model weights).

    By setting the unfreeze_rank_ratio, a user can select what percent of the model’s weights are deemed critical and left frozen versus how much of the least critical model components should remain unfrozen for new task learning capacity. Setting the value to 1.0 is effectively equivalent to full-fine-tuning with SFT, whereas setting to 0.5 will leave 50% of the model frozen and 50% trainable. See Figure 2.

    Diagram illustrating the effect of the unfreeze_rank_ratio (urr) value on model fine-tuning.
    Figure 2: OSFT provides a controllable balance for new task learning while retaining previous task performance and general model capability.

    With OSFT now being officially merged into Hugging Face PEFT, we expect future adoption and collaboration with popular community training libraries. All of these will be available through the Training Hub as a common source with direct inventor support.

    How to get started with Training Hub

    Let’s now do a quick run-through of getting set up with the Training Hub. The package is available on PyPI and can also be installed from source.

    Step 1: Set up your environment

    You’ll need Python 3.11+ installed. Then, create a project directory and virtual environment:

    mkdir training-project && cd training-project

    Enter python3 -m venv .venv or uv venv if preferred. Then run:

    source .venv/bin/activate

    Step 2: Install training-hub

    For basic installation with GPU support:

    pip install training-hub[cuda]

    For development, one can do an editable install from source:

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

    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
    pip install training-hub[cuda] --no-build-isolation

    Similarly, for development, you can run:

    pip install -e .
    pip install -e .[cuda] --no-build-isolation

    Step 3: Begin training

    To start training, either create your own Python file or notebook, or start with one of our existing examples. To see a list of available algorithms, you can run:

    from training_hub import AlgorithmRegistry
    algorithms = AlgorithmRegistry.list_algorithms()
    print("Available algorithms:", algorithms)

    All algorithms are also listed in the Training Hub main README and on the examples page.

    3.1: General guidance

    To begin training with a given algorithm, start by importing the desired algorithm:

    from training_hub import <algorithm_name>

    All you have to do from there is run:

    <algorithm_name>(
    model_path=”/path/to/model”,
    data_path=”path/to/data”,
    ckpt_output_dir=”path/to/save/checkpoints”,
    …
    )

    Most algorithms will have a set of similar common parameters along with a few algorithm-specific parameters. While there are also only a few required parameters, there is a large variety of available optional parameters. To view the available parameters for a given algorithm, you can run:

    from training_hub import create_algorithm
    osft_algo = create_algorithm('osft', 'mini-trainer')
    required_params = osft_algo.get_required_params()
    print("Required parameters:", list(required_params.keys()))
    optional_params = osft_algo.get_optional_params()
    print("Optional parameters:", list(optional_params.keys()))

    Or, simply view the documentation for the algorithm within our docs directory.

    3.2: Algorithm-specific examples

    Getting started with an algorithm like SFT is relatively straightforward. Run:

    from training_hub import sft
    sft(
    model_path="/path/to/model",
    data_path="/path/to/data",
    ckpt_output_dir="/path/to/checkpoints",
    num_epochs=3,
    learning_rate=1e-5,
    effective_batch_size=16,
    )

    However, the options for customizing to fit your use case and hardware are quite expansive:

    • To set a limit on the number of tokens per GPU (a hard cap for memory) you will want to set max_tokens_per_gpu.
    • For specifying the number of GPUs, set nprocs_per_node.
    • For configuring your checkpoint frequency, you can adjust checkpoint_at_epoch and save_samples, or to save optimizer state, add accelerate_full_state_at_epoch.
    • If you are starting a multi-node job, nnodes, node_rank, rdvz_id, and rdvz_endpoint will all be critical.

    The Training Hub lets you access the full power of the underlying implementations:

    # All possible SFT parameters
    training_params = {
        # Required parameters
        'model_path': model_path,
        'data_path': data_path,
        'ckpt_output_dir': ckpt_output_dir,
        
        # Core training parameters
        'num_epochs': num_epochs,
        'effective_batch_size': effective_batch_size,
        'learning_rate': learning_rate,
        'max_seq_len': max_seq_len,
        'max_tokens_per_gpu': max_tokens_per_gpu,
        
        # Data and processing parameters
        'data_output_dir': data_output_dir,
        'warmup_steps': warmup_steps,
        
        # Checkpointing parameters
        'checkpoint_at_epoch': checkpoint_at_epoch,
      'save_samples': save_samples,
        'accelerate_full_state_at_epoch': accelerate_full_state_at_epoch,
        
        # Distributed training parameters
        'nproc_per_node': nproc_per_node,
        'nnodes': nnodes,
        'node_rank': node_rank,
        'rdzv_id': rdzv_id,
        'rdzv_endpoint': rdzv_endpoint,
    }

    For example, if running on 8xH100 (single node) and training Llama-3.1-8B-Instruct, your function might look like:

    from training_hub import sft
    sft(
    model_path="meta-llama/Llama-3.1-8B-Instruct",
    data_path="/path/to/data",
    ckpt_output_dir="llama-ckpts",
    num_epochs=3,
    learning_rate=1e-5,
    effective_batch_size=16,
    nprocs_per_node=8,
    max_tokens_per_gpu=25000,
    max_seq_len=8192,
    checkpoint_at_epoch=True,
    accelerate_full_state_at_epoch=False
    )

    For runnable examples for both SFT and OSFT (using settings for 2x48GB GPUs by default), check out the following notebooks:

    • SFT runnable notebook
    • OSFT runnable notebook

    For more in-depth guidance, tutorials, documentation, and examples, check out our examples page.

    Continued progress

    The Training Hub will continue to receive new algorithm and community implementation support and is also fully open to contribution. If you have any core post-training algorithm or required library that you would like to incorporate in your workflows under the Training Hub interface, feel free to open issues or PRs directly on the GitHub repository. For any further inquiries, you can tag me directly on GitHub @Maxusmusti. Let’s work together to build a common home for all language model post-training!

    Related Posts

    • Post-training methods for language models

    • Accelerate model training on OpenShift AI with NVIDIA GPUDirect RDMA

    • How AMD GPUs accelerate model training and tuning with OpenShift AI

    • TrustyAI Detoxify: Guardrailing LLMs during training

    • Model training in Red Hat OpenShift AI

    • The strategic choice: Making sense of LLM customization

    Recent Posts

    • A day in the life of an NVIDIA H100 on Red Hat OpenShift 5

    • Migrate BuildConfigs to builds for Red Hat OpenShift with one plug-in install

    • Run Red Hat Enterprise Linux CoreOS on NVIDIA BlueField DPUs

    • Agent harness engineering: Separating model capabilities from enforcement

    • What's new for developers in Red Hat Enterprise Linux 10.3 and 9.9

    What’s up next?

    Use Podman Desktop to create a bootable Django-based application using image mode for RHEL, integrating Django, Gunicorn, and NGINX.

    Start the learning path
    Red Hat Developers logo

    Platforms

    • Red Hat AI
    • Red Hat Enterprise Linux
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform
    • See all products

    Build

    • Developer Sandbox
    • Developer tools
    • Interactive tutorials
    • API catalog

    Quicklinks

    • Learning resources
    • E-books
    • Cheat sheets
    • Blog
    • Events
    • Newsletter

    Communicate

    • About us
    • Contact sales
    • Find a partner
    • Report a website issue
    • Site status dashboard
    • Report a security problem

    Red Hat Developer

    Build here. Go anywhere.

    We serve the builders. The problem solvers who create careers with code.

    Join us if you’re a developer, software engineer, web designer, front-end designer, UX designer, computer scientist, architect, tester, product manager, project manager or team lead.

    Sign me up

    Red Hat legal and privacy links

    • About Red Hat
    • Jobs
    • Events
    • Locations
    • Contact Red Hat
    • Red Hat Blog
    • Inclusion at Red Hat
    • Cool Stuff Store
    • Red Hat Summit
    © 2026 Red Hat

    Red Hat legal and privacy links

    • Privacy statement
    • Terms of use
    • All policies and guidelines
    • Digital accessibility
    Ask AI