Instructions to use irotem98/FastLFM2.5-VL-0.5B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use irotem98/FastLFM2.5-VL-0.5B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="irotem98/FastLFM2.5-VL-0.5B", trust_remote_code=True) messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("irotem98/FastLFM2.5-VL-0.5B", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use irotem98/FastLFM2.5-VL-0.5B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "irotem98/FastLFM2.5-VL-0.5B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "irotem98/FastLFM2.5-VL-0.5B", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker
docker model run hf.co/irotem98/FastLFM2.5-VL-0.5B
- SGLang
How to use irotem98/FastLFM2.5-VL-0.5B with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "irotem98/FastLFM2.5-VL-0.5B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "irotem98/FastLFM2.5-VL-0.5B", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "irotem98/FastLFM2.5-VL-0.5B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "irotem98/FastLFM2.5-VL-0.5B", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }' - Docker Model Runner
How to use irotem98/FastLFM2.5-VL-0.5B with Docker Model Runner:
docker model run hf.co/irotem98/FastLFM2.5-VL-0.5B
FastLFM2.5-VL-0.5B
FastLFM2.5-VL-0.5B retains 92% of its teacher's average captioning quality while delivering 1.5x throughput and using 4x fewer visual tokens.
This model combines the vision encoder from Apple FastVLM-0.5B with the language model from LiquidAI LFM2.5-VL-450M. A small residual connector maps the FastVLM image features into the LFM2 embedding space.
The Apple vision encoder and Liquid language model remained frozen. Only the connector path, consisting of the residual MLP and its learned 2D positional embeddings, was trained. Training used supervised fine-tuning (SFT) followed by on-policy distillation (OPD) from the LFM2.5-VL-450M teacher.
Results
| Model | Input size | COCO CIDEr | COCO retention | NoCaps CIDEr | NoCaps retention | Visual tokens | Throughput vs. teacher |
|---|---|---|---|---|---|---|---|
| LiquidAI/LFM2.5-VL-450M | 512x512 | 0.9109 | 100% | 0.9443 | 100% | 256 (1x) | 1.00x |
| apple/FastVLM-0.5B | 512x512 | 0.7606 | 83.5% | 0.8103 | 85.8% | 64 (4x fewer) | 1.53x |
| FastLFM2.5-VL-0.5B | 512x512 | 0.8309 | 91.2% | 0.8782 | 93.0% | 64 (4x fewer) | 1.51x |
The two FastLFM retention scores average to 92.1%. Retention is computed independently for each benchmark against the 512x512 LFM teacher.
Throughput was measured on 1,000 unique, already-loaded 512x512 images on an NVIDIA RTX PRO 6000 Blackwell Server Edition, using batches of 250 and exactly 32 generated tokens after three warmup batches.
Architecture
512x512 image; 64 visual tokens; d_vision=3072; d_LLM=1024
┌─────────────────────┐
│ FastVLM Encoder │ frozen
└──────────┬──────────┘
│ [B, 64, 3072]
┌────────────────┴────────────────┐
│ │
┌─────────┴──────────┐ ┌──────────┴─────────┐
│ Skip Linear │ │ Standardize │
│ 3072 → 1024 │ │ Linear 3072 → 3072 │
└─────────┬──────────┘ │ ReLU² │
│ │ Linear 3072 → 1024 │
│ │ Scale × alpha │
│ └──────────┬─────────┘
└────────────────┬────────────────┘
│ residual addition
┌──────────┴──────────┐
│ Learned 8x8 2D │
│ positions │
└──────────┬──────────┘
│ [B, 64, 1024]
┌──────────┴──────────┐
│ LFM2 Language Model │ frozen
└─────────────────────┘
| Component | Parameters | Training status |
|---|---|---|
| Apple FastVLM-derived vision encoder | 125,073,504 (125.1M) | Frozen |
| Residual connector MLP and learned 8x8 2D positions | 15,750,145 (15.75M) | Trained: SFT, then OPD |
| Liquid LFM2 language model | 354,483,968 (354.5M) | Frozen |
| Total | 495,307,617 (495.31M) | 15.75M trainable (3.18%) |
Maximum-throughput vLLM
For large offline captioning jobs, use the included split vLLM path. It compiles the vision encoder, processes 250 images together, and passes the resulting 64-token prompt embeddings to vLLM's native LFM2 decoder. No patched or custom vLLM installation is required.
pip install "vllm==0.25.1" "transformers==5.13.1" \
huggingface_hub safetensors pillow numpy
hf download irotem98/FastLFM2.5-VL-0.5B \
--local-dir FastLFM2.5-VL-0.5B
python FastLFM2.5-VL-0.5B/fast_vllm.py \
--model FastLFM2.5-VL-0.5B \
--image-dir ./images \
--output captions.jsonl \
--batch-size 250 \
--max-tokens 128 \
--gpu-memory-utilization 0.85
Training
Training updated only the 15.75M-parameter connector path:
- SFT: supervised alignment of the FastVLM visual features to the frozen LFM2 language model.
- OPD: on-policy distillation from the LFM2.5-VL-450M teacher, refining the connector while keeping both foundation components frozen.
Intended use and limitations
This checkpoint is optimized for fast, one-sentence English image descriptions at 512x512 resolution. It always emits an 8x8 grid of 64 visual tokens. Quality and throughput figures above are captioning results under the stated setup, not guarantees for other prompts, resolutions, GPUs, batch sizes, or generation lengths.
License and attribution
This repository combines components derived from Apple FastVLM-0.5B and LiquidAI LFM2.5-VL-450M. Review and preserve both upstream licenses and usage terms before redistribution. The bundled FastVLM implementation retains its upstream Apache-2.0 source header; this model card does not replace either upstream license.
- Downloads last month
- 40
Model tree for irotem98/FastLFM2.5-VL-0.5B
Base model
LiquidAI/LFM2.5-350M-Base