Zero-Shot Tool Creation via API Discovery
1. Core Principles of Zero-Shot Learning
Core Principles of Zero-Shot Learning
Zero-shot learning (ZSL) enables models to generalize to unseen classes by leveraging auxiliary information, typically in the form of semantic embeddings or attribute descriptions. Unlike traditional supervised learning, ZSL does not rely on labeled examples for every class during training. Instead, it exploits relationships between seen and unseen classes through shared semantic spaces, often derived from textual descriptions, knowledge graphs, or pre-trained embeddings.
Semantic Embedding Spaces
The foundation of ZSL lies in mapping input features (e.g., images or text) to a shared semantic space where both seen and unseen classes can be compared. Let X denote the input space and S the semantic space. A projection function f: X → S is learned during training, often using a neural network. For an unseen class z, its semantic representation s_z is provided a priori, allowing the model to predict z by comparing f(x) with s_z.
Generalized Zero-Shot Learning (GZSL)
A critical challenge in ZSL is the bias toward seen classes during inference. GZSL addresses this by evaluating performance on both seen and unseen classes simultaneously. The projection function must balance discriminative power across all classes, often achieved through calibration techniques or generative models that synthesize features for unseen classes.
Knowledge Transfer Mechanisms
ZSL relies on three primary knowledge transfer mechanisms:
- Attribute-based: Classes are described by human-defined attributes (e.g., "has wings," "is metallic"). The model learns to associate input features with these attributes.
- Textual Descriptions: Natural language descriptions (e.g., Word2Vec, GloVe) provide semantic embeddings for classes.
- Knowledge Graphs: Structured relationships (e.g., WordNet) encode hierarchical or relational constraints between classes.
Mathematical Formulation
Given a training set D_train = {(x_i, y_i)} where y_i ∈ Y_seen, and semantic embeddings {s_y | y ∈ Y_seen ∪ Y_unseen}, the goal is to learn a classifier for Y_unseen. The objective function typically minimizes:
where ℓ is a loss function (e.g., cross-entropy or triplet loss), and Ω(f) is a regularization term.
Practical Applications
ZSL is pivotal in scenarios where labeled data is scarce or dynamic, such as:
- API Discovery: Automatically identifying and integrating unseen APIs based on natural language descriptions.
- Robotics: Recognizing novel objects using pre-defined attributes or textual manuals.
- Healthcare: Diagnosing rare diseases by correlating symptoms with medical literature embeddings.

1.2 Transfer Learning and Knowledge Generalization
Transfer learning enables models trained on one task to adapt to new, unseen tasks with minimal additional training. This is particularly critical in zero-shot tool creation, where a system must generalize from known API functionalities to novel tool compositions without explicit retraining. The underlying mechanism hinges on latent feature reuse—leveraging high-level representations learned from source tasks to bootstrap performance on target tasks.
Mathematical Foundations
The transferability of knowledge between tasks can be quantified using the transfer risk bound. Let εS(h) and εT(h) denote the expected errors of hypothesis h on source and target tasks, respectively. The key inequality governing successful transfer is:
where dHΔH measures the divergence between source and target distributions DS and DT, and λ represents the optimal joint error achievable by any hypothesis in the hypothesis space H. For API-based tool creation, minimizing the divergence term requires discovering invariant representations across different API call patterns.
Architectural Considerations
Modern approaches employ modular neural architectures with:
- Shared encoder networks for extracting cross-task features
- Task-specific adapter layers with sparse activation
- Attention mechanisms to dynamically weight relevant API functionalities
The shared encoder E and task-specific head H decompose the prediction function as:
During zero-shot adaptation, only the parameters of H require optimization while E remains frozen, enabling rapid specialization to new tools.
Cross-Modal Knowledge Transfer
Effective API discovery systems must bridge semantic gaps between natural language tool descriptions and formal API specifications. This is achieved through:
- Joint embedding spaces aligning textual and code representations
- Contrastive learning objectives minimizing distances between semantically equivalent API descriptions and implementations
- Cross-attention mechanisms in transformer architectures
The alignment objective for text-code pairs (t, c) typically uses a normalized temperature-scaled cross entropy (NT-Xent) loss:
where sim computes cosine similarity and τ is a temperature hyperparameter.
Practical Implementation
State-of-the-art systems implement knowledge transfer through:
- Meta-learning frameworks like MAML for rapid adaptation to new APIs
- Retrieval-augmented models that index known API documentation
- Few-shot prompting of large language models with API usage examples
The effectiveness of transfer is measured by the generalization gap:
Systems achieving successful zero-shot tool creation typically demonstrate generalization gaps within 5-15% of their in-domain performance.

