研究词频分布对模型训练的影响,发现文本数据最不利优化。
Scaling Laws for Gradient Descent and Sign Descent for Linear Bigram Models under Zipf's Law
- 用幂律分布建模词频,分析梯度下降与符号下降的优化规律
- 当词频遵循齐普夫定律(α=1)时,梯度下降迭代次数几乎随维度线性增长
- 符号下降在大词汇量下性能优越,迭代次数仅随维度平方根增长
近期研究指出,基于Transformer的语言模型在训练首尾层时面临优化困难,而Adam等优化器可克服此问题。该现象被认为与文本数据中词语频率呈重尾分布有关,即第k个最常见词的频率πₖ ∝ 1/k,符合齐普夫定律。为深入理解数据分布对训练性能的影响,本文研究了在线性二元语法模型中,当标记服从幂律分布πₖ ∝ 1/k^α(α > 0)时,确定性梯度下降与符号下降(作为Adam的代理)的优化缩放规律。现有理论通常假设数据特征值按幂律衰减且α > 1,这使问题本质上为“有限维”。相比之下,本文表明当数据尾部更重时问题更难。在α = 1(文本数据典型值)时,梯度下降达到小相对误差所需的迭代次数几乎随维度线性增长,为最坏情况。而符号下降虽也依赖维度,但其迭代次数仅随维度平方根增长,因此在大规模词汇量下具有显著优势。
原文摘要 · Abstract (English)
Recent works have highlighted optimization difficulties faced by gradient descent in training the first and last layers of transformer-based language models, which are overcome by optimizers such as Adam. These works suggest that the difficulty is linked to the heavy-tailed distribution of words in text data, where the frequency of the $k$th most frequent word $π_k$ is proportional to $1/k$, following Zipf's law. To better understand the impact of the data distribution on training performance, we study a linear bigram model for next-token prediction when the tokens follow a power law $π_k \propto 1/k^α$ parameterized by the exponent $α> 0$. We derive optimization scaling laws for deterministic gradient descent and sign descent as a proxy for Adam as a function of the exponent $α$. Existing theoretical investigations in scaling laws assume that the eigenvalues of the data decay as a power law with exponent $α> 1$. This assumption effectively makes the problem ``finite dimensional'' as most of the loss comes from a few of the largest eigencomponents. In comparison, we show that the problem is more difficult when the data have heavier tails. The case $α= 1$ as found in text data is ``worst-case'' for gradient descent, in that the number of iterations required to reach a small relative error scales almost linearly with dimension. While the performance of sign descent also depends on the dimension, for Zipf-distributed data the number of iterations scales only with the square-root of the dimension, leading to a large improvement for large vocabularies.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。