Manuscript Offprint
arXiv:2610.03213Toward SLM-based agentic task-tool intent matching
Abstract
Tool-equipped AI agents use tool calls to access data and act on external systems. Horizontal growth of agentic systems increases the number of these interactions, and further motivates the need for automated, per-call oversight that can operate at low latency and/or on-prem. Conventional authorization schemes can determine whether an agent is allowed to invoke a tool, but cannot assess the agent's underlying cognition, specifically, whether the tool selection represents a logical, relevant step toward satisfying the intent of the task or not. Consequently, an allowed call may still deviate from the task's intent: a rogue agent might deviate the calls or nudge other agents to make a combination of calls that would not align with the intent of the task. Therefore, every call needs to be verified. In this study we investigate the applicability of Small Language Models (SLMs) to this purpose: an SLM functions as a task-tool relevance classifier that evaluates every selected tool independently against the assigned task and returns a relevance signal for downstream enforcement. Equipped with a novel dataset with multi-tool tasks whose required tools span distinct Model Context Protocol (MCP) servers, we used prompt-optimization, supervised fine-tuning, and reinforcement learning through GRPO to optimize and specialize SLMs.
1 Introduction
Agents within a multi-agent system (MAS) rely on tool usage as the main method to interact with the environment. As these systems scale out, a trajectory highlighted by recent discourse on the Internet of Agents [1, 2] and its next evolution into the Internet of Cognition [3, 4], the research into fending off threats and ensuring the security of these systems is also advancing rapidly.
Our work extends Task Based Access Control (TBAC) to intent-based TBAC: broadly, TBAC dynamically activates, tracks, suspends, consumes, and revokes permissions as the authorization steps of a task progress [5]. In other words, a permission is available only when required by the current stage of an active task, and only for its authorized lifetime and usage. However, the original TBAC does not determine whether a tool semantically matches a user's or an agent's natural language intent. Furthermore, classical TBAC assumes that the tasks, workflow steps, dependencies, and permissions have been explicitly modeled. In agentic systems, however, due to the enormous flexibility of natural language, explicit modeling of these components ahead of time becomes impossible.
In order to assess semantic relevance of a tool to a given task a system needs to inspect both the subject query as well as the tool descriptions. Cloud-based, frontier LLMs with reasoning capability are effective for analyzing these calls (see the results section). However, in many organizations, concerns over privacy, cost, latency or organizational policies limit the practical applications of these models. The hypothesis for our study is that optimizing an SLM for this purpose is sufficient to achieve high accuracy while satisfying the operational constraints.
Code and data are available at https://github.com/outshift-open/outshift-casa-slm
Preprint.
2.1 Methodology Foundation
Let denote the set of MCP servers parsed and prepared for our problem's underlying data. For , let be its entire tool catalog, with denoting one tool (the tool's name and its metadata). We represented tool candidates as server-tool pairs , keeping identically named tools on different servers distinct. We created tasks that should require their intended sets of tools for execution. For a task , let be its annotated grounding set of candidate tools, the represented servers, and the number of tools paired with that are relevant to its execution. We set the task-tool relevance matching label if and otherwise. Our generated data thus satisfy:
Hence, each task originally has two or three grounding tools, exactly one from each represented server, and is cross-MCP with . In contrast, the prior work within ASTRA drew all grounding tools from one unique server [6, 7], which makes for lower-complexity tasks. We retained its data samples and pairwise targets, as well as similar data processed and derived from TOUCAN [8], while additionally extending with our novel tasks that have tools spanning across multiple servers. We simulate intent-breaking matches with by associating to candidate tools , while preserving the total number of distinct tool servers . We assigned labels separately for each candidate of a task to enable fine-grained data curation, and a group identifier links all the different candidates from the same multi-tool task.
Classification objective. Given our labeled task-candidate pairs , we formulate task-tool relevance as a binary classification problem. The classifier receives the task and the candidate tool's name and description and produces a structured output from which a boolean prediction is parsed. A false positive allows an irrelevant tool, whereas a false negative rejects a tool required by the task; broken outputs are logged as parsing failures.
Operational objective. Due to the needs of the downstream security task, we set the often used 95% goal [9, 10] for the accuracy and score.
2.2 Dataset Setup
We used a server catalog for data generation containing 352 tools from 12 distinct MCP servers. We divided it into two server-disjoint pools: 194 tools from 8 servers and 158 tools from 4 servers, to serve as non-overlapping validation or test sets. Grounding and alternative tools always remain within their assigned pool, with no task q causing any overlap.
For each target size , the first stage uses every tool in the pool equally often as an anchor. Given an anchor, it samples distinct servers uniformly at random without replacement from the other servers in the pool, then samples one tool uniformly at random from each chosen server. At the sampling front, anchor coverage is exact; eligible server combinations are equally likely, as are tools within a chosen server. We note that after sampling the realized frequencies can change during generation and curation, and probabilities across all tools differ because server catalogs have different sizes . The sampled tool sets are then processed with a similar pipeline as ASTRA's [6], using GPT-5.2 to produce natural-language tasks matching with the selected tools' names and descriptions, without exposing the tool-side input schema to avoid over-fitting.
The second stage leads to three types of N-tool candidate sets for sampled tasks. A correct set equals . A wrong set replaces grounding tools with different tools from the same server. A null set draws candidates from a server outside but within the same pool, such that its servers and the grounding servers do not overlap. We enforced the wrong and null logic in our cross-server setting, notably by masking all servers from the sampling pool of null samples. Ultimately, both wrong and null are mapped to an irrelevant task-tool label . The generation and sampling stages do not mix tool types in a given set, however, curation may introduce heterogeneous candidate sets for a given task, which is why we preserved candidate-level labels. Each candidate set is represented as N task-tool rows for relevance curation. For consistency, we performed a similar curation process as the one proposed by ASTRA [6]. We retained a row only when all recorded curators for that row agreed, and kept only groups containing all expected N rows. Out of our 9289 curated rows, 7811 formed 3155 complete groups, and 1478 rows in 996 incomplete groups were removed.
2.3 Optimization Approach
We applied the same sequential optimization strategy to two models of Gemma 3 family (1B and 4B):
GEPA [11] produced the prompt used for SFT, and GRPO [12] was initialized from the selected SFT checkpoint. Prompt and checkpoint selection used validation for the relevant class. The test set was evaluated only after all experimental choices had been fixed and shared no MCP servers, tools, or generated tasks with the training or validation splits. Each example contained a task, a candidate-tool name and description, and a target response of the form {"reasoning": "...", "appropriate": true/false}.
GEPA. To optimize agent's prompt, we used GEPA [11]. We selected a random, balanced subset of the training and validation data (500 and 250 samples, respectively). GPT-5.6 Sol was the optimizer/reflection LLM, with a reflection mini-batch size of 35. For reporting the test results, however, we used the entire test dataset.
SFT. Using the optimized prompt, we trained LoRA [13] adapters ( , ) on 4404 class-balanced, single-tool ASTRA examples and selected the checkpoint on 1136 validation examples. We treated single-tool tasks as a lower-complexity curriculum stage because they expressed direct task-tool relationships without the compositional dependencies of multi-tool tasks. We masked prompt tokens and minimized cross-entropy over the model response. Training used AdamW with a peak learning rate of , 10% warmup, three epochs, an effective batch size of 64, and a maximum sequence length of 1024 in bf16. To select the hyper-parameters, we used TPE sampler (Tree-structured Parzen Estimator) in Optuna [14], optimizing for validation set's .
GRPO. Starting from the -selected SFT checkpoint, we applied GRPO to a class-balanced mixture of single-tool, same-MCP multi-tool, and cross-MCP multi-tool examples (9485 training and 2927 validation). The deterministic reward combined schema compliance, label correctness, and a penalty for excessive reasoning; false positives and false negatives were penalized equally, and invalid outputs received an additional penalty. We did not use an LLM-based reasoning judge. We updated the LoRA adapters and sampled 16 responses per prompt at temperature 1.1. We optimized the Dr. GRPO [15] objective with sequence-level importance sampling, batch-scaled group-relative advantages, and a KL penalty of . Training used a learning rate of for three epochs at an effective batch size of 256 in bf16; prompts and completions were capped at 1024 and 192 tokens, respectively.
3 Experimental Setup
We evaluated the Gemma 3 1B and 4B model sizes and sought the smallest evaluated model that can reach this target through progressive specialization. The training data were balanced with respect to the binary relevance label, whereas the validation and test sets retained their curated class distributions. Prompt, hyperparameter, and checkpoint selection used only the validation split, with for the relevant class as the primary selection metric. The held-out test set was evaluated only after all experimental choices had been fixed. Aggregate performance is reported in Table 1.
Inference was performed with vLLM using a fixed decoding configuration across all four conditions. We report parse success, end-to-end (E2E) accuracy, accuracy, precision, recall, , false-positive rate, and false-negative rate. E2E accuracy was computed over the complete test set, with malformed or unparseable outputs counted as incorrect predictions. All other classification metrics were computed from successfully parsed Boolean predictions, with failed parses reported separately. We obtained 95% bias-corrected and accelerated confidence intervals from 10 000 paired bootstrap resamples. A server with a single H100 GPU was used for all three steps of the optimization.
4 Results and Discussion
Frontier LLMs. GPT-5.6 Sol achieved 98.58% accuracy and 98.86% on the held-out test set, with false-positive and false-negative rates of 1.42% and 1.41%, respectively, and no parse failures; exceeding our operational threshold of 95% accuracy.
SLM: Overall performance. Specialization improved both model sizes. For Gemma 3 1B, GEPA did not improve validation performance, so the seed prompt was retained and no separate GEPA result
Table 1: Task-tool relevance classification and end-to-end performance on the held-out test set for Gemma 3 4B and Gemma 3 1B. Scores are percentages; brackets give 95% confidence intervals. Bold indicates the best result for each metric.
| Model | Metric | Base | GEPA | SFT | GRPO |
|---|---|---|---|---|---|
| Gemma 3 1B | Failed parses ↓ | 103 | — | 175 | 1 |
| E2E Acc. ↑ | 60.94 [59.97, 61.91] | — | 78.63 [77.80, 79.42] | 89.60 [88.99, 90.18] | |
| Accuracy ↑ | 61.59 [60.64, 62.59] | — | 80.06 [79.26, 80.87] | 89.60 [88.99, 90.20] | |
| Precision ↑ | 72.53 [71.30, 73.69] | — | 94.54 [93.83, 95.16] | 94.61 [94.01, 95.19] | |
| Recall ↑ | 61.80 [60.56, 63.04] | — | 72.13 [70.99, 73.25] | 88.39 [87.55, 89.16] | |
| 66.74 [65.72, 67.75] | — | 81.82 [81.01, 82.63] | 91.39 [90.85, 91.91] | ||
| FPR ↓ | 38.76 [37.21, 40.36] | — | 6.86 [6.07, 7.74] | 8.37 [7.50, 9.30] | |
| FNR ↓ | 38.20 [36.96, 39.44] | — | 27.87 [26.75, 29.01] | 11.61 [10.84, 12.45] | |
| Gemma 3 4B | Failed parses ↓ | 0 | 9 | 1 | 0 |
| E2E Acc. ↑ | 87.48 [86.81, 88.13] | 91.58 [91.01, 92.11] | 93.78 [93.29, 94.25] | 96.13 [95.73, 96.50] | |
| Accuracy ↑ | 87.48 [86.81, 88.13] | 91.66 [91.11, 92.21] | 93.79 [93.29, 94.25] | 96.13 [95.73, 96.50] | |
| Precision ↑ | 95.29 [94.69, 95.82] | 92.17 [91.46, 92.80] | 95.75 [95.23, 96.24] | 96.75 [96.30, 97.18] | |
| Recall ↑ | 84.11 [83.16, 85.01] | 94.70 [94.12, 95.24] | 94.23 [93.62, 94.77] | 97.06 [96.61, 97.46] | |
| 89.35 [88.73, 89.93] | 93.42 [92.96, 93.86] | 94.98 [94.57, 95.36] | 96.90 [96.58, 97.20] | ||
| FPR ↓ | 6.92 [6.14, 7.77] | 13.39 [12.34, 14.55] | 6.95 [6.17, 7.81] | 5.42 [4.71, 6.17] | |
| FNR ↓ | 15.89 [14.99, 16.84] | 5.30 [4.76, 5.88] | 5.77 [5.23, 6.38] | 2.94 [2.54, 3.39] |

