{
  "schema_version": "1.0",
  "id": "T-6a78cb72695b",
  "url": "https://gpuatlas.top/articles/T-6a78cb72695b/",
  "title": "8B 模型做 LoRA，显存预算应该把哪些部分算进去？",
  "summary": "8B LoRA先算完整基础驻留，再加适配器状态和反向激活，名义16GB权重不是总训练需求。",
  "language": "zh-Hans",
  "category": {
    "id": "c-19",
    "name": "训练资源估算",
    "url": "https://gpuatlas.top/categories/c-19/"
  },
  "topics": [],
  "body_text": "先列实际基础权重。名义8B统一16bit原始数据约16GB，具体参数、精度和加载方式另核；LoRA通常冻结基础，不自动压缩这一部分，适配器文件小不表示整套训练只占很少空间。\n\n再列适配器参数、梯度和优化器状态，由目标模块、rank和状态精度决定。最后列反向激活、损失、临时张量与缓冲，受结构、长度、微批量和实现影响，推理KV不能替代这一预算。\n\n先核可训练参数和支持路径，用真实处理后样本完成前向、反向与更新，记录阶段峰值。不同8B模型模块和结构可能不同，只写规模无法复现容量。\n\n如果基础驻留已超预算，先研究支持的精度与布局；如果加载通过而反向失败，再比较微批量、长度与检查点。梯度累积不消除单条过长需求，重计算、分片通信和保存汇总都要纳入完整时间与峰值。\n\n在8B LoRA预算记录中，把模型精确标识、目标模块与rank同真实样本放在一起，跑到保存后再独立恢复。若用途是长文问答，恢复检查也用长题，而不是只测一句短问候。这样发现的反向或保存缺口，才对应实际训练任务所需的空间。",
  "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": "peft-quantization",
      "url": "https://raw.githubusercontent.com/huggingface/peft/main/docs/source/developer_guides/quantization.md",
      "retrieved_at": "2026-11-25T09:52:45.997121+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"
    }
  ],
  "revision_note": "完善阅读结构；非硬件实测。",
  "representations": {
    "html": "https://gpuatlas.top/articles/T-6a78cb72695b/",
    "json": "https://gpuatlas.top/data/articles/T-6a78cb72695b.json",
    "markdown": "https://gpuatlas.top/data/articles/T-6a78cb72695b.md"
  }
}
