Add LFM2-VL (Liquid Foundation Model 2 Vision-Language) support#21230
Merged
mickqian merged 4 commits intosgl-project:mainfrom Apr 4, 2026
Merged
Add LFM2-VL (Liquid Foundation Model 2 Vision-Language) support#21230mickqian merged 4 commits intosgl-project:mainfrom
mickqian merged 4 commits intosgl-project:mainfrom
Conversation
Add support for the LFM2-VL vision-language architecture, combining a SigLip2 vision encoder (NaFlex variable-resolution) with the LFM2 hybrid language model. New files: - configs/lfm2_vl.py: VL config with hybrid cache support - models/lfm2_vl.py: VL model (vision tower + projector + LFM2 LM) - models/siglip2.py: SigLip2 vision encoder with NaFlex packed attention - multimodal/processors/lfm2_vl.py: image processor with variable-resolution tiling Modified: - models/lfm2.py: add get_input_embeddings(), rename inputs_embeds -> input_embeds - configs/__init__.py, model_config.py, model_runner.py: register VL model - test_vision_openai_server_a.py: add TestLfm2VlServer
Contributor
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
mickqian
requested changes
Mar 25, 2026
Collaborator
|
@tugot17 could you address the comments? |
Contributor
Author
|
@ispobock yes I will go over this tomorrow |
Collaborator
|
@tugot17 Any update on this? |
Contributor
Author
|
WIP, should make an update today |
Contributor
Author
|
@mickqian Addressed both comments, my correctness tests pass. WDYT? |
mickqian
approved these changes
Mar 31, 2026
Collaborator
|
/tag-and-rerun-ci |
Contributor
Author
|
@ispobock should I add anything more or could we merge it? |
Collaborator
|
we can merge it once ci tests passed |
Contributor
Author
|
@ispobock which of these fails in CI are concerning and should still be addrressed? |
sundar24295s
pushed a commit
to sundar24295s/sglang
that referenced
this pull request
Apr 4, 2026
…gl-project#21230) Co-authored-by: Piotr Mazurek <piotr.mazurek@liquid.ai>
JustinTong0323
pushed a commit
to JustinTong0323/sglang
that referenced
this pull request
Apr 7, 2026
…gl-project#21230) Co-authored-by: Piotr Mazurek <piotr.mazurek@liquid.ai>
Fridge003
pushed a commit
that referenced
this pull request
Apr 7, 2026
…21230) Co-authored-by: Piotr Mazurek <piotr.mazurek@liquid.ai>
xiezhq-hermann
pushed a commit
to antgroup/sglang
that referenced
this pull request
Apr 7, 2026
…gl-project#21230) Co-authored-by: Piotr Mazurek <piotr.mazurek@liquid.ai>
yhyang201
pushed a commit
to yhyang201/sglang
that referenced
this pull request
Apr 22, 2026
…gl-project#21230) Co-authored-by: Piotr Mazurek <piotr.mazurek@liquid.ai>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds support for the LFM2-VL vision-language architecture, combining a SigLip2 vision encoder (NaFlex variable-resolution) with the LFM2 hybrid language model.
Example model: LFM2.5-VL-1.6B
How to run
sglang serve --model-path LiquidAI/LFM2.5-VL-1.6B # Also tested on TP=2 sglang serve --model-path LiquidAI/LFM2.5-VL-1.6B --tp 2Tests
pytest test/registered/vlm/test_vision_openai_server_a.py::TestLfm2VlServer -v -s ===================== 5 passed, 2 warnings in 72.95s (0:01:12) =====================Numerics
All 4 prompts pass with ROUGE-L 1.0 and low logprob divergence (HF vs SGLang, teacher forcing):
{ "prompt": "What is in this image?", "image": "man ironing on taxi", "rouge_l": 1.0, "prefill_max_diff": 0.0141, "decode_max_diff": 0.0091 }, { "prompt": "Describe this image in detail but as a rap song.", "rouge_l": 1.0, "prefill_max_diff": 0.0141, "decode_max_diff": 0.0111 }, { "prompt": "What is in this image?", "image": "Statue of Liberty (high-res, 1807 prompt tokens)", "rouge_l": 1.0, "prefill_max_diff": 0.0326, "decode_max_diff": 0.0044 }, { "prompt": "Compare these two images. What do you see in each?", "image": "multi-image (2031 prompt tokens)", "rouge_l": 1.0, "prefill_max_diff": 0.0141, "decode_max_diff": 0.0109 }Changes
New files:
python/sglang/srt/configs/lfm2_vl.py— VL config with hybrid cache supportpython/sglang/srt/models/lfm2_vl.py— VL model (vision tower + projector + LFM2 LM)python/sglang/srt/models/siglip2.py— SigLip2 vision encoder with NaFlex packed attentionpython/sglang/srt/multimodal/processors/lfm2_vl.py— Image processor with variable-resolution tilingModified files:
python/sglang/srt/models/lfm2.py— Addget_input_embeddings(), renameinputs_embeds→input_embedsfor multimodal compatibilitypython/sglang/srt/configs/__init__.py— RegisterLfm2VlConfigpython/sglang/srt/configs/model_config.py— Add to multimodal arch listpython/sglang/srt/model_executor/model_runner.py— Add hybrid model detectiontest/registered/vlm/test_vision_openai_server_a.py— AddTestLfm2VlServer