# Xiaomi-Lens-0

> A 4B open multimodal language model that predicts pixel-level masks and bounding boxes for grounding and visual reasoning.

Xiaomi-Lens-0 is a 4B multimodal large language model from Xiaomi's SeerRay Lab, built on Qwen3.5-4B. It decodes each generated mask token into a pixel mask, so the model can point at the regions it describes in its answer or mid-reasoning. Weights, a demo, training and inference code, and the LensBench benchmark are publicly released under Apache-2.0.

## What It Is

Xiaomi-Lens-0 is a vision-language model for grounding and segmentation. Given an image and a text instruction, it returns text containing bounding boxes and mask tokens, and a lightweight decoder turns each mask token into a pixel mask. The documented capabilities are referring expression comprehension, referring expression segmentation, multi-instance grounding, reasoning segmentation, embodied referring, and fine-grained perception such as counting and high-resolution question answering.

## How the Method Works

Each generated mask token carries a contextual state that represents a target region given the image, instruction, and preceding response. The decoder combines this state with a single pre-merge feature grid from the vision encoder, with no separate segmentation encoder or multi-scale fusion. Mask tokens inside the reasoning trace also decode to masks, which the project calls thinking with visual latents. Training has two stages: mask decoder pretraining with the backbone frozen, then full-parameter supervised fine-tuning.

## LensBench and Reported Results

The team also released LensBench, a segmentation benchmark with 4,800 instruction-level samples from 1,200 human-reviewed paired units across general, aerial, driving, and panoramic imagery. Each unit pairs single or multiple targets with explicit or implicit wording. The project reports that Xiaomi-Lens-0 leads compared models on all eight referring segmentation splits and improves over its Qwen3.5-4B backbone on all eight fine-grained perception benchmarks. The authors note that implicit instructions remain challenging on LensBench.

## Setup Path

The repository provides a Transformers inference script that overlays masks and boxes on an image, and a two-process vLLM serving setup for text generation and mask decoding. Inference requires a CUDA GPU with bf16 and FlashAttention-2. An evaluation script runs LensBench, and training scripts support full fine-tuning or LoRA on the released checkpoint as well as reproducing the two-stage training.

## Features
- Referring expression comprehension with bounding boxes
- Referring expression segmentation with pixel masks
- Multi-instance grounding with per-instance boxes and masks
- Reasoning segmentation for implicit and functional requests
- Embodied referring in cluttered scenes
- Fine-grained perception with counting and high-resolution QA
- Thinking with visual latents via mask tokens in reasoning traces
- LensBench segmentation benchmark
- Full fine-tuning and LoRA on the released checkpoint
- Transformers inference and vLLM serving

## Integrations
Hugging Face, ModelScope, vLLM, Transformers, DeepSpeed, Qwen3.5

## Platforms
LINUX, API, DEVELOPER_SDK, CLI

## Pricing
Open Source

## Links
- Website: https://xiaomi-research.github.io/xiaomi-lens-0/
- Documentation: https://github.com/xiaomi-research/xiaomi-lens-0#-quick-start
- Repository: https://github.com/xiaomi-research/xiaomi-lens-0
- EveryDev.ai: https://www.everydev.ai/tools/xiaomi-lens-0
