{
  "schema_version": "1.0",
  "id": "T-701f9c3d778d",
  "url": "https://gpuatlas.top/articles/T-701f9c3d778d/",
  "title": "3B 模型做 LoRA，显存预算应该把哪些部分算进去？",
  "summary": "3B LoRA预算需把冻结基础权重、适配器更新状态和激活分开，单层低秩比例不能代表整模型节省。",
  "language": "zh-Hans",
  "category": {
    "id": "c-19",
    "name": "训练资源估算",
    "url": "https://gpuatlas.top/categories/c-19/"
  },
  "topics": [],
  "body_text": "3B模型做LoRA，先固定架构、基础精度和目标模块。假设30亿参数统一16bit，原始基础数据约6GB，实际文件及运行开销另核，不能当成训练总显存。\n\n基础参数通常冻结，但仍参与前向及相关反向路径。适配器需要可训练参数、梯度和优化器，模块范围、rank及计算精度都会影响这部分，不能只写LoRA就认为更新状态固定。\n\n例如输入输出各2048、rank为16的线性层，两块低秩矩阵合计65536参数，原矩阵4194304参数。这个比例只针对示例层，模型还有其他模块和状态，不能直接当整模型显存节省比例。\n\n激活随序列、微批量和结构变化，可能比适配器更早造成峰值。受支持的重计算用额外计算换部分空间，不缩小基础权重，量化则是另一项条件，作用不能混用。\n\n资源估算最终要回到实际监督样本：先完成前向、反向与更新，再做评估、保存和新进程恢复，之后才增加必要长度。将峰值对应到具体阶段，并对照有效token、完整耗时和未见题收益。示例层的低秩参数少，只能说明那一层的更新规模，不能回答整套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": "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": "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": "llamafactory",
      "url": "https://raw.githubusercontent.com/hiyouga/LLaMA-Factory/main/README.md",
      "retrieved_at": "2026-11-25T09:52:45.997121+00:00"
    }
  ],
  "revision_note": "完善阅读结构；非硬件实测。",
  "representations": {
    "html": "https://gpuatlas.top/articles/T-701f9c3d778d/",
    "json": "https://gpuatlas.top/data/articles/T-701f9c3d778d.json",
    "markdown": "https://gpuatlas.top/data/articles/T-701f9c3d778d.md"
  }
}
