Adapting and Evaluating Heterogeneous On-Device Multimodal LLM Architectures
On-device multimodal LLMs are moving from single-spec scaling to heterogeneous architecture combinations. This article examines how inference engines should handle model export, graph rewriting, shared and heterogeneous KV cache management, operator fusion, layer-wise quantization, and multi-backend scheduling across CPU, GPU, and NPU. It also presents a layered evaluation approach covering latency, memory, long-context stability, multimodal end-to-end quality, and real-device experience, with practical recommendations for architecture selection and deployment.
Introduction
On-device multimodal LLMs are moving from “single-spec scaling” to “combinations of multiple architectural mechanisms.” A model family may cover phones, tablets, desktops, and servers across different compute tiers, but different tiers do not simply change parameter count. They combine attention structures, cache strategies, embedding injection methods, normalization placement, multimodal encoders, and expert routing in different ways. For an inference engine, the adaptation target is therefore no longer a fixed compute graph. It is a set of heterogeneous models that share some design ideas but differ significantly in execution paths and memory layouts.
This article does not focus on a specific product or user experience. It abstracts the problem into a general engineering question: when an on-device multimodal model uses a heterogeneous architecture, how should an inference engine handle model export, graph rewriting, cache management, operator fusion, quantization, and multi-backend scheduling? How should evaluation be designed to avoid models that “run” but are not “usable”? The following sections cover architecture trends, adaptation challenges, implementation approaches, evaluation methods, and usage recommendations.
1. Four Key Changes Brought by Architecture Evolution
1. Layer-wise embedding injection: from shared lookup to layer-wise conditional injection
Traditional models usually perform one shared embedding lookup at the input layer and feed the result into the backbone. To reduce backbone compute pressure, newer on-device models may split some conditional information into layer-wise embeddings: each layer obtains an additional vector via lookup and incorporates it through direct injection or a lightweight projection. The engineering value is to decouple part of the representational capacity from backbone matrix multiplications, reducing backbone width or compute while retaining layer-wise conditional adjustment.
Adaptation difficulty also increases. First, export must preserve the ordering between embedding lookups and layer execution; dynamic lookups must not be incorrectly constant-folded. Second, layer-wise embedding tables are often sensitive to quantization, and low-bit quantization may cause semantic drift. Third, different backends vary in their support for fusing “lookup—broadcast—add—normalization.” The inference engine needs fallback operator combinations and must identify fusable patterns during graph optimization.
2. KV cache sharing and heterogeneous KV heads: memory savings, but more complex layout
KV cache sharing is a practical mechanism in on-device models: multiple layers share the same key-value cache, significantly reducing cache footprint and read/write bandwidth, especially for long contexts and continuous conversations. Some models also use heterogeneous KV heads, where the number of KV heads differs across layers or modules. Other models use key-value source projection, reducing parameters and computation from separate value projections.
This creates three challenges for an inference engine. First, cache can no longer be uniformly allocated as independent tensors per layer; it must be managed by sharing groups, with reference counting and aliasing to avoid duplicate writes. Second, heterogeneous head counts require the cache pool to support grouped layouts, and the decode stage cannot simply use uniform slicing. Third, although key-value source projection saves operators, it requires attention to numerical stability and operator fusion order to avoid amplifying errors at low precision.
3. Hybrid attention and normalization: prefill and decode need different strategies
Hybrid attention usually combines local windows, global attention, or sparse patterns to balance long context and on-device compute. Query, key, and value normalization improves training stability but also lengthens the operator chain around attention. Dual-path positional encoding may use different positional information on different attention paths.
During adaptation, prefill and decode should be considered separately: prefill is compute-intensive and suits blocked attention and fused normalization; decode is memory-intensive, with focus on cache layout, batching, and merging small operators. Hybrid attention also requires the inference engine to select different kernels by layer and to handle block scheduling and memory reuse under long contexts.
4. Multimodal encoders and mixture of experts: subgraph scheduling and dynamic routing
Multimodal support usually includes vision encoders, audio encoders, pooling or alignment modules, and a text backbone. Vision encoders may use Transformer structures or lightweight convolutional structures; audio encoders may use specialized sequence modeling structures. Mixture-of-experts routing dynamically selects experts based on input, increasing capacity but introducing conditional branches and weight access overhead.
The inference engine needs to treat multimodal encoders as independent subgraphs, support asynchronous execution, resolution or sample-rate bucketing, and merging with text tokens. For mixture of experts, on-device deployment should not blindly pursue large-scale expert parallelism. Instead, it should support grouped routing, expert weight caching, and low-bit quantization while preserving high precision for routing scores to avoid routing jitter.
2. Inference Engine Adaptation Methods
1. Export and graph rewriting
The export stage should unify the intermediate representation, mark shared caches as aliases, preserve layer-wise embedding lookup operators, preserve expert routing conditional branches, and split multimodal encoders into independent subgraphs. Constant folding must be careful: embedding tables, positional encoding tables, and routing parameters should not be incorrectly frozen. Graph rewriting can perform three types of optimization: lookup and projection fusion, normalization and attention pre-fusion, and shared cache read/write merging.
2. Cache management pseudocode
def build_cache_plan(num_layers, share_groups, heads_per_layer):plan = []for layer in range(num_layers):group = find_share_group(layer, share_groups)if group.owner is None:group.owner = layerplan.append(CacheBlock(layer, group,heads=heads_per_layer[layer],shared=False))else:plan.append(CacheRef(layer, group, shared=True))return plan
The execution layer can be abstracted as:
def run_layer(x, layer_id, token_ids, cache):emb = lookup(layer_emb_table[layer_id], token_ids)if cache.is_shared_ref(layer_id):kv = cache.get_shared(layer_id)else:q, k, v = qkv_proj(x)kv = cache.write(layer_id, k, v)x = mixed_attention(x, kv, norm_qkv=True,pos=dual_position(x, layer_id))return fuse_projection(x + emb)
Multimodal prefill can be scheduled independently:
def multimodal_prefill(image, audio, text):v = vision_encoder(image)v = pooler(v)a = audio_encoder(audio)tokens = merge_tokens(text, v, a)return prefill(tokens)
3. Quantization and multi-backend scheduling
Quantization should be handled layer by layer: normalization, routing scores, and layer-wise embedding tables are recommended to retain higher precision; KV cache can use low bits after accuracy regression passes; vision and audio encoders need validation with multimodal calibration sets. Multi-backend scheduling should provide operator fallback. CPU, GPU, and NPU select kernels according to a capability table. Multimodal encoders can execute asynchronously, while text decode prioritizes low latency.
3. Evaluation Methods and Experience Assessment
Evaluation cannot rely only on single-turn question answering. A layered metric set is recommended: first-token latency, decode throughput, peak memory, cold-start time, long-context stability, multimodal end-to-end latency, and task accuracy and multimodal alignment quality before and after quantization. Test sets should cover short text, long documents, image question answering, audio input, and continuous conversations, and should record P50/P95 latency and error categories.
Experience assessment should reflect real scenarios: on-device focus on temperature rise, power consumption, and memory jitter; desktop and server focus on batch throughput and concurrency stability. An “architecture combination matrix” regression test is recommended. After every change to export, quantization, or cache strategy, run both accuracy gates and real-device performance gates.
4. Usage Recommendations
First, select by scenario: on-device should prioritize combinations of KV sharing, low-bit quantization, and lightweight multimodal encoders; desktop can enable larger attention heads and expert routing as appropriate; server can pursue throughput and batching. Second, advance quantization in stages: weights first, then cache; text first, then multimodal. Third, cache management should support sharing groups, reference counting, and session isolation to avoid cross-talk in continuous conversations. Fourth, bucket multimodal preprocessing by resolution and sample rate, and execute encoders asynchronously. Fifth, build a reproducible evaluation pipeline that puts accuracy, latency, memory, and stability into the same gate.
Conclusion
Competition in on-device multimodal LLMs is shifting from parameter scale to architecture combinations and deployment efficiency. For inference engines, the core task is to build an adaptation layer that can express shared caches, layer-wise embeddings, heterogeneous attention, and multimodal subgraphs, and to move from “runnable” to “stably usable” through quantization, operator fusion, and layered evaluation. Only by doing architecture abstraction, memory management, and evaluation systems well together can heterogeneous model combinations truly land in on-device and cloud-edge collaborative scenarios.
