SmolVLM2 500M

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

SmolVLM2 500MDetect. P = image patches; L = combined tokens (runtime axes). Model widths below are resolved.LibreYOLOSmolVLM2 500MDetect. P = image patches; L = combined tokens (runtime axes). Model widths below are resolved.Image encoderImage processorNominal runner size 512; native tiling/resizeConv2d patch embeddingpatch=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 960 channelsVisual token sequencePatch grouping factor 4 per axisPrompt and image placeholdersVocabulary and detection requestTokenizerRuntime text lengthToken embeddingVocabulary 49280; width 960Replace image-token placeholdersL × 960; 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=32; width 960Final RMSNorm960 channelsLanguage head Linear960 to 49280Greedy 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 × 960RMSNorm960 channelsCausal attention+RMSNorm960 channelsGated MLP+OutputS × 960S 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 960; Q heads 15; K/V heads 5.Q Linear960 to 960Split heads64 per headK Linear960 to 320Split heads64 per headV Linear960 to 320Split heads64 per headRotary positioncos/sin half rotationRotary positioncos/sin half rotationAlign K heads5 to 15Align V heads5 to 15Q × transpose(K)Scale by 1/sqrt(64)Softmax over keysCausal mask; cached K/V optionalAttention weights × V15 query heads, weighted valuesConcat headsOutput Linear960 to 960RoPE: 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 × 960Gate Linear960 to 2560Up Linear960 to 2560SiLUElementwise multiplyS × 2560Down Linear2560 to 960OutputS × 960Residual addition is in the enclosing layer diagram.S is the token count of this sublayer.Visual projectorPixel shuffle / spatial grouping4 × 4; width 12288Linear without bias12288 to 960No connector activation or hidden layer.Output 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.Scope: native backend architecture from pinned config metadata; no pretrained execution. The image path is shown.Source: libreyolo/models/vlm/smolvlm.py; Transformers 5.16.1. Revision a4d0ecc9e17f.libreyolo.com