N Neurarch Architectures Models Checks Data Docs Open the app

Architectures / Multimodal

๐Ÿ”— CLIP ViT-B/32

Dual-encoder contrastive model โ€” a ViT image tower and a Transformer text tower projected into a shared embedding space (OpenAI 2021)

From Radford et al. (2021). Learning Transferable Visual Models From Natural Language Supervision. ICML 2021. This page is the graph, not the PDF: open it, edit it, verify it, export it.

Layers
40
Parameters
151.20M
Input
3 ร— 224 ร— 224
Output
512
Verifier
Clean

Every number on this page is computed from the graph by the same functions the app runs, not written by hand.

Open CLIP ViT-B/32 on the canvas Free, no account needed

When to pick it

Pick to study cross-modal retrieval / zero-shot classification. Two parallel encoders meet at a contrastive similarity head.

Structure

40 layers. Output shapes are propagated from the input shape, batch dimension excluded.

LayerTypeParametersOutput shape
1imageInputshape=[3, 224, 224]3 ร— 224 ร— 224
2patch_embedPatch EmbedembedDim=768, patchSize=3249 ร— 768
3vis_posPositional EncodingembedDim=768, maxLen=5049 ร— 768
4vis_block_1Transformer BlockembedDim=768, numHeads=12, ffDim=307249 ร— 768
5vis_block_2Transformer BlockembedDim=768, numHeads=12, ffDim=307249 ร— 768
6vis_block_3Transformer BlockembedDim=768, numHeads=12, ffDim=307249 ร— 768
7vis_block_4Transformer BlockembedDim=768, numHeads=12, ffDim=307249 ร— 768
8vis_block_5Transformer BlockembedDim=768, numHeads=12, ffDim=307249 ร— 768
9vis_block_6Transformer BlockembedDim=768, numHeads=12, ffDim=307249 ร— 768
10vis_block_7Transformer BlockembedDim=768, numHeads=12, ffDim=307249 ร— 768
11vis_block_8Transformer BlockembedDim=768, numHeads=12, ffDim=307249 ร— 768
12vis_block_9Transformer BlockembedDim=768, numHeads=12, ffDim=307249 ร— 768
13vis_block_10Transformer BlockembedDim=768, numHeads=12, ffDim=307249 ร— 768
14vis_block_11Transformer BlockembedDim=768, numHeads=12, ffDim=307249 ร— 768
15vis_block_12Transformer BlockembedDim=768, numHeads=12, ffDim=307249 ร— 768
16vis_normLayerNormnormalizedShape=76849 ร— 768
17to_channels_visPermute768 ร— 49
18vis_poolGlobalAvgPool1D768
19img_projLinearoutFeatures=512, inFeatures=768512
20tokensInputshape=[77]77
21tok_embedEmbedding77 ร— 512
22txt_posPositional EncodingembedDim=512, maxLen=7777 ร— 512
23txt_block_1Transformer BlockembedDim=512, numHeads=8, ffDim=204877 ร— 512
24txt_block_2Transformer BlockembedDim=512, numHeads=8, ffDim=204877 ร— 512
25txt_block_3Transformer BlockembedDim=512, numHeads=8, ffDim=204877 ร— 512
26txt_block_4Transformer BlockembedDim=512, numHeads=8, ffDim=204877 ร— 512
27txt_block_5Transformer BlockembedDim=512, numHeads=8, ffDim=204877 ร— 512
28txt_block_6Transformer BlockembedDim=512, numHeads=8, ffDim=204877 ร— 512
29txt_block_7Transformer BlockembedDim=512, numHeads=8, ffDim=204877 ร— 512
30txt_block_8Transformer BlockembedDim=512, numHeads=8, ffDim=204877 ร— 512
31txt_block_9Transformer BlockembedDim=512, numHeads=8, ffDim=204877 ร— 512
32txt_block_10Transformer BlockembedDim=512, numHeads=8, ffDim=204877 ร— 512
33txt_block_11Transformer BlockembedDim=512, numHeads=8, ffDim=204877 ร— 512
34txt_block_12Transformer BlockembedDim=512, numHeads=8, ffDim=204877 ร— 512
35txt_normLayerNormnormalizedShape=51277 ร— 512
36to_channels_txtPermute512 ร— 77
37txt_poolGlobalAvgPool1D512
38txt_projLinearoutFeatures=512, inFeatures=512512
39similarityMatMul512
40logitsOutput512

What the verifier says

The same 43 single-graph checks that run on every edit in the app, on this graph.

No finding. Shapes propagate end to end, every divisibility condition holds, and no advisory rule fires. See the checks.

The PyTorch it exports

Generated from the graph above. First 46 lines; the app exports the whole file, plus the training loop, the data contract and a deploy bundle.

# Architecture designed with Neurarch: https://neurarch.com
# PyTorch: compatible with Python 3.8+ and torch>=1.12
# Colab: pip install torch torchvision  (usually pre-installed)

