Revisiting Encoder-Decoder Architecture: A Guide to Open-Source Multimodal Small Models for On-Device Deployment
This article explains why encoder-decoder architectures are drawing renewed attention for multimodal and on-device AI. It covers how a recent open-source model family adapts pretrained decoder-only weights into an encoder-decoder structure, the model family's multimodal, long-context, and multilingual capabilities, and practical guidance on quantization, encoder output reuse, and task selection for edge deployment.
1. Background: Why Encoder-Decoder Architecture Is Back in Focus
Over the past few years, decoder-only architectures have become the de facto standard for large language models, thanks to their good scalability and fluent generation. In practice, however, researchers have found several structural weaknesses:
- Hallucination. The model has no explicit “understand and verify” stage during generation, so it can fabricate facts.
- Multimodal processing. Unidirectional attention limits how well the model understands input sequences.
- On-device efficiency. Autoregressive generation requires loading all parameters, which makes these models unsuitable for compute-limited settings such as phones and IoT devices.
Encoder-decoder architectures address these gaps. The encoder uses bidirectional attention to build a deep understanding of the input, while the decoder focuses on generation. Together they form a two-stage process: understand first, then output.
A recently open-sourced family of next-generation, multimodal, long-context encoder-decoder small models revisits this classic architecture and modernizes it. The family comes in three sizes, from several hundred MB to several GB, using symmetric encoder-decoder configurations. It covers scenarios from lightweight to mid-range compute.
2. Technical Approach: Adapting a Decoder into an Encoder-Decoder
The core training approach is worth attention from developers. Rather than pretraining an encoder-decoder model from scratch, these models use an “adaptation” approach:
- Select a seed model. Start with a decoder-only model that has completed large-scale pretraining. Its parameters have been trained on trillion-scale token corpora, so it has mature language understanding.
- Map the weights. Map the seed decoder’s weights into the new encoder-decoder structure. For the encoder, change the attention mask so that causal attention becomes bidirectional. The original weights serve as the initialization.
- Continue training. After adaptation, continue pretraining so the model recovers and improves its capabilities under the new architecture.
The main advantage is controllable compute cost. Adaptation requires far less compute than training from scratch, and the model inherits the language ability of the original. For teams with limited resources, this is a practical engineering pattern: reuse existing pretrained weights during an architecture migration instead of starting over.
The following pseudocode illustrates the weight mapping flow:
# Pseudocode: core logic of architecture adaptationseed_decoder = load_pretrained_decoder(checkpoint) # Load the seed decoderencoder = build_encoder(from=seed_decoder,attention="bidirectional") # Convert to bidirectional attentiondecoder = init_decoder(from=seed_decoder) # Keep the causal attentionadapt_model = continue_pretraining(encoder_decoder, corpus)
3. Model Capabilities: Multimodal, Long-Context, and Multilingual
The model family focuses on three capability areas:
- Multimodal understanding. The model processes image and text inputs together, supporting tasks such as visual question answering and image-text reasoning. The encoder encodes visual signals and text into a unified representation, and the decoder generates answers from that fused representation. For tasks that require precise image reading, this structure is more controllable than purely generative approaches.
- Long context. The model supports input of up to 128K tokens, which covers long-document summarization and analysis of very long code. The encoder handles understanding and compression of long inputs, which reduces the overhead of the generation stage.
- Multilingual and on-device tasks. The model supports more than 140 languages. On phones and other compute-limited devices, it can handle translation, summarization, and instruction execution. The same family includes a lighter variant that, after quantization, runs in about 135 MB, which lowers the barrier to on-device use.
4. Engineering Essentials for On-Device Deployment
When deploying these models on edge devices, consider the following practices:
- Choose a quantization level. Select INT8 or a lower bit width based on device memory. Models at the several-hundred-MB scale can reach acceptable time-to-first-token latency on mobile CPUs.
- Process in stages. Use the encoder-decoder structure to cache and reuse encoded results for long inputs. This reduces repeated computation in scenarios such as multi-turn summarization and incremental translation.
- Match the task. Small encoder-decoder models suit tasks with clear inputs and structured outputs, such as translation, summarization, and extraction. They are not suited to open-ended long-form writing, so select a model that fits the shape of the task.
5. Summary
Encoder-decoder architectures show distinctive value for multimodal processing, long context, and on-device efficiency. The approach of reusing pretrained decoder weights for architecture adaptation is also worth learning from. For developers, understanding the capability boundaries and deployment essentials of this route helps them choose models more effectively for edge computing and lightweight scenarios.
