Skip to content

[Model] Add LFM2-VL model support#31758

Merged
vllm-bot merged 6 commits intovllm-project:mainfrom
tianshu-Michael-yu:upstream-contribution
Jan 8, 2026
Merged

[Model] Add LFM2-VL model support#31758
vllm-bot merged 6 commits intovllm-project:mainfrom
tianshu-Michael-yu:upstream-contribution

Conversation

@tianshu-Michael-yu
Copy link
Copy Markdown
Contributor

@tianshu-Michael-yu tianshu-Michael-yu commented Jan 6, 2026

Purpose

Add support for the LFM2-VL (Liquid Foundation Model 2 Vision-Language) model family from LiquidAI.

Changes:

  • Add Lfm2VLForConditionalGeneration model implementation with full multimodal processing pipeline
  • Add SigLIP2 vision encoder (siglip2.py) used by LFM2-VL
  • Register model in the multimodal model registry
  • Fix max_seqlen type hint in MMEncoderAttention to accept int | torch.Tensor
  • Add double-buffering for is_mm_embed in GPU model runner to avoid race conditions with async copies

The model supports:

  • Dynamic resolution image processing with smart resize
  • Hybrid architecture (Mamba + Attention)
  • LoRA fine-tuning
  • Pipeline parallelism

Test Plan

python -m vllm.entrypoints.openai.api_server
--model LiquidAI/LFM2-VL-3B
--trust-remote-code
--served-model-name lfm2-vl-3b
--mm-processor-cache-type shm
--async-scheduling
--compilation-config '{"max_cudagraph_capture_size": 8192, "compile_mm_encoder": true}'## Test Result

Tested with LiquidAI/LFM2-VL-450M, LFM2-VL-3B, and LFM2-VL-8B-A1B variants.

LFM2-VL-3B benchmark results (MMStar):

  • vLLM spinup time: 99s
  • Overall Score: 0.578

Essential Elements of an Effective PR Description Checklist
  • The purpose of the PR, such as "Fix some issue (link existing issues this PR will resolve)".
  • The test plan, such as providing test command.
  • The test results, such as pasting the results comparison before and after, or e2e results
  • (Optional) The necessary documentation update, such as updating supported_models.md and examples for a new model.
  • (Optional) Release notes update. If your change is user facing, please update the release notes draft in the Google Doc.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Jan 6, 2026

👋 Hi! Thank you for contributing to the vLLM project.

💬 Join our developer Slack at https://slack.vllm.ai to discuss your PR in #pr-reviews, coordinate on features in #feat- channels, or join special interest groups in #sig- channels.

Just a reminder: PRs would not trigger full CI run by default. Instead, it would only run fastcheck CI which starts running only a small and essential subset of CI tests to quickly catch errors.

You ask your reviewers to trigger select CI tests on top of fastcheck CI.

Once the PR is approved and ready to go, your PR reviewer(s) can run CI to test the changes comprehensively before merging.

To run CI, PR reviewers can either: Add ready label to the PR or enable auto-merge.

If you have any questions, please reach out to us on Slack at https://slack.vllm.ai.

🚀

