Native Multimodal Embedding Models: Architecture Design and On-Device Deployment

    Native multimodal embedding models map text, code, images, audio, and video into a single shared vector space, enabling true cross-modal retrieval instead of post-hoc stitching of separate single-modal models. This article explains the key design ideas behind them: a shared vector space, a modular encoder architecture that loads models on demand, and Matryoshka Representation Learning for variable-length vectors. It also covers the engineering realities of running them on phones and edge devices, including quantization, memory usage, and context-window sizing. It then presents practical guidelines for tiered retrieval, resource planning, and building on-device-first, privacy-friendly semantic applications.

    1. From Single-Modal to Multimodal: How Embedding Models Evolved

    At its core, an embedding model maps high-dimensional, unstructured raw data into a low-dimensional, dense, and measurable vector space. In that space, “semantically similar” becomes “close in distance.”

    For a long time, text embeddings were the most widely used form. Retrieval, clustering, deduplication, and recommendation recall all relied on the same pipeline: text to vector.

    As content formats diversified, however, a structural limitation of text-only embeddings became clear: they cannot directly understand images, audio, or video. A common engineering workaround is to embed each modality separately and align the results afterward. This approach has obvious drawbacks: cross-modal semantic alignment is difficult, system complexity is high, and deployment involves switching back and forth between multiple models.

    The term “native multimodal embedding” refers to unified modeling across modalities from the very start of training. Text, code, images, audio, video, and other signals are all mapped into the same compatible vector space. This is not a post-hoc combination of multiple models. Instead, it shares one semantic measurement system, which makes true cross-modal retrieval possible. Use cases such as searching for images with a text query or finding related videos from an image then work naturally.

    2. Shared Vector Space: The Foundation of Cross-Modal Retrieval

    The most critical design decision in a multimodal embedding model is that all modalities are ultimately projected into a space with the same dimensionality and distribution.

    Take a common 768-dimensional space as an example. Whether the input is an image, a piece of code, or a sentence in natural language, the output vectors have the same dimension and the same metric semantics, no matter how different their original forms are. Only then can they be compared directly.

    This means retrieval can cross modality boundaries. For example, suppose a user has stored image vectors in a database and submits a text query. As long as both vectors live in the same space, the same similarity metric can be used to find matches:

    1. import numpy as np
    2. def cosine_similarity(a, b):
    3. """Core of cross-modal retrieval: compute similarity in one shared vector space"""
    4. a = a / np.linalg.norm(a)
    5. b = b / np.linalg.norm(b)
    6. return float(np.dot(a, b))
    7. # text_vec comes from text encoding; image_vec comes from visual encoding
    8. # Both have the same dimension and compatible semantic space, so they can be compared directly
    9. text_query = embed_text("a beach at sunset")
    10. scores = [cosine_similarity(text_query, img_vec) for img_vec in image_db]
    11. best = image_db[int(np.argmax(scores))]

    The value of a shared space is that all downstream tasks, including retrieval, deduplication, recommendation, and clustering, no longer need to care what modality the data originally came from. They operate uniformly on vectors alone. This is the key step that turns “multimodal” from a concept into an engineering reality.

    3. Modular Architecture: Load on Demand and Control Resource Usage

    The direct cost of multimodal models is growth in parameter count and computation. If every modality carried a full-fledged encoder, edge devices would not be able to handle it. A mature approach in the industry is a modular architecture: split the overall system into one base encoder plus several pluggable, modality-specific encoders, and load only the parts the current task actually needs at runtime.

    A typical layered design looks roughly like this:

    • Base layer: handles general-purpose encoding of text and code. It is the “good enough” configuration for most scenarios.
    • Visual encoder: when added, enables joint image-text modeling.
    • Audio encoder: when added, enables speech and sound understanding.
    • Full form: all encoders are present, supporting any combination of text, code, images, video, and audio.

    The outputs of all encoders are aligned to the same vector space. Loading only a subset on demand therefore does not break the consistency of cross-modal retrieval. For developers, this means deployment flexibility: a text-only retrieval scenario can load just the base encoder, which greatly reduces memory usage. Image or audio modules are loaded only when the application genuinely needs to process those inputs. This kind of progressive loading is the architectural prerequisite for bringing multimodal capabilities to resource-constrained devices.

    4. Matryoshka Representation Learning: One Vector, Multiple Precisions

    Even with modularity in place, the storage and transfer overhead of the vectors themselves remains a pain point for on-device deployment. The approach widely adopted in the industry is Matryoshka Representation Learning (MRL).

    The core idea comes from the nesting doll. During training, the model is constrained so that the first few dimensions of a vector form a usable, semantically complete representation on their own. Cutting the vector in half no longer renders it useless. As a result, the same set of weights can output a full 768-dimensional vector or a short vector dynamically truncated to 512, 256, or 128 dimensions, and all truncated versions remain semantically consistent with one another.

    The engineering benefits are direct:

    • Storage compression: shorter vectors take up proportionally less space. A 128-dimensional vector costs about one-sixth of the storage of a 768-dimensional one, which significantly eases capacity pressure on local vector stores.
    • Tiered retrieval: a low-dimensional short vector can do a fast, low-cost coarse filtering pass to retrieve candidates. A high-dimensional vector can then re-rank that candidate set with higher accuracy.
    • Bandwidth friendliness: in edge-cloud collaboration or synchronization between devices, transferring short vectors uses less bandwidth.
    1. def truncate_embedding(vec, target_dim):
    2. """
    3. After MRL training, vectors can be safely truncated.
    4. The leading dimensions already encode the main semantics,
    5. so the truncated vectors are still usable for coarse-grained retrieval.
    6. """
    7. return vec[:target_dim]
    8. full_vec = embed(text) # e.g. 768 dims, for re-ranking
    9. coarse_vec = truncate_embedding(full_vec, 128) # 128 dims, for coarse filtering

    5. On-Device Deployment: Quantization, Memory, and Context Window

    To actually run multimodal embeddings on mobile phones, edge devices, and other on-device hardware, you have to deal with three engineering variables.

    The first is quantization. Compressing model weights from high-precision floating point into a low-bit integer representation can greatly reduce memory usage and inference latency, with almost no loss of retrieval quality. The common experience in the industry is as follows. Lightweight modalities such as text alone can be kept at around 200 MB of resident memory after quantization. Enabling the full multimodal setup raises the memory requirement to several hundred megabytes. This gives a quantitative basis for deciding whether a model can run on the target device.

    The second is the context window. How much input an embedding model can accept at once determines how long a text, how many images, how many video frames, or how many seconds of audio it can process. Expanding the window from the 1,000–2,000 tokens of earlier models to the 8,000-token range means a single model can handle a fairly large interleaved input directly on the device. Examples include dozens of images, dozens of video frames, or several minutes of audio. The larger the window, the stronger the ability to model the overall semantics of long documents and long videos, without relying on external chunking and stitching.

    The third is coordination with generative models. When the embedding model and a generative large language model share a text tokenizer and part of the encoder, they can run as part of the same inference pipeline. The embedding model finds relevant content, and the generative model understands it and produces an answer. On-device, this closes the loop for retrieval-augmented tasks, and the data never leaves the local device. That is a natural fit for privacy protection requirements.

    6. Practical Engineering Guidance

    Based on these technical characteristics, you can follow this practical path when putting them into production:

    1. Start from a single-modal baseline. First enable only the text/code encoder to validate retrieval quality, then gradually add visual and audio modules as needed. This avoids wasting resources by loading all encoders at once.
    2. Use tiered retrieval to control costs. Use MRL short vectors for recall and full-dimension vectors for re-ranking to balance latency, memory, and accuracy.
    3. Quantize first, then measure memory. Quantize on the target device and measure the actual resident memory and inference latency of each modality. Use real data, rather than estimates based on parameter counts, to decide the loading strategy.
    4. Treat the unified vector space as a hard constraint. Before adding any custom encoder, confirm that its output dimension and semantic distribution are aligned with the main space. Otherwise, cross-modal retrieval will break.
    5. On-device first, privacy-friendly. For scenarios involving sensitive data, prefer solutions that can run inference offline on local hardware. This both reduces latency and avoids sending sensitive data off the device.

    When building your own retrieval or semantic understanding services, these multimodal embedding capabilities are typically used together with general-purpose cloud infrastructure such as vector databases, object storage, and message queues. Together they form a collaborative “on-device encoding + cloud retrieval/training” architecture. The general-purpose cloud products offered by platforms such as Baidu AI Cloud can serve as the foundation for hosting retrieval, storage, and inference orchestration, helping teams focus their attention on the model and business logic itself.

    7. Conclusion

    Native multimodal embedding models represent the shift of semantic computing from “isolated single-modal” to “unified multimodal.” They deliver true cross-modal retrieval through a shared vector space, control on-device resource usage through modular architecture and quantization, and balance accuracy and efficiency through Matryoshka Representation Learning. For developers, understanding these underlying mechanisms is what makes it possible to make sound tradeoffs among device capabilities, cost budgets, and retrieval quality, and to build modern semantic applications that are both efficient and privacy-friendly.