Small Models, Big Tasks: An Exploratory Empirical Study on Small Language Models for Function Calling

Ishan Kavathekar, Raghav Donakanti, Ponnurangam Kumaraguru, Karthik Vaidhyanathan

Abstract

As Large Language Models (LLMs) increasingly serve as the brains for autonomous agents, the demand for local, privacy-preserving alternatives has grown. This study investigates the feasibility of using Small Language Models (SLMs)—defined as models with fewer than 4 billion parameters—for function calling tasks. By evaluating five prominent SLMs across zero-shot, few-shot, and fine-tuned settings, we identify the critical barriers to SLM deployment on edge devices and demonstrate that while out-of-the-box performance is poor, targeted fine-tuning can enable high-precision structured output.

Introduction

Function calling is the process by which a language model converts a natural language query into a structured API call, identifying the correct tool and populating the necessary parameters. While frontier models like GPT-4 excel at this task, their reliance on cloud infrastructure introduces latency, cost, and privacy concerns. Small Language Models (SLMs) offer a potential solution for edge computing environments, such as mobile devices and IoT hardware. However, the rigorous requirements of function calling—specifically the need for perfect JSON syntax and precise argument extraction—pose a significant challenge for models with limited parameter counts.

Methodology

This study evaluates five SLMs: Deepseek-coder-1.3B, Phi-3-mini-4k (3.8B), Phi-2 (2.7B), Starcoder2-3B, and Stable-code-3B. The research team employed three primary evaluation strategies:

  1. Zero-shot Prompting: Testing the models' inherent ability to follow instructions and output structured data.
  2. Few-shot Prompting (3-shot): Providing three context-rich examples of query-to-function mappings to guide the model.
  3. Fine-tuning (LoRA): Utilizing Low-Rank Adaptation to specialize the models on function-calling tasks using the Salesforce XLAM dataset.

Data and Hardware

The Salesforce XLAM Function Calling dataset provided 60,000 high-quality samples for the study, with 55,000 used for training and 5,000 for evaluation. To assess real-world viability, the models were deployed on a Qualcomm Snapdragon 8 Gen 2 mobile processor using 4-bit quantization in the GGUF format.

Key Findings

The Syntactic Barrier: The "JSON Wall"

In zero-shot environments, SLMs largely failed to produce usable results. The primary failure mode was not a lack of logical understanding, but an inability to adhere to strict JSON formatting. Without specific training or examples, the models could not consistently generate the syntactically perfect code required for API integration. Only Deepseek-coder-1.3B showed any measurable success in this category, albeit at a low 7.34% success rate.

The Impact of Few-Shot Learning and Fine-Tuning

Few-shot prompting significantly boosted performance for specific architectures. Deepseek-coder-1.3B emerged as the most capable few-shot learner, reaching over 55% task accuracy with just three examples.

However, fine-tuning proved to be the "great equalizer." After LoRA adaptation, both Phi-3-mini and Deepseek-coder achieved over 99% JSON parsability. In terms of task accuracy, Phi-3-mini eventually took the lead, reaching 87.27%, followed by Deepseek-coder at 85.43%. Notably, some models like Phi-2 and Starcoder2 remained unable to produce reliable structured output even after fine-tuning, suggesting that base model architecture and pre-training data play a vital role in functional capabilities.

Robustness and Edge Performance

The study also tested the models' resilience against "prompt injection" (random character noise). Fine-tuned models demonstrated impressive robustness, with performance dropping by only 1-2%. In contrast, few-shot models were significantly more fragile when faced with noisy inputs.

Deployment on the Snapdragon 8 Gen 2 highlighted the current limitations of edge AI. While 4-bit quantization reduced memory overhead by 5x, the latency remained a significant hurdle. Deepseek-coder-1.3B required 61–70 seconds per call, while the larger Phi-3-mini often exceeded 300 seconds, making them currently unsuitable for real-time voice assistants or interactive applications.

Discussion and Future Work

The results indicate that SLMs are highly capable of function calling if they are properly fine-tuned. The "JSON Wall" can be overcome, transforming a 1.3B parameter model into a reliable automation engine. However, the latency observed on mobile hardware suggests that software-level optimization is not enough. Future research must focus on:

  • Hardware Acceleration: Leveraging NPUs (Neural Processing Units) to reduce inference time.
  • Constrained Decoding: Implementing grammar-based sampling to force models to follow JSON schemas, which could potentially eliminate the need for extensive fine-tuning for formatting.
  • Adversarial Robustness: Moving beyond random noise to test models against sophisticated prompt injection attacks.

Conclusion

Small Language Models represent a viable path forward for local, private function calling. While they struggle with zero-shot formatting, fine-tuning allows them to rival much larger models in accuracy and reliability. As hardware acceleration and inference techniques like Flash Attention mature, these "tiny" models are poised to become the primary interface for local device automation.

Summary updated

BibTeX
@inproceedings{kavathekar2025small,
  author = {Ishan Kavathekar and Raghav Donakanti and Ponnurangam Kumaraguru and Karthik Vaidhyanathan},
  title = {{Small Models, Big Tasks: An Exploratory Empirical Study on Small Language Models for Function Calling}},
  booktitle = {EASE},
  year = {2025},
  doi = {10.1145/3756681.3757001},
}
Figure