Our take
- Activity
- 20
- Community
- 40
- Issues
- 21
- Pull requests
- 21
+0 stars in the last 16 days
Overview
Mergoo is a Python library for composing specialized LLMs or LoRA adapters into a model that routes inputs among experts. It addresses the work of bringing together domain or task-specific model knowledge while retaining the option to train the composed model.
It may suit practitioners already using Hugging Face model workflows who want to experiment with mixture-of-experts or mixture-of-adapters designs. The repository documents support for several model families and training paths; check the README and its notebooks for implementation details.
Key Features
- Compose fully fine-tuned models as a Mixture-of-Experts model.
- Combine LoRA fine-tunes as a Mixture-of-Adapters model.
- Apply routing selectively across layers.
- Configure the number of experts used per token.
- Save a composed model checkpoint for loading and further training.
- Integrate with Hugging Face Trainer, TRL's SFTTrainer, and PEFT.
- Documented base-model support includes Llama, Mistral, Phi-3, and BERT.
- Supports CPU, MPS, and GPU devices.
Use Cases
- A model-development team can combine math- and code-specialized fine-tunes when it wants a single routed model to use both areas of expertise.
- Teams with multiple LoRA adapters for related support tasks can combine them into a mixture of adapters instead of managing each adapter independently.
- Researchers can explore layer-wise routing and expert composition with Hugging Face training workflows.
- Practitioners can compose a model first, then fine-tune its routers or the full merged model for a target dataset.
Getting Started
Install from PyPI:
pip install mergoo
For configuration, model composition, and training examples, see the README and linked notebooks.
Considerations
- Composing and training large language models can require substantial memory and compute. The README lists CPU, MPS, and GPU support, but does not specify resource requirements.
- The documented support is limited to named model families and Hugging Face-based training integrations. Verify compatibility with your specific model and workflow before adopting it.
- The roadmap lists router load-balancing loss and lazy tensor loading as incomplete, so these capabilities should not be assumed.
- The LGPL-3.0 license has conditions worth reviewing for your distribution and integration plans.
Found this useful?
Share it with someone who would like mergoo.