{
  "schema_version": "1.0",
  "id": "T-8bc86909ea2e",
  "url": "https://gpuatlas.top/articles/T-8bc86909ea2e/",
  "title": "32G 显存想做微调，怎么选模型规模和训练方式？",
  "summary": "32G微调应先核对有效样本与更新方式，长序列反向压力不能靠梯度累积自动消除。",
  "language": "zh-Hans",
  "category": {
    "id": "c-11",
    "name": "按显存找方案",
    "url": "https://gpuatlas.top/categories/c-11/"
  },
  "topics": [
    {
      "id": "task-e33d9598da",
      "name": "微调",
      "kind": "task",
      "description": "让模型适应自己的任务，从训练方式、样本和显存预算入手，最后验证适配器是否真正起效。",
      "url": "https://gpuatlas.top/topics/task-e33d9598da/"
    },
    {
      "id": "task-796e01d5af",
      "name": "训练",
      "kind": "task",
      "description": "模型训练时的资源占用与推理不同。查看优化器、激活值、并行策略和中断恢复相关问题。",
      "url": "https://gpuatlas.top/topics/task-796e01d5af/"
    }
  ],
  "body_text": "32G显存做微调，先确定验证任务，再选LoRA、QLoRA或全参数更新。目标是改善用途，不是挑刚好能加载的最大模型；基础权重、可训练状态、激活和缓冲要分别安排。\n\nQLoRA降低基础权重存储，但反向仍需激活。长序列和微批量增加会改变峰值，不能只把低位文件大小和显存比较。全参数更新还需对应梯度与优化器状态，预算结构不同。\n\n先检查处理后的样本，确认模板、截断和损失范围，避免回答被切掉或有效监督太少。用真实长度完成前向、反向与更新，再保存并在新进程恢复，覆盖短样本一步无法发现的问题。\n\n短样本正常而长样本失败时，优先核对长度与激活，分别比较微批量和受支持的重计算。梯度累积改变有效批量，不会自动降低单条过长输入的需求；重计算也需要记录完整时间变化。\n\n短回答与较长回答混合的数据，应先检查处理后是否都保留了有效监督，再比较训练方式。吞吐统一按有效训练token统计，注明填充、读取与检查点是否包含。32G方案既要完整保存恢复，也要在验证中达标；保留退步样例及量化、状态设置，才知道规模变化带来的实际影响。",
  "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": "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"
    },
    {
      "id": "llamafactory-data-args",
      "url": "https://raw.githubusercontent.com/hiyouga/LLaMA-Factory/main/src/llamafactory/hparams/data_args.py",
      "retrieved_at": "2026-11-25T11:04:14.292936+00:00"
    }
  ],
  "revision_note": "更新使用说明与操作示例；非硬件实测。",
  "representations": {
    "html": "https://gpuatlas.top/articles/T-8bc86909ea2e/",
    "json": "https://gpuatlas.top/data/articles/T-8bc86909ea2e.json",
    "markdown": "https://gpuatlas.top/data/articles/T-8bc86909ea2e.md"
  }
}
