Which Long Documents Matter? A Controlled Study of Data Selection for Context Extension
Organizations: Hunyuan Team, Tencent
Abstract
Natural long documents are widely used for context extension, but which selection pipelines are effective remains unclear. We conduct a controlled comparison on Qwen2.5-3B at 128K under matched 6B-token continued-training budgets. Random sampling of natural long documents (random-long) outperforms repacking at longer evaluation lengths. Within the same candidate pool, selecting documents with high LongPPL key-token density yields further gains, unlike the evaluated generic-quality and LLM-judge selectors. We introduce truncLongPPL to reduce scoring cost by computing key-token density over a truncated prefix. At 128K, scoring the first half of the reference span yields downstream performance close to full-span scoring with a measured end-to-end scoring speedup. Across three training seeds, truncLongPPL achieves the highest mean scores among evaluated pipelines, exceeding random-long by 4.54 points on validation HELMET and 3.28 on held-out RULER, with gains most consistent in retrieval. At a 256K target context, it gains 2.82 average RULER points over random-long on Qwen2.5-3B. In short/long mixed training across Qwen2.5-3B, Qwen3-8B, and OLMo3-7B, it gains 1.47--7.31 average RULER points over random-long mixing, with seven-task short-context averages within 0.23 points of the corresponding baselines. After supervised fine-tuning (SFT), Qwen3-8B and OLMo3-7B models trained with selected long documents outperform their random-long counterparts by 1.13--1.67 points on LongBench v2 and 0.62--1.44 points on MRCR.
Figures & tables
| Study | Backbone | Context | Tokens | Data setting |
|---|---|---|---|---|
| Controlled comparison | Qwen2.5-3B | 128K | 6B | Controlled pipelines |
| Length extension | Qwen2.5-3B | 128K / 256K | 6B | Natural long |
| Mixture validation | Qwen2.5-3B | 128K | 10B | Mixed, 66/34 |
| Cross-model validation | Qwen3-8B | 256K | 20B | Mixed, 66/34 |
| Cross-model validation | OLMo 3-7B | 256K | 20B | Mixed, 66/34 |
| 128K training | 256K training | ||
|---|---|---|---|
| Selection pipeline | RULER | RULER | RULER 256K |
| random-long | 75.81 | 62.91 | |
| LongFilter | 77.25 | 65.75 | |
| truncLongPPL | 78.63 | 67.05 | |
| Configuration | Short | RULER | RULER 256K |
|---|---|---|---|
| dolma3-short | 63.42 | 83.72 | 67.39 |
| random-long | 63.42 | 85.61 | 73.12 |
| truncLongPPL | 63.46 | 87.08 | 77.20 |
| Configuration | Short | RULER | RULER 256K |
|---|---|---|---|
| dolma3-short | 62.11 | 60.60 | 43.73 |
| random-long | 61.65 | 65.68 | 53.06 |
| truncLongPPL | 61.42 | 72.99 | 55.94 |
| Configuration | Overall | Short | Medium | Long |
|---|---|---|---|---|
| dolma3-short | 33.20 | 42.93 | 28.67 | 25.93 |
| random-long | 33.87 | 43.33 | 28.67 | 28.43 |
| truncLongPPL | 35.00 | 42.60 | 30.53 | 31.20 |
| Configuration | Overall | 2-needle | 4-needle | 8-needle |
|---|---|---|---|---|
| dolma3-short | 24.59 | 37.93 | 19.99 | 15.87 |
| random-long | 24.99 | 38.11 | 20.61 | 16.26 |
| truncLongPPL | 25.61 | 39.15 | 20.78 | 16.90 |
Appendix figures & tables18 assets
Supplementary material from the paper’s appendix.
Appendix
| Method | Document signal | Selection rule or construction |
|---|---|---|
| Scoring-free constructions | ||
| repack | None | Pack documents into 128K sequences following the repacking strategy of MAI-Thinking-1; documents may be concatenated. |
| random-long (random in figures) | None | Uniformly sample documents from without document scoring. |
| Generic-quality selectors | ||
| PPL (top40 / mid40) | Document-level perplexity under Gemma-4-26B-A4B (base) | Select scores above the 60th percentile or between the 30th and 70th percentiles, respectively. |
| gzip (mid60) | gzip compression ratio | Select scores between the 20th and 80th percentiles. |
| HELMET | RULER | |||
|---|---|---|---|---|
| Training tokens | LongPPL-density | gzip | LongPPL-density | gzip |
| 2B | 50.41 | 49.24 | 76.67 | 75.86 |
| 4B | 50.56 | 50.36 | 77.84 | 77.55 |
| 6B | 50.40 | 50.71 | 77.91 | 77.45 |
| 8B | 50.33 | 50.68 | 77.93 | 77.72 |
| 10B | 50.54 | 51.05 | 78.15 | 78.01 |
| Threshold | Scattered | Contiguous front-half |
|---|---|---|
| 0.03 | 55.01 / 80.55 | 56.03 / 80.87 |
| 0.04 | 56.23 / 80.97 | 55.79 / 81.01 |
| 0.05 | 56.24 / 81.32 | 56.23 / 81.23 |
| 128K training | 256K training | ||
|---|---|---|---|
| Scoring configuration | RULER | RULER | RULER 256K |
| truncLongPPL ( ) | 78.01 | 66.41 | |
| truncLongPPL ( , default) | 78.63 | 67.05 | |
| Configuration | ARC-C | ARC-E | HellaSwag | LAMBADA | LogiQA | PIQA | WinoG. | Avg. |
|---|---|---|---|---|---|---|---|---|
| Base (no CT) | 45.05 | 77.36 | 55.00 | 66.89 | 29.95 | 78.24 | 68.35 | 60.12 |
| dolma3-short | 48.21 | 79.17 | 54.27 | 66.31 | 26.27 | 78.18 | 68.19 | 60.09 |
| random-long | 47.01 | 78.58 | 54.17 | 65.63 | 27.34 | 78.02 | 68.19 | 59.85 |
| truncLongPPL | 46.84 | 78.45 | 54.10 | 65.26 | 27.34 | 78.13 | 68.43 | 59.79 |
| Configuration | Short | HELMET | RULER |
|---|---|---|---|
| dolma3-short | 60.04 0.11 | 49.44 0.12 | 77.16 0.15 |
| random-long | 59.81 0.04 | 50.72 0.10 | 78.61 0.15 |
| truncLongPPL | 59.79 0.06 | 55.31 0.27 | 81.94 0.16 |
| Pipeline | HELMET | RULER |
|---|---|---|
| truncLongPPL | ||
| LongFilter | ||
| Prospector | ||
| random-long | ||
| repack | ||
| gzip (mid60) |
| HELMET | RULER | Short | ||||
|---|---|---|---|---|---|---|
| Short:long | Random | Selected | Random | Selected | Random | Selected |
| 66/34 | 50.70 | 55.30 | 78.60 | 81.90 | 59.80 | 59.80 |
| 50/50 | 51.58 | 55.42 | 79.02 | 81.70 | 59.74 | 59.86 |
| 34/66 | 49.98 | 54.35 | 78.18 | 81.36 | 59.30 | 59.31 |
| Metric | dolma3-short | random-long | truncLongPPL |
|---|---|---|---|
| Overall | 33.20 0.40 | 33.87 0.31 | 35.00 0.20 |
| Easy | 34.03 0.64 | 34.73 0.76 | 35.93 1.38 |
| Hard | 32.70 0.35 | 33.33 0.50 | 34.40 0.60 |
| Short | 42.93 0.64 | 43.33 0.55 | 42.60 0.82 |
| Medium | 28.67 1.21 | 28.67 1.10 | 30.53 0.58 |
| Long | 25.93 1.62 | 28.43 1.93 | 31.20 3.26 |
| Metric | dolma3-short | random-long | truncLongPPL |
|---|---|---|---|
| Overall | 24.59 0.30 | 24.99 0.33 | 25.61 0.29 |
| 2-needle | 37.93 0.43 | 38.11 0.77 | 39.15 0.51 |
| 4-needle | 19.99 0.60 | 20.61 0.24 | 20.78 0.42 |
| 8-needle | 15.87 0.21 | 16.26 0.39 | 16.90 0.21 |
| Metric | dolma3-short | random-long | truncLongPPL |
|---|---|---|---|
| Overall | 27.27 0.42 | 27.67 0.42 | 29.33 0.31 |
| Easy | 27.93 2.12 | 29.13 1.38 | 31.40 1.21 |
| Hard | 26.90 1.23 | 26.80 0.85 | 28.10 0.46 |
| Short | 32.03 1.96 | 33.87 0.55 | 34.07 0.29 |
| Medium | 25.73 1.60 | 25.27 0.29 | 27.60 0.52 |
| Long | 22.53 1.91 | 22.20 0.90 | 25.00 0.90 |
| Metric | dolma3-short | random-long | truncLongPPL |
|---|---|---|---|
| Overall | 13.02 0.18 | 13.73 0.27 | 15.16 0.26 |
| 2-needle | 17.99 0.42 | 18.72 1.13 | 22.03 0.83 |
| 4-needle | 11.55 0.34 | 11.93 0.29 | 12.68 0.34 |
| 8-needle | 9.54 0.31 | 10.54 0.47 | 10.79 0.58 |
Training Data Selection
Training data selection studies how to choose, filter, weight, or schedule examples to improve learning while reducing data and compute costs.
See all 187 papers