{
  "schema_version": "1.0",
  "id": "T-4597243dff06",
  "url": "https://gpuatlas.top/articles/T-4597243dff06/",
  "title": "给 Gemma 3 12B 做 QLoRA，怎么估算自己显存够不够？",
  "summary": "Gemma 3 12B QLoRA先核实际图文训练路径，理想6GB低位权重之外还有视觉、适配器状态和激活。",
  "language": "zh-Hans",
  "category": {
    "id": "c-18",
    "name": "模型微调",
    "url": "https://gpuatlas.top/categories/c-18/"
  },
  "topics": [
    {
      "id": "model-6bfe1186af",
      "name": "Gemma 3",
      "kind": "model",
      "description": "按 Gemma 3 的具体模型大小查显卡搭配，分清权重占用、上下文开销和额外运行空间。",
      "url": "https://gpuatlas.top/topics/model-6bfe1186af/"
    }
  ],
  "body_text": "先确认纯文本或图文训练，以及当前框架的前向、反向与保存支持。Gemma 3 12B带视觉和混合注意力，推理能执行不能代替低位训练路径检查。\n\n名义12B统一4bit原始数据约6GB，实际参数、视觉组件、元数据和未量化层另核。再列适配器参数、梯度、优化器状态、激活与缓冲，模块、rank、精度、长度和微批量共同决定峰值。\n\n明确冻结范围并核实际可训练参数，用真实处理后的样本完成前向、反向和更新。图片处理设置也要保留，纯文本短样本不能代表图文，理想权重数字更不能代表完整显存。\n\n按失败阶段选择调整：驻留不足先核精度布局，反向不足再比微批量、长度和受支持检查点或分片。梯度累积不消除单条过长输入，重计算、通信、主存和保存汇总都要计入。\n\nGemma 3 12B训练能完成更新后，继续观察适配器保存和新进程恢复。若图文问答是目标，就在恢复版本上核对未参与训练的图片信息，并与文本题的结果分开记录。资源方案应覆盖这条交付路径，不能止于名义12B的低位权重小计。",
  "published_at": null,
  "modified_at": "2026-11-26T15:00:32.276655+00:00",
  "evidence": {
    "type": "documentation_and_conditional_estimates",
    "hardware_tested": false,
    "note": "资料解释与条件估算，非硬件实测。"
  },
  "sources": [
    {
      "id": "gemma3-official",
      "url": "https://raw.githubusercontent.com/google-gemma/docs/main/docs/models/gemma-3/index.md",
      "retrieved_at": "2026-11-25T11:28:43.769677+00:00"
    },
    {
      "id": "gemma3-config-code",
      "url": "https://raw.githubusercontent.com/google/gemma_pytorch/main/gemma/config.py",
      "retrieved_at": "2026-11-25T11:31:21.126309+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": "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"
    }
  ],
  "revision_note": "更新使用说明与操作示例；非硬件实测。",
  "representations": {
    "html": "https://gpuatlas.top/articles/T-4597243dff06/",
    "json": "https://gpuatlas.top/data/articles/T-4597243dff06.json",
    "markdown": "https://gpuatlas.top/data/articles/T-4597243dff06.md"
  }
}
