TL;DR
This paper introduces PackLLM, a novel method for fusing multiple Large Language Models (LLMs) at test-time. By optimizing for minimal perplexity on a given prompt, PackLLM dynamically determines the importance of each LLM, leading to improved performance without requiring any retraining. This approach allows for flexible integration of new LLMs and outperforms existing test-time fusion methods.
What Problem Does This Paper Address?
The rapid proliferation of powerful Large Language Models (LLMs) presents an opportunity to combine their diverse strengths for better task performance. However, existing fusion methods often fall into two categories: learning-based fusers that are not modular and require expensive retraining to incorporate new LLMs, or simple ensembles that can degrade performance if some LLMs are weak. A key challenge is how to effectively fuse LLMs at test-time, leveraging arbitrary user-specified models without prior training, and ensuring that the fusion process accounts for how well each LLM understands the input prompt.
Methods
PackLLM tackles this by framing LLM fusion as a test-time optimization problem. The core idea is that an LLM's perplexity on a given prompt is a good indicator of its understanding and expertise.
- PackLLMsim: A simpler variant that validates the hypothesis that perplexity is a reliable measure for LLM expertise. It assigns weights to LLMs inversely proportional to their perplexity scores.
- PackLLMopt: The main proposed method, which approximately solves a perplexity minimization problem using a greedy algorithm. It sequentially determines the optimal weights for combining LLMs, aiming to minimize the perplexity of the fused output.
- Tokenizer Alignment: To handle LLMs with different tokenizers (a common issue), PackLLM employs a Minimum Edit Distance (MinED) approach to align token vocabularies, allowing for the addition of LLMs with diverse tokenization schemes.
Datasets
The paper evaluates PackLLM on a diverse set of tasks and datasets, including:
- Language Modeling: C4 and S2ORC datasets.
- Downstream Tasks:
- STEM: MMLU-STEM (5 tasks).
- Commonsense Reasoning: ARC, BoolQ, HellaSwag, OpenBookQA (4 tasks).
- Domain-Specific (Medicine): PubMedQA, USMLE, MMLU-Health.
- Miscellaneous Classification: AGNews, SST2, Amazon, SemEval.
The paper also details the specific LLMs used as "seed LLMs" across these tasks, totaling over 100 models.
Key Insights and Ideas
- Perplexity as an Expertise Metric: The paper strongly validates that perplexity is a reliable and effective indicator of an LLM's understanding of a given prompt, making it a suitable basis for test-time fusion.
- Test-Time Flexibility: PackLLM's key advantage is its ability to fuse arbitrary LLMs at inference time, meaning it can seamlessly incorporate newly released, more powerful models without any retraining.
- Greedy Optimization for Efficiency: The proposed greedy algorithm for PackLLMopt efficiently finds near-optimal weights, balancing performance gains with computational feasibility during inference.
- Model-Dependent Weights are Crucial: Unlike methods that rely on data-dependent (e.g., tf-idf) or fixed weights, PackLLM's model-dependent, perplexity-based weights dynamically adapt to the input and individual LLM capabilities, leading to better performance.
Key Results
- Outperforming Baselines: PackLLM outperforms existing test-time fusion baselines (like Top1-PPL and uniform ensemble) by 1.72–1.89% accuracy points on average across 25 tasks.
- Leveraging New LLMs: PackLLM significantly improves performance over learning-based fusion approaches (like FuseLLM and FoE) by 3.92–11.94% accuracy points when incorporating recently released LLMs.
- Scalability: Performance gains increase with a larger number of expert LLMs.
- Comparison to Model Selection/Merging: PackLLM generally outperforms selecting the best or largest single model and also shows advantages over model merging techniques.
- Perplexity Optimization Benefit: PackLLMopt, which optimizes perplexity, generally performs better than the simpler PackLLMsim, especially on datasets with longer prompts.
Limitations and Future Work
- Tokenizer Alignment: While PackLLM addresses differing tokenizers using MinED, aligning different tokenizers remains an open problem in NLP, and more advanced techniques could further improve performance.
- Inference Cost: Like other fusion approaches, PackLLM incurs additional inference costs compared to using a single model or simpler methods like weight averaging. Accelerating the inference time for fusion methods is identified as a promising future research direction.
Summary updated