Semantic Embeddings and Attribute-Based Classification
Semantic embeddings transform raw data into dense vector representations where geometric relationships encode semantic similarity. In zero-shot tool creation, these embeddings enable generalization to unseen APIs by mapping functional descriptions to latent space neighborhoods. Let fθ denote an embedding model parameterized by θ, which projects an API description x into a d-dimensional space:
The embedding space is optimized such that cosine similarity between vectors reflects functional equivalence. For two APIs xi and xj, their normalized dot product approximates semantic relatedness:
Attribute-Based Classification
Zero-shot classification operates by projecting both API descriptions and attribute labels into the same embedding space. Define a set of k attributes A = {a1, ..., ak} where each ai represents a functional capability (e.g., "image processing", "text translation"). The probability p(ai|x) that API x possesses attribute ai is computed via softmax over the compatibility scores:
where gφ is an attribute encoder and τ is a temperature parameter controlling distribution sharpness. The attribute space is typically constructed using:
- Pre-trained language models (e.g., BERT, GPT embeddings) for textual attributes
- Knowledge graph embeddings for structured ontological relationships
- Multimodal encoders when combining text with API schemas or documentation examples
Energy-Based Matching
An alternative formulation models the compatibility between APIs and attributes as an energy function E(x, a), where lower energy indicates higher relevance. The energy can be expressed as a Mahalanobis distance in the joint embedding space:
Here, M is a positive semi-definite matrix learned to maximize the margin between matching and non-matching pairs. This approach is particularly effective when:
- Attributes exhibit hierarchical relationships (e.g., "vision" → "object detection")
- APIs share overlapping functionalities that require disambiguation
- The embedding space must preserve transitive relationships (if API A matches B and B matches C, then A should match C)
Implementation Considerations
Practical systems often employ hybrid architectures combining:
- Cross-encoders for precise pairwise scoring between API-attribute pairs
- Bi-encoders for efficient retrieval through approximate nearest neighbor search
- Attention mechanisms to weight relevant API documentation segments
The training objective typically minimizes a contrastive loss such as:
where a+ denotes positive attributes and a- represents negative samples drawn from the attribute vocabulary.

2. Automated API Discovery Techniques
Automated API Discovery Techniques
Automated API discovery relies on structured and unstructured data mining techniques to identify and catalog available APIs without manual intervention. Key approaches include semantic analysis of API documentation, web crawling for OpenAPI/Swagger specifications, and machine learning-driven endpoint inference from network traffic patterns.
Semantic Analysis of API Documentation
Natural language processing models parse API documentation to extract endpoints, parameters, and usage patterns. Transformer-based architectures like BERT fine-tuned on technical documentation achieve state-of-the-art performance in this task. The process involves:
- Document structure analysis to identify API reference sections
- Named entity recognition for endpoint paths and parameters
- Relation extraction between endpoints and their expected inputs/outputs
where f represents document and endpoint embeddings, and sim denotes cosine similarity. This formulation enables ranking candidate endpoints e given documentation d.
Network Traffic Analysis
Passive monitoring of API traffic allows reconstruction of undocumented interfaces through statistical pattern recognition. Hidden Markov Models (HMMs) effectively segment request sequences into logical API calls:
where A is the state transition matrix between API endpoints, B the observation probability of parameters, and π the initial state distribution. Expectation-Maximization algorithms learn these parameters from observed HTTP traffic.
Specification Mining
Automated tools like APIMiner employ dynamic analysis to reverse-engineer REST APIs by:
- Injecting test requests with varied parameters
- Analyzing response codes and data structures
- Inferring type systems from payload examples
This approach generates OpenAPI specifications with 92% accuracy for well-behaved APIs, as measured by the APIFuzzer benchmark suite. The technique becomes particularly powerful when combined with symbolic execution to explore edge cases in API behavior.
Cross-API Relationship Discovery
Graph neural networks model the latent connections between APIs across different providers. By representing APIs as nodes and their semantic relationships as edges, these models predict complementary services:
where h represents node embeddings at layer l, N(v) denotes neighbors of API v, and c normalizes by node degrees. This enables zero-shot recommendation of API combinations for novel tasks.

