HyperAIHyperAI

Command Palette

Search for a command to run...

Best Paper Runner-UpNeurIPS 2024

사전학습에 필요한 것은 모든 토큰이 아니다

초록

기존 언어 모델 사전학습 방법은 모든 학습 토큰에 대해 균일하게 다음 토큰 예측 손실을 적용해 왔다. 본 연구는 이러한 관행에 도전하며, "코퍼스 내 모든 토큰이 언어 모델 학습에 동일하게 중요한 것은 아니다"라는 가설을 제시한다. 초기 분석에서는 언어 모델의 토큰 수준 학습 동역학을 조사하여 서로 다른 토큰에 대해 상이한 손실 패턴이 존재함을 확인하였다. 이러한 통찰을 바탕으로 새로운 언어 모델 RHO-1을 제안한다. 코퍼스의 모든 다음 토큰을 예측하도록 학습하는 전통적 언어 모델과 달리, RHO-1은 선택적 언어 모델링(Selective Language Modeling, SLM)을 적용하여 원하는 분포와 부합하는 유용한 토큰만을 선택적으로 학습한다. 이 접근법은 참조 모델을 사용하여 토큰을 채점한 후, 더 높은 점수를 받은 토큰에 대해 집중된 손실로 언어 모델을 학습하는 방식으로 이루어진다. 15B OpenWebMath 코퍼스에서 연속 사전학습을 수행한 결과, RHO-1은 9개의 수학 태스크에서 few-shot 정확도를 최대 30%까지 절대 향상시켰다. 파인튜닝 이후 RHO-1-1B와 7B는 MATH 데이터셋에서 각각 40.6%와 51.8%의 최신 최고 성능을 달성하였는데, 이는 사전학습 토큰의 단 3%만을 사용하여 DeepSeekMath에 필적하는 결과이다. 또한 80B 일반 토큰에서 연속 사전학습을 수행한 경우, 15개의 다양한 태스크에서 평균 6.8%의 성능 향상을 달성하여 언어 모델 사전학습의 데이터 효율성과 성능을 모두 향상시켰다.

One-sentence Summary

Researchers from Xiamen University, Tsinghua University, and Shanghai AI Laboratory propose RHO-1, a language model that diverges from uniform next-token prediction by introducing Selective Language Modeling (SLM), which uses a reference model to score and filter tokens for focused loss computation, achieving up to 30%30\%30% absolute improvement on 9 math tasks and state-of-the-art MATH results matching DeepSeekMath with only 3%3\%3% of the pretraining tokens.

Key Contributions

  • Token-level analysis of pretraining dynamics shows that substantial loss reduction occurs mainly on selected tokens, while many easy tokens and difficult tokens can cause inefficient gradient updates.
  • RHO-1 introduces Selective Language Modeling, in which a reference model scores tokens according to a desired distribution and the target model is trained with a focused loss only on tokens with high reference-model scores or large excess loss.
  • Math continual pretraining on the 15B OpenWebMath corpus yields absolute few-shot accuracy gains up to 30% across 9 math tasks, and fine-tuned RHO-1-1B and 7B reach 40.6% and 51.8% on MATH, with RHO-1-7B matching DeepSeekMath using 3% of its pretraining tokens. General continual pretraining on 80B tokens improves average results across 15 tasks by 6.8%, and self-referencing yields up to 3.3% gains without high-quality reference data.

Introduction

Large language models improve by scaling parameters and data, but training on all available tokens is neither always optimal nor feasible. Existing data filtering often works at the document level, yet high-quality corpora can still contain noisy, ambiguous, or poorly aligned tokens that add ineffective gradient updates and limit learning. Prior work also struggles with balancing token removal against preserving meaning and useful data.

