Encoder-Free Multimodal Architecture: Practical Engineering for Lightweight Inference

    Encoder-free multimodal models replace the conventional dedicated-encoder-plus-adapter pipeline with a single lightweight projection layer, feeding raw image patches and audio waveform blocks directly into the language backbone. This article walks through why the approach works, how a thinking mode allocates inference budget on demand, and which inference-side techniques—a multi-token draft model and quantization-aware training—make it practical for on-device and low-concurrency serving. It also includes a size-selection guide, a deployment checklist, and the key risks that should be settled with real measurements rather than assumptions.

    1. Where the problem starts: fitting multimodality into a limited parameter budget

    Over the past two years, the path to mainstream multimodal capability has largely followed one fixed pattern: a dedicated encoder → a projection/adapter layer → a language model backbone. This chain is mature from an engineering standpoint, but it pushes the cost structure in a direction that is easy to overlook. What actually determines VRAM usage, time-to-first-token latency, and memory-bandwidth pressure is often not the language backbone, but the encoder modules bolted on to “see” and “hear.”

    Take vision as an example. A mid-sized image encoder can easily carry hundreds of millions of parameters, and adding spectral encoding on the audio side is another expense. Stacked together, this brings three costs:

    1. A diluted parameter budget. Under the same total parameter count, the encoder consumes a share that could have gone to language and reasoning capability.
    2. Increasing marginal cost of modality expansion. Every new modality requires its own encoder, its own preprocessing pipeline, and its own alignment-training process.
    3. Persistent alignment loss across heterogeneous feature spaces. The output of a frozen encoder has a systematic bias relative to the backbone’s embedding space, requiring projection layers and large-scale paired data to recalibrate repeatedly.

    A recent series of open-source multimodal models (available in four sizes, roughly 2B, 4B, 12B, and 31B) took a different path: remove the modality encoders entirely. This route is worth unpacking layer by layer, because it is not a simple case of “cutting modules” but a wholesale replacement of the architectural assumptions.

    2. The encoder-free architecture: handing feature extraction back to the backbone

    2.1 Core design: a single projection layer

    These models remove the vision and audio encoders and keep only a single projection layer of roughly 35M parameters, whose job is to map the two raw signal streams into the language model’s unified embedding space:

    • Image: instead of building a convolutional feature pyramid, the image is cut directly into patches; each patch is flattened and linearly projected into a token vector.
    • Audio: instead of spectrogram/filter-bank encoding, the raw waveform is split directly into blocks of about 40 milliseconds, each projected into a token vector.

    The image tokens, audio tokens, and text tokens are then interleaved into a single sequence and fed into the autoregressive backbone.

    2.2 Why this approach works

    The premise behind this design is a judgment: the language backbone already has enough sequence-modeling and pattern-recognition capacity, so the “hand-crafted priors” that early feature engineering provided yield diminishing returns against a sufficiently deep and wide backbone.

    Broken down, three factors support this:

    • Capacity reallocation. The parameters saved by dropping the encoder all flow into the backbone, so the model’s effective capacity for language reasoning and cross-modal association actually increases. A 35M projection layer is less than 2% of a 2B backbone, adding almost no burden.
    • High-resolution friendliness. The patch-based path has no hard constraints from convolutional receptive fields or downsampling ratios. When input resolution changes, you only adjust the number of tokens rather than redesigning the encoder.
    • Linearized modality expansion. A new modality needs only a new, isomorphic projection head, and the training pipeline reuses the same sequence-splicing and loss functions.

    2.3 Conceptual code

    1. # Modality input path for an encoder-free architecture (illustrative, not an actual implementation)
    2. def build_multimodal_embeddings(image, waveform, image_proj, audio_proj):
    3. # Image: split into patches and flatten, keeping only an injectable positional bias
    4. patches = patchify(image, patch_size=16) # [N, P*C]
    5. img_tokens = image_proj(patches.to("bf16")) # single projection layer -> LLM embedding space
    6. img_tokens = img_tokens + rope_or_rel_bias(img_tokens)
    7. # Audio: 40 ms waveform blocks (~640 samples at 16 kHz), no frequency-domain transform
    8. frames = frame_waveform(waveform, win_ms=40, hop_ms=20) # [M, 640]
    9. audio_tokens = audio_proj(frames.to("bf16"))
    10. # Interleave with text tokens into a single sequence
    11. return interleave(text_embed, img_tokens, audio_tokens)

    2.4 Costs and engineering considerations

    Beyond the benefits of swapping the architecture, the functionality that was replaced must also be faced squarely:

    • Sequence-length inflation. A high-resolution image can expand into thousands of patch tokens, and 40 ms audio blocks mean about 1,500 blocks per minute of audio (at a 20 ms hop). The context budget must be managed explicitly; strategies such as adaptive downsampling by information density, keyframe selection, or block-level merging are recommended.
    • Increased pressure on positional encoding. Long mixed sequences demand more from positional encoding’s extrapolation ability, so the ratio of training length to inference length needs attention.
    • Fine-grained perception must be measured empirically. Without convolutional inductive bias, performance on small-object localization, dense text, and fine spatial relations depends more heavily on the pretraining data distribution, and cannot be assumed to inherit the level of traditional encoder-based schemes.
    • Shifted denoising responsibility. Raw pixels and waveforms are noisier, so real deployments should pair the model with input preprocessing (resolution cropping, silence trimming, sample-rate normalization) to control useless tokens.

    3. Thinking mode: allocating inference budget on demand

    3.1 Design motivation

    The Thinking Mode introduced by this series essentially changes the inference budget from “on by default” to “explicitly controllable.” The implementation is very lightweight: a system-side control token triggers a dense intermediate reasoning trace locally, after which the formal answer is produced.

    The value for production is direct. Simple intent recognition, format conversion, and keyword-extraction requests do not need long-chain reasoning, while complex multi-hop reasoning, chart reading, and long-audio understanding genuinely do. Forcing everything into long thinking wastes tokens and latency; disabling it everywhere loses points on hard cases.

    3.2 Invocation

    1. messages = [{
    2. "role": "user",
    3. "content": [
    4. {"type": "text", "text": "What does the quarter-over-quarter change in this quarterly report indicate?"},
    5. {"type": "image", "image": report_bytes},
    6. ],
    7. }]
    8. # Inject a control token on the system side to start the thinking trace
    9. messages[0]["content"].insert(0, {"type": "text", "text": "<thinking>"})
    10. cfg = {
    11. "max_new_tokens": 2048, # total budget for thinking + answer
    12. "stop_tokens": ["</thinking>", "<answer>"],
    13. "temperature": 0.2,
    14. }

    3.3 How to decide “enable or disable”

    Do not decide based on subjective feeling. Instead, build a two-axis accuracy–token-cost curve: fix an evaluation set and, under both thinking-on and thinking-off settings, record task accuracy, average output tokens, and P50/P95 latency, then convert to cost per thousand requests. In practice, two patterns usually emerge. Structured extraction, classification, and summarization tasks gain little and may even drift due to over-reasoning, while multi-step computation, constraint satisfaction, and cross-modal cross-validation tasks see clear gains.

    3.4 Three common pitfalls

    • Over-thinking. The model unfolds a long chain on simple questions, which actually increases the probability of errors and the latency. A lightweight intent classifier as a front-end router is recommended.
    • Chain-of-thought leakage. The intermediate trace may not be suitable to return directly to end users, so field-level trimming should be done on the output side, keeping only the formal answer.
    • Budget truncation. When max_new_tokens is reached and the output is hard-truncated, it is often an incomplete sentence. Set termination criteria and fallback phrasing to avoid a half-sentence entering downstream parsing.

    4. Two supporting inference techniques

    If a lightweight architecture does not also compress decoding cost, it remains hard to deploy in on-device and low-concurrency scenarios. This series also provides two engineering-side supports.

    4.1 Multi-token prediction draft model

    This is the typical idea behind accelerating autoregressive decoding: a smaller model acts as a draft model, guessing several upcoming tokens at once, then the target model performs a single forward pass to verify all positions in parallel, accepting the matching prefix.

    1. draft = draft_model.propose(ctx, k=4) # draft model proposes 4 candidates
    2. logits = target_model.forward(ctx + draft) # target model verifies in a single parallel pass
    3. accepted = 0
    4. for i, tok in enumerate(draft):
    5. if tok == logits.argmax(i): # accept while the prefix matches
    6. accepted += 1
    7. else:
    8. break
    9. produced = accepted + 1 # actual tokens produced this round

    The key engineering metric is not the speedup factor itself, but the distribution of acceptance rate and acceptance length, along with the VRAM and compute overhead introduced by the draft model. If the acceptance rate is too low, the extra drafting overhead drags down overall throughput instead, so the draft model must share the same distribution and tokenizer as the target model.

    4.2 Quantization-aware training (QAT)

    Compared with post-training quantization (PTQ), QAT simulates quantization error during the training stage, letting weights and activations adapt to low-bit representation, thereby supporting more aggressive bit widths at the same accuracy loss. In deployment terms, this means lower VRAM usage, reduced memory-bandwidth pressure, and improved on-device runnability.

    Engineering-wise, note that QAT produces weights specific to a particular bit width and quantization scheme and cannot be freely migrated across inference backends; switching inference engines requires re-calibration and an accuracy regression.

    4.3 How the two work together

    A combination worth attention: when the draft model and the target model are deployed under the same quantization scheme, the token-distribution deviation is smaller and the acceptance rate is usually more stable. Conversely, if the target model is QAT-quantized while the draft model stays high-precision, distribution drift erodes the acceleration gains. It is advisable to write “quantization-scheme consistency” as a default constraint into deployment specs.

    5. Parameter-scale selection guide

    Size class Typical resource constraints Suitable scenarios Main risks
    2B class Phone/embedded devices, 4–8GB RAM On-device real-time Q&A, image-assisted recognition, voice commands Long context and long thinking traces must be rate-limited
    4B class Edge boxes/industrial PCs, 8–16GB Offline document understanding, quality-inspection assist High-resolution images need forced downsampling
    12B class Single-server GPU, 24GB-class VRAM with quantization Mid-size business APIs, multimodal knowledge retrieval Concurrency is limited by VRAM bandwidth
    31B class High-VRAM single GPU or multiple GPUs Hard reasoning, complex charts and long-audio analysis Time-to-first-token and throughput must be stress-tested

    Selection should be based on task-difficulty distribution rather than a preference for scale: first sample errors from real traffic with a smaller size class, tally the proportion of hard cases, then decide whether to move up a size class. This can significantly avoid capacity waste.

    6. Deployment checklist

    • Input governance: normalization of resolution and audio sample rate, plus trimming of silence and blank pages—these directly determine the proportion of useless tokens.
    • Context budget: set separate quotas for image tokens, audio tokens, and thinking traces so they do not crowd each other out.
    • Routing strategy: lightweight classification up front, simple requests take the non-thinking path, hard cases then trigger thinking mode.
    • Deployment form: for local or edge use, quantized weights delivered via container platforms; on the server side, message queues for peak shaving and object storage for large multimodal inputs. Baidu AI Cloud product categories (container platform, object storage, message queue, log service, monitoring and alerting) mainly serve hosting and operations duties in such scenarios; the specific capability boundaries should follow the actual product documentation.
    • Evaluation metrics: beyond task accuracy, consistently collect six items—time-to-first-token latency, P95 latency, cost per thousand tokens, draft acceptance rate, and thinking-mode trigger rate—to form a regression baseline.
    • Security and compliance: add image/audio content moderation and injection detection on the multimodal input side; desensitize raw multimodal data in logs or store only summaries, and persist intermediate reasoning traces on demand with a defined retention period.

    7. Conclusion

    The core insight of the encoder-free architecture is this: when the language backbone has enough capacity, maintaining a separate encoder for each modality is redundant investment. Combined with on-demand thinking mode, multi-token prediction decoding, and quantization-aware training, these small-parameter multimodal models become engineering-feasible for on-device and low-concurrency server-side scenarios.

    But architectural simplification does not mean the risks disappear. The four issues—sequence-length inflation, fine-grained perception, draft acceptance-rate drift, and quantization-backend binding—must be answered with measured data rather than architectural assumptions. It is advisable for teams to first build a small-scale baseline evaluation and cost instrumentation, then gradually scale up model size and modality count: measurable, incremental deployment is more reliable than betting everything on a single architecture route.