Figure 1: False-positive rate (FPR) and false-negative rate (FNR) on the held-out test set (9736 samples) for Gemma 3 1B and Gemma 3 4B across successive stages of the specialization pipeline: Base, GEPA, SFT, and GRPO. GRPO achieves the lowest rates for Gemma 3 4B with FPR of 5.42% and FNR of 2.94%. Because the stages were applied sequentially, the results represent cumulative improvements rather than independent ablations. For Gemma 3 1B, an em dash indicates that GEPA produced no validation improvement and therefore no separate configuration was selected for test evaluation.
was evaluated on the held-out test set. SFT increased accuracy from 61.59 to 80.06 and from 66.74 to 81.82, although parse failures increased from 103 to 175, limiting E2E accuracy to 78.63. GRPO largely resolved this issue, reducing parse failures to one while increasing E2E accuracy to 89.60 and to 91.39. For Gemma 3 4B, performance improved at every stage of the sequential pipeline (Table 1). GEPA increased E2E accuracy and by 4.10 and 4.07 percentage points (pp), respectively; SFT added 2.20 and 1.56 pp, and GRPO a further 2.35 and 1.92 pp, yielding cumulative gains of 8.65 and 7.55 pp.
Error trade-off across stages. The stages affected false positives and false negatives differently (Figure 1). For Gemma 3 1B, SFT substantially reduced the false-positive rate from 38.76 to 6.86, while GRPO reduced the false-negative rate from 27.87 to 11.61, at the cost of a modest increase in false positives to 8.37. For Gemma 3 4B, GEPA reduced the false-negative rate from 15.89 to 5.30, but increased the false-positive rate from 6.92 to 13.39. SFT restored selectivity, reducing false positives to 6.95 while retaining most of the recall gain. GRPO produced the best balance, with false-positive and false-negative rates of 5.42 and 2.94, respectively. Thus, GEPA prompt optimization, SFT, and GRPO made complementary contributions.
5 Conclusion
While frontier LLMs can meet the 95% operational target (GPT-5.6 Sol achieved an accuracy of 98.58%), both SLMs initially performed well below this threshold, with E2E accuracies of 60.94% and 87.48% for Gemma 3 1B and 4B respectively. Sequential specialization, however, substantially improved the performance of both model sizes. After GRPO, Gemma 3 1B reached 89.60% E2E accuracy, remaining below the operational target, whereas Gemma 3 4B reached 96.13%, slightly surpassing it. Although our evaluation is limited to synthetic, LLM-curated task-tool pairs and two model sizes from a single family, these results support our hypothesis that specialized SLMs can provide a viable operational alternative to frontier models for intent-based TBAC in agentic systems.
References
[1] Charles Fleming, Luca Muscariello, Vijoy Pandey, and Ramana Kompella. A layered protocol architecture for the internet of agents. arXiv preprint arXiv:2511.19699, 2025.
[2] Weize Chen, Ziming You, Ran Li, Yitong Guan, Chen Qian, Chenyang Zhao, Cheng Yang, Ruobing Xie, Zhiyuan Liu, and Maosong Sun. Internet of agents: Weaving a web of heterogeneous agents for collaborative intelligence. In International Conference on Learning Representations, 2025.
[3] Vijoy Pandey. Scaling out superintelligence: Building an internet of cognition for distributed artificial superintelligence. Technical report, Outshift by Cisco, January 2026. Version 2.
[4] Multi-agent systems have some more to learn from human multi-agent systems. Available at SSRN 6736398, 2026.
[5] Roshan K. Thomas and Ravi S. Sandhu. Task-based authorization controls (TBAC): A family of models for active and enterprise-oriented authorization management. In T. Y. Lin and Shelly Qian, editors, Database Security XI: Status and Prospects, pages 166–181. Springer, Boston, MA, 1998.
[6] Majed El Helou, Chiara Troiani, Benjamin Ryder, Jean Diaconu, Hervé Muyal, and Marcelo Yannuzzi. Delegated authorization for agents constrained to semantic task-to-scope matching. arXiv preprint arXiv:2510.26702, 2025.
[7] Majed El Helou, Benjamin Ryder, Chiara Troiani, Jean Diaconu, Hervé Muyal, and Marcelo Yannuzzi. Hybrid inspection and task-based access control in zero-trust agentic AI. arXiv preprint arXiv:2605.02682, 2026.
[8] Zhangchen Xu, Adriana Meza Soria, Shawn Tan, Anurag Roy, Ashish Sunil Agrawal, Radha Poovendran, and Rameswar Panda. Toucan: Synthesizing 1.5 M tool-agentic data from real-world MCP environments. arXiv preprint arXiv:2510.01179, 2025.
[9] Hasan H Al-Khshali and Muhammad Ilyas. Impact of portable executable header features on malware detection accuracy. Computers, Materials and Continua, 74(1):153–178, 2022.
[10] Suzan Sallam, May El Barachi, and Nan Li. Intrusion detection on the internet of things: A comprehensive review and gap analysis toward real-time, lightweight, adaptive, and autonomous security. Internet of Things (IoT), 7(1):16, 2026.
[11] Lakshya A Agrawal, Shangyin Tan, Dilara Soylu, Noah Ziems, Rishi Khare, Krista Opsahl-Ong, Arnav Singhvi, Herumb Shandilya, Michael J Ryan, Meng Jiang, et al. GEPA: Reflective prompt evolution can outperform reinforcement learning. In International Conference on Learning Representations (ICLR), pages 8479–8565, 2026.
[12] Zhihong Shao, Peiyi Wang, Qihao Zhu, Runxin Xu, Junxiao Song, Xiao Bi, Haowei Zhang, Mingchuan Zhang, YK Li, Yang Wu, et al. DeepSeekMath: Pushing the limits of mathematical reasoning in open language models. arXiv preprint arXiv:2402.03300, 2024.
[13] Edward J Hu, Yelong Shen, Phillip Wallis, Zeyuan Allen-Zhu, Yuanzhi Li, Shean Wang, Lu Wang, and Weizhu Chen. LoRA: Low-rank adaptation of large language models. arXiv preprint arXiv:2106.09685, 2021.
[14] Takuya Akiba, Shotaro Sano, Toshihiko Yanase, Takeru Ohta, and Masanori Koyama. Optuna: A next-generation hyperparameter optimization framework. In Proceedings of the 25th ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, 2019.
[15] Zichen Liu, Changyu Chen, Wenjun Li, Penghui Qi, Tianyu Pang, Chao Du, Wee Sun Lee, and Min Lin. Understanding R1-Zero-like training: A critical perspective, 2025.