LFM2.5-VL 450M
Fit diagram
Read at 100%
Clear selection
Download SVG
Download PNG
Click a block to read its description, or select it with Tab and Enter.
LFM2.5-VL 450M
Detect. P = image patches; L = combined tokens (runtime axes). Model widths below are resolved.
LibreYOLO
LFM2.5-VL 450M
Detect. P = image patches; L = combined tokens (runtime axes). Model widths below are resolved.
Image encoder
Image processor
Nominal runner size 512; native tiling/resize
Linear patch projection
patch=16; output P × 768
Learned/interpolated 2D positions
P × 768
Vision transformer blocks
n=12; width 768; heads=12
Final LayerNorm
768 channels
V
V carries final visual features to the projector.
Patch counts vary with processor output, not model size.
Projection and multimodal sequence
V
Visual projector
768 channels become 1024 channels
Visual token sequence
Patch grouping factor 2 per axis
Prompt and image placeholders
Vocabulary and detection request
Tokenizer
Runtime text length
Token embedding
Vocabulary 65536; width 1024
Replace image-token placeholders
L × 1024; image and text in one sequence
S
Visual features replace placeholders before language layers.
Text and image masks preserve their positions.
S denotes the multimodal token sequence.
Language model and generated output
S
Text decoder layers
n=16; width 1024
Layer order (zero-based):
0:C; 1:C; 2:A; 3:C; 4:C; 5:A; 6:C; 7:C
8:A; 9:C; 10:A; 11:C; 12:A; 13:C; 14:A; 15:C
A: causal attention; C: gated short convolution.
Final RMSNorm
1024 channels
Language head Linear
1024 to 65536
Greedy token generation
max_new_tokens=1024; do_sample=False
O
O is the generated reply; prompt tokens are removed.
The adapter decodes O into task geometry below.
Vision transformer layer
Input
S × 768
LayerNorm
768 channels
Vision attention
+
LayerNorm
768 channels
Vision MLP
+
Output
S × 768
S is the token count of this sublayer.
Text decoder layer
Input
S × 1024
RMSNorm
1024 channels
Attention / short Conv
+
RMSNorm
1024 channels
Gated MLP
+
Output
S × 1024
S is the token count of this sublayer.
Vision attention
Input width 768; Q heads 12; K/V heads 12.
Q Linear
768 to 768
Split heads
64 per head
K Linear
768 to 768
Split heads
64 per head
V Linear
768 to 768
Split heads
64 per head
Q × transpose(K)
Scale by 1/sqrt(64)
Softmax over keys
Within the image; padding mask
Attention weights × V
12 query heads, weighted values
Concat heads
Output Linear
768 to 768
Position information enters through embeddings.
Distinct projections share the same normalized input.
Text attention
Input width 1024; Q heads 16; K/V heads 8.
Q Linear
1024 to 1024
Split heads
64 per head
K Linear
1024 to 512
Split heads
64 per head
V Linear
1024 to 512
Split heads
64 per head
RMSNorm
64 per head
RMSNorm
64 per head
Rotary position
cos/sin half rotation
Rotary position
cos/sin half rotation
Align K heads
8 to 16
Align V heads
8 to 16
Q × transpose(K)
Scale by 1/sqrt(64)
Softmax over keys
Causal mask; cached K/V optional
Attention weights × V
16 query heads, weighted values
Concat heads
Output Linear
1024 to 1024
RoPE: x*cos + rotate_half(x)*sin.
Cached decode appends past K/V before head alignment.
Vision MLP
Input
S × 768
Linear
768 to 3072
gelu_pytorch_tanh
Down Linear
3072 to 768
Output
S × 768
Residual addition is in the enclosing layer diagram.
S is the token count of this sublayer.
Text MLP
Input
S × 1024
Gate Linear
1024 to 4608
Up Linear
1024 to 4608
SiLU
Elementwise multiply
S × 4608
Down Linear
4608 to 1024
Output
S × 1024
Residual addition is in the enclosing layer diagram.
S is the token count of this sublayer.
Visual projector
Pixel unshuffle
2 × 2; width 3072
Linear
3072 to 2048
GELU
Linear
2048 to 1024
Output width equals the language-model embedding.
LibreYOLO output adapter
O
Decode generated tokens
Retain reply text
Parse JSON boxes
Resolve label and box-key aliases
Normalize coordinates
Divide by 1; xyxy corners
Validate / class / confidence
Synthetic per-box score1; clamp valid boxes
Same-class deduplication
Rounded boxes and IoU filter before max_det
Results.boxes
Scale xyxy to original W,H; cap max_det
Scores are adapter placeholders, not calibrated confidence.
LFM gated short convolution
Selected instead of attention at C entries in the layer-order list. Input/output width 1024.
Linear in projection
1024 to 3072
Split B, C, x
Three streams of width 1024
B × x
Elementwise gating
Depthwise causal Conv1d
kernel3, groups=1024; crop causal length
C × convolution
Elementwise gating
Linear output
1024 to 1024
C gate bypass
Cache keeps the causal convolution state during single-token decoding.
The following gated MLP uses the effective rounded width shown in the Text MLP inset.
Scope: native backend architecture from pinned config metadata; no pretrained execution. The image path is shown.
Source: libreyolo/models/vlm/lfm2.py; Transformers 5.16.1. Revision a4d0ecc9e17f.
libreyolo.com