{
  "id": "rqvae-semantic-id",
  "name": "RQ-VAE Semantic ID Tokenizer",
  "description": "Rajput et al. 2023 - the tokenizer that turns an item content embedding into a short tuple of discrete codes, so an item becomes a WORD a decoder can generate instead of a row in a lookup table. Residual quantization gives the codes a coarse-to-fine hierarchy.",
  "icon": "💠",
  "category": "Recommendation",
  "components": [
    {
      "id": "in-item",
      "type": "input",
      "name": "Item content embedding",
      "position": {
        "x": 240,
        "y": 60
      },
      "params": {
        "shape": [
          768
        ]
      },
      "inputs": [],
      "outputs": []
    },
    {
      "id": "e1",
      "type": "linear",
      "name": "Encoder 768-512",
      "position": {
        "x": 240,
        "y": 160
      },
      "params": {
        "inFeatures": 768,
        "outFeatures": 512
      },
      "inputs": [],
      "outputs": []
    },
    {
      "id": "a1",
      "type": "relu",
      "name": "ReLU",
      "position": {
        "x": 240,
        "y": 240
      },
      "params": {},
      "inputs": [],
      "outputs": []
    },
    {
      "id": "e2",
      "type": "linear",
      "name": "Encoder 512-256",
      "position": {
        "x": 240,
        "y": 320
      },
      "params": {
        "inFeatures": 512,
        "outFeatures": 256
      },
      "inputs": [],
      "outputs": []
    },
    {
      "id": "a2",
      "type": "relu",
      "name": "ReLU",
      "position": {
        "x": 240,
        "y": 400
      },
      "params": {},
      "inputs": [],
      "outputs": []
    },
    {
      "id": "e3",
      "type": "linear",
      "name": "Encoder 256-128",
      "position": {
        "x": 240,
        "y": 480
      },
      "params": {
        "inFeatures": 256,
        "outFeatures": 128
      },
      "inputs": [],
      "outputs": []
    },
    {
      "id": "rvq",
      "type": "residualVQ",
      "name": "Residual VQ (4 levels x 256 codes)",
      "position": {
        "x": 240,
        "y": 560
      },
      "params": {
        "numQuantizers": 4,
        "codebookSize": 256,
        "embedDim": 128
      },
      "inputs": [],
      "outputs": []
    },
    {
      "id": "d1",
      "type": "linear",
      "name": "Decoder 128-256",
      "position": {
        "x": 240,
        "y": 660
      },
      "params": {
        "inFeatures": 128,
        "outFeatures": 256
      },
      "inputs": [],
      "outputs": []
    },
    {
      "id": "a3",
      "type": "relu",
      "name": "ReLU",
      "position": {
        "x": 240,
        "y": 740
      },
      "params": {},
      "inputs": [],
      "outputs": []
    },
    {
      "id": "d2",
      "type": "linear",
      "name": "Decoder 256-512",
      "position": {
        "x": 240,
        "y": 820
      },
      "params": {
        "inFeatures": 256,
        "outFeatures": 512
      },
      "inputs": [],
      "outputs": []
    },
    {
      "id": "a4",
      "type": "relu",
      "name": "ReLU",
      "position": {
        "x": 240,
        "y": 900
      },
      "params": {},
      "inputs": [],
      "outputs": []
    },
    {
      "id": "d3",
      "type": "linear",
      "name": "Decoder 512-768",
      "position": {
        "x": 240,
        "y": 980
      },
      "params": {
        "inFeatures": 512,
        "outFeatures": 768
      },
      "inputs": [],
      "outputs": []
    },
    {
      "id": "out",
      "type": "output",
      "name": "reconstructed embedding",
      "position": {
        "x": 240,
        "y": 1060
      },
      "params": {},
      "inputs": [],
      "outputs": []
    }
  ],
  "connections": [
    {
      "id": "c1",
      "from": "in-item",
      "to": "e1",
      "fromPort": "bottom",
      "toPort": "top"
    },
    {
      "id": "c2",
      "from": "e1",
      "to": "a1",
      "fromPort": "bottom",
      "toPort": "top"
    },
    {
      "id": "c3",
      "from": "a1",
      "to": "e2",
      "fromPort": "bottom",
      "toPort": "top"
    },
    {
      "id": "c4",
      "from": "e2",
      "to": "a2",
      "fromPort": "bottom",
      "toPort": "top"
    },
    {
      "id": "c5",
      "from": "a2",
      "to": "e3",
      "fromPort": "bottom",
      "toPort": "top"
    },
    {
      "id": "c6",
      "from": "e3",
      "to": "rvq",
      "fromPort": "bottom",
      "toPort": "top"
    },
    {
      "id": "c7",
      "from": "rvq",
      "to": "d1",
      "fromPort": "bottom",
      "toPort": "top"
    },
    {
      "id": "c8",
      "from": "d1",
      "to": "a3",
      "fromPort": "bottom",
      "toPort": "top"
    },
    {
      "id": "c9",
      "from": "a3",
      "to": "d2",
      "fromPort": "bottom",
      "toPort": "top"
    },
    {
      "id": "c10",
      "from": "d2",
      "to": "a4",
      "fromPort": "bottom",
      "toPort": "top"
    },
    {
      "id": "c11",
      "from": "a4",
      "to": "d3",
      "fromPort": "bottom",
      "toPort": "top"
    },
    {
      "id": "c12",
      "from": "d3",
      "to": "out",
      "fromPort": "bottom",
      "toPort": "top"
    }
  ]
}