Abstract
The rapid proliferation of Large Language Models (LLMs) and adaptation techniques has created a "paradox of choice" for developers. Finding the optimal combination of base model and adaptation strategy—such as fine-tuning or in-context learning—typically requires expensive trial-and-error. We present COSMOS (COSt-effective MOdel–Strategy prediction), a framework that accurately forecasts the performance and cost of various adaptation strategies without full execution. By leveraging lightweight proxy models and scaling laws, COSMOS identifies Pareto-optimal configurations with a 92.72% reduction in compute cost and a low 1.09% error rate.
The Strategy Selection Problem
As of early 2025, the Hugging Face ecosystem hosts over 1.6 million models. For any specific task, developers must navigate a massive search space: which base model to select and whether to apply Supervised Fine-Tuning (SFT), Retrieval-Augmented Generation (RAG), or Chain-of-Thought (CoT) prompting.
Currently, identifying the "Pareto optimal" setup—the configuration offering maximum performance for a given budget—demands exhaustive and costly experimentation. This financial barrier often forces practitioners to settle for sub-optimal configurations. COSMOS addresses this by making the selection process both predictable and computationally inexpensive.
Methodology: COSMOS Predictors
COSMOS treats strategy selection as an optimization problem, utilizing two specialized, low-cost predictors to bypass full-scale experiments:
- Fine-tuning (QLoRA) Predictor: Instead of training the entire model, COSMOS employs an embedding-augmented proxy. It utilizes frozen embeddings from the base LLM to train a lightweight linear projector. A small calibration step (using approximately 10% of the data) then bridges the performance gap between this proxy and the actual fine-tuned model.
- In-Context Learning (ICL) Predictor: Observing that ICL performance follows an exponential saturation curve, COSMOS fits a scaling law using just two sparse measurements (e.g., 1-shot and 8-shot). This allows for accurate forecasting of performance at higher shot counts (e.g., 16 or 32) without the associated inference costs.
Evaluation and Datasets
The framework was evaluated across eight diverse benchmarks to ensure robustness:
- General Domain: MMLU, Winogrande, ARC-Challenge, and HellaSwag.
- Financial Domain: FPB, FiQA-SA, Headline, and Multifin EN.
These datasets range from 380 to over 21,000 examples, providing a robust testbed for COSMOS's scalability across different data regimes.
Key Insights
- Predictability of Adaptation: LLM performance gains are not stochastic. Fine-tuning success correlates with the linear separability of base model embeddings, while ICL gains follow mathematical scaling laws.
- Efficiency in Complexity: COSMOS becomes increasingly efficient as tasks grow more difficult. In resource-intensive scenarios like MMLU, cost savings reached 98.71%.
- Adaptation-Augmented Routing: Beyond simple model selection, COSMOS enables choosing between complex combinations, such as a "Small Model + LoRA" versus a "Large Model + RAG," significantly expanding the low-cost performance frontier.
Results
COSMOS demonstrates remarkable fidelity and efficiency:
- High Accuracy: Across 55 strategy combinations, COSMOS achieved a Mean Absolute Error (MAE) of 1.09%, nearly matching oracle accuracy.
- Computational Savings: On average, the framework reduced the overhead of strategy selection by 92.72%.
- Economic Impact: In a GPT-4o case study, COSMOS was estimated to save approximately $940,000—a 24.7x cost reduction compared to exhaustive search.
Limitations and Future Directions
While highly effective, COSMOS currently relies on strategy-specific proxy logic. Future work aims to develop a more universal predictor. Additionally, as hybrid strategies gain popularity, the search space will expand, requiring even more sophisticated modeling. Expanding the model pool to include architectures like Mixture-of-Experts (MoE) will further validate the framework's generalizability.
Summary updated