Fine-tuning Hugging Face Hub LLMs with Together AI

Together AI and Hugging Face have launched an integration that enables the fine-tuning of any compatible Large Language Model (LLM) hosted on the Hugging Face Hub using Together AI's managed infrastructure. This removes the need for developers to manage complex DevOps overhead or expensive training hardware when customizing open-source models.

Bidirectional Integration with Hugging Face Hub

The integration allows for a seamless flow of models between the Hugging Face Hub and Together AI's training environment. Together AI can pull any compatible public model from the Hub, as well as models from private repositories using an API token. Once the fine-tuning process is complete, the resulting model can be automatically pushed back to the Hugging Face Hub if a destination repository name is specified.

Technical Implementation: Base and Custom Models

To fine-tune a model, the Together AI platform utilizes a two-parameter system to configure the training environment:

  • Base Model (model): This serves as a training template. It is a model from Together AI's official catalog that defines the infrastructure configuration, memory allocation, GPU resource optimization, and inference setup.
  • Custom Model (from_hf_model): This is the specific Hugging Face model the user intends to fine-tune.

For optimal results, the custom model must share a similar architecture, approximate size, and sequence length as the base model template. For example, a model using the Llama architecture (such as HuggingFaceTB/SmolLM2-1.7B-Instruct) would use togethercomputer/llama-2-7b-chat as its base model template.

Compatibility and Scope

In general, all CausalLM models with fewer than 100 billion parameters are intended to be compatible with this feature.

Developer Impact and Use Cases

This integration reduces the friction of moving from model discovery to production. Developers can now experiment with community-driven innovations and specialized models without spending days setting up training infrastructure.

Real-World Applications

Early adopters and beta users have implemented this capability in several ways:

  • Domain Adaptation: Specializing general-purpose models for industries such as finance, healthcare, or legal work by starting with models that already possess some domain knowledge.
  • Iterative Improvement: Using a community model as a starting point, fine-tuning it, and then using that result for further refinement.
  • Community Model Specialization: Further customizing models already optimized for specific tasks, such as reasoning, coding, or multilingual capabilities, for proprietary use cases.
  • Architecture Exploration: Rapidly testing new model variants and architectures as they are released on the Hub.

Case Studies

  • Slingshot AI: Integrates this capability into their development pipeline, allowing them to run parts of the training on their own infrastructure, upload to the Hub, and then perform continued fine-tuning on Together AI's platform.
  • Parsed: Demonstrated that small, well-tuned open-source models can outperform larger closed models through the use of carefully curated datasets.

Efficiency Gains

Teams report a significant increase in "speed to value," moving specialized models into production in days rather than weeks. Additionally, the process is more cost-efficient because starting with a model that already has relevant capabilities requires fewer training epochs and smaller datasets to reach target performance levels.

Sources