{
  "modelType": "transformer",
  "output": {
    "baseDir": "models/local",
    "modelBaseId": "glm-ocr-f16-af32",
    "textOnly": false,
    "fast": false
  },
  "sourceTensors": {
    "requireAll": false,
    "rules": [
      {
        "kind": "ignore",
        "match": "^model\\.language_model\\.layers\\.16\\.",
        "expectedMatches": 16,
        "reason": "GLM-OCR layer 16 is the auxiliary next-token prediction head, not one of the 16 base decoder layers."
      }
    ]
  },
  "quantization": {
    "weights": "f16",
    "embeddings": "f16",
    "lmHead": "f16",
    "vision": "f16",
    "projector": "f16",
    "audio": "f16",
    "computePrecision": "f32"
  },
  "manifest": {
    "hashAlgorithm": "sha256",
    "visionConfig": {
      "vision_architecture": "glmocr",
      "depth": 24,
      "hidden_size": 1024,
      "intermediate_size": 4096,
      "num_heads": 16,
      "out_hidden_size": 1536,
      "patch_size": 14,
      "spatial_merge_size": 2,
      "temporal_patch_size": 2,
      "rms_norm_eps": 0.00001,
      "hidden_act": "silu",
      "rope_theta": 10000,
      "min_pixels": 12544,
      "max_pixels": 9633792,
      "default_output_length": 6144,
      "in_channels": 3,
      "merger_intermediate_size": 4608,
      "downsample_kernel_size": 2,
      "normalization": {
        "mean": [
          0.48145466,
          0.4578275,
          0.40821073
        ],
        "std": [
          0.26862954,
          0.26130258,
          0.27577711
        ]
      }
    },
    "artifactIdentity": {
      "sourceCheckpointId": "zai-org/GLM-OCR@ca5d8b3e287e52589e37c28385d9655ee4372f9d",
      "sourceRepo": "zai-org/GLM-OCR",
      "sourceRevision": "ca5d8b3e287e52589e37c28385d9655ee4372f9d",
      "artifactCompleteness": "complete"
    },
    "eosTokenId": [
      59246,
      59253
    ]
  },
  "inference": {
    "attention": {
      "queryPreAttnScalar": 128,
      "attnLogitSoftcapping": null,
      "slidingWindow": null,
      "queryKeyNorm": false,
      "valueNorm": false,
      "causal": true,
      "attentionBias": false,
      "attentionOutputGate": false
    },
    "normalization": {
      "rmsNormEps": 0.00001,
      "rmsNormWeightOffset": false,
      "postAttentionNorm": true,
      "preFeedforwardNorm": true,
      "postFeedforwardNorm": true
    },
    "ffn": {
      "activation": "silu",
      "gatedActivation": true,
      "branchMode": "auto",
      "useDoubleWideMlp": false,
      "swigluLimit": null
    },
    "rope": {
      "ropeTheta": 10000,
      "ropeLocalTheta": null,
      "ropeInterleaved": true,
      "mropeInterleaved": true,
      "mropeSection": [
        16,
        24,
        24
      ],
      "partialRotaryFactor": 1,
      "ropeLocalPartialRotaryFactor": null,
      "ropeFrequencyBaseDim": 128,
      "ropeLocalFrequencyBaseDim": null,
      "ropeScalingType": null,
      "ropeScalingFactor": 1,
      "ropeLocalScalingType": null,
      "ropeLocalScalingFactor": 1,
      "yarnBetaFast": null,
      "yarnBetaSlow": null,
      "yarnOriginalMaxPos": null,
      "ropeLocalYarnBetaFast": null,
      "ropeLocalYarnBetaSlow": null,
      "ropeLocalYarnOriginalMaxPos": null,
      "longropeShortFactor": null,
      "longropeLongFactor": null,
      "longropeOriginalMaxPos": null
    },
    "output": {
      "finalLogitSoftcapping": null,
      "tieWordEmbeddings": false,
      "scaleEmbeddings": false,
      "embeddingTranspose": false,
      "embeddingVocabSize": 59392,
      "embeddingPostprocessor": null,
      "embeddingScale": null,
      "logitInputScale": 1
    },
    "layerPattern": {
      "type": "global",
      "globalPattern": "attention",
      "period": null,
      "offset": null,
      "layerTypes": null,
      "residualBranchScale": 1
    },
    "chatTemplate": {
      "type": "glmocr",
      "enabled": true,
      "thinking": null
    }
  },
  "session": {
    "compute": {
      "defaults": {
        "activationDtype": "f32",
        "mathDtype": "f32",
        "accumDtype": "f32",
        "outputDtype": "f32"
      }
    },
    "kvcache": {
      "kvDtype": "f16",
      "layout": "contiguous",
      "maxSeqLen": 8192,
      "pageSize": 256,
      "tiering": {
        "mode": "off",
        "hotWindow": 1024,
        "coldPageSize": 256,
        "coldDtype": "f16",
        "compression": {
          "mode": "none",
          "blockSize": 1,
          "bitWidth": 4,
          "prodMode": false
        },
        "gating": {
          "mode": "auto",
          "minAluBwRatio": 0
        }
      },
      "quantization": {
        "mode": "none",
        "bitWidth": 4,
        "prodMode": false
      }
    },
    "decodeLoop": {
      "batchSize": 4,
      "stopCheckMode": "batch",
      "readbackInterval": 1,
      "readbackMode": "sequential",
      "submitLatencyThresholdMs": null,
      "ringTokens": 1,
      "ringStop": 1,
      "ringStaging": 1,
      "disableCommandBatching": false
    },
    "perLayerInputs": {
      "materialization": "auto",
      "rowCache": {
        "mode": "lru",
        "maxRows": 256,
        "maxBytes": 134217728,
        "decodedDtype": "f32"
      },
      "prefetch": {
        "mode": "next_token",
        "rowsAhead": 1
      },
      "gpuUpload": {
        "mode": "per_step_slices",
        "stagingRows": 2
      },
      "hotCache": {
        "mode": "prepared_tokens",
        "maxTokens": 1024,
        "maxBytes": 134217728,
        "outputDtype": "f32"
      }
    },
    "prefillChunkSubmitMode": "sync",
    "useFlashPrefillAttention": false,
    "useWideTileQ4KPrefill": false,
    "retainQ4KMaterialization": false
  },
  "execution": {
    "inlineKernelPath": true,
    "kernels": {
      "embed": {
        "kernel": "gather_f16.wgsl",
        "entry": "main",
        "digest": "sha256:a2c318bc362d676769d8cb751d61a4d7777e1068be0456eff634e0821d783c10"
      },
      "rmsnorm": {
        "kernel": "rmsnorm.wgsl",
        "entry": "main",
        "digest": "sha256:4f4d144735bdff86b8567346ba7ea7b82fe68a2ac9656ba1577106158af9bc7c"
      },
      "gemv": {
        "kernel": "matmul_gemv_subgroup.wgsl",
        "entry": "main_vec4",
        "digest": "sha256:2ea9aea659367210fbf61d922c0d4ee17cdac68ffb506b3bc5516e498071e011"
      },
      "rope": {
        "kernel": "rope.wgsl",
        "entry": "main",
        "digest": "sha256:923f9a96c941aee94119ecf04fa5b1508c77b7d927a7e6044ce6588b2d51a416"
      },
      "attn_decode": {
        "kernel": "attention_decode_online_f16kv.wgsl",
        "entry": "main",
        "digest": "sha256:c6d9f8c614a2a088cb533958007896391efb3e348377dc8095c409944c562912",
        "precision": {
          "kvDtype": "f16"
        }
      },
      "residual": {
        "kernel": "residual.wgsl",
        "entry": "main",
        "digest": "sha256:4dbfb0a9ca0fb6047a01618f0374b445c243774d039407acdf41b0711ea8eaf4"
      },
      "silu": {
        "kernel": "silu.wgsl",
        "entry": "main",
        "digest": "sha256:712787a59b032453b09f147be0d0c073266c47a7a12c3b746984aaf28075bedb",
        "constants": {
          "HAS_GATE": true
        }
      },
      "tiled": {
        "kernel": "matmul_f16w_f32a_tiled.wgsl",
        "entry": "main",
        "digest": "sha256:5dada68240a47e2fcf916ae1467d89010a27a22588f097c1523f7ee6c9e9377a"
      },
      "attn_head128": {
        "kernel": "attention_head128_f16kv.wgsl",
        "entry": "main",
        "digest": "sha256:559a3da4f3f5dcc4671f5a9b429a84209340a66a6e17f583bb329b2e23832c9b",
        "precision": {
          "kvDtype": "f16"
        }
      },
      "lm_head_gemv": {
        "kernel": "matmul_gemv_subgroup.wgsl",
        "entry": "main_multicol",
        "digest": "sha256:e41f94574d5ac54dd2710036da5d5acc643a483b79b2d74b86825efdaaa7438f",
        "constants": {
          "MULTICOL_COLS_PER_WG": 64,
          "MULTICOL_THREADS_PER_COL": 4
        }
      },
      "sample": {
        "kernel": "sample.wgsl",
        "entry": "sample_single_pass",
        "digest": "sha256:f2377b2a58c2eeb695a6f6f7ad877630bdba5e74d5dc1a8d919cd73b360d4870"
      }
    },
    "preLayer": [
      [
        "embed",
        "embed",
        "embed_tokens"
      ]
    ],
    "decode": [
      [
        "input_norm",
        "rmsnorm"
      ],
      [
        "q_proj",
        "gemv",
        "layer.{L}.self_attn.q_proj"
      ],
      [
        "k_proj",
        "gemv",
        "layer.{L}.self_attn.k_proj"
      ],
      [
        "v_proj",
        "gemv",
        "layer.{L}.self_attn.v_proj"
      ],
      [
        "rope_q",
        "rope"
      ],
      [
        "rope_k",
        "rope"
      ],
      [
        "attention",
        "attn_decode"
      ],
      [
        "o_proj",
        "gemv",
        "layer.{L}.self_attn.o_proj"
      ],
      [
        "attn_residual",
        "residual"
      ],
      [
        "post_attn_norm",
        "rmsnorm"
      ],
      [
        "ffn",
        "silu"
      ],
      [
        "ffn_residual",
        "residual"
      ]
    ],
    "prefill": [
      [
        "input_norm",
        "rmsnorm"
      ],
      [
        "q_proj",
        "tiled",
        "layer.{L}.self_attn.q_proj"
      ],
      [
        "k_proj",
        "tiled",
        "layer.{L}.self_attn.k_proj"
      ],
      [
        "v_proj",
        "tiled",
        "layer.{L}.self_attn.v_proj"
      ],
      [
        "rope_q",
        "rope"
      ],
      [
        "rope_k",
        "rope"
      ],
      [
        "attention",
        "attn_head128"
      ],
      [
        "o_proj",
        "tiled",
        "layer.{L}.self_attn.o_proj"
      ],
      [
        "attn_residual",
        "residual"
      ],
      [
        "post_attn_norm",
        "rmsnorm"
      ],
      [
        "ffn",
        "silu"
      ],
      [
        "ffn_residual",
        "residual"
      ]
    ],
    "postLayer": [
      [
        "final_norm",
        "rmsnorm"
      ],
      [
        "lm_head",
        "lm_head_gemv",
        "lm_head"
      ],
      [
        "lm_head_prefill",
        "tiled",
        "lm_head"
      ],
      [
        "sample",
        "sample"
      ]
    ],
    "policies": {
      "unsupportedPrecision": "error",
      "dtypeTransition": "require_cast_step",
      "unresolvedKernel": "error"
    }
  },
  "largeWeights": {
    "gpuResidentOverrides": null
  }
}
