On-Device Multimodal Model Selection and Deployment: Calculate Memory First, Then Evaluate Capability

    Open-source LLMs are evolving rapidly, and more lightweight models can now run on phones, workstations, and embedded devices. On-device inference reduces API costs, keeps data local, and enables basic intelligent interaction offline. However, many teams select models based only on parameter counts and benchmark scores, overlooking peak memory, latency, and power consumption—the factors that actually determine whether a model can be deployed. This article walks through the selection process and deployment steps from an engineering perspective, covering memory peak estimation for Dense and MoE models, the fit of 2B–4B models for phones and edge boxes, and the trade-offs of native multimodal input.

    Open-source LLMs are evolving rapidly, and more lightweight models can now run on phones, workstations, and embedded devices. On-device inference reduces API costs, keeps data from leaving the device, and enables basic intelligent interaction offline. But many teams select models based on parameter counts and benchmark scores while ignoring peak memory, latency, and power consumption—the very factors that determine whether a model can actually ship. This article walks through the selection logic and deployment steps from an engineering perspective.

    1. Calculate Peak Memory Before Evaluating Capability

    Estimating memory from the weight file size alone underestimates actual usage. Peak memory during inference is the sum of the following:

    • Model weights: parameter count multiplied by bytes per parameter. FP16 uses 2 bytes per parameter, INT8 uses 1 byte, and INT4 uses 0.5 bytes.
    • KV cache: grows with context length. It can be estimated as “2 × number of layers × number of KV heads × head dimension × context length × bytes per element.”
    • Intermediate activations and temporary buffers: related to input length; typically 1GB to 2GB for a single request.
    • Runtime and framework overhead: memory used by the inference engine itself, typically 1GB to 2GB.
    • Multimodal encoders: the weights and compute buffers of image or audio encoders must be counted separately.

    Take a 30B-parameter model as an example. Assume it has 60 layers, 8 KV heads, a head dimension of 128, a context length of 8K, and the KV cache stored in FP16. The KV cache is then about 2 × 60 × 8 × 128 × 8192 × 2 bytes, roughly 2GB. The peak estimate after INT4 quantization is:

    • Weights: 30B × 0.5 bytes, about 15GB;
    • KV cache (8K context): about 2GB;
    • Intermediate activations and buffers: 1GB to 2GB;
    • Runtime overhead: 1GB to 2GB;
    • Total: about 19GB to 21GB.

    With INT8, the weights are about 30GB, and the total peak is about 34GB to 36GB. The architecture parameters above are only examples; actual values depend on the model’s configuration file.

    Model selection should start from the device’s available memory. The system and other apps consume part of it, so the space available to the model is often much less than the advertised capacity. Peak usage should not exceed 70% of available memory, meaning the device’s available memory must be at least the peak divided by 0.7. By this calculation, the INT4 version of a 30B model requires about 30GB of available memory, and the INT8 version requires about 52GB. If a multimodal encoder also needs to be loaded, its footprint must be added on top.

    2. Dense Models: Stable Capability, but Specify Requirements per Precision

    Dense models activate all parameters on every inference pass. Their structure is simple, their inference behavior is predictable, and they generally perform more consistently on multi-step reasoning and complex instruction following.

    The running conditions for a 30B-class Dense model, by quantization precision:

    • INT4 quantization: at least about 30GB of available device memory, or a discrete GPU with at least about 30GB of usable VRAM;
    • INT8 quantization: at least about 52GB of available device memory, or a discrete GPU with at least about 52GB of usable VRAM;
    • Run inference with a single request (batch=1), and limit context length to the minimum required by the business;
    • Time-to-first-token and generation speed should fall within an acceptable range for the business, based on actual measurements.

    Under these conditions, the model can typically handle everyday tasks reliably—for example, generating a recipe from available ingredients and guiding the cooking step by step. Whether the quality is good enough needs to be validated with your own task data. This article provides no generic scores and does not recommend applying others’ test results directly.

    3. Why MoE Models Are Judged by Total Parameters, Not Activated Parameters

    In a Mixture-of-Experts (MoE) model, a routing module decides which expert networks process each input. Only a small fraction of parameters is activated per inference pass, so compute and power consumption are low while the capacity of a larger model is retained.

    Memory usage, however, is determined by the total parameter count. Unless parameter offloading is used, all expert weights must be loaded into memory. Take an MoE model with 32B total parameters: INT4 weights are about 16GB, and after adding the KV cache and runtime overhead, the peak is about 20GB to 22GB—close to a Dense model of the same size. MoE saves compute, not memory.

    Two additional points matter for MoE on the edge.

    First, routing itself has compute overhead, and switching between experts can introduce extra memory-access latency. Second, phones typically have lower memory bandwidth than desktop devices, so the same MoE model can generate tokens at very different speeds on the two classes of hardware. Actual MoE speed must therefore be measured on the target device.

    4. 2B–4B Small Models: Suited to Phones and Edge Boxes, Not Microcontrollers

    After INT4 quantization, models in the 2B–4B range have weights of roughly 1GB to 2GB. Including multimodal encoders and runtime overhead, the overall peak is usually between 1GB and 3GB. INT8 versions have weights of about 2GB to 4GB, with a peak of about 3GB to 5GB. These models fit mid-to-high-end phones, edge gateways with local compute, and small edge boxes, handling text chat, simple image understanding, and basic voice command processing.

    Microcontrollers (MCUs) typically have only KB-to-MB-scale flash and memory, and cannot host general-purpose multimodal LLMs. On MCUs, a more reasonable approach is to use models under 100M parameters, or TinyML models designed for embedded scenarios, for fixed tasks such as wake-word detection and sensor classification.

    The table below summarizes the common profiles of these model classes. The values are rough estimates; actual results depend on context length, quantization scheme, inference framework, and device model.

    Model Class Parameter Profile INT4 Peak Memory (Rough) INT8 Peak Memory (Rough) Typical Devices Main Risks Suitable Tasks
    30B-class Dense Fully activated every pass ~19GB–21GB ~34GB–36GB High-end workstations, high-VRAM GPUs High latency, high power draw Multi-step reasoning, complex instructions
    32B-class MoE (example) Large total parameters, small activated parameters ~20GB–22GB ~36GB–38GB High-end devices, workstations Expert-switching latency, high memory floor Dialogue and understanding requiring larger capacity
    2B–4B small models Few parameters, compact structure ~1GB–3GB ~3GB–5GB Mid-to-high-end phones, edge boxes Limited long-context and complex reasoning ability Local chat, image understanding, voice commands
    Under 100M or TinyML Extremely small models A few hundred KB to a few MB Same magnitude Microcontrollers Fixed tasks only Wake words, sensor classification

    5. Multimodal Input: Weigh the Benefits Against the Costs

    Native multimodal models can directly process images, video, and audio, eliminating external models and text-based intermediation. This simplifies the architecture but introduces new engineering challenges.

    5.1 Variable-Resolution Images

    The traditional approach forces images into a fixed size, such as 224×224. Variable-resolution input lets the model process images at their original aspect ratio and detail level, so small text and fine textures are better preserved in document parsing and real-world object recognition.

    The cost is that higher resolution produces more visual tokens, increasing time-to-first-token and memory usage. A maximum pixel budget should therefore be set to balance accuracy against speed. In addition, inference frameworks and chips vary in their support for variable resolution: some frameworks require fixed resolution tiers, and others perform extra interpolation during preprocessing. Confirm the target framework’s support before going live.

    5.2 Native Audio Input

    Some models in the 2B–4B range can directly…