{
  "id": "hstu",
  "name": "HSTU (Generative Recommender)",
  "description": "Meta 2024 HSTU - the recommendation problem is recast as sequential transduction over one interleaved item+action token stream. Pointwise aggregated attention replaces softmax attention, so the block is NOT a transformer block and its arithmetic is not a transformer block's.",
  "icon": "📈",
  "category": "Recommendation",
  "components": [
    {
      "id": "in-seq",
      "type": "input",
      "name": "Interleaved item+action tokens",
      "position": {
        "x": 240,
        "y": 60
      },
      "params": {
        "shape": [
          1,
          1024
        ]
      },
      "inputs": [],
      "outputs": []
    },
    {
      "id": "emb",
      "type": "embedding",
      "name": "Unified Token Embed",
      "position": {
        "x": 240,
        "y": 160
      },
      "params": {
        "vocabSize": 200000,
        "embeddingDim": 512
      },
      "inputs": [],
      "outputs": []
    },
    {
      "id": "rope",
      "type": "rope",
      "name": "RoPE",
      "position": {
        "x": 240,
        "y": 260
      },
      "params": {
        "dim": 512,
        "maxSeqLen": 1024,
        "base": 10000
      },
      "inputs": [],
      "outputs": []
    },
    {
      "id": "hstu1",
      "type": "hstuBlock",
      "name": "HSTU Block 1",
      "position": {
        "x": 240,
        "y": 360
      },
      "params": {
        "embedDim": 512,
        "numHeads": 4,
        "linearDim": 128,
        "attnDim": 128
      },
      "inputs": [],
      "outputs": []
    },
    {
      "id": "hstu2",
      "type": "hstuBlock",
      "name": "HSTU Block 2",
      "position": {
        "x": 240,
        "y": 460
      },
      "params": {
        "embedDim": 512,
        "numHeads": 4,
        "linearDim": 128,
        "attnDim": 128
      },
      "inputs": [],
      "outputs": []
    },
    {
      "id": "hstu3",
      "type": "hstuBlock",
      "name": "HSTU Block 3",
      "position": {
        "x": 240,
        "y": 560
      },
      "params": {
        "embedDim": 512,
        "numHeads": 4,
        "linearDim": 128,
        "attnDim": 128
      },
      "inputs": [],
      "outputs": []
    },
    {
      "id": "hstu4",
      "type": "hstuBlock",
      "name": "HSTU Block 4",
      "position": {
        "x": 240,
        "y": 660
      },
      "params": {
        "embedDim": 512,
        "numHeads": 4,
        "linearDim": 128,
        "attnDim": 128
      },
      "inputs": [],
      "outputs": []
    },
    {
      "id": "norm",
      "type": "rmsNorm",
      "name": "RMSNorm",
      "position": {
        "x": 240,
        "y": 760
      },
      "params": {
        "normalizedShape": 512,
        "eps": 1e-06
      },
      "inputs": [],
      "outputs": []
    },
    {
      "id": "head",
      "type": "lmHead",
      "name": "Retrieval Head (catalogue logits)",
      "position": {
        "x": 240,
        "y": 860
      },
      "params": {
        "vocabSize": 200000,
        "hiddenSize": 512,
        "tieWeights": true
      },
      "inputs": [],
      "outputs": []
    },
    {
      "id": "out",
      "type": "output",
      "name": "next-item logits",
      "position": {
        "x": 240,
        "y": 960
      },
      "params": {},
      "inputs": [],
      "outputs": []
    }
  ],
  "connections": [
    {
      "id": "c1",
      "from": "in-seq",
      "to": "emb",
      "fromPort": "bottom",
      "toPort": "top"
    },
    {
      "id": "c2",
      "from": "emb",
      "to": "rope",
      "fromPort": "bottom",
      "toPort": "top"
    },
    {
      "id": "c3",
      "from": "rope",
      "to": "hstu1",
      "fromPort": "bottom",
      "toPort": "top"
    },
    {
      "id": "c4",
      "from": "hstu1",
      "to": "hstu2",
      "fromPort": "bottom",
      "toPort": "top"
    },
    {
      "id": "c5",
      "from": "hstu2",
      "to": "hstu3",
      "fromPort": "bottom",
      "toPort": "top"
    },
    {
      "id": "c6",
      "from": "hstu3",
      "to": "hstu4",
      "fromPort": "bottom",
      "toPort": "top"
    },
    {
      "id": "c7",
      "from": "hstu4",
      "to": "norm",
      "fromPort": "bottom",
      "toPort": "top"
    },
    {
      "id": "c8",
      "from": "norm",
      "to": "head",
      "fromPort": "bottom",
      "toPort": "top"
    },
    {
      "id": "c9",
      "from": "head",
      "to": "out",
      "fromPort": "bottom",
      "toPort": "top"
    }
  ]
}