@mergify mergify bot added new-model Requests to new models v1 labels Jan 6, 2026
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds support for the LFM2-VL model, including its SigLIP2 vision encoder. The changes are comprehensive, covering the model implementation, multimodal processing pipeline, and necessary integrations. I've identified a couple of issues. First, there's a line of dead code in the smart_resize logic within lfm2_vl.py that should be removed. More critically, the data parallelism feature for the vision encoder (mm_encoder_tp_mode=\"data\") appears to be broken due to a hardcoded use_data_parallel=False flag in siglip2.py. This prevents the vision encoder from being replicated across tensor parallel ranks as intended. My review includes detailed comments on these points.

@mergify
Copy link
Copy Markdown

mergify bot commented Jan 6, 2026

Hi @tianshu-Michael-yu, the pre-commit checks have failed. Please run:

uv pip install pre-commit
pre-commit install
pre-commit run --all-files

Then, commit the changes and push to your branch.

For future commits, pre-commit will run automatically on changed files before each commit.

Tip

Is mypy or markdownlint failing?
mypy and markdownlint are run differently in CI. If the failure is related to either of these checks, please use the following commands to run them locally:
# For mypy (substitute "3.10" with the failing version if needed)
pre-commit run --hook-stage manual mypy-3.10
# For markdownlint
pre-commit run --hook-stage manual markdownlint

@tianshu-Michael-yu tianshu-Michael-yu force-pushed the upstream-contribution branch 2 times, most recently from 909b2ba to c3cd440 Compare January 7, 2026 02:19
Signed-off-by: Tianshu Yu <tianshuyu.formal@gmail.com>
@mgoin
Copy link
Copy Markdown
Member

mgoin commented Jan 8, 2026

Signed-off-by: Tianshu Yu <tianshuyu.formal@gmail.com>
- Move Siglip2Model import to top of file using relative import
- Remove redundant CUDA check for spatial_shapes (already kept on CPU)
- Remove use_data_parallel parameter from Siglip2 classes since it is
  derived from multimodal_config internally

Signed-off-by: Tianshu Yu <tianshuyu.formal@gmail.com>
Copy link
Copy Markdown
Member

@DarkLight1337 DarkLight1337 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please also add this model to the Supported Models page, example scripts (e.g. examples/offline_inference/vision_language.py), as well as the test registry tests/models/registry.py.

Signed-off-by: Tianshu Yu <tianshuyu.formal@gmail.com>
@mergify
Copy link
Copy Markdown

mergify bot commented Jan 8, 2026

Documentation preview: https://vllm--31758.org.readthedocs.build/en/31758/

@mergify mergify bot added the documentation Improvements or additions to documentation label Jan 8, 2026
@ywang96 ywang96 added the ready ONLY add when PR is ready to merge/full CI is needed label Jan 8, 2026
Signed-off-by: Cyrus Leung <cyrus.tl.leung@gmail.com>
@vllm-bot vllm-bot merged commit 03fd76c into vllm-project:main Jan 8, 2026
51 of 53 checks passed
@tianshu-Michael-yu tianshu-Michael-yu deleted the upstream-contribution branch January 8, 2026 15:25
yugong333 pushed a commit to yugong333/vllm that referenced this pull request Jan 9, 2026
Signed-off-by: Tianshu Yu <tianshuyu.formal@gmail.com>
Signed-off-by: Cyrus Leung <cyrus.tl.leung@gmail.com>
Co-authored-by: Roger Wang <hey@rogerw.io>
Co-authored-by: Cyrus Leung <cyrus.tl.leung@gmail.com>
@yileld
Copy link
Copy Markdown

yileld commented Jan 12, 2026

here is the problm I meet.
When I run LFM2-VL-450M

self.projector_use_layernorm = config.projector_use_layernorm
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/dist-packages/transformers/configuration_utils.py", line 207, in __getattribute__
return super().__getattribute__(key)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'Lfm2VlConfig' object has no attribute 'projector_use_layernorm'

if I add "projector_use_layernorm": false in config.json, still error
ValueError: There is no module or parameter named 'multi_modal_projector.layer_norm' in Lfm2VLForConditionalGeneration

akh64bit pushed a commit to akh64bit/vllm that referenced this pull request Jan 16, 2026
Signed-off-by: Tianshu Yu <tianshuyu.formal@gmail.com>
Signed-off-by: Cyrus Leung <cyrus.tl.leung@gmail.com>
Co-authored-by: Roger Wang <hey@rogerw.io>
Co-authored-by: Cyrus Leung <cyrus.tl.leung@gmail.com>
dsuhinin pushed a commit to dsuhinin/vllm that referenced this pull request Jan 21, 2026
Signed-off-by: Tianshu Yu <tianshuyu.formal@gmail.com>
Signed-off-by: Cyrus Leung <cyrus.tl.leung@gmail.com>
Co-authored-by: Roger Wang <hey@rogerw.io>
Co-authored-by: Cyrus Leung <cyrus.tl.leung@gmail.com>
Signed-off-by: dsuhinin <suhinin.dmitriy@gmail.com>
ItzDEXX pushed a commit to ItzDEXX/vllm that referenced this pull request Feb 19, 2026
Signed-off-by: Tianshu Yu <tianshuyu.formal@gmail.com>
Signed-off-by: Cyrus Leung <cyrus.tl.leung@gmail.com>
Co-authored-by: Roger Wang <hey@rogerw.io>
Co-authored-by: Cyrus Leung <cyrus.tl.leung@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation new-model Requests to new models ready ONLY add when PR is ready to merge/full CI is needed v1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants