{
  "schema_version": "1.0",
  "id": "T-4632659dca8d",
  "url": "https://gpuatlas.top/articles/T-4632659dca8d/",
  "title": "3B 模型做 全参数微调，显存预算应该把哪些部分算进去？",
  "summary": "3B全参数微调需在权重之外预算梯度、优化器、主副本及激活，54GB算例仅对应特定状态布局。",
  "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": "3B模型全参数微调，先固定精度和优化器布局。假设恰有30亿参数，16bit原始权重约6GB，但训练还需要更新状态，不能照推理文件大小选显存。\n\n例如每参数2字节权重、4字节梯度、两份Adam状态共8字节，再保留4字节主权重，合计18字节，对3B约54GB，均为十进制算术。激活、临时张量和保存峰值未包含，也不是所有框架默认。\n\n梯度类型、主副本、优化器和分片会改变组成，先查看有效配置。使用ZeRO、FSDP或卸载时，参数、梯度和优化器可能分别分布，临时聚合也占空间，不能把54GB直接除卡数。\n\n按时间线记录加载、前向、反向、首次更新、评估和保存，部分状态会延后创建。只有模型加载或前向成功，不能证明完整循环通过，主存和磁盘也需覆盖恢复产物。\n\n微批量影响部分激活，累积可以安排有效批量，但损失归一化、更新与调度需核对。单条过长样本仍可能超限，增加累积不会自动拆掉该单步。\n\n用代表数据完成更新、保存与新进程恢复后，再扩大目标长度，确认首次更新和保存的额外峰值没有漏掉。随后让全参数方案与适配器等较小更新范围回答同一组验证题，比较收益及完整成本。3B的条件算术说明预算规模，真正值得采用哪种训练方式，还取决于这些任务结果。",
  "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-dtypes",
      "url": "https://docs.pytorch.org/docs/2.15/tensor_attributes.html",
      "retrieved_at": "2026-11-25T10:13:38.582093+00:00"
    },
    {
      "id": "deepspeed-zero",
      "url": "https://deepspeed.readthedocs.io/en/latest/zero3.html",
      "retrieved_at": "2026-11-25T10:21:36.176985+00:00"
    }
  ],
  "revision_note": "完善阅读结构；非硬件实测。",
  "representations": {
    "html": "https://gpuatlas.top/articles/T-4632659dca8d/",
    "json": "https://gpuatlas.top/data/articles/T-4632659dca8d.json",
    "markdown": "https://gpuatlas.top/data/articles/T-4632659dca8d.md"
  }
}
