{
  "schema_version": "1.0",
  "id": "T-e77094396b95",
  "url": "https://gpuatlas.top/articles/T-e77094396b95/",
  "title": "给 Gemma 4 26B-A4B 做 QLoRA，怎么估算自己显存够不够？",
  "summary": "Gemma 4 26B-A4B QLoRA按总权重及实际训练路径规划，约12.6GB理想低位算术之外仍有视觉、状态和激活。",
  "language": "zh-Hans",
  "category": {
    "id": "c-18",
    "name": "模型微调",
    "url": "https://gpuatlas.top/categories/c-18/"
  },
  "topics": [
    {
      "id": "model-bf587b53c1",
      "name": "Gemma 4",
      "kind": "model",
      "description": "这里整理已有 Gemma 4 相关文章的配置问题；实际使用前，需核对文章所指版本、来源与框架支持。",
      "url": "https://gpuatlas.top/topics/model-bf587b53c1/"
    }
  ],
  "body_text": "先确认当前框架支持该MoE的低位前向、反向和保存，再预算容量。Gemma 4 26B-A4B约25.2B总参数、3.8B激活，不能按A4B估全部权重或训练状态。\n\n按25.2B统一4bit做原始算术约12.6GB，实际视觉、元数据和未量化部分另核。官方静态加载参考不是QLoRA训练表，适配器状态、反向激活、专家执行及临时缓冲仍需加入。\n\n明确目标模块、rank、冻结范围、精度与优化器，检查实际可训练参数。QAT不等于已经提供当前工具的可训练格式，文本和图文路径也需分别核，不能只靠模型名字识别通过。\n\n用真实处理后长度与微批量完成前向、反向和更新，记录阶段峰值。基础不足先核精度布局，反向不足再比较微批量、长度、检查点或分片，梯度累积不解决单条过长样本，重计算与通信需计时。\n\n保存后，在新进程恢复这套MoE适配器，用未参与训练的文本或图文任务检查实际收益。若采用分片，还要保留每卡峰值和布局，而不能只记一个总占用。这样得到的是Gemma 4 26B-A4B完整训练与交付所需资源，不是按激活参数推出来的门槛。",
  "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": "gemma4-card",
      "url": "https://raw.githubusercontent.com/google-gemma/docs/main/docs/models/gemma-4/model-card.md",
      "retrieved_at": "2026-11-25T11:31:21.126309+00:00"
    },
    {
      "id": "gemma4-official",
      "url": "https://raw.githubusercontent.com/google-gemma/docs/main/docs/models/gemma-4/index.md",
      "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-e77094396b95/",
    "json": "https://gpuatlas.top/data/articles/T-e77094396b95.json",
    "markdown": "https://gpuatlas.top/data/articles/T-e77094396b95.md"
  }
}