import torch
import torch.nn as nn
import torch.nn.functional as F
from typing import Tuple

class CLIPViT_B32(nn.Module):
    def __init__(self):
        super().__init__()

        self.patchEmbed_1 = nn.Conv2d(3, 768, kernel_size=32, stride=32)  # Patch embedding (ViT-style)
        self.transformerBlock_1 = nn.TransformerEncoderLayer(d_model=768, nhead=12, dim_feedforward=3072, batch_first=True)
        self.transformerBlock_2 = nn.TransformerEncoderLayer(d_model=768, nhead=12, dim_feedforward=3072, batch_first=True)
        self.transformerBlock_3 = nn.TransformerEncoderLayer(d_model=768, nhead=12, dim_feedforward=3072, batch_first=True)
        self.transformerBlock_4 = nn.TransformerEncoderLayer(d_model=768, nhead=12, dim_feedforward=3072, batch_first=True)
        self.transformerBlock_5 = nn.TransformerEncoderLayer(d_model=768, nhead=12, dim_feedforward=3072, batch_first=True)
        self.transformerBlock_6 = nn.TransformerEncoderLayer(d_model=768, nhead=12, dim_feedforward=3072, batch_first=True)
        self.transformerBlock_7 = nn.TransformerEncoderLayer(d_model=768, nhead=12, dim_feedforward=3072, batch_first=True)
        self.transformerBlock_8 = nn.TransformerEncoderLayer(d_model=768, nhead=12, dim_feedforward=3072, batch_first=True)
        self.transformerBlock_9 = nn.TransformerEncoderLayer(d_model=768, nhead=12, dim_feedforward=3072, batch_first=True)
        self.transformerBlock_10 = nn.TransformerEncoderLayer(d_model=768, nhead=12, dim_feedforward=3072, batch_first=True)
        self.transformerBlock_11 = nn.TransformerEncoderLayer(d_model=768, nhead=12, dim_feedforward=3072, batch_first=True)
        self.transformerBlock_12 = nn.TransformerEncoderLayer(d_model=768, nhead=12, dim_feedforward=3072, batch_first=True)
        self.layerNorm_1 = nn.LayerNorm(768)
        self.linear_1 = nn.Linear(768, 512)
        self.embedding_1 = nn.Embedding(49408, 512)
        self.transformerBlock_13 = nn.TransformerEncoderLayer(d_model=512, nhead=8, dim_feedforward=2048, batch_first=True)
        self.transformerBlock_14 = nn.TransformerEncoderLayer(d_model=512, nhead=8, dim_feedforward=2048, batch_first=True)
        self.transformerBlock_15 = nn.TransformerEncoderLayer(d_model=512, nhead=8, dim_feedforward=2048, batch_first=True)
        self.transformerBlock_16 = nn.TransformerEncoderLayer(d_model=512, nhead=8, dim_feedforward=2048, batch_first=True)
        self.transformerBlock_17 = nn.TransformerEncoderLayer(d_model=512, nhead=8, dim_feedforward=2048, batch_first=True)
        self.transformerBlock_18 = nn.TransformerEncoderLayer(d_model=512, nhead=8, dim_feedforward=2048, batch_first=True)
        self.transformerBlock_19 = nn.TransformerEncoderLayer(d_model=512, nhead=8, dim_feedforward=2048, batch_first=True)
        self.transformerBlock_20 = nn.TransformerEncoderLayer(d_model=512, nhead=8, dim_feedforward=2048, batch_first=True)
        self.transformerBlock_21 = nn.TransformerEncoderLayer(d_model=512, nhead=8, dim_feedforward=2048, batch_first=True)
        self.transformerBlock_22 = nn.TransformerEncoderLayer(d_model=512, nhead=8, dim_feedforward=2048, batch_first=True)
        self.transformerBlock_23 = nn.TransformerEncoderLayer(d_model=512, nhead=8, dim_feedforward=2048, batch_first=True)
        self.transformerBlock_24 = nn.TransformerEncoderLayer(d_model=512, nhead=8, dim_feedforward=2048, batch_first=True)
        self.layerNorm_2 = nn.LayerNorm(512)
        self.linear_2 = nn.Linear(512, 512)

    def forward(self, src, tgt=None):
        # image shape: [3,224,224]

For agents

This architecture is machine-readable end to end. An agent can list the set, fetch this graph, edit it, and have the edit verified before any GPU time is spent.

Also in Multimodal

๐Ÿ‘๏ธ LLaVA-1.5
Vision-language model โ€” CLIP image encoder + MLP projector feed visual tokens into a LLaMA decoder
229 layers ยท 7.06B
๐Ÿงฑ Qwen2-VL (Native-Resolution VLM)
Wang et al
15 layers ยท 1.55B
๐Ÿ”— ColBERT (Late Interaction Retrieval)
Khattab and Zaharia 2020 - the document keeps its tokens until scoring time
14 layers ยท 75.43M
๐Ÿช† Matryoshka Text Embedder
Kusupati et al
11 layers ยท 54.74M