The authors analyze token-level training dynamics and show that loss reduction is concentrated in a subset of informative tokens, while many easy tokens are already learned and hard tokens may resist convergence. They introduce Selective Language Modeling, or SLM, which uses a reference model to score tokens and then trains on tokens with high excess loss, focusing updates on tokens most beneficial for downstream tasks. This approach improves token efficiency and performance, especially in math continual pretraining and general continual pretraining.

Method

The proposed method is built around a token-level observation: during standard causal language modeling, different tokens do not contribute equally to learning. The authors first examine how token-level losses evolve during pretraining. They continue training a small language model on a large corpus and repeatedly evaluate losses on a validation set. Refer to the figure below:

The training trajectories separate tokens into four behavioral categories. Some tokens remain persistently low loss, indicating they have already been learned. Others start with high loss and reduce significantly, meaning they still provide meaningful learning signal. A smaller group remains persistently high loss, which may reflect ambiguous or intrinsically uncertain content. Another group initially has low loss but increases during training, suggesting unstable optimization or noisy supervision. Moreover, many tokens show fluctuating losses rather than smooth convergence, which can cause inefficient gradient updates if all tokens receive equal training weight. This motivates a selective training objective that emphasizes tokens with richer learnable signal and suppresses tokens that are already learned, irrelevant, or noisy.

To operationalize this insight, the authors propose Selective Language Modeling, a three-step training pipeline that uses a reference model to guide token selection during language model pretraining. The framework diagram is shown below:

The first step is reference modeling. A reference model is trained on a curated high-quality corpus that represents the desired data distribution. This reference model acts as a scoring module rather than the final deployment model. For each token xix_ixi​ in a target pretraining corpus, the reference model computes a reference loss based on the probability it assigns to the token under the previous context x<ix_{<i}x<i​:

LRM(xi)=−log⁡P(xi∣x<i).\mathcal{L}_{\mathrm{RM}}(x_i) = -\log P(x_i \mid x_{<i}).LRM​(xi​)=−logP(xi​∣x<i​).

This reference loss captures how well the desired distribution supports the token. Low reference loss generally indicates tokens that are consistent with high-quality training data, while poorly supported tokens may reflect noise, ambiguity, or distribution mismatch.

The second step is token scoring. The trained reference model evaluates every token in the pretraining corpus, producing a reference-loss profile for the full training data. During active pretraining, the training model also computes its own token-level loss Lθ(xi)\mathcal{L}_{\theta}(x_i)Lθ​(xi​) under parameters θ\thetaθ. The method then computes an excess loss for each token:

LΔ(xi)=Lθ(xi)−LRM(xi).\mathcal{L}_{\Delta}(x_i) = \mathcal{L}_{\theta}(x_i) - \mathcal{L}_{\mathrm{RM}}(x_i).LΔ​(xi​)=Lθ​(xi​)−LRM​(xi​).

This excess loss measures the gap between what the current training model predicts and what the reference model expects. Tokens with high excess loss are treated as more useful learning targets because they may still require adaptation while also being relevant to the reference distribution. Tokens with low excess loss are down-weighted or excluded, which reduces unnecessary updates on already learned or uninformative tokens.

The third step is selective pretraining. Instead of applying the standard causal language modeling loss uniformly to all tokens, the model optimizes cross-entropy only over a selected subset of high-scoring tokens. Given a batch with sequence length NNN and a selection ratio k%k\%k%, the Selective Language Modeling loss is:

LSLM(θ)=−1N⋅k%∑i=1NIk%(xi)log⁡P(xi∣x<i;θ),\mathcal{L}_{\mathrm{SLM}}(\theta) = -\frac{1}{N \cdot k\%} \sum_{i=1}^{N} I_{k\%}(x_i)\log P(x_i \mid x_{<i};\theta),LSLM​(θ)=−N⋅k%1​i=1∑N​Ik%​(xi​)logP(xi​∣x<i​;θ),

where the indicator function is

