{
  "id": "mind",
  "name": "Multi-Interest Network (MIND)",
  "description": "Alibaba 2019 MIND - dynamic routing turns one behaviour sequence into K interest vectors, so a user is K points in the item space rather than one. Retrieval scores the candidate against every interest and keeps the best.",
  "icon": "🧭",
  "category": "Recommendation",
  "components": [
    {
      "id": "in-seq",
      "type": "input",
      "name": "Behavior Seq (50 items)",
      "position": {
        "x": 80,
        "y": 60
      },
      "params": {
        "shape": [
          50
        ]
      },
      "inputs": [],
      "outputs": []
    },
    {
      "id": "seq-emb",
      "type": "embedding",
      "name": "Item Embed",
      "position": {
        "x": 80,
        "y": 180
      },
      "params": {
        "vocabSize": 1000000,
        "embeddingDim": 64
      },
      "inputs": [],
      "outputs": []
    },
    {
      "id": "mi",
      "type": "multiInterest",
      "name": "Dynamic Routing (K=4)",
      "position": {
        "x": 80,
        "y": 300
      },
      "params": {
        "embedDim": 64,
        "numInterests": 4,
        "numIterations": 3
      },
      "inputs": [],
      "outputs": []
    },
    {
      "id": "mi-fc",
      "type": "linear",
      "name": "Interest Projection",
      "position": {
        "x": 80,
        "y": 420
      },
      "params": {
        "inFeatures": 64,
        "outFeatures": 64
      },
      "inputs": [],
      "outputs": []
    },
    {
      "id": "in-item",
      "type": "input",
      "name": "Candidate Item",
      "position": {
        "x": 420,
        "y": 60
      },
      "params": {
        "shape": [
          1
        ]
      },
      "inputs": [],
      "outputs": []
    },
    {
      "id": "item-emb",
      "type": "embedding",
      "name": "Item Embed (shared vocab)",
      "position": {
        "x": 420,
        "y": 180
      },
      "params": {
        "vocabSize": 1000000,
        "embeddingDim": 64
      },
      "inputs": [],
      "outputs": []
    },
    {
      "id": "item-t",
      "type": "permute",
      "name": "transpose",
      "position": {
        "x": 420,
        "y": 300
      },
      "params": {
        "dims": [
          1,
          0
        ]
      },
      "inputs": [],
      "outputs": []
    },
    {
      "id": "score",
      "type": "matmul",
      "name": "interest · item",
      "position": {
        "x": 240,
        "y": 540
      },
      "params": {},
      "inputs": [],
      "outputs": []
    },
    {
      "id": "best",
      "type": "topK",
      "name": "Label-aware max over K",
      "position": {
        "x": 240,
        "y": 640
      },
      "params": {
        "k": 1,
        "dim": 0,
        "sorted": true
      },
      "inputs": [],
      "outputs": []
    },
    {
      "id": "flat",
      "type": "flatten",
      "name": "flatten",
      "position": {
        "x": 240,
        "y": 740
      },
      "params": {},
      "inputs": [],
      "outputs": []
    },
    {
      "id": "sig",
      "type": "sigmoid",
      "name": "Sigmoid",
      "position": {
        "x": 240,
        "y": 840
      },
      "params": {},
      "inputs": [],
      "outputs": []
    },
    {
      "id": "out",
      "type": "output",
      "name": "score",
      "position": {
        "x": 240,
        "y": 940
      },
      "params": {},
      "inputs": [],
      "outputs": []
    }
  ],
  "connections": [
    {
      "id": "c1",
      "from": "in-seq",
      "to": "seq-emb",
      "fromPort": "bottom",
      "toPort": "top"
    },
    {
      "id": "c2",
      "from": "seq-emb",
      "to": "mi",
      "fromPort": "bottom",
      "toPort": "top"
    },
    {
      "id": "c3",
      "from": "mi",
      "to": "mi-fc",
      "fromPort": "bottom",
      "toPort": "top"
    },
    {
      "id": "c4",
      "from": "in-item",
      "to": "item-emb",
      "fromPort": "bottom",
      "toPort": "top"
    },
    {
      "id": "c5",
      "from": "item-emb",
      "to": "item-t",
      "fromPort": "bottom",
      "toPort": "top"
    },
    {
      "id": "c6",
      "from": "mi-fc",
      "to": "score",
      "fromPort": "bottom",
      "toPort": "top"
    },
    {
      "id": "c7",
      "from": "item-t",
      "to": "score",
      "fromPort": "bottom",
      "toPort": "top"
    },
    {
      "id": "c8",
      "from": "score",
      "to": "best",
      "fromPort": "bottom",
      "toPort": "top"
    },
    {
      "id": "c9",
      "from": "best",
      "to": "flat",
      "fromPort": "bottom",
      "toPort": "top"
    },
    {
      "id": "c10",
      "from": "flat",
      "to": "sig",
      "fromPort": "bottom",
      "toPort": "top"
    },
    {
      "id": "c11",
      "from": "sig",
      "to": "out",
      "fromPort": "bottom",
      "toPort": "top"
    }
  ]
}