{
  "schema_version": "1.0",
  "id": "T-5b1e8c3d56c6",
  "url": "https://gpuatlas.top/articles/T-5b1e8c3d56c6/",
  "title": "8B 模型做 QLoRA，显存预算应该把哪些部分算进去？",
  "summary": "8B QLoRA的理想4GB只描述名义低位数据，元数据、适配器状态、激活和缓冲必须另预算。",
  "language": "zh-Hans",
  "category": {
    "id": "c-19",
    "name": "训练资源估算",
    "url": "https://gpuatlas.top/categories/c-19/"
  },
  "topics": [],
  "body_text": "先算实际基础驻留，再列适配器训练状态、激活与运行开销。名义8B统一4bit原始数据约4GB，只是筛选起点，实际参数、量化元数据和保留高精度的部分都会改变结果。\n\n基础权重通常冻结，目标适配器仍需参数、梯度和优化器状态，模块覆盖、rank及状态精度影响大小。长度、微批量和注意力实现影响激活，不会自动跟随基础权重变成4bit。\n\n按工具支持流程准备模型，核对实际可训练参数，用真实处理后样本完成前向、反向和更新，记录峰值阶段。只通过导入、低位运算或模型加载，不能证明目标训练、保存和恢复可用。\n\n先判断失败是基础驻留还是反向压力，再分别比较精度布局、微批量、长度和检查点。梯度累积不解决单条过长输入，分片与卸载还需主存和通信，重计算也要计入完整时间。\n\n8B QLoRA已完成低位加载、却在真实长样本反向时失败，应回查激活相关设置，不再用约4GB估总需求。候选配置通过更新后继续走到保存恢复，再检查目标任务质量；这份预算要支持的是可用适配器，不能止于基础权重驻留。",
  "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": "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-5b1e8c3d56c6/",
    "json": "https://gpuatlas.top/data/articles/T-5b1e8c3d56c6.json",
    "markdown": "https://gpuatlas.top/data/articles/T-5b1e8c3d56c6.md"
  }
}
