Skip to main content
QUICK REVIEW

[Paper Review] Data Selection for Language Models via Importance Resampling

Sang Michael Xie, Shibani Santurkar|arXiv (Cornell University)|Feb 6, 2023
Natural Language Processing TechniquesComputer Science16 citations
TL;DR

The paper introduces DSIR, a scalable framework that selects pretraining data by estimating importance weights in a reduced feature space (hashed n-grams) and resampling accordingly to match a target distribution, improving downstream performance over random or heuristic baselines.

ABSTRACT

Selecting a suitable pretraining dataset is crucial for both general-domain (e.g., GPT-3) and domain-specific (e.g., Codex) language models (LMs). We formalize this problem as selecting a subset of a large raw unlabeled dataset to match a desired target distribution given unlabeled target samples. Due to the scale and dimensionality of the raw text data, existing methods use simple heuristics or require human experts to manually curate data. Instead, we extend the classic importance resampling approach used in low-dimensions for LM data selection. We propose Data Selection with Importance Resampling (DSIR), an efficient and scalable framework that estimates importance weights in a reduced feature space for tractability and selects data with importance resampling according to these weights. We instantiate the DSIR framework with hashed n-gram features for efficiency, enabling the selection of 100M documents from the full Pile dataset in 4.5 hours. To measure whether hashed n-gram features preserve the aspects of the data that are relevant to the target, we define KL reduction, a data metric that measures the proximity between the selected pretraining data and the target on some feature space. Across 8 data selection methods (including expert selection), KL reduction on hashed n-gram features highly correlates with average downstream accuracy (r=0.82). When selecting data for continued pretraining on a specific domain, DSIR performs comparably to expert curation across 8 target distributions. When pretraining general-domain models (target is Wikipedia and books), DSIR improves over random selection and heuristic filtering baselines by 2-2.5% on the GLUE benchmark. Code is available at https://github.com/p-lambda/dsir.

Motivation & Objective

  • Formalize data selection as choosing a subset of a large unlabeled dataset to match a target distribution
  • Develop a scalable method to estimate importance weights in a tractable feature space
  • Demonstrate that hashed n-gram features preserve target-relevant information for data selection
  • Show DSIR’s effectiveness in domain-specific continued pretraining and general-domain LM pretraining
  • Introduce KL reduction as a metric linking feature-space fidelity to downstream performance

Proposed method

  • Map raw and target data into a feature space via h, creating q_feat and p_feat
  • Estimate importance weights w_i = p_feat(z_i) / q_feat(z_i) for each raw example z_i = h(x_i)
  • Resample k examples without replacement from the raw data according to normalized weights
  • Instantiate DSIR with hashed n-gram features (m buckets, e.g., m=10000) and bag-of-ngrams model parameters gamma
  • Estimate feature distributions by counting hashed bucket frequencies to obtain gamma_hat
  • Demonstrate scalability by selecting 100M documents from The Pile in 4.5 hours on 1 CPU node; measure KL reduction as a proxy for target similarity

Experimental results

Research questions

  • RQ1Can importance resampling in a reduced feature space effectively select pretraining data that matches a target distribution?
  • RQ2Do hashed n-gram features preserve the information needed to choose data relevant to the downstream target?
  • RQ3Does DSIR improve downstream performance compared to random selection and heuristic filtering in domain-specific continued pretraining and general-domain pretraining?
  • RQ4Is KL reduction a reliable cheap proxy for downstream performance across data selection methods?
  • RQ5How does target-domain alignment affect transfer when pretraining data is selected for one target and evaluated on another?

Key findings

  • DSIR improves over random selection and heuristic baselines in domain-specific continued pretraining by about 2% on average (F1 across 8 datasets) and is comparable to manual curation.
  • For general-domain pretraining, DSIR improves GLUE performance by 2–2.5% on average over baselines.
  • Hashed n-gram features enable selecting 100M documents from The Pile in 4.5 hours, with most time spent computing importance weights.
  • KL reduction on hashed n-grams correlates strongly with downstream performance (Pearson r = 0.82).
  • Discriminative DSIR variants underperform generative DSIR; unigram+bigram (hashed) features outperform unigram-only versions.
  • DSIR enables automatic data selection that can substitute manual curation in many settings; quality filters and compute budget control the results.
  • Within-domain pretraining transfers better than cross-domain pretraining when selecting data with DSIR (average improvement about 1.7%).

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.