Choosing On-Device Multimodal Models and Deploying AI Agents: A Practical Guide
As large language models move from the cloud to phones, PCs, and embedded devices, the developer's question has shifted from "can it run?" to "which model to choose, how to deploy it, and how to control cost?" This guide covers a general framework for selecting and deploying on-device multimodal models—sizing models by memory and active parameters, evaluating with real-world samples instead of public benchmarks, and managing latency, quantization, and KV Cache. It includes a practical on-device AI Agent example and deployment checklist.
As large language models move from the cloud to phones, personal computers, and embedded devices, the developer’s question has shifted from “can it run?” to “which model should I choose, how do I deploy it, and how do I control cost?” A new generation of open-source multimodal models can accept text and images within a single model—some also accept audio—which provides a new foundation for on-device AI Agents. This article discusses general selection and deployment methods rather than any specific product. Every conclusion notes its prerequisites, so you can verify them on your own hardware.
Key takeaway up front: First tier models by memory footprint and active parameters, then evaluate with real samples—don’t rely solely on public leaderboards.
1. Start with Memory and Active Parameters
Model lineups typically fall into three tiers, each matching different device conditions. When selecting, verify two numbers: total parameters determine how much weight memory must be loaded, while active parameters determine the compute cost per inference.
| Tier | Example Size | Compute Pattern | Memory Footprint | Target Hardware | Quantization Advice |
|---|---|---|---|---|---|
| Large dense | ~30B | All parameters participate in every inference | Total parameters equal memory footprint | High-memory workstations or servers | Prefer INT8; evaluate INT4 only for quality-sensitive tasks |
| Mixture of Experts (MoE) | ~25B (total) | Only a subset of experts activate per token | Load all parameters; active parameters drive compute | Memory needs close to a dense model of the same scale | Same as above; verify active parameters against official documentation |
| Small | 2B–4B | All parameters participate | Few parameters, but constrained by memory capacity and bandwidth | Phones, Raspberry Pi, and other resource-limited devices | Typically INT4; test output quality on real workloads |
The advantage of MoE models is mainly compute. A 25B total-parameter MoE model still loads all expert weights, so it doesn’t necessarily save memory compared to a 30B dense model. Always go by actual memory usage.
To estimate weight memory, multiply parameter count by bytes per parameter: roughly 2 bytes per parameter for FP16, 1 byte for INT8, and 0.5 bytes for INT4. Using this method, a 30B dense model’s weights are about 60 GB (FP16), 30 GB (INT8), and 15 GB (INT4). A 25B MoE model is about 50 GB, 25 GB, and 12.5 GB. A 4B model needs about 8 GB (FP16) or 2 GB (INT4), and a 2B model about 4 GB (FP16) or 1 GB (INT4).
These figures are only a lower bound for weights. KV Cache, activations, and runtime overhead require additional headroom, so real-world usage is usually higher.
Small models suit information extraction, intent recognition, and simple task planning. Whether they run smoothly on a phone depends on the chip architecture, memory capacity, quantization scheme, and input length. Vendors typically don’t publish unified power or latency guarantees, so developers must measure on target hardware themselves.
The point of a tiered lineup is that developers can split workloads across cloud, edge, and device layers instead of forcing one model to cover every scenario.
2. What Native Multimodal Input Changes
Native multimodality means the model encodes multiple input types into a single Transformer during training, rather than stitching together external modules. For on-device development, this matters in two main ways.
First, variable-resolution visual input. The traditional approach resizes images to a fixed resolution, which easily loses detail in documents, tables, and small-text screenshots. Models supporting variable resolution split the image into tiles based on content and allocate different numbers of vision tokens. Implementation details vary by model—check the official documentation for supported resolution ranges and token counting, then validate recognition quality with your own document samples.
Second, audio input. Some small models support relatively short audio inputs; check the official documentation for maximum duration and sampling rate requirements. The traditional speech pipeline is microphone capture, an external ASR model for transcription, an LLM processing the text, and TTS output. This pipeline has three typical problems: the ASR model consumes extra memory and storage; each step adds latency; and once audio is transcribed to text, acoustic cues such as tone and pauses are lost, making it hard for the model to read user emotion.
Feeding audio features directly can eliminate the ASR module, but audio encoding itself consumes memory and increases time-to-first-token—so measure with real audio rather than counting reduced modules. You should keep an external ASR fallback if: a user’s single recording exceeds the model’s audio duration limit, audio encoding latency exceeds your product’s acceptable threshold, or your business requires verbatim transcripts.
3. Why Benchmark Scores and Real-World Experience Diverge
In some public comparisons, certain next-generation models score slightly below mainstream open-source models of similar size. Meanwhile, some community feedback (not from standardized evaluations) suggests these models feel better in everyday use. The gap can be understood from two angles.
First, public benchmark distributions differ from real applications. Many leaderboards emphasize complex math reasoning or obscure knowledge questions, while high-frequency on-device requests are things like rewriting text, summarizing content, and giving step-by-step instructions. Leaderboard scores don’t directly reflect how well a model handles these tasks.
Second, late-stage instruction tuning and preference alignment shape output format, tone, and structure. Well-aligned models tend to produce cleaner answers on everyday tasks. Static leaderboards rarely capture how these capabilities hold up on out-of-distribution tasks.
So “lower on leaderboards but better in practice” is a selection clue, not a conclusion. Evaluate with your own business data using this process:
- Collect 100–300 real requests covering high-frequency tasks and edge cases.
- Define scoring criteria per task type, e.g., correctness, format compliance, and missing key information.
- Compare two or three candidate models side by side. Every comparison must use identical inputs, hardware, quantization, inference framework version, and sampling parameters.
- Record results per sample in a table like the one below.
| Field | Description |
|---|---|
| Sample ID | Unique identifier for review |
| Task type | Rewriting, summarization, step-by-step instructions, ingredient recognition, etc. |
| Input type and size | Text length, image resolution, audio duration |
| Scoring items | Correctness, format compliance, missing key info—score each 0 or 1 |
| Time to first token | From request sent to first output token |
| Total latency | Full completion time |
| Peak memory | Highest memory usage during inference |
| Failure reason | Timeout, format error, content error, out of memory, etc. |
Adjust sample size and scoring criteria to your business scale. The key is that every comparison uses identical inputs and hardware—otherwise results aren’t comparable.
4. An On-Device Agent Example
Consider: “Look at what’s in my fridge and suggest a dish with steps.” The user speaks to the phone while photographing the fridge interior.
A traditional architecture typically needs separate speech recognition, image recognition, recipe retrieval, and LLM services. Orchestration is complex, and each step can fail.
If the model can accept audio and images together, the flow simplifies to three steps: the app sends audio and photo to the model in one request; the model recognizes ingredients and understands the spoken request; the model generates dish suggestions and steps. This reduces inter-service calls—but whether a single inference can complete the task depends on the model’s actual multimodal support and the task’s complexity.
On-Device vs. Cloud: Division of Labor and Boundaries
The local side handles ingredient recognition, spoken-language understanding, and basic recipe generation. These requests should be handed off to the cloud or external tools:
- Checking real-time prices or promotions.
- Searching external recipe databases or content that must be up to date.
- Long-form planning tasks that exceed the local model’s context length.
Cloud routing rules can be: the user explicitly asks for real-time information; local confidence falls below a threshold; or the task exceeds the local context limit.
Define privacy boundaries in advance. Photos and audio stay on the device by default. If upload is unavoidable, get user consent first and minimize data—for example, convert ingredients to a text list locally and upload only the list, not the original photo.
Design failure fallbacks as follows. If the cloud times out or the network drops, the local model returns a usable result and tells the user what couldn’t be fetched. If the photo is blurry or ingredients can’t be recognized, prompt the user to retake the shot. If confidence is low, ask the user for more information instead of letting the model guess.
Latency Measurement
On-device performance is heavily affected by memory bandwidth and thermal throttling. After sustained inference, some phones and laptops slow down as clocks drop. Your measurements should include:
- Cold-start time: from first model load to ready for inference.
- Time to first token.
- Sustained throughput after continuous running—run at least 10 minutes and record in segments.
- Throttling observation: log temperature, frequency changes, and when throughput declines.
5. Deployment Essentials
Inference engine. Choose an inference framework that explicitly supports your target hardware backend, and verify operator coverage and version numbers. Treat advertised speedups as marketing until validated on your own device.
Quantization. INT4 significantly cuts memory usage but can hurt number recognition, OCR, and long-context stability. Validation method: run the same sample set through FP16, INT8, and INT4, recording accuracy, peak memory, time to first token, and throughput. If INT4’s accuracy drop exceeds what your business can tolerate, switch to INT8 or reserve INT4 for small models only. Build separate test sets for numeric and receipt-like tasks, since they’re most sensitive to quantization error.
KV Cache management. Estimate per-token KV Cache usage with: 2 × number of layers × number of KV heads × head dimension × bytes per element. Multiply by context length for a single session; multiply again by session count for concurrent sessions. Practical measures include:
- Set a context length limit; when exceeded, truncate earlier history or summarize before retaining.
- Allocate KV Cache with paging to reduce memory fragmentation.
- Reuse the KV Cache for fixed system prompts (complete this implementation per your framework’s capabilities, following the official documentation).
