{
  "schema_version": "1.0",
  "id": "T-1b409383074d",
  "url": "https://gpuatlas.top/articles/T-1b409383074d/",
  "title": "32B 模型做 全参数微调，显存预算应该把哪些部分算进去？",
  "summary": "32B全参数预算按真实状态布局列算，18字节假设约576GB不含激活，每卡与保存峰值需另外验收。",
  "language": "zh-Hans",
  "category": {
    "id": "c-19",
    "name": "训练资源估算",
    "url": "https://gpuatlas.top/categories/c-19/"
  },
  "topics": [
    {
      "id": "task-e33d9598da",
      "name": "微调",
      "kind": "task",
      "description": "让模型适应自己的任务，从训练方式、样本和显存预算入手，最后验证适配器是否真正起效。",
      "url": "https://gpuatlas.top/topics/task-e33d9598da/"
    }
  ],
  "body_text": "先列权重、梯度、优化器状态、可能的主权重，再加激活和运行缓冲。名义32B不等于精确参数数目，具体精度、优化器及框架布局也会改变容量，不能只看权重文件。\n\n一个有条件算例：每参数权重2字节、梯度4字节、Adam两份状态共8字节、主权重4字节，合计18字节。名义32B对应576GB，只覆盖列出的状态，不含激活和其他开销；18字节并不是所有框架默认。\n\n对照实际配置替换每项假设，注明状态在哪个设备、是否分片、何时汇总。不能把576GB除以单卡容量就宣布卡数够用，主存、通信、每卡缓冲和不均匀布局都需检查。\n\n用真实长度与微批量完成加载、前向、反向、更新和保存恢复，分别观察峰值。推理KV不能预测激活，梯度累积不能自动降低单条长样本需求，检查点的重计算也应计入完整时间。\n\n在32B全参数作业中，先将实际状态精度与分片方式填回18字节算例，找出576GB小计与真实布局的差别。随后重点查看更新和保存是否出现额外峰值，恢复后验证独立任务。只有这条作业路径完成，参数乘法才有助于选择资源。",
  "published_at": null,
  "modified_at": "2026-11-26T15:17:38.690397+00:00",
  "evidence": {
    "type": "documentation_and_conditional_estimates",
    "hardware_tested": false,
    "note": "资料解释与条件估算，非硬件实测。"
  },
  "sources": [
    {
      "id": "transformers-training-memory",
      "url": "https://raw.githubusercontent.com/huggingface/transformers/main/docs/source/en/model_memory_anatomy.md",
      "retrieved_at": "2026-11-25T10:16:15.738480+00:00"
    },
    {
      "id": "torch-checkpoint",
      "url": "https://docs.pytorch.org/docs/2.15/checkpoint.html",
      "retrieved_at": "2026-11-25T10:16:15.738480+00:00"
    },
    {
      "id": "deepspeed-zero",
      "url": "https://deepspeed.readthedocs.io/en/latest/zero3.html",
      "retrieved_at": "2026-11-25T10:21:36.176985+00:00"
    },
    {
      "id": "torch-fsdp",
      "url": "https://docs.pytorch.org/docs/2.15/fsdp.html",
      "retrieved_at": "2026-11-25T10:21:36.176985+00:00"
    }
  ],
  "revision_note": "完善阅读结构；非硬件实测。",
  "representations": {
    "html": "https://gpuatlas.top/articles/T-1b409383074d/",
    "json": "https://gpuatlas.top/data/articles/T-1b409383074d.json",
    "markdown": "https://gpuatlas.top/data/articles/T-1b409383074d.md"
  }
}
