From Relevance to Validity: Zero-Shot Tool Selection via Functional and Contextual Validation
Organizations: UESTC · LZU · CityUHK · Northwestern ·
Abstract
Large language model (LLM) agents increasingly face tasks from unseen domains and execution contexts, making zero-shot tool selection essential for identifying tools that can satisfy task requirements. Existing dominant methods mainly rely on relevance ranking, but semantic matching alone cannot ensure that a tool is functionally compatible or remains applicable in a new context. We preliminarily identify a transfer-validity gap, where semantically relevant tools may still fail to satisfy functional or contextual requirements after transfer. To address this gap, we propose \methodname{}, a progressive validation framework that complements semantic relevance with endpoint-grounded functional compatibility and task-conditioned contextual evidence. Across cross-domain and cross-dataset transfer, \methodname{} consistently improves capability ranking, with larger gains under functional or contextual ambiguity. Ablation results further confirm the complementary contributions of functional and contextual validation.
Figures & tables
| Protocol | Model | Natural | Semantic | Context | Mixed | ||||||||
| MRR | N@5 | H@3 | MRR | N@5 | H@3 | MRR | N@5 | H@3 | MRR | N@5 | H@3 | ||
| Random | 0.227 | 0.157 | 0.220 | 0.222 | 0.157 | 0.209 | 0.222 | 0.154 | 0.212 | 0.219 | 0.153 | 0.205 | |
| 0.001 | 0.001 | 0.003 | 0.004 | 0.006 | 0.008 | 0.001 | 0.001 | 0.004 | 0.001 | 0.003 | 0.004 | ||
| Semantic Cosine | 0.881 | 0.840 | 0.911 | 0.263 | 0.246 | 0.305 | 0.259 | 0.225 | 0.297 | 0.213 | 0.165 | 0.190 | |
| 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | 0.000 | ||
| Pointwise MLP | 0.740 | 0.699 | 0.823 | 0.440 | 0.410 | 0.500 | 0.435 | 0.392 | 0.487 | 0.399 | 0.355 | 0.442 | |
| Protocol | Variant | Natural | Semantic | Context | Mixed | ||||||||
| MRR | N@5 | H@3 | MRR | N@5 | H@3 | MRR | N@5 | H@3 | MRR | N@5 | H@3 | ||
| Cross domain | TACT (Full) | 0.915 | 0.873 | 0.952 | 0.629 | 0.604 | 0.726 | 0.672 | 0.624 | 0.755 | 0.564 | 0.529 | 0.644 |
| w/o Context | 0.899 | 0.853 | 0.939 | 0.620 | 0.592 | 0.720 | 0.594 | 0.552 | 0.677 | 0.521 | 0.483 | 0.594 | |
| w/o Functional | 0.903 | 0.859 | 0.941 | 0.568 | 0.545 | 0.660 | 0.605 | 0.557 | 0.683 | 0.504 | 0.467 | 0.579 | |
| Anchor only | 0.881 | 0.840 | 0.911 | 0.263 | 0.246 | 0.305 | 0.259 | 0.225 | 0.297 | 0.213 | 0.165 | 0.190 | |
| Cross dataset | TACT (Full) | 0.763 | 0.746 | 0.836 | 0.613 | 0.580 | 0.668 | 0.574 | 0.543 | 0.613 | 0.538 | 0.500 | 0.572 |
| Scale | Natural | Semantic | Context | Mixed | ||||
| Sem. | TACT | Sem. | TACT | Sem. | TACT | Sem. | TACT | |
| Base | 0.8397 | 0.8725 | 0.2458 | 0.6035 | 0.2246 | 0.6244 | 0.1654 | 0.5288 |
| 100 | 0.4319 | 0.4454 | 0.0406 | 0.2930 | 0.0780 | 0.3242 | 0.0600 | 0.2862 |
| 500 | 0.4015 | 0.4100 | 0.0346 | 0.2478 | 0.0626 | 0.2782 | 0.0508 | 0.2462 |
| Full | 0.3822 | 0.4011 | 0.0333 | 0.2315 | 0.0563 | 0.2602 | 0.0483 | 0.2311 |
Appendix figures & tables19 assets
Supplementary material from the paper’s appendix.
Appendix
| Diagnostic statistic | Value |
| Eligible functional-diagnostic tasks | 29,178 |
| 31.41% | |
| 44.25% | |
| 57.14% | |
| 73.62% | |
| Constructed contextual pairs | 500 |
| Changed condition | Included | Flips | Rate (%) |
| Access policy | 64 | 6 | 9.38 |
| Execution environment | 68 | 5 | 7.35 |
| Geographic scope | 62 | 8 | 12.90 |
| Locale | 71 | 9 | 12.68 |
| Platform | 73 | 23 | 31.51 |
| Temporal scope | 70 | 11 | 15.71 |
| Dataset | View | Tasks | Caps. | Pairs | Pos. (%) | Sem. (%) | Ctx. (%) | Other (%) | Cand./Task |
| ToolBench | Natural | 201,774 | 3,442 | 4,370,648 | 7.7 | 0.0 | 0.0 | 92.3 | 21.66 |
| Semantic | 50,254 | 3,442 | 1,084,884 | 7.4 | 30.4 | 0.0 | 62.3 | 21.59 | |
| Context | 75,709 | 3,442 | 1,637,800 | 7.5 | 0.0 | 51.4 | 41.1 | 21.63 | |
| Mixed | 62,266 | 3,442 | 1,345,846 | 7.5 | 22.0 | 24.7 | 45.9 | 21.61 | |
| TaskBench | Natural | 17,136 | 103 | 205,535 | 23.7 | 0.0 | 0.0 | 76.3 | 11.99 |
| Semantic | 17,136 | 103 | 220,048 | 22.1 | 77.9 | 0.0 | 0.0 | 12.84 |
| View | Domains | Tasks/Pools | Caps. | Pairs | Pos. (%) | Sem. (%) | Ctx. (%) | Other (%) | Cand./Task |
| Natural | 49 | 201,774 | 3,442 | 4,370,648 | 7.7 | 0.0 | 0.0 | 92.3 | 21.66 |
| Semantic | 42 | 50,254 | 3,442 | 1,084,884 | 7.4 | 30.4 | 0.0 | 62.3 | 21.59 |
| Context | 49 | 75,709 | 3,442 | 1,637,800 | 7.5 | 0.0 | 51.4 | 41.1 | 21.63 |
| Mixed | 46 | 62,266 | 3,442 | 1,345,846 | 7.5 | 22.0 | 24.7 | 45.9 | 21.61 |
| Dataset | View | Unit | Valid | Valid (%) | Invalid | Unresolved | |
| ToolBench | Semantic | Pair | 160 | 152 | 95.0 | 8 | 0 |
| Context | Pair | 160 | 148 | 92.5 | 12 | 0 | |
| Mixed | Pool | 100 | 92 | 92.0 | 8 | 0 | |
| TaskBench | Semantic | Pair | 160 | 154 | 96.3 | 6 | 0 |
| Context | Pair | 160 | 150 | 93.8 | 10 | 0 | |
| Mixed | Pool | 100 | 93 | 93.0 | 7 | 0 |
| View | Audited records | Unit | Valid | Valid (%) | Agreement (%) | Sem. | Func. | |
| Natural | 98 | Pair | 85 | 82 | 96.5 | 92.7 | 0.920 | 0.767 |
| Semantic | 126 | Pair | 84 | 78 | 92.9 | 89.1 | 0.750 | 0.844 |
| Context | 147 | Pair | 98 | 92 | 93.9 | 90.3 | 0.797 | 0.740 |
| Mixed | 496 | Pool | 46 | 43 | 93.5 | 93.8 | 0.687 | 0.747 |
| Configuration | Value |
| Frozen encoder | all-MiniLM-L6-v2 |
| Embedding dimension | 384 |
| Maximum requirements | 4 |
| Endpoint retrieval | 4 |
| Maximum exact assignments | 209 |
| Initial null score | 0.15 |
| Method | Configuration |
| Logistic Ranker | Eight pair features; StandardScaler ; balanced pointwise logistic regression with , lbfgs , and 500 maximum iterations. |
| Pointwise MLP | Input ; with LayerNorm, ReLU, and dropout ; weighted BCE with positive weight ; AdamW ( , weight decay ); batch size 2048; cosine schedule; clip 1.0; optimized for up to 20 cross-domain or 12 cross-dataset epochs. |
| MultiPool | Separate task/capability encoders, dropout , raw-cosine plus zero-initialized bounded residual; pairwise hinge margin ; AdamW ( , ); at most 50,000 pairs, two positives and five negatives per task; batch size 1024/2048 and up to 20/12 training epochs for cross-domain/cross-dataset. The cross-dataset rows use label-free transductive model_signature alignment based on unlabeled target embedding statistics. |
| ZESRec | Separate towers; normalized dot product; 128-d zero-initialized capability-ID residual (weight 0.20) and ID bias (weight 0.05); no domain ID. Weighted BCE and the Pointwise-MLP optimizer, batch size, schedule, clipping, and training budget. |
| UniSRec | Separate MoE adaptors with eight parametric-whitening experts, dropout , noisy soft gates, and learned temperature initialized at 10 and clipped to ; no domain ID. The same weighted BCE objective and optimization schedule as Pointwise MLP. |
| AREAD | Invariant and domain towers ; 64-d source-domain embedding, FiLM conditioning, four experts, domain-correction gate, , and centroid inference temperature . It uses the same weighted BCE objective and optimization schedule as Pointwise MLP. |
| Method | Generation and retrieval configuration |
| Re-Invoke | text-bison@001 generates ten synthetic queries per capability at temperature 0.7 and extracts task intents at temperature 0.0. textembedding-gecko@003 embeds augmented documents and intents; the expanded document embeddings are averaged. |
| ToolDreamer | GPT-4.1 generates hypothetical tools. Each tool contributes its thought, name, and description alongside the original query (QTND). Retrieval uses the Qwen3-8B dense and BM25 configurations with RRF over the resulting ranked lists. |
| Natural : held-out domain | MRR | NDCG@5 | HR@3 | |
| Advertising | 2,189 | 0.7984 (0.0213) | 0.7479 (0.0220) | 0.8502 (0.0242) |
| Artificial Intelligence / ML | 2,076 | 0.9270 (0.0046) | 0.8832 (0.0083) | 0.9478 (0.0041) |
| Business | 7,229 | 0.8522 (0.0051) | 0.7828 (0.0076) | 0.8974 (0.0051) |
| Business Software | 2,828 | 0.8509 (0.0089) | 0.7948 (0.0098) | 0.9004 (0.0071) |
| Commerce | 2,686 | 0.9050 (0.0095) | 0.8532 (0.0127) | 0.9443 (0.0092) |
| Communication | 4,015 | 0.8737 (0.0004) | 0.8211 (0.0015) | 0.9310 (0.0031) |
| Semantic : held-out domain | MRR | NDCG@5 | HR@3 | |
| Advertising | 15 | 0.5617 (0.0380) | 0.5291 (0.0410) | 0.6000 (0.0667) |
| Artificial Intelligence / ML | 229 | 0.6276 (0.0150) | 0.5987 (0.0121) | 0.7074 (0.0131) |
| Business | 1,628 | 0.5841 (0.0061) | 0.5101 (0.0055) | 0.6396 (0.0065) |
| Business Software | 615 | 0.6250 (0.0124) | 0.5737 (0.0115) | 0.6678 (0.0199) |
| Commerce | 224 | 0.8091 (0.0249) | 0.8094 (0.0293) | 0.9137 (0.0269) |
| Communication | 695 | 0.7016 (0.0073) | 0.6748 (0.0040) | 0.8072 (0.0094) |
| Context : held-out domain | MRR | NDCG@5 | HR@3 | |
| Advertising | 1,674 | 0.6202 (0.0193) | 0.5858 (0.0202) | 0.6808 (0.0247) |
| Artificial Intelligence / ML | 685 | 0.6761 (0.0109) | 0.6279 (0.0038) | 0.7611 (0.0034) |
| Business | 3,475 | 0.6159 (0.0017) | 0.5450 (0.0028) | 0.6718 (0.0012) |
| Business Software | 1,643 | 0.6307 (0.0136) | 0.5735 (0.0129) | 0.6963 (0.0171) |
| Commerce | 1,131 | 0.6615 (0.0145) | 0.6143 (0.0167) | 0.7586 (0.0248) |
| Communication | 2,081 | 0.6157 (0.0042) | 0.5519 (0.0039) | 0.6761 (0.0046) |
| Mixed : held-out domain | MRR | NDCG@5 | HR@3 | |
| Advertising | 344 | 0.5005 (0.0279) | 0.4675 (0.0307) | 0.5514 (0.0244) |
| Artificial Intelligence / ML | 477 | 0.5930 (0.0192) | 0.5656 (0.0118) | 0.6953 (0.0087) |
| Business | 2,295 | 0.5649 (0.0044) | 0.4932 (0.0028) | 0.6115 (0.0038) |
| Business Software | 913 | 0.6063 (0.0118) | 0.5555 (0.0125) | 0.6484 (0.0162) |
| Commerce | 667 | 0.6508 (0.0181) | 0.6186 (0.0216) | 0.7261 (0.0350) |
| Communication | 1,316 | 0.5869 (0.0057) | 0.5499 (0.0035) | 0.6654 (0.0076) |
| View | Target dataset | MRR | NDCG@5 | HR@3 |
| Natural | ToolBench | 0.8975 (0.0055) | 0.8648 (0.0045) | 0.9326 (0.0020) |
| TaskBench | 0.8387 (0.0097) | 0.7366 (0.0129) | 0.9160 (0.0095) | |
| MetaTool | 0.6839 (0.0032) | 0.6981 (0.0024) | 0.7429 (0.0054) | |
| APIBench | 0.6334 (0.0027) | 0.6847 (0.0027) | 0.7514 (0.0046) | |
| Semantic | ToolBench | 0.4167 (0.0033) | 0.3817 (0.0025) | 0.4859 (0.0033) |
| TaskBench | 0.9170 (0.0075) | 0.8107 (0.0042) | 0.9700 (0.0035) |
| Targets | View | Scored | MRR | NDCG@5 | HR@3 | |
| Domains | Natural | 49/49 | 201,774 | 0.915159 | 0.872471 | 0.951539 |
| Semantic | 39/49 | 50,249 | 0.629185 | 0.603492 | 0.726141 | |
| Context | 49/49 | 75,709 | 0.671839 | 0.624384 | 0.755076 | |
| Mixed | 44/49 | 62,260 | 0.564361 | 0.528805 | 0.644375 | |
| Datasets | Natural | 4/4 | – | 0.763375 | 0.746050 | 0.835725 |
| Semantic | 4/4 | – | 0.613150 | 0.580325 | 0.667875 |
| Group | Semantic scope | # Domains | Included ToolBench domains | Natural tasks |
| G1 | Data, Security, and Communication | 10 | Cybersecurity, Cryptography, Data, Database, Communication, Email, Monitoring, SMS, Text_Analysis, and Translation | 41,503 |
| G2 | Business, Finance, and Commerce | 10 | Advertising, Business, Business_Software, Commerce, eCommerce, Finance, Financial, Jobs, Payments, and Reward | 39,275 |
| G3 | Media, Leisure, and Social | 10 | Entertainment, Events, Gaming, Media, Movies, Music, News_Media, Social, Sports, and Video_Images | 63,943 |
| G4 | Mobility and Infrastructure | 10 | Devices, Energy, Logistics, Location, Mapping, Other, Storage, Transportation, Travel, and Weather | 26,603 |
| G5 | AI, Life, and Knowledge | 9 | Artificial_Intelligence_Machine_Learning, Education, Food, Health_and_Fitness, Medical, Science, Search, Tools, and Visual_Recognition | 30,450 |
| Protocol | Model | Natural | Semantic | Context | Mixed | ||||||||
| MRR | N@5 | H@3 | MRR | N@5 | H@3 | MRR | N@5 | H@3 | MRR | N@5 | H@3 | ||
| Random | 0.2841 | 0.1926 | 0.2735 | 0.1682 | 0.2134 | 0.2817 | 0.1745 | 0.2284 | 0.1836 | 0.2712 | 0.1947 | 0.1423 | |
| 0.0021 | 0.0004 | 0.0036 | 0.0049 | 0.0068 | 0.0071 | 0.0030 | 0.0027 | 0.0025 | 0.0022 | 0.0014 | 0.0044 | ||
| Semantic Cosine | 0.8264 | 0.7513 | 0.8472 | 0.3416 | 0.1892 | 0.2438 | 0.1974 | 0.3125 | 0.2251 | 0.2985 | 0.2417 | 0.2766 | |
| 0.0000 | 0.0000 | 0.0000 | 0.0000 | 0.0000 | 0.0000 | 0.0000 | 0.0000 | 0.0000 | 0.0000 | 0.0000 | 0.0000 | ||
| Pointwise MLP | 0.6428 | 0.7861 | 0.7315 | 0.3674 | 0.4912 | 0.4136 | 0.3487 | 0.4732 | 0.5794 | 0.4618 | 0.3105 | 0.3642 | |
| Pre-evaluation filter stage | Remaining queries |
| Initial candidate query pool | 5000 |
| Annotated capability is present in the frozen 3,442-capability library | 3078 |
| At least one public GET / HEAD endpoint is available | 1528 |
| Required arguments can be instantiated from the public schema | 745 |
| At least one permitted endpoint has a valid MirrorAPI-Cache response | 354 |
| No authentication, write operation, or live external side effect is required | 147 |
| Full vs. Semantic Cosine | Full vs. Re-Invoke | |||||
| Agent Backbone | Completion | Bootstrap 95% CI | Exact | Completion | Bootstrap 95% CI | Exact |
| GPT-5.6 Terra | +13.33 pp | [+5.83, +20.83] | 0.0015 | +8.33 pp | [+1.67, +15.83] | 0.0414 |
| Grok-4.5 | +9.17 pp | [+2.50, +15.83] | 0.0127 | +8.33 pp | [+4.17, +13.33] | 0.0020 |
| Claude Sonnet 5 | +9.17 pp | [+3.33, +15.83] | 0.0074 | +8.33 pp | [+2.50, +15.00] | 0.0213 |
| Gemini 3.1 Pro | +13.33 pp | [+5.83, +20.83] | 0.0009 | +9.17 pp | [+2.50, +15.83] | 0.0192 |
Tool Selection
Tool selection studies how AI agents decide when to use external tools and which APIs, models, or physical tools best fit a task.
See all 25 papers