{
  "schema_version": "1.0",
  "id": "T-1c68f9935577",
  "url": "https://gpuatlas.top/articles/T-1c68f9935577/",
  "title": "7B 模型做 全参数微调，显存预算应该把哪些部分算进去？",
  "summary": "7B全参数训练先列实际状态布局，18字节示例约126GB不含激活；分片卡数与保存峰值不能简单推算。",
  "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": "先把权重、梯度、优化器状态和可能的主权重列出，再加激活与运行缓冲。7B只是规模标签，具体参数、精度和框架布局会改变训练需求，不能只看权重文件。\n\n一个明确假设：每参数权重2字节、梯度4字节、Adam两份状态共8字节、主权重4字节，合计18字节。名义7B对应126GB，只覆盖列出的状态，不含激活和其他开销，不能当所有混合精度实现的默认。\n\n逐项核实际优化器、状态精度、主权重与分片策略，记录状态在哪些设备、何时汇总。不能把126GB除以单卡容量就宣布卡数够用，每卡布局、主存和通信也可能形成边界。\n\n用真实长度与微批量完成加载、前向、反向、更新和保存恢复，观察阶段峰值。推理KV不能预测反向激活，梯度累积不降低单条过长样本需求，检查点会增加重计算。\n\n把7B作业的实际状态精度逐项填回18字节假设，再核更新与保存阶段的驻留是否符合预期。状态布局不同，就先修预算表，不必让实测去匹配126GB。恢复后的独立验证与完整时间通过，才说明这份预算支持了原定训练。",
  "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-1c68f9935577/",
    "json": "https://gpuatlas.top/data/articles/T-1c68f9935577.json",
    "markdown": "https://gpuatlas.top/data/articles/T-1c68f9935577.md"
  }
}
