TL;DR
This paper introduces "constructive specification," a novel method for efficiently identifying the best agent (a specialized LLM or tool-augmented system) for a given user query in a large, rapidly evolving ecosystem of black-box agents. It achieves this by building hierarchical "capability specifications" from limited agent profiling and then matching queries to these specifications, enabling plug-and-play agent selection without retraining.
What Problem Does This Paper Address?
The proliferation of Large Language Models (LLMs) as API-accessible agents has created a complex ecosystem where developers need to select the most suitable agent for a specific task. However, with agents acting as black boxes (no access to internals) and the sheer scale and constant evolution of these systems, exhaustively testing and profiling every agent for every query is computationally infeasible. Existing methods often rely on coarse descriptions or require expensive retraining of selection models as the agent pool changes. This paper tackles the challenge of efficient, accurate, and scalable agent identification in such dynamic, black-box environments.
Methods
The core of the proposed solution is constructive specification. This involves two main stages:
- Offline Specification Generation:
- Budget-Efficient Capability Profiling: Agents are profiled on a set of diverse benchmarks. Instead of exhaustive evaluation, an "optimism-guided active profiling" algorithm is used. This algorithm intelligently explores promising regions of the benchmark space, prioritizing candidates that are likely to yield high performance while staying within a strict evaluation budget. This is inspired by bandit algorithms and uses an optimistic upper bound to guide exploration.
- Hierarchical PAVE Specification: The performance profile (which samples an agent handles well) is encoded into a "PAVE" (Parameter Vector) specification. This specification is hierarchical, meaning it captures both global agent capabilities and finer-grained sub-capabilities within specific clusters. This allows for more nuanced matching. The PAVE specification is essentially a parameter update to a shared base model, making specifications directly comparable across agents.
- Online Agent Search:
- Benchmark Anchoring: When a user query arrives, it's first "anchored" to the most relevant benchmark within the system. This is done by finding a local neighborhood of similar samples in the benchmark's embedding space.
- Query Specification: The query is then enriched with this benchmark context and transformed into a query specification using the same PAVE encoding.
- Confidence-Aware Aggregation: The query specification is matched against the hierarchical specifications of all agents. A confidence-aware aggregation mechanism combines similarity scores with a measure of the agent's reliability (based on its performance on "hard" benchmark samples) to produce a final ranking score. This ensures robust selection even with limited query information.
The entire process is designed to be plug-and-play: new agents can be added by computing their specifications offline, and queries can be matched instantly without retraining any central component.
Datasets
The paper uses several datasets for training and evaluation, categorized into:
- In-System Benchmarks: These are used for agent profiling and specification construction. They include:
- Mathematics: GSM8K, MATH, MathQA
- Healthcare: MedMCQA, PubMedQA
- Finance: FPB
- Out-of-System Benchmarks: These are used to evaluate generalization to unseen data distributions. They include:
- Mathematics (MMLU subsets): Abstract Algebra, College Mathematics, Elementary Mathematics, High School Mathematics
- Healthcare (MMLU subsets): Anatomy, Clinical Knowledge, College Biology, College Medicine, Medical Genetics, Professional Medicine
- Finance: MA, German Credit
Key Insights and Ideas
- Leveraging Learnware for LLM Agents: The paper effectively bridges the gap between the traditional "learnware" paradigm (reusable software components with specifications) and the modern LLM agent ecosystem, adapting learnware principles to black-box, API-accessible agents.
- Hierarchical Specifications for Nuance: The hierarchical nature of the PAVE specifications is crucial. It allows the system to capture fine-grained capabilities, which is essential for accurately matching queries to agents, especially when user queries are underspecified.
- Optimism-Guided Profiling for Efficiency: The active profiling strategy is a key innovation. By intelligently exploring the benchmark space and pruning unpromising regions, it significantly reduces the number of agent calls needed to build reliable specifications, making the process computationally feasible.
- Plug-and-Play is Achievable: The proposed method demonstrates that true plug-and-play agent identification is possible without the need for constant retraining of selection models, a significant advantage in rapidly evolving agent ecosystems.
- Lightweight Agents Can Compete: The results show that by effectively routing queries to specialized, lightweight agents, the system can match or even surpass the performance of much larger, single-purpose models.
Key Results
- High Accuracy: The proposed "Ours" method achieved the highest average accuracy (86.59% in-system, 90.83% out-of-system) across multiple benchmarks, outperforming strong contenders like GPT-4.1 and EmbedLLM.
- Superior Ranking: The method achieved a perfect average rank of 1.00 on in-system benchmarks, indicating it consistently selected the best agent.
- Robust Generalization: The approach showed strong performance on out-of-system benchmarks, demonstrating its ability to generalize to unseen data distributions.
- Scalability: The plug-and-play design scales well with the number of agents, with accuracy improving as the agent pool grows.
- Efficiency: The constructive specification approach is computationally efficient, with offline specification generation being feasible within hours and online search taking seconds.
Limitations and Future Work
- Latency: While the identification accuracy is high, the current online search latency is not optimized for real-time applications. Future work could focus on accelerating this process.
- Multi-Step Workflows: The current work focuses on single-turn query identification. The authors suggest extending this to multi-step workflows where agents need to be selected and re-selected iteratively.
- Resource-Aware Identification: Incorporating latency and computational cost into the objective for resource-aware agent selection is another avenue for future research.
- Storage Trade-offs: While specification storage is manageable, further exploration of accuracy-storage trade-offs by adjusting hierarchical granularity or PAVE update space is suggested.
Summary updated