Ik%(xi)={1,if xi ranks in the top k% by S(xi),0,otherwise.I_{k\%}(x_i) = \begin{cases} 1, & \text{if } x_i \text{ ranks in the top } k\% \text{ by } S(x_i), \\ 0, & \text{otherwise}. \end{cases}Ik%​(xi​)={1,0,​if xi​ ranks in the top k% by S(xi​),otherwise.​

By default, the score function S(xi)S(x_i)S(xi​) is the excess loss LΔ(xi)\mathcal{L}_{\Delta}(x_i)LΔ​(xi​). In practice, tokens in each batch can be ranked by this score, and only the top k%k\%k% tokens contribute to the gradient. The full input sequence is still processed by the model, but the loss is masked away from tokens deemed less beneficial. This design preserves the context needed for autoregressive modeling while focusing optimization effort on the most informative token targets.

Experiment

The experiments evaluate selective language modeling through continual pretraining on both mathematical and general corpora, comparing against directly pretrained baselines and strong public models across few-shot reasoning, fine-tuning, and broad benchmark tasks. In mathematical training, the method improves chain-of-thought and tool-integrated reasoning while demonstrating efficient data use and some transfer to unseen tasks; in general training, it also yields broader benchmark gains, especially in code and math. Additional self-reference and ablation studies validate that the approach can select informative tokens without external high-quality data, that selected-token losses better track downstream performance, and that the method primarily retains relevant, high-learning-value tokens.

Few-shot CoT evaluations show that RHO-1-Math improves math reasoning accuracy over direct continued pretraining, with the clearest gains in smaller 1B models. Additional epochs on OpenWebMath further raise average accuracy. RHO-1-7B reaches performance comparable to much larger-token baselines while using far fewer selected math tokens. RHO-1-Math improves few-shot CoT accuracy over direct continued pretraining, with stronger gains for 1B models. Training on OpenWebMath for multiple epochs further raises average performance. RHO-1-7B reaches comparable few-shot results to DeepSeekMath-7B with a much smaller selected token budget.

Tool-integrated fine-tuning improves math reasoning performance, with the RHO-1 models achieving strong MATH accuracy at both 1B and 7B scales. Models using external tools and larger parameter counts tend to show stronger average results across the listed math tasks. RHO-1 also shows some generalization to unseen math tasks, with clearer relative gains for the 1B model than the 7B model. RHO-1 reaches strong MATH accuracy at both small and mid-sized model scales. Tool use and larger model size are associated with better overall math-reasoning performance.

A reference model trained only on OpenWebMath can guide further pretraining on the same corpus and improve average downstream math reasoning scores while using fewer training tokens. Selecting tokens with both reference-model loss and next-token entropy gives stronger gains than either score alone, and the same OWM-trained reference model also improves training on Proof-Pile-2 with fewer tokens. OWM-trained reference model improves OWM pretraining with less token training Entropy-only scoring yields gains similar to reference-model loss Intersection of loss and entropy selection gives best OWM average performance OWM-trained reference model also improves Proof-Pile-2 pretraining with fewer tokens

The experiments evaluate RHO-1 through few-shot chain-of-thought reasoning, tool-integrated fine-tuning, and reference-guided token selection for continued pretraining. These results validate that math-focused data selection improves reasoning over direct continued pretraining, with clearer benefits for smaller models, while tool use and larger model scales further strengthen performance. They also show that a reference model trained on OpenWebMath can guide more effective pretraining, especially when combining loss and entropy selection, and that the approach remains useful across related math corpora.


AI로 AI 구축

아이디어에서 출시까지 — 무료 AI 코코딩, 즉시 사용 가능한 환경, 최적의 GPU 가격으로 AI 개발을 가속화하세요.

AI 협업 코딩
바로 사용 가능한 GPU
최적의 가격

HyperAI Newsletters

최신 정보 구독하기
한국 시간 매주 월요일 오전 9시 에 이번 주의 최신 업데이트를 메일로 발송합니다
이메일 서비스 제공: MailChimp