{
  "schema_version": 2,
  "diagram_type": "workflow",
  "meta": {
    "title": "CLM: chấm điểm action theo state",
    "quality_profile": "showcase",
    "views": [
      {
        "id": "cold",
        "label": "State mới",
        "focus": [
          "state",
          "cache",
          "encoder",
          "heads",
          "score",
          "answer"
        ],
        "note": "Cache miss: gọi encoder Qwen3-8B, chiếu qua head 20M tham số, rồi dot product và softmax."
      },
      {
        "id": "warm",
        "label": "Cache hit",
        "focus": [
          "state",
          "actions",
          "cache",
          "score",
          "answer"
        ],
        "note": "State hoặc action đã gặp: lấy vector từ cache, bỏ qua encoder và head. Theo README khoảng 2.8 lần nhanh hơn khi loop lặp lại state."
      }
    ],
    "legend": {
      "mode": "hidden"
    }
  },
  "lanes": [
    {
      "id": "io",
      "label": "Câu hỏi và trả lời"
    },
    {
      "id": "serve",
      "label": "clm-serve (CPU hoặc GPU)"
    },
    {
      "id": "enc",
      "label": "vLLM Qwen3-8B (GPU)"
    }
  ],
  "phases": [
    {
      "id": "in",
      "label": "Đầu vào",
      "fromCol": 0,
      "toCol": 1
    },
    {
      "id": "embed",
      "label": "Nhúng",
      "fromCol": 2,
      "toCol": 3,
      "variant": "emphasis"
    },
    {
      "id": "out",
      "label": "Chấm điểm",
      "fromCol": 4,
      "toCol": 5,
      "variant": "dashed"
    }
  ],
  "mainPath": [
    "state",
    "cache",
    "encoder",
    "heads",
    "score",
    "answer"
  ],
  "nodes": [
    {
      "id": "state",
      "lane": "io",
      "col": 0,
      "type": "frontend",
      "label": "State",
      "sublabel": "ngữ cảnh hiện tại",
      "width": 132
    },
    {
      "id": "actions",
      "lane": "io",
      "col": 1,
      "type": "frontend",
      "label": "Candidate",
      "sublabel": "option / câu trả lời",
      "width": 132
    },
    {
      "id": "cache",
      "lane": "serve",
      "col": 2,
      "type": "database",
      "label": "Vector cache",
      "sublabel": "LRU, cấp sẵn",
      "width": 132
    },
    {
      "id": "encoder",
      "lane": "enc",
      "col": 3,
      "type": "cloud",
      "label": "Qwen3-8B",
      "sublabel": "frozen, pooling",
      "width": 132
    },
    {
      "id": "heads",
      "lane": "serve",
      "col": 3,
      "type": "backend",
      "label": "State/Action head",
      "sublabel": "20M tham số mỗi head",
      "width": 150
    },
    {
      "id": "score",
      "lane": "serve",
      "col": 4,
      "type": "backend",
      "label": "Dot product",
      "sublabel": "softmax ÷ temperature",
      "width": 150
    },
    {
      "id": "answer",
      "lane": "io",
      "col": 5,
      "type": "frontend",
      "label": "Answer",
      "sublabel": "noul / choice / score",
      "width": 150
    }
  ],
  "edges": [
    {
      "id": "state-cache",
      "from": "state",
      "to": "cache",
      "variant": "emphasis"
    },
    {
      "id": "actions-cache",
      "from": "actions",
      "to": "cache"
    },
    {
      "id": "cache-encoder",
      "from": "cache",
      "to": "encoder",
      "label": "miss",
      "variant": "dashed"
    },
    {
      "id": "encoder-heads",
      "from": "encoder",
      "to": "heads",
      "label": "embedding"
    },
    {
      "id": "heads-score",
      "from": "heads",
      "to": "score",
      "variant": "emphasis"
    },
    {
      "id": "score-answer",
      "from": "score",
      "to": "answer",
      "variant": "emphasis"
    },
    {
      "id": "cache-hit",
      "from": "cache",
      "to": "score",
      "label": "hit",
      "variant": "dashed",
      "role": "branch"
    }
  ],
  "cards": [
    {
      "dot": "cyan",
      "title": "Huấn luyện 3 giai đoạn",
      "items": [
        "Pre: ~60M cặp Q&A Nemotron",
        "Mid: ~30M hard negative, post: ~1M trajectory"
      ]
    },
    {
      "dot": "rose",
      "title": "Kết quả theo README",
      "items": [
        "Nhanh tới 9 lần; đúng kém Jev ở 2/4 bài",
        "Verifier: Terminal-Bench 2.1 87.6%, DeepSWE 81.6%"
      ]
    }
  ]
}
