Long-Context Fine-Tuning with Limited VRAM· 有限VRAM下的长上下文微调
Parameter-efficient fine-tuning reduces model and optimizer memory, but dense attention still makes long training sequences expensive. We combine Hierarchical Global Attention (HGA) with segment-wise backpropagation and tiered KV storage. Only the active segment remains differentiable in VRAM; older KV is detached into RAM or NVMe, and HGA loads a bounded set of exact historical tokens for each query block. On Qwen3-8B with 4-bit QLoRA and PG19, dense training on a 16 GB Quadro RTX 5000 fits 2,048 tokens but fails at 4,096, whereas HGA reaches 16,384 tokens with 15.28 GB peak VRAM. Under evaluation the same adapter runs through 131,072 tokens on this card; VRAM is not constant but grows gently with the resident chunk summaries, so RAM and NVMe capacity set the practical limit beyond these
减少微调时的内存使用,实现长上下文处理。
- 核心方法
- 结合层级全局注意力 (HGA) 与分段反向传播及层级 KV 存储,仅保持活动段在 VRAM 中可微,旧的 KV 存储到 RAM 或 NVMe 中。
- 适合谁读
- 研究者、工程师
- 要解决的问题
- 在有限的 VRAM 下,传统的密集注意力机制无法处理长训练序列。
- 关键实验
- 在 Qwen3-8B 模型和 PG19 数据集上,使用 4-bit QLoRA 微调,验证了 HGA 的有效性和内存效率。
- 主要贡献
- 实现长上下文(16,384 个 token)的微调,仅需 15.28 GB VRAM。
- 意义与局限
- 提高了长文本处理能力,适用于资源有限的设备,但 RAM 和 NVMe 的容量限制了进一步扩展。