SkillWeaver: Alibaba's new framework reduces tokens by 99%

Discover how Alibaba's SkillWeaver reduces token consumption by 99% by intelligently routing tools with skill-based decomposition.

viernes, 3 de julio de 2026 • 4 min read • Q2BSTUDIO Team

How SkillWeaver optimizes tool routing

In today's enterprise AI ecosystem, managing agents with hundreds of tools and skills has become a critical challenge. When a system must orchestrate complex tasks such as downloading datasets, transforming them, and generating visual reports, the key lies not only in having a broad catalog of capabilities, but in knowing how to break down the problem into atomic steps and choose the right tool for each one. Researchers at Alibaba have introduced SkillWeaver, a framework that addresses this issue by creating an execution graph and a novel feedback loop called Skill-Aware Decomposition (SAD). This compositional approach allows an AI agent to iteratively retrieve and evaluate tool candidates, rather than selecting them in a single step. Experimental results show that this technique reduces token consumption by over 99% compared to exposing the entire tool catalog to the model, resulting in lower API costs and faster response times. For companies looking to implement enterprise AI efficiently, understanding the granularity of task decomposition becomes the main bottleneck for accurate skill routing.

SkillWeaver is structured in three phases: decomposition, retrieval, and composition. In the first phase, a language model acts as a decomposer, dividing the user query into subtasks that require a single skill. Then, using an embedding model, each subtask is compared against a skill library to obtain a shortlist of candidates. Finally, a planner evaluates the compatibility between the selected tools and generates a directed acyclic graph (DAG) that allows independent tasks to be executed in parallel. The SAD feedback loop improves decomposition accuracy: when the model generates generic descriptions, the system retrieves similar skills and injects them as hints for the LLM to adjust its technical vocabulary. This ability to align the agent's language with that of the actual tools is especially relevant in environments where tens of thousands of skills are managed, as occurs in AI agent ecosystems that integrate protocols like the Model Context Protocol (MCP).

Experiments on the CompSkillBench benchmark, which includes 300 multi-step queries and over 2,200 real skills, reveal that large models without guidance tend to over-decompose tasks, while the SAD loop anchors them to reality. Decomposition accuracy jumped from 51% to 67.7% with a 7-billion-parameter model, and reached 92% with a larger model. Furthermore, the selective retrieval approach consumes only 1,160 tokens per query compared to 884,000 for the direct method, a reduction of 99.9%. This demonstrates that optimizing skill routing can be more impactful than paying for a larger model. For companies that need custom applications with AI capabilities, integrating these types of decomposition and retrieval patterns is essential to scale without skyrocketing costs.

From a practical perspective, implementing a system similar to SkillWeaver does not require exotic infrastructure. The researchers shared prompt templates and used open-source tools such as the all-MiniLM-L6-v2 embedding model and a FAISS index. Indexing the entire skill library took only 15 seconds, and retrieval latency is under 15 milliseconds. However, to achieve optimal performance in production, it is advisable to add a secondary reranker (such as a cross-encoder) to improve top-1 accuracy, which currently stands at around 37%. Additionally, the current framework lacks error recovery mechanisms; when an API call fails in the middle of a multi-step chain, the entire flow stops. Therefore, in real deployments, it is necessary to build retry and fallback layers.

At Q2BSTUDIO, we understand that artificial intelligence applied to business processes requires going beyond simple model integration. Our team develops custom software that incorporates these compositional routing patterns, enabling organizations to automate complex workflows with efficient resource consumption. For example, we combine AWS and Azure cloud services to host vector indexes and language models, and apply business intelligence services with Power BI to visualize the results of those automated processes. Furthermore, our cybersecurity solutions ensure that communication between agents and tools remains secure, especially when handling sensitive data. If your company needs to implement AI agents capable of orchestrating multiple skills without skyrocketing costs, we invite you to explore how we can adapt these architectures to your context.

To delve deeper into how to apply these concepts in real environments, we recommend consulting our page on enterprise AI, where we detail how we design intelligent routing systems. Likewise, if you are interested in developing applications that integrate this type of compositional logic, you can learn about our capabilities for custom software, where we combine innovation with operational efficiency.

A BREAK?

Play for a moment before you go

OUR SERVICES

How we can help you

Do you have a project in mind?

Tell us your vision and we'll turn it into a software solution. Whatever the scope, we make your idea real.