{
  "id": "matryoshka-embed",
  "name": "Matryoshka Text Embedder",
  "description": "Kusupati et al. 2022 - one embedding model whose prefixes are independently usable, so a caller on a tight index budget truncates to 96 dimensions instead of running a second, smaller model. Trained with InfoNCE on every prefix at once.",
  "icon": "🪆",
  "category": "Multimodal",
  "components": [
    {
      "id": "in-txt",
      "type": "input",
      "name": "Text tokens",
      "position": {
        "x": 240,
        "y": 60
      },
      "params": {
        "shape": [
          1,
          512
        ]
      },
      "inputs": [],
      "outputs": []
    },
    {
      "id": "emb",
      "type": "embedding",
      "name": "Token Embed",
      "position": {
        "x": 240,
        "y": 160
      },
      "params": {
        "vocabSize": 30522,
        "embeddingDim": 768
      },
      "inputs": [],
      "outputs": []
    },
    {
      "id": "pos",
      "type": "positionalEncoding",
      "name": "Pos Encoding",
      "position": {
        "x": 240,
        "y": 260
      },
      "params": {
        "dModel": 768,
        "maxLen": 512
      },
      "inputs": [],
      "outputs": []
    },
    {
      "id": "enc1",
      "type": "transformerBlock",
      "name": "Encoder Block 1",
      "position": {
        "x": 240,
        "y": 360
      },
      "params": {
        "embedDim": 768,
        "numHeads": 12,
        "ffDim": 3072
      },
      "inputs": [],
      "outputs": []
    },
    {
      "id": "enc2",
      "type": "transformerBlock",
      "name": "Encoder Block 2",
      "position": {
        "x": 240,
        "y": 460
      },
      "params": {
        "embedDim": 768,
        "numHeads": 12,
        "ffDim": 3072
      },
      "inputs": [],
      "outputs": []
    },
    {
      "id": "enc3",
      "type": "transformerBlock",
      "name": "Encoder Block 3",
      "position": {
        "x": 240,
        "y": 560
      },
      "params": {
        "embedDim": 768,
        "numHeads": 12,
        "ffDim": 3072
      },
      "inputs": [],
      "outputs": []
    },
    {
      "id": "enc4",
      "type": "transformerBlock",
      "name": "Encoder Block 4",
      "position": {
        "x": 240,
        "y": 660
      },
      "params": {
        "embedDim": 768,
        "numHeads": 12,
        "ffDim": 3072
      },
      "inputs": [],
      "outputs": []
    },
    {
      "id": "pool",
      "type": "attentionPool",
      "name": "Pooling",
      "position": {
        "x": 240,
        "y": 760
      },
      "params": {
        "dim": 768,
        "numHeads": 12,
        "numSeeds": 1
      },
      "inputs": [],
      "outputs": []
    },
    {
      "id": "proj",
      "type": "contrastiveHead",
      "name": "Contrastive Head (InfoNCE)",
      "position": {
        "x": 240,
        "y": 860
      },
      "params": {
        "projDim": 768,
        "temperature": 0.05,
        "learnableTemp": true,
        "normalize": true
      },
      "inputs": [],
      "outputs": []
    },
    {
      "id": "mrl",
      "type": "matryoshkaHead",
      "name": "Matryoshka (768/384/192/96/48)",
      "position": {
        "x": 240,
        "y": 960
      },
      "params": {
        "embedDim": 768,
        "nestedDims": [
          768,
          384,
          192,
          96,
          48
        ]
      },
      "inputs": [],
      "outputs": []
    },
    {
      "id": "out",
      "type": "output",
      "name": "embedding (truncatable)",
      "position": {
        "x": 240,
        "y": 1060
      },
      "params": {},
      "inputs": [],
      "outputs": []
    }
  ],
  "connections": [
    {
      "id": "c1",
      "from": "in-txt",
      "to": "emb",
      "fromPort": "bottom",
      "toPort": "top"
    },
    {
      "id": "c2",
      "from": "emb",
      "to": "pos",
      "fromPort": "bottom",
      "toPort": "top"
    },
    {
      "id": "c3",
      "from": "pos",
      "to": "enc1",
      "fromPort": "bottom",
      "toPort": "top"
    },
    {
      "id": "c4",
      "from": "enc1",
      "to": "enc2",
      "fromPort": "bottom",
      "toPort": "top"
    },
    {
      "id": "c5",
      "from": "enc2",
      "to": "enc3",
      "fromPort": "bottom",
      "toPort": "top"
    },
    {
      "id": "c6",
      "from": "enc3",
      "to": "enc4",
      "fromPort": "bottom",
      "toPort": "top"
    },
    {
      "id": "c7",
      "from": "enc4",
      "to": "pool",
      "fromPort": "bottom",
      "toPort": "top"
    },
    {
      "id": "c8",
      "from": "pool",
      "to": "proj",
      "fromPort": "bottom",
      "toPort": "top"
    },
    {
      "id": "c9",
      "from": "proj",
      "to": "mrl",
      "fromPort": "bottom",
      "toPort": "top"
    },
    {
      "id": "c10",
      "from": "mrl",
      "to": "out",
      "fromPort": "bottom",
      "toPort": "top"
    }
  ]
}