LiquidAI/LFM2-VL-3B
1421.5k
1---2library_name: transformers3license: other4license_name: lfm1.05license_link: LICENSE6language:7- en8- ja9- fr10- es11- de12- it13- pt14- ar15- zh16- ko17pipeline_tag: image-text-to-text18tags:19- liquid20- lfm221- lfm2-vl22- edge23---24 25<center>26<div style="text-align: center;">27 <img 28 src="https://cdn-uploads.huggingface.co/production/uploads/61b8e2ba285851687028d395/2b08LKpev0DNEk6DlnWkY.png" 29 alt="Liquid AI"30 style="width: 100%; max-width: 100%; height: auto; display: inline-block; margin-bottom: 0.5em; margin-top: 0.5em;"31 />32</div>33<div style="display: flex; justify-content: center; gap: 0.5em;">34<a href="https://playground.liquid.ai/chat?model=lfm2.5-vl-1.6b"><strong>Try LFM</strong></a> • <a href="https://docs.liquid.ai/lfm/getting-started/welcome"><strong>Docs</strong></a> • <a href="https://leap.liquid.ai/"><strong>LEAP</strong></a> • <a href="https://discord.com/invite/liquid-ai"><strong>Discord</strong></a>35</div>36</center>37 38<br>39 40# LFM2‑VL41 42**LFM2-VL-3B** is the newest and most capable model in [Liquid AI](https://www.liquid.ai/)'s multimodal **LFM2-VL** series, designed to process text and images with variable resolutions. 43Built on the [LFM2](https://huggingface.co/collections/LiquidAI/lfm2-686d721927015b2ad73eaa38) backbone, it extends the architecture for higher-capacity reasoning and stronger visual understanding while retaining efficiency. 44 45We are releasing the weights of the new [3B](https://huggingface.co/LiquidAI/LFM2-VL-3B) checkpoint—offering higher performance across benchmarks while remaining optimized for scalable deployment.46 47* **Competitive multimodal performance** among lightweight open models.48* **Enhanced visual understanding and reasoning**, particularly on fine-grained perception tasks49* **Retains efficient inference** with the same flexible architecture and user-tunable speed-quality tradeoffs 50* **Processes native resolutions up to 512×512** with intelligent patch-based handling for larger inputs 51 52For more details, see the [LFM2-VL-3B post](https://www.liquid.ai/blog/lfm2-vl-3b-a-new-efficient-vision-language-for-the-edge) and the [LFM2 blog post](https://www.liquid.ai/blog/liquid-foundation-models-v2-our-second-series-of-generative-ai-models).53 54## 📄 Model details55 56Due to their small size, **we recommend fine-tuning LFM2-VL models on narrow use cases** to maximize performance. 57They were trained for instruction following and lightweight agentic flows. 58Not intended for safety‑critical decisions.59 60| Property | [**LFM2-VL-450M**](https://huggingface.co/LiquidAI/LFM2-VL-450M) | [**LFM2-VL-1.6B**](https://huggingface.co/LiquidAI/LFM2-VL-1.6B) | [**LFM2-VL-3B**](https://huggingface.co/LiquidAI/LFM2-VL-3B) |61|---|---:|---:|---:|62| **Parameters (LM only)** | 350M | 1.2B | 2.6B |63| **Vision encoder** | SigLIP2 NaFlex base (86M) | SigLIP2 NaFlex shape-optimized (400M) | SigLIP2 NaFlex large (400M) |64| **Backbone layers** | hybrid conv+attention | hybrid conv+attention | hybrid conv+attention |65| **Context (text)** | 32,768 tokens | 32,768 tokens | 32,768 tokens |66| **Image tokens** | dynamic, user-tunable | dynamic, user-tunable | dynamic, user-tunable |67| **Vocab size** | 65,536 | 65,536 | 65,536 |68| **Precision** | bfloat16 | bfloat16 | bfloat16 |69| **License** | LFM Open License v1.0 | LFM Open License v1.0 | LFM Open License v1.0 |70 71**Supported languages:** English72 73**Generation parameters**: We recommend the following parameters:74- Text: `temperature=0.1`, `min_p=0.15`, `repetition_penalty=1.05`75- Vision: `min_image_tokens=64` `max_image_tokens=256`, `do_image_splitting=True`76 77**Chat template**: LFM2-VL uses a ChatML-like chat template as follows: 78 79```80<|startoftext|><|im_start|>system81You are a helpful multimodal assistant by Liquid AI.<|im_end|>82<|im_start|>user83<image>Describe this image.<|im_end|>84<|im_start|>assistant85This image shows a Caenorhabditis elegans (C. elegans) nematode.<|im_end|>86```87 88Images are referenced with a sentinel (`<image>`), which is automatically replaced with the image tokens by the processor.89 90You can apply it using the dedicated [`.apply_chat_template()`](https://huggingface.co/docs/transformers/en/chat_templating#applychattemplate) function from Hugging Face transformers.91 92**Architecture**93- **Hybrid backbone**: Language model tower (LFM2-2.6B) paired with SigLIP2 NaFlex vision encoders (400M shape-optimized)94- **Native resolution processing**: Handles images up to 512×512 pixels without upscaling and preserves non-standard aspect ratios without distortion95- **Tiling strategy**: Splits large images into non-overlapping 512×512 patches and includes thumbnail encoding for global context96- **Efficient token mapping**: 2-layer MLP connector with pixel unshuffle reduces image tokens (e.g., 256×384 image → 96 tokens, 1000×3000 → 1,020 tokens)97- **Inference-time flexibility**: User-tunable maximum image tokens and patch count for speed/quality tradeoff without retraining98 99**Training approach**100- Builds on the LFM2 base model with joint mid-training that fuses vision and language capabilities using a gradually adjusted text-to-image ratio101- Applies joint SFT with emphasis on image understanding and vision tasks102- Leverages large-scale open-source datasets combined with in-house synthetic vision data, selected for balanced task coverage103- Follows a progressive training strategy: base model → joint mid-training → supervised fine-tuning104 105## 🏃 How to run LFM2-VL106 107You can run LFM2-VL with Hugging Face [`transformers`](https://github.com/huggingface/transformers) via installing Transformers from source as follows:108 109```bash110pip install git+https://github.com/huggingface/transformers.git@87be5595081364ef99393feeaa60d71db3652679 pillow111```112 113Here is an example of how to generate an answer with transformers in Python:114 115```python116from transformers import AutoProcessor, AutoModelForImageTextToText117from transformers.image_utils import load_image118 119# Load model and processor120model_id = "LiquidAI/LFM2-VL-3B"121model = AutoModelForImageTextToText.from_pretrained(122 model_id,123 device_map="auto",124 dtype="bfloat16"125)126processor = AutoProcessor.from_pretrained(model_id)127 128# Load image and create conversation129url = "https://www.ilankelman.org/stopsigns/australia.jpg"130image = load_image(url)131conversation = [132 {133 "role": "user",134 "content": [135 {"type": "image", "image": image},136 {"type": "text", "text": "What is in this image?"},137 ],138 },139]140 141# Generate Answer142inputs = processor.apply_chat_template(143 conversation,144 add_generation_prompt=True,145 return_tensors="pt",146 return_dict=True,147 tokenize=True,148).to(model.device)149outputs = model.generate(**inputs, max_new_tokens=64)150processor.batch_decode(outputs, skip_special_tokens=True)[0]151 152# This image captures a vibrant street scene in a Chinatown area. The focal point is a large red Chinese archway with gold and black accents, adorned with Chinese characters. Flanking the archway are two white stone lion statues, which are traditional guardians in Chinese culture.153```154 155You can directly run and test the model with this [Colab notebook](https://colab.research.google.com/drive/11EMJhcVB6OTEuv--OePyGK86k-38WU3q?usp=sharing).156 157 158## 🔧 How to fine-tune159 160We recommend fine-tuning LFM2-VL models on your use cases to maximize performance.161 162| Notebook | Description | Link |163|-----------|----------------------------------------------------------------------|------|164| SFT (TRL) | Supervised Fine-Tuning (SFT) notebook with a LoRA adapter using TRL. | <a href="https://colab.research.google.com/drive/1csXCLwJx7wI7aruudBp6ZIcnqfv8EMYN?usp=sharing"><img src="https://cdn-uploads.huggingface.co/production/uploads/61b8e2ba285851687028d395/vlOyMEjwHa_b_LXysEu2E.png" width="110" alt="Colab link"></a> |165 166 167## 📈 Performance168 169| Model | Average | MMStar | RealWorldQA | MM-IFEval | BLINK | MMBench (dev en) | OCRBench | POPE |170|-------------------|----------|--------|--------------|------------|--------|------------------|-----------|-------|171| InternVL3_5-2B | 66.50 | 57.67 | 60.78 | 47.31 | 50.97 | 78.18 | 834.00 | 87.17 |172| Qwen2.5-VL-3B | 65.42 | 56.13 | 65.23 | 38.62 | 48.97 | 80.41 | 824.00 | 86.17 |173| InternVL3-2B | 67.44 | 61.10 | 65.10 | 38.49 | 53.10 | 81.10 | 831.00 | 90.10 |174| SmolVLM2-2.2B | 56.01 | 46.00 | 57.50 | 19.42 | 42.30 | 69.24 | 725.00 | 85.10 |175| LFM2-VL-3B | 69.00 | 57.73 | 71.37 | 51.83 | 51.03 | 79.81 | 822.00 | 89.01 |176 177More benchmark scores are reported in our [LFM2-VL-3B post](https://www.liquid.ai/blog/lfm2-vl-3b-a-new-efficient-vision-language-for-the-edge). We obtained the scores for competitive models using VLMEvalKit. Qwen3-VL-2B is not listed in the results table, as its release occurred the day before.178 179## 📬 Contact180 181- Got questions or want to connect? [Join our Discord community](https://discord.com/invite/liquid-ai)182- If you are interested in custom solutions with edge deployment, please contact [our sales team](https://www.liquid.ai/contact).183 184## Citation185 186```187@article{liquidai2025lfm2,188 title={LFM2 Technical Report},189 author={Liquid AI},190 journal={arXiv preprint arXiv:2511.23404},191 year={2025}192}193```