{
  "id": "colbert",
  "name": "ColBERT (Late Interaction Retrieval)",
  "description": "Khattab and Zaharia 2020 - the document keeps its tokens until scoring time. Each query token takes its best-matching document token and those maxima are summed, which recovers most of a cross-encoder’s quality at a fraction of its cost, and pays for it in index size.",
  "icon": "🔗",
  "category": "Multimodal",
  "components": [
    {
      "id": "in-q",
      "type": "input",
      "name": "Query tokens",
      "position": {
        "x": 80,
        "y": 60
      },
      "params": {
        "shape": [
          1,
          32
        ]
      },
      "inputs": [],
      "outputs": []
    },
    {
      "id": "q-emb",
      "type": "embedding",
      "name": "Token Embed",
      "position": {
        "x": 80,
        "y": 160
      },
      "params": {
        "vocabSize": 30522,
        "embeddingDim": 768
      },
      "inputs": [],
      "outputs": []
    },
    {
      "id": "q-pos",
      "type": "positionalEncoding",
      "name": "Pos Encoding",
      "position": {
        "x": 80,
        "y": 260
      },
      "params": {
        "dModel": 768,
        "maxLen": 512
      },
      "inputs": [],
      "outputs": []
    },
    {
      "id": "q1",
      "type": "transformerBlock",
      "name": "Query Encoder 1",
      "position": {
        "x": 80,
        "y": 360
      },
      "params": {
        "embedDim": 768,
        "numHeads": 12,
        "ffDim": 3072
      },
      "inputs": [],
      "outputs": []
    },
    {
      "id": "q2",
      "type": "transformerBlock",
      "name": "Query Encoder 2",
      "position": {
        "x": 80,
        "y": 460
      },
      "params": {
        "embedDim": 768,
        "numHeads": 12,
        "ffDim": 3072
      },
      "inputs": [],
      "outputs": []
    },
    {
      "id": "q-proj",
      "type": "linear",
      "name": "Down-project to 128",
      "position": {
        "x": 80,
        "y": 560
      },
      "params": {
        "inFeatures": 768,
        "outFeatures": 128
      },
      "inputs": [],
      "outputs": []
    },
    {
      "id": "in-d",
      "type": "input",
      "name": "Document tokens",
      "position": {
        "x": 520,
        "y": 60
      },
      "params": {
        "shape": [
          1,
          180
        ]
      },
      "inputs": [],
      "outputs": []
    },
    {
      "id": "d-emb",
      "type": "embedding",
      "name": "Token Embed (shared)",
      "position": {
        "x": 520,
        "y": 160
      },
      "params": {
        "vocabSize": 30522,
        "embeddingDim": 768
      },
      "inputs": [],
      "outputs": []
    },
    {
      "id": "d-pos",
      "type": "positionalEncoding",
      "name": "Pos Encoding",
      "position": {
        "x": 520,
        "y": 260
      },
      "params": {
        "dModel": 768,
        "maxLen": 512
      },
      "inputs": [],
      "outputs": []
    },
    {
      "id": "d1",
      "type": "transformerBlock",
      "name": "Doc Encoder 1",
      "position": {
        "x": 520,
        "y": 360
      },
      "params": {
        "embedDim": 768,
        "numHeads": 12,
        "ffDim": 3072
      },
      "inputs": [],
      "outputs": []
    },
    {
      "id": "d2",
      "type": "transformerBlock",
      "name": "Doc Encoder 2",
      "position": {
        "x": 520,
        "y": 460
      },
      "params": {
        "embedDim": 768,
        "numHeads": 12,
        "ffDim": 3072
      },
      "inputs": [],
      "outputs": []
    },
    {
      "id": "d-proj",
      "type": "linear",
      "name": "Down-project to 128",
      "position": {
        "x": 520,
        "y": 560
      },
      "params": {
        "inFeatures": 768,
        "outFeatures": 128
      },
      "inputs": [],
      "outputs": []
    },
    {
      "id": "maxsim",
      "type": "lateInteraction",
      "name": "MaxSim",
      "position": {
        "x": 300,
        "y": 680
      },
      "params": {
        "embedDim": 128,
        "similarity": "cosine",
        "docLen": 180
      },
      "inputs": [],
      "outputs": []
    },
    {
      "id": "out",
      "type": "output",
      "name": "relevance score",
      "position": {
        "x": 300,
        "y": 780
      },
      "params": {},
      "inputs": [],
      "outputs": []
    }
  ],
  "connections": [
    {
      "id": "c1",
      "from": "in-q",
      "to": "q-emb",
      "fromPort": "bottom",
      "toPort": "top"
    },
    {
      "id": "c2",
      "from": "q-emb",
      "to": "q-pos",
      "fromPort": "bottom",
      "toPort": "top"
    },
    {
      "id": "c3",
      "from": "q-pos",
      "to": "q1",
      "fromPort": "bottom",
      "toPort": "top"
    },
    {
      "id": "c4",
      "from": "q1",
      "to": "q2",
      "fromPort": "bottom",
      "toPort": "top"
    },
    {
      "id": "c5",
      "from": "q2",
      "to": "q-proj",
      "fromPort": "bottom",
      "toPort": "top"
    },
    {
      "id": "c6",
      "from": "in-d",
      "to": "d-emb",
      "fromPort": "bottom",
      "toPort": "top"
    },
    {
      "id": "c7",
      "from": "d-emb",
      "to": "d-pos",
      "fromPort": "bottom",
      "toPort": "top"
    },
    {
      "id": "c8",
      "from": "d-pos",
      "to": "d1",
      "fromPort": "bottom",
      "toPort": "top"
    },
    {
      "id": "c9",
      "from": "d1",
      "to": "d2",
      "fromPort": "bottom",
      "toPort": "top"
    },
    {
      "id": "c10",
      "from": "d2",
      "to": "d-proj",
      "fromPort": "bottom",
      "toPort": "top"
    },
    {
      "id": "c11",
      "from": "q-proj",
      "to": "maxsim",
      "fromPort": "bottom",
      "toPort": "top"
    },
    {
      "id": "c12",
      "from": "d-proj",
      "to": "maxsim",
      "fromPort": "bottom",
      "toPort": "top"
    },
    {
      "id": "c13",
      "from": "maxsim",
      "to": "out",
      "fromPort": "bottom",
      "toPort": "top"
    }
  ]
}