Abstract
Large Language Models (LLMs) excel as generalists but are computationally expensive to serve, while small models require extensive domain-specific specialization to achieve high performance. Traditionally, this specialization requires retraining a model for every new task. We present Soup-of-Experts (SoE), a novel architecture that pre-trains a large bank of expert parameters designed to be linearly combined at test time. By estimating the domain weights of a target dataset, SoE can instantly instantiate a small, highly specialized language model without any gradient updates. Our results show that a 110M-parameter SoE model outperforms standard generic models and provides a significant head start over traditional fine-tuning.
Introduction
The current landscape of natural language processing presents a difficult trade-off: deploy massive, general-purpose LLMs at high cost, or invest in training small, specialized models for specific domains. While small models are efficient, they typically require vast amounts of domain-specific data to reach expert-level performance. When target data is scarce—such as in private corporate databases—practitioners often resort to importance sampling during pre-training. However, this approach is unscalable, as it necessitates training a new model from scratch for every unique specialization task.
Soup-of-Experts (SoE) addresses this bottleneck by shifting the specialization process from training-time to inference-time. Inspired by the concept of "model soups," SoE bakes the parameter-merging process directly into the pre-training phase, allowing for the instant creation of custom specialists.
The Soup-of-Experts Architecture
The SoE framework consists of three primary components that work in tandem to enable parameter-level merging:
- Parameter Bank: The model maintains a set of shared base parameters and a large bank of $n$ "expert" parameters (e.g., 128 experts).
- Routing Mechanism: A lightweight Multi-Layer Perceptron (MLP) acts as a router. It accepts a vector of "domain weights"—representing the mixture of data domains—and outputs a set of linear combination coefficients.
- Linear Instantiation: The $n$ experts are linearly combined using the coefficients from the MLP and added to the shared base parameters. This results in a single, standard-sized model ready for inference.
Meta-Training Loop
During the pre-training phase, the system undergoes a meta-training process. The model samples random domain weights from a meta-distribution, instantiates the corresponding model via the expert bank, and trains it on a batch of data sampled from that specific domain mixture. This ensures that the experts learn to be complementary and effectively combinable across a wide variety of potential domain compositions.
Zero-Shot Specialization
At test time, SoE enables specialization with zero gradient updates. Given a few documents from a target task, the system estimates their domain weights using a nearest-neighbor search against pre-computed domain centroids. These weights are passed through the MLP to merge the experts, creating a custom specialist model instantly. This process requires as few as three target samples to produce a model that significantly outperforms generic baselines.
Experimental Evaluation
Datasets and Setup
For pre-training, the authors utilized RedPajama-v2, clustered into 4,096 distinct domains using hierarchical k-means on sentence embeddings. Evaluation was conducted on 16 diverse datasets from The Pile (including arXiv, PubMed, and GitHub), representing domains and domain weights that were never seen during the pre-training phase.
Performance and Efficiency
- Superior Specialization: An instantiated 110M-parameter SoE model (derived from a 14B parameter expert bank) consistently outperformed a standard 110M generic model across all 16 specialized domains.
- The Fine-Tuning Gap: The zero-shot performance of SoE is remarkably high. In the
uspto(patents) domain, a standard generic model required 10 million additional fine-tuning tokens just to match the out-of-the-box performance of the SoE specialist. - Training Throughput: Despite the complexity of the expert bank, the linear combination process is computationally efficient. Training throughput for SoE remains at approximately 77% of standard generic pre-training.
Key Insights
Meta-Distribution Sparsity
The researchers found that the diversity of the meta-distribution during training is critical. Training SoE on sparse domain mixtures (sampling from only 2 to 4 domains at a time) produced the most effective downstream specialists. Overly broad mixtures during training prevented the model from learning the sharp distinctions necessary for narrow, specialized tasks.
Dense vs. Low-Rank Experts
In an effort to reduce storage overhead, the authors experimented with low-rank matrices for experts (similar to LoRA). However, dense experts proved more parameter-efficient. Low-rank experts appeared significantly harder to optimize from scratch, suggesting that the full capacity of dense parameters is necessary for the expert bank to learn effectively.
Conclusion and Future Work
Soup-of-Experts provides a scalable pathway for creating specialized small models without the prohibitive cost of task-specific retraining. While the current implementation requires significant storage for the 14B parameter expert bank, the resulting inference-time models are small, fast, and highly accurate.
Future research will focus on optimizing the storage of the expert bank and exploring the integration of SoE with Mixture-of-Experts (MoE) architectures. Combining these approaches could potentially raise the performance ceiling of instantiated models while maintaining the low inference latency that makes small models attractive for production use.
Summary updated