Training and Serving Multimodal LLMs in Production
Canva fine-tuned a 4B Qwen3.5 vision-language model to run 30+ content and quality checks on over 100k images a day, cutting LLM costs by about 85% and halving the false negative rate without raising false positives. Training used LoRA/QLoRA across all linear layers, loss masking on the assistant response, and a second stage that trains the true-minus-false logit difference directly with a binary classification loss. At serving time, a three-state logit mask in vLLM forces the fixed JSON structure and yields a calibrated probability per check. Because 157 of 190 output tokens are known in advance, switching to draft-free speculative decoding with a grammar constraint dropped p50 latency from 3.5 s to 240 ms on L40S GPUs.
Related posts
- Build specialized multimodal models with LFM3
Hugging Face hardMasterLFM3 is Liquid AI's new family of ~2B-parameter models: text, vision, audio, omni and decision variants, all built on one shared LFM3-1.7B-Base backbone and designed for single-GPU fine-tuning and on-device deployment. The backbone is a 24-layer tri-hybrid found by hardware-in-the-loop architecture search. It mixes 13 gated short convolutions (kernel size 7), 5 sliding-window attention layers and 6 global attention layers, and adds head-wise sigmoid-gated attention, partial RoPE and sandwich norm. Pre-training covered 22T tokens, with a 3.5T-token agentic mid-training stage that extends context to 256K. Reported results include LFM3-1.7B beating LFM2.5-2.6B with 35% fewer parameters and running about 25% faster at 8K context. New in-house vision and audio encoders cut compute (2.2x fewer FLOPs than Qwen3.5-2B's encoder), and the LiquidCodec speech tokenizer decodes about 87x real time on one CPU thread; `transformers` usage snippets are included for each model.
- Preference Optimization for Vision Language Models
Hugging Face hardMasterTRL now supports direct preference optimization (DPO) for vision language models, trained on chosen/rejected answer pairs rather than fixed labels. A walkthrough fine-tunes Idefics2-8b on the RLAIF-V dataset, formatting image-plus-question prompts with the processor's chat template. Full float32 DPO training would need about 160 GB (policy, reference model, gradients, AdamW states), but bfloat16 plus LoRA cuts trainable parameters to 55M and memory to roughly 32 GB. Batch size 2 with 32 gradient accumulation steps and gradient checkpointing fits activations, and training is judged by rising accuracy and reward margin.
- SmolVLM - small yet mighty Vision Language Model
Hugging Face hardMasterSmolVLM is a 2B-parameter open vision language model built on the Idefics3 architecture with a SmolLM2 1.7B backbone. It uses 9x pixel-shuffle compression so each 384x384 patch becomes just 81 tokens. A test prompt plus image encodes to 1.2k tokens versus 16k for Qwen2-VL, giving 5 GB minimum GPU RAM, 3.3-4.5x faster prefill and 7.5-16x faster generation, at modestly lower benchmark scores. Training details cover extending context to 16k by raising the RoPE base to 273k, choosing checkpoints with a weighted benchmark metric, and fine-tuning with QLoRA on a ~16 GB L4 or DPO via TRL.
- Vision Language Models (Better, faster, stronger)
Hugging Face easyNoviceVision language models shifted over the past year toward smaller yet stronger models, any-to-any architectures, multimodal reasoning, Mixture-of-Experts decoders and vision-language-action models for robotics. Specialized capabilities matured: detection, segmentation and counting via localization tokens (PaliGemma, Molmo, Qwen2.5-VL), multimodal safety filters (ShieldGemma 2, Llama Guard 4), and multimodal RAG that skips brittle PDF parsing using DSE or ColBERT-style retrievers such as ColPali. Small models like SmolVLM and gemma-3-4b-it can run locally through MLX and llama.cpp with one-line commands, and MoE decoders trade higher memory for faster inference.
- Optimizing inference speed and costs: Lessons learned from large-scale deployments
Together AI easyNoviceLower LLM inference latency and cost come mainly from how inference runs rather than from buying more GPUs. The levers covered are FP8/FP4 quantization (claimed 20–40% throughput gains), distilled models like DeepSeek-R1 variants (2–5× lower cost), regional proxies that cut 50–100 ms of TTFT, removing GPU stalls via kernel fusion, MoE execution and scheduling, and speculative decoding or MTP (20–50% faster decode). It also covers Blackwell-class hardware with tensor or expert parallelism and dynamically shifting GPU capacity between endpoints. A starting checklist: measure TTFT, decode TPS and network RTT, then add proxies, continuous batching and decoding optimizations.