On-Device AI Agents in Practice: Narrow-and-Deep Fine-Tuning for Tiny Models

    This article walks through how to build production-grade AI agents on edge devices—phones, edge hardware, and local terminals—under real constraints on package size, power, and offline availability. It covers a dual-track deployment strategy (system-level AI versus in-app tiny models), dynamic skill loading as a lighter alternative to preloading every tool, narrow-and-deep fine-tuning for models in the 100M–200M parameter range, how synthetic data lifted function-calling success from roughly 46% to over 90%, and a multi-model chaining pattern for offline tasks like real-time transcription. It closes with a practical checklist and common pitfalls to avoid.

    Why On-Device AI Agents Need a New Methodology

    Running an AI agent on-device—on a phone, an edge device, or a local terminal—is a fundamentally different engineering problem than deploying a large model in the cloud. The cloud can lean on near-unlimited compute, memory, and bandwidth. On-device work, by contrast, runs into three hard constraints at once: the size budget for the app package, the power ceiling imposed by the battery, and the availability requirement when there is no network.

    Many teams’ first instinct is to “take a large cloud model, compress it, and squeeze it in.” Practice repeatedly shows this path hits a cliff in general-purpose capability once the parameter count drops to a few hundred million.

    The real breakthrough is to redefine the problem: an on-device agent does not need to “know everything”—it needs to be “production-grade on a limited set of tasks.” When a model lands in the 100M–200M parameter range, chasing generality is the wrong goal. A better approach is targeted synthetic-data fine-tuning that turns it into an expert in one high-frequency scenario. Engineering experience shows that a tiny model of only about 270M parameters can outperform much larger general-purpose models on a specific task. This is the core idea of on-device agent design: trade breadth of tasks for depth of capability.

    Deployment Choices: A Dual-Track Strategy for System-Level and In-App AI

    The first decision point in on-device deployment is whether to rely on a large model preinstalled by the operating system or to ship a tiny model bundled with your app. Each route has trade-offs, and understanding their boundaries saves a lot of trial and error.

    Prefer reusing system-level AI. Modern mobile operating systems often ship with system-level large-model capabilities. Calling into them yields two direct benefits: first, your app package doesn’t need to bundle model weights, which significantly saves space; second, system-level models are usually optimized for the underlying hardware in terms of power and scheduling, so they run more efficiently and smoothly. If your requirements can be covered by system capabilities, this is the highest return-on-investment choice.

    Use in-app AI for customization and cross-platform needs. When the business requires highly customized behavior, needs to cover scenarios the system model doesn’t support, or needs a consistent experience across multiple operating systems, choose a tiny language model (TLM) shipped with the app. The cost is a larger install size and the responsibility of managing model updates and versioning yourself. In exchange, you get full control over the model’s behavior.

    A pragmatic approach often uses both: hand generic, standard capabilities to system-level AI, and hand strongly customized, privacy-sensitive, or offline-critical capabilities to the in-app model.

    On-Device Agent Framework: From “Preload Everything” to Dynamic Skill Loading

    The traditional agent approach stuffs every tool and capability into the model’s context up front and lets the model choose at runtime. This doesn’t work on-device—tool descriptions quickly bloat the context, slow down inference, and crowd out an already tight token budget.

    A more elegant solution is dynamic skill loading. The idea is to give the model a single meta-tool for “loading a skill.” The model doesn’t preload all functionality; instead, it pulls a specific plug-in on demand based on user intent. No complex framework is required—a prompt plus capability injection from the host environment is enough to get it running:

    1. // Illustration: expose a "load skill" meta-tool to the on-device model
    2. const skills = {
    3. loadSkill: {
    4. description: "Load a specialized capability plug-in on demand and return its available sub-tools",
    5. parameters: {
    6. name: "string, skill name, e.g. maps / restaurant_wheel / weather"
    7. }
    8. }
    9. };
    10. // After the model emits a structured call, the host environment executes it and injects the result
    11. function onLoadSkill(name) {
    12. const module = skillRegistry.get(name); // fetch from the local plug-in library
    13. return module ? module.describeTools() : { error: "unknown skill" };
    14. }

    The value of this mechanism is that the base model only retains intent recognition and routing, while concrete features like map lookup, random recommendations, and schedule management are split into independent plug-ins. The agent loads whatever the user asks for, keeping the context lean. On-device, this is both a memory optimization and a loosely coupled design for capability expansion—adding a skill just means adding a plug-in, with no need to retrain the model.

    Narrow-and-Deep Fine-Tuning: The Only Path to Keeping a Tiny Model Usable

    Earlier we noted that general-purpose capability drops noticeably once parameters fall to 100M–200M. Here’s how to deal with that.

    The key insight: do not fine-tune a tiny model on general-purpose data. General fine-tuning further dilutes its already limited capability and makes it “mediocre” across every task. The right path is “narrow and deep”—pick a single, high-frequency, well-bounded task (for example, function calling, text polishing, or intent classification) and pour all your fine-tuning resources into making it excellent.

    Narrow-and-deep works because it shrinks the hypothesis space the model has to learn. When the task is focused enough, even a model with a few hundred million parameters can approach or exceed a large model’s specialized performance in that narrow band. Conversely, if you try to make one tiny model reason, create, and call tools all at once, the usual result is that it meets the bar on none of them.

    A practical rule for choosing a task: prioritize scenarios where the input/output structure is stable, the evaluation criteria are clear, and the call frequency is high. These tasks are the easiest to convert limited parameters into reliable gains.

    Synthetic-Data-Driven Performance Leap: From 46% to 90%

    Fine-tuning results depend heavily on data, and on-device specialized tasks often lack ready-made labeled corpora. The key weapon here is synthetic data.

    Take function calling, a typical task. With prompting alone and no fine-tuning, the model’s call success rate under an app intent framework may be only around 46%—the model knows a tool exists but often picks the wrong tool, fills in the wrong parameters, or drops required fields. The problem is that general models aren’t good at structured decisions like “when to call” and “how to organize the arguments.”

    The solution is to build a synthetic dataset: use a more capable model to generate “user instruction → correct function call” sample pairs in bulk, covering the high-frequency call patterns and edge cases seen in real usage, then use those samples to fine-tune the target tiny model. Engineering practice shows that after fine-tuning a function-calling-oriented specialized tiny model this way, call success rose from under half to over 90% across 80% of the tested functions.

    This leap from 46% to 90% is not about making the model “smarter.” It’s about a tiny model narrowed to a single task reaching production-ready quality on that task through dense training on high-quality synthetic data. It also points to an important lesson in on-device AI: the targeting of the data and the regularity of its structure often matter more to the final result than the model’s parameter count.

    Two things are worth noting when building synthetic data. First, stay close to the real distribution—cover parameter boundaries, abnormal inputs, and multi-turn corrections—otherwise the model will expose weaknesses on real traffic. Second, build a validation mechanism to filter out incorrect samples using rules or a stronger model, so the model doesn’t learn wrong patterns.

    Multi-Model Chaining: An Engineering Solution for Complex Offline Tasks

    A single tiny model is limited in capability, but chaining several tiny models that each have a strength can solve complex tasks a single model can’t cover. Offline real-time transcription is a compelling example.

    A high-quality offline transcription app needs to do two things at once: convert speech to text (speech recognition) and turn the raw spoken text into smooth, readable text (text polishing)—removing filler words like “um” and “uh,” restoring punctuation, and recognizing proper nouns from a personal lexicon. No single model can easily handle both.

    A workable solution is to chain two tiny models with a few hundred million parameters each: one speech-recognition engine converts the audio into a preliminary transcript, and one text-polishing engine normalizes the result. The entire pipeline runs offline on-device with no dependence on any network request. This case shows that the practical value of tiny models lies not in single-model capability but in composition and pipeline design—using multiple narrow-and-deep specialists working together to approximate the workflow of one general-purpose large model.

    Two things to watch when chaining models. First, the data contract between models must be clear: the output format of one must be a stable input for the next. Second, latency accumulation must stay controllable—the total latency of running several models serially needs to be budgeted for, and you may need parallelism, caching, or downsampling to optimize it where necessary.

    Implementation Checklist and Common Pitfalls

    Drawing on the practices above, deploying an on-device AI agent boils down to an actionable checklist:

    • Selection first: Evaluate whether system-level AI can cover the requirement. If it can, don’t build your own model—save space and power.
    • Narrow the task: Resist the temptation of “one tiny model does it all,” and stick to single-task, narrow-and-deep fine-tuning.
    • Decouple skills: Replace full preloading with dynamic loading to keep the context lean and capabilities extensible.
    • Data is king: Build high-quality synthetic data for high-frequency, structured, scorable tasks. The return on investment far exceeds piling on parameters.
    • Break through by combining: For complex tasks, use multi-model chaining to decompose the problem into several narrow tasks rather than chasing an all-capable single model.

    Pitfalls to avoid: first, blindly chasing larger parameter counts while ignoring on-device size and power constraints; second, fine-tuning a tiny model on general-purpose data, which dilutes its specialized capability; third, neglecting quality validation of synthetic data and letting incorrect samples pollute the training set; fourth, ignoring end-to-end latency when chaining models, making the experience unusable.

    The central challenge of on-device AI agents has never been moving a large model to the local device. It’s using the right architecture and targeted fine-tuning to get a tiny model with a few hundred million parameters to deliver production-grade performance on specific tasks under real resource constraints. Once you understand these three points—narrow-and-deep, dynamic loading, and multi-model composition—you’ve grasped the key to taking an on-device agent from a demo to a deliverable.