Abstract
Algorithm selection, a critical process of automated machine learning, aims to identify the most suitable algorithm for solving a specific problem prior to execution. Mainstream algorithm selection techniques heavily rely on problem features, while the role of algorithm features remains largely unexplored. Due to the intrinsic complexity of algorithms, effective methods for universally extracting algorithm information are lacking. This paper takes a significant step towards bridging this gap by introducing Large Language Models (LLMs) into algorithm selection for the first time. By comprehending the code text, LLM not only captures the structural and semantic aspects of the algorithm, but also demonstrates contextual awareness and library function understanding. The high-dimensional algorithm representation extracted by LLM, after undergoing a feature selection module, is combined with the problem representation and passed to the similarity calculation module. The selected algorithm is determined by the matching degree between a given problem and different algorithms. Extensive experiments validate the performance superiority of the proposed model and the efficacy of each key module. Furthermore, we present a theoretical upper bound on model complexity, showcasing the influence of algorithm representation and feature selection modules. This provides valuable theoretical guidance for the practical implementation of our method.
Introduction
In the field of automated machine learning (AutoML), Algorithm Selection (AS) is the challenge of picking the best algorithm for a specific problem instance before execution. Traditionally, this has been a "unidirectional" process: researchers manually extract features from the problem (e.g., dataset size or logic formula constraints) and map them to historical performance data.
The primary bottleneck in this field is the "black box" treatment of algorithms. Because algorithms are complex and diverse, manually designing a universal set of features to describe them is incredibly difficult. Without "understanding" an algorithm's internal logic, library dependencies, or structural patterns, selection models miss the critical bidirectional relationship between a problem's requirements and an algorithm's specific capabilities.
The AS-LLM Framework
To address these limitations, we introduce AS-LLM, a multi-module framework designed to bridge the gap between problem representation and algorithm logic. Unlike traditional methods that rely on Abstract Syntax Trees or manual engineering, AS-LLM treats algorithm source code or documentation as a rich source of semantic information.
The framework consists of several key stages:
- Algorithm Representation via LLMs: Pretrained LLMs (such as CodeBERT or GPT-3) are used to embed algorithm source code or descriptive text (like pseudo-code). This captures nuanced semantic information and contextual awareness.
- Sequential Processing: Because LLM embeddings are sequential, an LSTM layer processes these features into a fixed-length vector.
- Differentiable Feature Selection: To handle the high dimensionality and potential noise of LLM embeddings, a feature selection module using Gumbel-softmax distributions is implemented. This allows the model to learn which algorithmic features are most predictive in a differentiable way.
- Similarity Calculation: Problem features and algorithm features are processed through separate Multi-Layer Perceptrons (MLPs). The model then calculates the cosine similarity between these representations to determine the "matching degree" for a candidate algorithm.
Experimental Evaluation
We evaluated AS-LLM using the ASlib (Algorithm Selection Library) Benchmark, covering 10 diverse scenarios including SAT solving, Constraint Programming, the Traveling Salesman Problem, and Bayesian Network Structure Learning (BNSL).
Key Results
- State-of-the-Art Performance: AS-LLM outperformed five classic algorithm selection methods (including SATzilla11 and SUNNY) in 8 out of 10 scenarios.
- Significant Gains: In the BNSL-2016 scenario, AS-LLM achieved a PAR10 score of 1385.58, a substantial improvement over the next best competitor, SATzilla11, which scored 2004.23.
- Ablation Studies: Removing the algorithm feature module resulted in the most significant performance drop, confirming that algorithmic "understanding" is the primary driver of the model's success.
Discussion and Insights
The core insight of this work is that algorithms are not black boxes; their source code is a goldmine of information. LLMs can "read" this code to understand library usage and logic flow, which directly correlates to performance on specific problem types. Furthermore, the model is robust to missing code; even when source code is unavailable, LLMs can extract meaningful features from natural language descriptions or pseudo-code.
While the use of multiple modules (LLM, LSTM, Feature Selection) increases computational overhead compared to simpler ranking models, the inclusion of the Gumbel-softmax feature selection module is critical for ensuring the model converges efficiently and generalizes well. Future work will explore domain-specific LLMs fine-tuned for optimization and more advanced fusion techniques to further refine the problem-algorithm interaction.
Summary updated