LFM2.5-VL 450M

Click a block to read its description, or select it with Tab and Enter.

LFM2.5-VL 450MDetect. P = image patches; L = combined tokens (runtime axes). Model widths below are resolved.LibreYOLOLFM2.5-VL 450MDetect. P = image patches; L = combined tokens (runtime axes). Model widths below are resolved.Image encoderImage processorNominal runner size 512; native tiling/resizeLinear patch projectionpatch=16; output P × 768Learned/interpolated 2D positionsP × 768Vision transformer blocksn=12; width 768; heads=12Final LayerNorm768 channelsVV carries final visual features to the projector.Patch counts vary with processor output, not model size.Projection and multimodal sequenceVVisual projector768 channels become 1024 channelsVisual token sequencePatch grouping factor 2 per axisPrompt and image placeholdersVocabulary and detection requestTokenizerRuntime text lengthToken embeddingVocabulary 65536; width 1024Replace image-token placeholdersL × 1024; image and text in one sequenceSVisual features replace placeholders before language layers.Text and image masks preserve their positions.S denotes the multimodal token sequence.Language model and generated outputSText decoder layersn=16; width 1024Layer order (zero-based):0:C; 1:C; 2:A; 3:C; 4:C; 5:A; 6:C; 7:C8:A; 9:C; 10:A; 11:C; 12:A; 13:C; 14:A; 15:CA: causal attention; C: gated short convolution.Final RMSNorm1024 channelsLanguage head Linear1024 to 65536Greedy token generationmax_new_tokens=1024; do_sample=FalseOO is the generated reply; prompt tokens are removed.The adapter decodes O into task geometry below.Vision transformer layerInputS × 768LayerNorm768 channelsVision attention+LayerNorm768 channelsVision MLP+OutputS × 768S is the token count of this sublayer.Text decoder layerInputS × 1024RMSNorm1024 channelsAttention / short Conv+RMSNorm1024 channelsGated MLP+OutputS × 1024S is the token count of this sublayer.Vision attentionInput width 768; Q heads 12; K/V heads 12.Q Linear768 to 768Split heads64 per headK Linear768 to 768Split heads64 per headV Linear768 to 768Split heads64 per headQ × transpose(K)Scale by 1/sqrt(64)Softmax over keysWithin the image; padding maskAttention weights × V12 query heads, weighted valuesConcat headsOutput Linear768 to 768Position information enters through embeddings.Distinct projections share the same normalized input.Text attentionInput width 1024; Q heads 16; K/V heads 8.Q Linear1024 to 1024Split heads64 per headK Linear1024 to 512Split heads64 per headV Linear1024 to 512Split heads64 per headRMSNorm64 per headRMSNorm64 per headRotary positioncos/sin half rotationRotary positioncos/sin half rotationAlign K heads8 to 16Align V heads8 to 16Q × transpose(K)Scale by 1/sqrt(64)Softmax over keysCausal mask; cached K/V optionalAttention weights × V16 query heads, weighted valuesConcat headsOutput Linear1024 to 1024RoPE: x*cos + rotate_half(x)*sin.Cached decode appends past K/V before head alignment.Vision MLPInputS × 768Linear768 to 3072gelu_pytorch_tanhDown Linear3072 to 768OutputS × 768Residual addition is in the enclosing layer diagram.S is the token count of this sublayer.Text MLPInputS × 1024Gate Linear1024 to 4608Up Linear1024 to 4608SiLUElementwise multiplyS × 4608Down Linear4608 to 1024OutputS × 1024Residual addition is in the enclosing layer diagram.S is the token count of this sublayer.Visual projectorPixel unshuffle2 × 2; width 3072Linear3072 to 2048GELULinear2048 to 1024Output width equals the language-model embedding.LibreYOLO output adapterODecode generated tokensRetain reply textParse JSON boxesResolve label and box-key aliasesNormalize coordinatesDivide by 1; xyxy cornersValidate / class / confidenceSynthetic per-box score1; clamp valid boxesSame-class deduplicationRounded boxes and IoU filter before max_detResults.boxesScale xyxy to original W,H; cap max_detScores are adapter placeholders, not calibrated confidence.LFM gated short convolutionSelected instead of attention at C entries in the layer-order list. Input/output width 1024.Linear in projection1024 to 3072Split B, C, xThree streams of width 1024B × xElementwise gatingDepthwise causal Conv1dkernel3, groups=1024; crop causal lengthC × convolutionElementwise gatingLinear output1024 to 1024C gate bypassCache 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