On-Device Agent Fine-Tuning: Improving Small Model Performance Through Focused Training

    On-device agents require small models that can run efficiently on local or edge devices while still delivering reliable functionality. This article discusses a focused, or "narrow and deep", fine-tuning approach for small language models in agent scenarios. It covers task scoping around core capabilities such as function calling, building realistic and structured training data, using parameter-efficient fine-tuning, evaluating results with function-call success rate, and deploying with quantization, tool-set updates, and fallback mechanisms. The article explains how aligning training objectives with real tasks can substantially improve small-model performance without increasing model size.

    1. Why On-Device Agents Need to Be “Small and Specialized”

    On-device agents, or intelligent agents running on local devices and edge nodes, are becoming a major focus for real-world deployment. Compared with cloud-based LLM solutions, on-device deployment offers advantages such as low latency, privacy protection, offline availability, and controllable inference cost. These advantages depend on one prerequisite: the model must be small enough to run smoothly in memory- and compute-constrained environments.

    This creates a fundamental tension. General-purpose large models are powerful but difficult to deploy on-device. Lightweight small models are easier to deploy but often perform poorly on complex instruction following and tool calling. The key engineering question for on-device agents is how to make a small language model usable, or even strong, in a specific scenario.

    The answer is not a broad, all-purpose model. It is targeted fine-tuning that makes the model narrow and deep. This is a key way for small models to overcome performance bottlenecks.

    2. The “Narrow and Deep” Fine-Tuning Strategy: Core Idea

    The “narrow and deep” strategy has two meanings:

    • Narrow (task focus): Clearly define the agent’s responsibility boundaries and strengthen only a few critical capabilities. For example, an on-device personal assistant may only need to handle scheduling, information lookup, and device control well, rather than serving as a general-purpose assistant. Clear task boundaries allow fine-tuning data to be more concentrated, improving the learning efficiency of a small model.
    • Deep (capability depth): Push the selected capabilities to a high level, especially the core agent mechanism of function calling or tool use. This should be polished until it is highly reliable.

    Why prioritize function calling? The intelligence of an agent comes from a closed loop: understanding intent, selecting a tool, generating parameters, and parsing results. Even if a model has limited knowledge, it can compensate by reliably selecting the right tool and generating valid parameters. In other words, tool calling is the leverage point through which small models can punch above their weight.

    The opposite approach, “wide and shallow”, tries to make a tiny model cover a large amount of domain knowledge. This often leads to shallow performance in every domain because the model has limited parameter capacity. It is usually not worthwhile.

    3. Data Construction: A Decisive Factor for Fine-Tuning Success

    For tiny models, data quality matters more than data volume. To support the “narrow and deep” objective, data construction should follow these principles:

    1. Realistic scenarios: Training samples should come from real user-intent distributions and cover high-frequency use cases. Avoid synthetic data that deviates significantly from the online distribution.
    2. Balanced positive and negative samples: In addition to correct tool-call examples, include negative and boundary examples such as cases where a tool should not be called, cases where the model should ask for clarification rather than execute, and fallback behavior after a failed call. These help the model learn restraint and robustness.
    3. Structured representation: Represent intent, available tools, call parameters, and execution results in a unified structured format so that the model can clearly understand the input-output contract.

    A typical training sample can use a structured format like this:

    1. {
    2. "instruction": "Remind me about the meeting at 3 p.m. tomorrow.",
    3. "available_tools": [
    4. {"name": "create_reminder", "params": ["time", "content"]}
    5. ],
    6. "output": {
    7. "tool_call": "create_reminder",
    8. "arguments": {"time": "2026-09-22T15:00:00", "content": "Meeting"}
    9. }
    10. }

    The key is to make the available tool list vary across samples. This trains the model to select tools and fill in parameters under the constraint of the given tool set, rather than memorizing fixed mappings.

    4. Parameter-Efficient Fine-Tuning: The Technical Path for Small Models

    Full-parameter fine-tuning of a small model often faces both overfitting and computational overhead. A common approach is parameter-efficient fine-tuning (PEFT), such as low-rank adaptation techniques, which train only a small number of new parameters while freezing the backbone weights. Its advantages include:

    • Significantly lower memory usage and training time; training can often be done on a single GPU.
    • Reduced overfitting on small datasets and more stable generalization.
    • Faster production of lightweight adapters for different task scenarios, which can be loaded on demand.

    A simplified training flow is shown below:

    1. # Pseudocode: load a lightweight base model and attach a parameter-efficient adapter
    2. base_model = load_base_model(model_path) # Load the lightweight base model
    3. adapter = attach_peft_adapter(base_model) # Freeze the backbone and train only adapter layers
    4. for batch in finetune_dataloader: # Structured samples from focused scenarios
    5. logits = adapter(**batch)
    6. loss = compute_loss(logits, batch["labels"])
    7. loss.backward()
    8. optimizer.step()

    During training, it is recommended to use a relatively low instruction-following learning rate and an early-stopping strategy that monitors tool-call accuracy on the validation set. This helps prevent the model from drifting within the narrow task.

    5. Evaluation: Focus on Function-Calling Success Rate

    Evaluation of on-device agents should go beyond fluency and focus on functional correctness with measurable metrics. The core metric is the function-calling success rate: the proportion of cases in which the model selects the correct tool and generates valid, executable parameters for a given intent.

    In a typical practice, a small model without targeted fine-tuning had a function-calling success rate below 50%, around 46%. It could understand intent but often selected the wrong tool or generated malformed parameters. After focused “narrow and deep” fine-tuning around function calling, the same model’s success rate on the same test set rose to about 90%. This improvement shows that capability gains come not from making the model larger, but from precisely aligning the training objective with real tasks.

    In addition to success rate, the following evaluation dimensions are recommended:

    • Parameter accuracy: Selecting the right tool but generating incorrect parameters is still a failure, so field-level accuracy should be tracked separately.
    • Refusal and clarification rate: For ambiguous intents, the model should ask for clarification rather than blindly executing.
    • End-to-end latency: Latency directly affects user experience in on-device scenarios and should be included in regression tests.

    6. Deployment and Continuous Optimization

    After fine-tuning produces an adapter, on-device deployment should address three areas. First, quantization and compression: low-bit quantization can further reduce model size, but it is necessary to verify whether the function-calling success rate regresses after quantization. Second, tool-set hot updates: tool descriptions can be injected along with samples so that newly added tools can be recognized without retraining. Third, fallback mechanisms: when model confidence is low or a call fails, the agent should fall back to deterministic rules or prompt the user for clarification to maintain a minimum quality level.

    It is also important to build an online data feedback mechanism. Failed samples from real calls should be anonymized, structured, and added to the training set. This creates a closed loop of fine-tuning, evaluation, data feedback, and further fine-tuning, allowing the agent’s capabilities to improve continuously.

    7. Conclusion

    The core challenge of on-device agents is not model size, but how to achieve highly reliable functionality within limited capacity. The “narrow and deep” fine-tuning path provides a clear approach: focus on core task boundaries, make function calling highly reliable, use high-quality structured data to drive parameter-efficient fine-tuning, and continuously validate and iterate with measurable success rates. The result of improving success rate from below 50% to above 90% demonstrates that, with the right methodology, small models can serve as reliable intelligent agents on devices. For developers, this represents a practical on-device AI deployment paradigm with controllable cost, controllable user experience, and privacy-friendly design.