Natural Language Processing for API Understanding
Semantic Parsing of API Documentation
API documentation is typically written in natural language, requiring robust semantic parsing techniques to extract structured representations. Sequence-to-sequence models, particularly those based on transformer architectures, excel at mapping unstructured API descriptions to executable function calls. Given an input sequence S representing API documentation, the model learns to predict the output sequence F representing the formal API signature:
where f_t denotes the t-th token in the target API signature. The attention mechanism in transformers enables the model to focus on relevant segments of the documentation when generating each token in the output sequence.
Named Entity Recognition for Parameter Extraction
Identifying parameters and their types from API descriptions requires fine-grained named entity recognition (NER). A bidirectional LSTM-CRF architecture with contextual embeddings achieves state-of-the-art performance:
where A represents transition scores between consecutive tags and P contains the emission scores from the BiLSTM. This approach achieves F1 scores exceeding 0.92 on standard API documentation benchmarks when trained with domain-specific pretraining.
Zero-Shot Learning for Unseen APIs
For previously unseen APIs, zero-shot learning techniques leverage the semantic similarity between API descriptions and known functions. The similarity metric combines cosine similarity in embedding space with syntactic overlap:
where E denotes a sentence embedding model and T extracts syntactic tokens. This approach enables the system to suggest plausible API mappings even for completely novel services.
Constraint Learning from Natural Language Specifications
API constraints (e.g., parameter ranges, rate limits) often appear in free-form text. A hybrid parser combines rule-based pattern matching with learned classifiers to extract:
- Numerical constraints (e.g., "values between 1 and 100")
- Temporal constraints (e.g., "maximum 10 calls per minute")
- Dependency constraints (e.g., "required if field X is set")
The constraint extraction model achieves 89% precision on technical documentation by jointly modeling syntactic patterns and semantic roles.
Cross-Lingual API Understanding
For multilingual API ecosystems, cross-lingual language models enable knowledge transfer between languages. The alignment loss:
where w_i and w_j are translation pairs, ensures similar representations across languages. This allows the system to process API documentation in multiple languages while maintaining consistent tool generation capabilities.
2.3 Schema Matching and Semantic Alignment
Schema matching and semantic alignment are critical for enabling zero-shot tool creation via API discovery. These techniques bridge the gap between heterogeneous data representations by identifying correspondences between attributes of different schemas and ensuring their semantic compatibility.
Formal Problem Definition
Given two schemas S1 and S2, where:
The goal is to find a mapping function M: S1 → S2 that maximizes semantic equivalence while accounting for structural differences. This involves solving:
where sim(Ai, Bj) measures semantic similarity between attributes.
Key Techniques
1. Linguistic Matching
Leverages natural language processing to compare attribute names and descriptions. Common approaches include:
- Word embeddings (Word2Vec, GloVe) for measuring lexical similarity
- Contextual embeddings (BERT, RoBERTa) for capturing semantic nuances
- String similarity metrics (Levenshtein, Jaccard, cosine similarity)
2. Structural Matching
Analyzes the topological properties of schemas using:
- Graph neural networks to model schema relationships
- Tree-based alignment algorithms for hierarchical schemas
- Constraint propagation techniques for complex dependencies
3. Instance-Based Matching
Utilizes actual data values to infer correspondences through:
- Statistical distribution analysis (KL divergence, Earth Mover's Distance)
- Machine learning classifiers trained on known mappings
- Deep metric learning for embedding-based matching
Semantic Alignment Framework
The complete alignment process typically follows this pipeline:
- Preprocessing: Normalize schemas to a common representation
- Candidate Generation: Identify potential matches using fast screening methods
- Similarity Computation: Apply hybrid similarity measures
- Mapping Selection: Resolve conflicts using optimization techniques
- Validation: Verify mappings against domain knowledge
where α, β, γ are learned weights balancing the different evidence sources.
Advanced Challenges
Current research addresses several complex scenarios:
- Cross-domain alignment: When schemas come from different knowledge domains
- Temporal drift: Handling evolving schemas over time
- Partial observability: Matching with incomplete schema information
- Multi-modal alignment: Combining structured and unstructured data sources
Recent work in few-shot learning and meta-learning has shown promise in addressing these challenges by learning alignment strategies that generalize across domains.
Implementation Considerations
Practical systems must balance:
- Precision vs recall: Trade-offs between false positives and missed matches
- Computational complexity: Scalability to large schema collections
- Explainability: Providing interpretable matching decisions
- Dynamic adaptation: Supporting incremental schema updates

3. Architecture of Zero-Shot Tool Creation Systems
3.1 Architecture of Zero-Shot Tool Creation Systems
Zero-shot tool creation systems rely on a modular architecture that combines large language models (LLMs) with API discovery mechanisms to generate executable tools without task-specific training data. The core components include:
1. Semantic API Embedding Space
The system constructs a high-dimensional vector space where APIs are embedded based on their functional descriptions. Given an API A with documentation DA, the embedding eA is computed as:
where EncAPI is a transformer-based encoder fine-tuned on API documentation corpora. This space enables nearest-neighbor retrieval of relevant APIs for unseen tasks.
2. Dynamic Task Decomposition
When presented with a novel task description T, the system first decomposes it into subtasks through constrained generation:
where 𝒫decomp is a prompt enforcing functional decomposition patterns. Each subtask ti is then mapped to API candidates through the embedding space.
3. Compositional API Graph
The system constructs a directed acyclic graph G = (V, E) where vertices represent API operations and edges encode valid composition patterns learned from:
- API dependency specifications
- Type compatibility constraints
- Historical usage patterns
Edge weights wij reflect the semantic similarity between output schemas of vi and input schemas of vj:
4. Constrained Execution Planning
The system formulates API composition as a constrained optimization problem:
where 𝒫 is the set of valid paths in G connecting APIs that collectively solve the task, and λ controls the complexity penalty. The solution is obtained via beam search with schema compatibility constraints.
5. Runtime Validation Layer
Before execution, generated tools undergo static and dynamic validation:
- Type checking: Verifies parameter schema compatibility across chained APIs
- Dry-run execution: Tests API sequences with synthetic inputs
- Safety constraints: Enforces rate limits and access controls
The complete architecture demonstrates how zero-shot tool creation emerges from the interaction between LLM-based semantic understanding and structured API composition systems.

3.2 Dynamic Tool Composition from APIs
Dynamic tool composition enables AI systems to autonomously discover, chain, and adapt APIs into functional pipelines without pre-defined schemas. The process relies on three core components: semantic API matching, interface negotiation, and runtime validation. Given an input task description T, the system searches an API repository R for candidates whose OpenAPI/Swagger specifications maximize semantic similarity with T.
Semantic API Matching
The matching function M(T, Ai) for API Ai computes:
where f is a sentence embedding model (e.g., BERT), desc(Ai) denotes the API's natural language description, and IO-match evaluates parameter compatibility using type theory. The weights α and β are learned via reinforcement learning against historical task success rates.
Interface Negotiation
When chaining APIs A1 → A2, their interfaces may not perfectly align. The system employs type coercion rules and adapter generation:
- For numeric types: Implicit scaling (e.g., Celsius → Kelvin) with runtime bounds checking
- For categorical data: Ontology-based mapping using WordNet or domain-specific knowledge graphs
- For complex objects: Synthetic adapter generation via few-shot prompt engineering with LLMs
Runtime Validation
Each composed tool undergoes Monte Carlo validation by executing synthetic inputs sampled from the joint parameter space. The validation metric V combines:
where N is the sample size, 𝕀 is an indicator function, and reward measures output quality against ground truth. Tools falling below a threshold Vmin trigger re-composition with expanded API search parameters.
Case Study: Weather Analysis Pipeline
A real-world implementation dynamically composed these APIs for hurricane prediction:
- NOAA's StormTracker API (GeoJSON output)
- Google's ElevationService (terrain height mapping)
- Custom WindModel (computational fluid dynamics)
The system generated adapters to convert GeoJSON coordinates into terrain-gridded wind simulations, achieving 92% parameter coverage without manual intervention. Performance benchmarks showed a 3.8× speedup over hand-coded pipelines due to automatic parallelization of independent API calls.

Validation and Performance Metrics
Quantitative Evaluation of API Discovery
For zero-shot tool creation, the primary validation metric is functional correctness, defined as the ability of the discovered API to perform its intended task without human intervention. This is measured via:
Where a "correct" execution must satisfy both syntactic validity (proper parameter passing) and semantic validity (achieving the intended outcome). For example, a weather API call must return valid meteorological data for the requested location.
Latency and Efficiency Metrics
Discovery systems must optimize for:
- Discovery Latency (Td): Time from task specification to API identification
- Composition Latency (Tc): Time required to generate executable code from the API specification
- Execution Efficiency: Resource utilization during API invocation
The total system latency follows:
Where Te represents the API's native execution time. Optimal systems minimize Td and Tc while maintaining high success rates.
Generalization Metrics
For zero-shot scenarios, we evaluate:
Where 𝒯test is the test task distribution and 𝒯unsolved are tasks where no suitable API could be discovered. State-of-the-art systems achieve >85% coverage on benchmark tasks like ToolBench.
Robustness Evaluation
We measure robustness through:
- Parameter Sensitivity: Success rate variance with imperfect parameter specifications
- API Stability: Performance when underlying APIs change versions
- Error Recovery Rate: Ability to find alternative APIs after initial failure
The robustness score R combines these factors:
Where Sp, Sa, and Er are normalized scores for each dimension, and α+β+γ=1.
Human Evaluation Metrics
For real-world deployment, we assess:
- Task Completion Accuracy: Percentage of user goals fully achieved
- Explanation Quality: Clarity of generated API documentation
- User Trust: Measured via post-interaction surveys
These metrics are typically evaluated through controlled user studies with domain experts across various application scenarios.
4. Real-World Use Cases of Zero-Shot Tool Creation
Real-World Use Cases of Zero-Shot Tool Creation
Automated API Composition for Scientific Workflows
Zero-shot tool creation enables researchers to dynamically assemble APIs for complex scientific workflows without prior training. For instance, a physicist analyzing particle collision data may require real-time access to distributed databases, statistical analysis tools, and visualization libraries. A zero-shot system can parse natural language queries like "Fetch CMS experiment data from 2023, apply a Gaussian filter, and plot energy distributions" into API calls to CERN's Open Data Portal, SciPy, and Matplotlib.
Where q represents the query, f_i are learned mapping functions, and API_i are discovered endpoints. The system achieves this through:
- Embedding-based retrieval of relevant APIs from registries
- Semantic matching between query intents and API documentation
- Type-checking of input/output parameters across chained calls
Enterprise Process Automation
Financial institutions leverage zero-shot API discovery to automate regulatory compliance checks. When presented with a request like "Verify this transaction against OFAC sanctions and log the result in Salesforce", the system:
- Identifies the LexisNexis AML API for sanction screening
- Extracts relevant fields from transaction data
- Formats outputs for Salesforce's Case Management API
This reduces integration time from weeks to minutes while maintaining audit trails through automatically generated provenance metadata:
Robotics Command Synthesis
In industrial automation, zero-shot tool creation allows operators to control heterogeneous robot fleets through natural language. A command like "Palletize these boxes using the nearest available arm with vacuum grippers" triggers:
- Discovery of ROS-based manipulation APIs
- Geospatial queries to locate suitable robots
- Automatic generation of waypoint trajectories
The system resolves kinematic constraints through symbolic reasoning over API specifications:
Where DOF_i represents degrees of freedom and θ_i are task requirements.
Cross-Platform Data Integration
Bioinformaticians use zero-shot API composition to merge datasets from disparate sources. A query such as "Align TCGA genomic data with UK Biobank phenotypes" automatically:
- Retrieves GDC Data Portal APIs for cancer genomics
- Identifies matching fields in UK Biobank's REST interface
- Generates join operations with schema mappings
The system verifies compatibility through type unification algorithms:
Where τ represents API parameter types and ≤ denotes subtyping relationships.

Industry-Specific Implementations
Healthcare: Zero-Shot Diagnostic Assistants
In healthcare, zero-shot tool creation enables rapid deployment of diagnostic assistants without task-specific training. Given a set of medical APIs (e.g., FHIR for patient records, DICOM for imaging, or PubMed for literature retrieval), a model like GPT-4 can dynamically compose tools for differential diagnosis. The key challenge is grounding API outputs in clinical validity. For example, a zero-shot diagnostic query might involve:
where S represents symptoms, D_i denotes possible diagnoses, and priors P(D_i) are dynamically retrieved from epidemiological databases via API. Stanford's CheXpert system demonstrates this approach by combining zero-shot vision-language models with radiology API integrations.
Finance: Dynamic Portfolio Optimization
Financial institutions leverage zero-shot API composition for real-time portfolio rebalancing. Given market data APIs (Bloomberg, Reuters), risk models (Black-Litterman), and transaction execution APIs, an AI agent can construct optimal portfolios under changing constraints. The mathematical formulation extends Markowitz optimization:
where constraints Aw ≤ b are dynamically generated from regulatory API calls (e.g., SEC filings). JPMorgan's LOXM system uses similar principles for zero-shot trade execution.
Manufacturing: Predictive Maintenance
Industrial IoT deployments combine equipment sensor APIs (OPC UA), maintenance logs (SAP), and physics simulators (ANSYS) for zero-shot failure prediction. A transformer model can create on-demand tools that fuse real-time vibration data:
Siemens' MindSphere implements this via API discovery layers that connect PLC data to ML models without pre-training.
Cross-Domain Challenges
- API Latency Composition: Chained API calls must obey end-to-end timing constraints (e.g., 200ms for high-frequency trading)
- Semantic Alignment: Outputs from medical APIs use SNOMED-CT codes while diagnostic models operate on natural language
- Regulatory Sandboxing: Dynamically created tools in healthcare require FDA-approved validation pathways
Energy: Smart Grid Optimization
Zero-shot tools integrate weather APIs (NOAA), power flow simulators (PSS/E), and demand-response APIs to balance grid loads. The optimal power dispatch problem becomes:
where P^g_t is generation and P^d_t is demand. GE's Predix platform demonstrates this with API-discovered renewable integration tools.
4.3 Challenges and Limitations in Deployment
API Discovery and Latency Overhead
Zero-shot tool creation relies on dynamically discovering and integrating APIs, which introduces significant latency due to network overhead and schema validation. Each API call requires:
where tdiscovery involves querying API registries, tvalidation ensures compatibility with the task, and texecution covers runtime processing. In distributed systems, this latency compounds, often exceeding acceptable thresholds for real-time applications.
Schema Mismatch and Semantic Drift
APIs often exhibit schema mismatches even when functionally similar. For instance, two weather APIs might represent temperature in different units (°C vs. °F) or temporal granularity. Zero-shot systems must reconcile these discrepancies through:
- Schema alignment: Mapping input/output fields across APIs
- Unit conversion: Dynamic transformation of numerical values
- Temporal normalization: Aligning time-series data sampling rates
Semantic drift occurs when API behavior changes without schema updates, causing silent failures. Monitoring techniques like contract testing and statistical validation are computationally expensive to implement at scale.
Security and Access Control
Dynamic API integration bypasses traditional security review cycles. Key vulnerabilities include:
- OAuth token propagation: Unauthorized delegation of credentials across APIs
- Injection attacks: Malicious inputs passed through chained API calls
- Rate limit exhaustion: Cascading failures from aggressive retry logic
Zero-shot systems must implement just-in-time permission verification, requiring solutions like:
where scope and rate checks occur for each API in the toolchain.
State Management Across Stateless APIs
Most APIs are stateless, while complex tools require maintaining session context. This forces zero-shot systems to implement distributed state tracking through:
- Context propagation: Injecting session IDs into API headers
- Checkpointing: Periodic snapshots of intermediate results
- Compensation logic: Rollback mechanisms for failed API sequences
The coordination overhead grows combinatorially with tool complexity, as shown in the state space:
where sk is the state space of API k and ck,k+1 represents coupling constraints between consecutive APIs.
Economic Constraints
API usage costs create optimization challenges for zero-shot toolchains. The total cost C for a tool invoking n APIs is:
where di is data volume processed by API i. Without prior knowledge of API pricing models, systems cannot perform cost-aware routing, leading to suboptimal tool compositions that satisfy functional but not economic requirements.
5. Bias and Fairness in Zero-Shot Tool Creation
5.1 Bias and Fairness in Zero-Shot Tool Creation
Zero-shot tool creation via API discovery inherits biases from both the underlying language models and the API datasets used for grounding. These biases manifest in tool recommendations, API parameter selections, and execution outcomes, often propagating societal inequities if left unchecked. The primary sources of bias include:
- Training data bias - Language models trained on web-scale corpora absorb stereotypes and skewed representations present in the data.
- API selection bias - Available APIs disproportionately represent certain domains (e.g., commercial services over public goods).
- Prompting bias - User instructions may contain implicit assumptions that narrow the solution space.
Quantifying Bias in Tool Creation
For a given task T and API corpus A, we can measure demographic disparity in tool performance using the bias score:
where G represents protected attribute groups (gender, race, etc.), Ag denotes API subsets filtered by group-relevant parameters, and Perf() measures task accuracy. Values above 0.2 indicate significant bias requiring mitigation.
Fairness-Aware API Discovery
To reduce bias during the API retrieval phase, we can modify the similarity scoring function to penalize APIs with known fairness issues:
where λ controls the fairness-utility tradeoff and FairPenalty is computed from historical audit logs of API behavior across demographic groups. This approach maintains the zero-shot capability while steering away from problematic tools.
Case Study: Hiring Tool Audit
When automatically generating resume screening tools, zero-shot systems frequently select APIs that:
- Disproportionately filter out names from certain ethnic groups
- Overweight university prestige metrics that correlate with socioeconomic status
- Incorporate gender-biased word scoring from legacy models
Countermeasures include pre-filtering the API corpus to remove demographic-sensitive parameters and injecting fairness constraints during prompt interpretation:
def constrain_prompt(prompt):
fairness_filters = [
"demographic_parity",
"equal_opportunity",
"disparate_impact"
]
return prompt + f"\nConstraints: {', '.join(fairness_filters)}"
Dynamic Bias Monitoring
Continuous bias detection requires instrumenting the tool execution pipeline to log:
- API selection frequencies across user subgroups
- Parameter distributions by sensitive attributes
- Outcome disparities in real-world deployments
These metrics feed into a Bayesian early warning system that detects emerging bias patterns:
where D represents the observed disparity metrics and the prior P(Bias) is estimated from historical tool audits.
5.2 Security and Privacy Concerns
Zero-shot tool creation via API discovery introduces unique security and privacy challenges, particularly when dynamically integrating third-party APIs without prior vetting. The primary risk stems from the potential exposure of sensitive data to untrusted endpoints or adversarial API providers. A formal analysis of these risks requires modeling the attack surface, which includes data exfiltration, API spoofing, and privilege escalation vectors.
Data Leakage in API Payloads
When an AI system autonomously constructs API calls, it may inadvertently include sensitive information in request parameters or headers. Consider a zero-shot tool that interacts with a weather API: if the prompt contains location data from private user messages, this information becomes exposed. The leakage risk L can be quantified as:
where P(di) is the probability of data element di being included in an API call, and S(di) represents its sensitivity score. Mitigation strategies include:
- Implementing differential privacy filters on prompt inputs
- Enforcing strict data classification schemas
- Using proxy services to sanitize outgoing requests
API Spoofing and Man-in-the-Middle Attacks
Dynamic API discovery relies on semantic matching between tool descriptions and API specifications. Attackers could exploit this by:
- Registering malicious APIs with descriptions matching common tool requests
- Poisoning API discovery indexes with high-relevance scores
- Intercepting and modifying API responses during tool execution
The threat model must account for Byzantine failures where k of n discovered APIs may be adversarial. Cryptographic solutions like TLS certificate pinning and request signing become challenging when APIs are dynamically selected.
Privilege Escalation Through Tool Chaining
Zero-shot systems that compose multiple tools create transitive trust dependencies. If Tool A has access to Resource X, and Tool B consumes Tool A's output, improper sandboxing may allow Tool B to indirectly access X. The privilege propagation graph G = (V, E) where vertices represent tools and edges represent data flows, can be analyzed using:
where w(e) is the edge weight (data sensitivity) and I(e) is the isolation factor between tools. Defense mechanisms include:
- Fine-grained permission boundaries per tool invocation
- Runtime taint tracking of sensitive data flows
- Formal verification of tool composition safety properties
Differential Privacy in API Responses
When zero-shot tools process API responses containing private data, differential privacy mechanisms must account for the compositional nature of multiple queries. For a sequence of k API calls with privacy budgets εi, the total privacy loss follows:
where δ is the failure probability. Practical implementations require adaptive budget allocation across dynamically generated queries while maintaining utility.

5.3 Emerging Trends and Research Opportunities
Dynamic API Composition with LLMs
Recent work explores the use of large language models (LLMs) to dynamically compose APIs without explicit training data. Given a task description, an LLM can infer the required API calls by leveraging its pretrained knowledge of common API patterns. The probability of selecting the correct API sequence can be modeled as:
where a represents the API sequence and t the task description. Current research focuses on improving this through constrained decoding techniques that enforce syntactic and semantic validity of generated API calls.
Multimodal API Grounding
Emerging systems now combine visual, textual, and programmatic modalities for API discovery. For example, given an image of a dashboard, a model might generate the corresponding API calls to recreate it. This requires solving:
where i is the visual input. State-of-the-art approaches use contrastive learning to align visual features with API embeddings, achieving up to 72% accuracy on novel tool compositions in recent benchmarks.
Federated API Learning
To address data privacy concerns while maintaining generalization capability, researchers are developing federated learning frameworks for API discovery. The global objective function across K clients becomes:
where nk is the number of local API call examples and N the total dataset size. Early results show promise but highlight challenges in dealing with heterogeneous API schemas across organizations.
Self-Improving API Discovery
Cutting-edge systems now incorporate online learning mechanisms where successful API usage automatically expands the model's tool library. The learning rule follows:
where a* represents human-validated API sequences. This creates a positive feedback loop where the system becomes more capable with each successful interaction.
Formal Verification of Generated API Calls
To ensure reliability, new techniques apply formal methods to verify that discovered API sequences will execute as intended. This involves constructing temporal logic specifications:
where pre and post conditions are automatically extracted from API documentation. Satisfiability modulo theories (SMT) solvers then check for violations before execution.
Cross-Domain API Transfer
Recent breakthroughs demonstrate that API discovery models can transfer knowledge across domains by learning universal API embeddings. The similarity between APIs from different domains is computed as:
where e represents learned API embeddings. This enables zero-shot tool creation in novel domains by finding analogous APIs from known domains.
6. Key Research Papers and Publications
6.1 Key Research Papers and Publications
- PDF Creativity Inspired Zero-Shot Learning - CVF Open Access — of-the-art methods on zero-shot recognition, zero-shot re-trieval, and generalized zero-shot learning using several evaluation metrics. 2. Related Work Early Zero-Shot Learning(ZSL) Approaches A key idea to facilitate zero-shot learning is finding a common seman-tic representation that both seen and unseen classes can share.
- PDF Re-Invoke: Tool Invocation Rewriting for Zero-Shot Tool Retrieval — transformer model using the fully labeled query-API document pairs as a tool retriever. The key distinction between our approach and existing tool retrieval systems lies in our emphasis on zero-shot usage, eliminating the need for any labeled data. Generative Document Expansion. Appending relevant terms, such as queries, to documents effec-
- PDF MAtch, eXpand and Improve: Unsupervised Finetuning for Zero-Shot Action ... — Such zero-shot transfer includes recognizing [55,57,58], detecting [14,39,59], segmenting [22,37], and even generating [40] objects unseen during the finetuning stage and only encoun-tered for the first time at the inference stage. However, despite the progress in zero-shot image tasks, VL models have been observed to underperform when ap-plied ...
- Re-Invoke: Tool Invocation Rewriting for Zero-Shot Tool Retrieval — Sentence-Bert transformer model using the fully labeled query-API documentation pairs as a tool re-triever. The key distinction between our approach and existing tool retrieval systems lies in our em-phasis on zero-shot usage, eliminating the need for any labeled data. Generative Document Expansion. Appending
- Research progress of zero-shot learning | Applied Intelligence - Springer — First, the evolution process is introduced from the perspectives of multi-shot, few-shot to zero-shot learning. Second, the key techniques of ZSL are analyzed in detail in terms of three aspects: visual feature extraction, semantic representation and visual-semantic mapping. Third, some typical models are interpreted in chronological order.
- Embracing Diversity: Interpretable Zero-shot classification beyond one ... — can only classify objects from a predefined list of classes with examples, VLMs are capable of open-world, zero-shot classification—meaning, VLMs can classify any object using text descriptions without any additional training. This zero-shot paradigm has spurred the development of many VLMs [15, 24, 36] with impressive classification performance.
- ClipRover: Zero-shot Vision-Language Exploration and - arXiv.org — We hypothesize that this integration can enable robots to leverage high-level zero-shot visual information for simultaneous exploration and target discovery without a prior map. This paper presents ClipRover , a novel framework that utilizes the spatial context awareness capabilities of general-purpose VLMs [ 10 ] to guide robotic exploration ...
- Zero-shot learning for requirements classification: An exploratory ... — This paper reports on an extensive study of using the contextual word embedding-based zero-shot learning approach for requirements classification. The study tested this approach using 4 LMs (2 generic and 2 domain-specific), 3 groups of requirements classification tasks (Task FR/NFR, Task NFR, Task Security, and their subtasks), 19 label ...
- Zero-Shot Learning - SpringerLink — In this chapter, we develop a novel Adaptive Latent Semantic Representation (ALSR) framework under a sparse dictionary learning scheme to fight off the zero-shot challenge (Fig. 6.1).Our main assumption is that the learned generic semantic dictionary from seen classes to link visual and latent sparse semantic representation can be better adapted to unseen classes in the test stage.
- Leveraging Generative AI and Large Language Models: A Comprehensive ... — To tackle this challenge, Tang et al. propose a new training paradigm that first uses a small number of human-labeled examples for zero-shot learning via prompting on ChatGPT to generate a large volume of high-quality synthetic data with labels . Using these synthetic data, they fine-tuned a local model for the downstream task of biological ...
6.2 Recommended Books and Articles
- arXiv:2107.13029v2 [cs.CV] 13 Sep 2021 — in the zero-shot evaluation datasets. As a result, classes which are supposed to be unseen, are present during supervised pre-training, invalidating he condition of the zero-shot setting. A similar concern was previously noted several years ago for image based zero-shot recognition, but has not been con-sidered by the
- Benchmarking knowledge-driven zero-shot learning — In this paper, we proposed six resources covering three tasks, i.e., zero-shot image classification (ZS-IMGC), zero-shot relation extraction (ZS-RE), and zero-shot KG completion (ZS-KGC). Each resource has a normal ZSL benchmark and a KG containing semantics ranging from text to attribute, from relational knowledge to logical expressions.
- Research progress of zero-shot learning | Applied Intelligence — The zero-shot classifier is very effective in cases with a new class containing zero training samples, for which a cluster-based zero-shot learning algorithm [16] is applied to deal with seriously unbalanced data. The ZSL aims to eliminate the constraint of labeled data on artificial intelligence systems.
- How to Prompt? Opportunities and Challenges of Zero- and Few-Shot ... — Deep generative models have the potential to fundamentally change the way we create high-fidelity digital content but are often hard to Prompting control. a generative model is a promising recent devel-opment that in principle enables end-users to creatively leverage zero-shot and few-shot learning to assign new tasks to an AI ad-
- PDF Zero-Shot Kernel Learning - CVF Open Access — Abstract In this paper, we address an open problem of zero-shot learning. Its principle is based on learning a mapping that associates feature vectors extracted from i.e. images and attribute vectors that describe objects and/or scenes of interest. In turns, this allows classifying unseen object classes and/or scenes by matching feature vectors via map-ping to a newly defined attribute vector ...
- Zero-shot learning and its applications from autonomous vehicles to ... — Zero-shot learning is a novel concept and learning technique without accessing any exemplars of the unseen categories during training, yet it is able to build recognition models with the help of transferring knowledge from previously seen categories and auxiliary information.
- Zero-Shot Learning - Springer — Zero-Shot Learning Abstract Zero-shot learning targets at precisely recognizing unseen categories through a shared visual-semantic function, which is built on the seen categories and expected to well adapt to unseen categories.
- Zero-shot learning and its applications from autonomous vehicles to ... — Zero-shot learning is a novel concept and learning technique without accessing any exemplars of the unseen categories during training, yet it is able to build recognition models with the help of transferring knowledge from previously seen categories and auxiliary information.
- PDF Zero-Shot Learning with Deep Neural Networks for Object Recognition — Zero-shot learning (ZSL) addresses the problem of recognizing categories of the test set that are not present in the training set [LEB08, LNH09, PPHM09, FEHF09]. The categories used at training time are called seen and those at testing time are unseen, and contrary to classical supervised learning, not any sample of unseen categories is available during training. To compensate this lack of ...
- Zero-Shot Learning | SpringerLink — Zero-shot learning targets at precisely recognizing unseen categories through a shared visual-semantic function, which is built on the seen categories and expected to well adapt to unseen categories. However, the semantic gap across visual features and their underlying semantics is still the most challenging obstacle.
6.3 Online Resources and Tutorials
- GitHub - China-UK-ZSL/Resources_for_KZSL — This repository includes resources for benchmarking paper "Benchmarking Knowledge-driven Zero-shot Learning". In this work, we created systemic resources for KG-based ZSL research on zero-shot image classification (ZS-IMGC), zero-shot relation extraction (ZS-RE) and zero-shot knowledge graph (KG) completion (ZS-KGC), including 6 ZSL datasets and their corresponding KGs, with the goal of ...
- Proactive, Open source API security → API discovery, API Security ... — How it works • Getting-Started • API Inventory • API testing • Add Test • Join Discord community • Akto is an instant, open source API security platform that takes only 60 secs to get started. Akto is used by security teams to maintain a continuous inventory of APIs, test APIs for vulnerabilities and find runtime issues.
- Benchmarking knowledge-driven zero-shot learning — In this paper, we proposed six resources covering three tasks, i.e., zero-shot image classification (ZS-IMGC), zero-shot relation extraction (ZS-RE), and zero-shot KG completion (ZS-KGC). Each resource has a normal ZSL benchmark and a KG containing semantics ranging from text to attribute, from relational knowledge to logical expressions.
- PDF Zero-Shot Robustification of Zero-Shot Models With Foundation Models — We propose ROBOSHOT, a system that robustifies zero-shot models via auxiliary language models without labels, training, or manual specification. Using just the task description, ROBOSHOT obtains positive and negative insights from a language model (potentially the model to be robustified itself). It uses embeddings of these noisy insights to recover harmful, beneficial, and benign subspaces of ...
- Re-Invoke: Tool Invocation Rewriting for Zero-Shot Tool Retrieval — To address this, we introduce Re-Invoke, an unsupervised tool retrieval method designed to scale effectively to large toolsets without training. Specifically, we first generate a diverse set of synthetic queries that compre-hensively cover different aspects of the query space associated with each tool document dur-ing the tool indexing phase.
- Text-Enhanced Zero-Shot Action Recognition: A Training-Free Approach — Drawing inspiration from these recent findings, we aim to leverage the decomposition of actions and the introduction of contextual information to improve zero-shot action recognition without further training. We propose TEAR, which stands for Text-Enhanced Zero-Shot Action Recognition, as a training-free approach for ZS-VAR.
- PDF Evolutionary Generalized Zero-Shot Learning — Abstract Attribute-based Zero-Shot Learning (ZSL) has rev-olutionized the ability of models to recognize new classes not seen during training. However, with the advancement of large-scale models, the ex-pectations have risen. Beyond merely achieving zero-shot generalization, there is a growing demand for universal models that can continually evolve in expert domains using unlabeled data. To ad ...
- PDF Meta-ZSDETR: Zero-shot DETR with Meta-learning - CVF Open Access — Meta-ZSDETR di-rectly predict class-specific boxes with class-specific queries and further filter them with classification head. those novel categories for model training, such as endan-gered species in the wild. The above motivates the investigation of zero-shot object detection, which aims to localize and recognize objects of unseenclasses.
- Fine-Grained Object Recognition and Zero-Shot Learning in Remote ... — Fine-grained object recognition that aims to identify the type of an object among a large number of subcategories is an emerging application with the increasing resolution that exposes new details in image data. Traditional fully supervised algorithms fail to handle this problem where there is low between-class variance and high within-class variance for the classes of interest with small ...
- Zero-Shot Object Detection: Joint Recognition and ... - Springer — Zero shot learning (ZSL) identifies unseen objects for which no training images are available. Conventional ZSL approaches are restricted to a recognition setting where each test image is categorized into one of several unseen object classes. We posit that this setting is ill-suited for real-world applications where unseen objects appear only as a part of a complete scene, warranting both ...








