actively maintained (master) repo: https://github.com/brando90/beyond-scale-div-coeff — this original repo and the brando90/beyond-scale-language-data-diversity fork are both outdated
This repository contains the original (now outdated) implementation of the Task2Vec Diversity Coefficient (the official, maintained implementation lives in brando90/beyond-scale-div-coeff) from the following paper:
Beyond Scale: The Diversity Coefficient as a Data Quality Metric for Variability in Natural Language Data. Brando Miranda, Alycia Lee, Sudharsan Sundar, Allison Casasola, Rylan Schaeffer, Elyas Obbad, Sanmi Koyejo. Published as a workshop paper in the Data-centric Machine Learning Research (DMLR) Workshop, ICLR 2024. Paper: https://arxiv.org/abs/2306.13840
This repository also contains code for generating GINC datasets and computing the Diversity Coefficient of those datasets (see ginc/).
diversity/ contains the Task2Vec diversity coefficient computation for natural language data. See Quick-start for a tutorial on computing the diversity coefficient for a language dataset. Run diversity/runner.sh to compute Task2Vec embeddings and diversity coefficient for c4, WikiText-103, and The Pile.
When cloning your main repository in the future, you will need to initialize the submodules as well by using:
cd ~
git clone --recurse-submodules git@github.com:brando90/beyond-scale-language-data-diversity.gitIf you forget to use --recurse-submodules, you can still initialize the:
git clone https://github.com/alycialee/beyond-scale-language-data-diversity.git
cd ~/beyond-scale-language-data-diversity
git submodule update --init --recursiveNote: to push the changes to submodule cd there and do git cmds there. In the main repo folder to do git pushes/edits to the main repo code.
For all experiments including the ginc data set:
ginc/ contains Generative In-Context learning Dataset from the original GINC repo.
Run ginc/runner_generate.sh to generate GINC datasets with varying number of HMMs and number of symbols.
Run ginc/runner_train.sh to train GPT-2 Transformers on GINC datasets using wandb.
Create conda env:
conda create -n beyond_scale_div_coeff python=3.11 -y
# conda activatexport HOME=/data/
conda activate beyond_scale_div_coeff
pip install -e ~/beyond-scale-language-data-diversity
# conda remove --name beyond_scale_diiv_coeff --allCreate venv python environment:
deactivate
# mkdir ~/.virtualenvs
ls ~/.virtualenvs
python3.11 -m venv ~/.virtualenvs/beyond_scale_div_coeff
source ~/.virtualenvs/beyond_scale_div_coeff/bin/activate
pip install --upgrade pip
which python
pip install -e ~/beyond-scale-language-data-diversityWe acknowledge that code in ginc/ was sourced from the original GINC repo.
We thank Rylan Schaeffer for his contributions to updating the scripts in ginc/ for ease of usage.
If you found this repo useful, please cite
@misc{miranda2025scalediversitycoefficientdata,
title={Beyond Scale: The Diversity Coefficient as a Data Quality Metric for Variability in Natural Language Data},
author={Brando Miranda and Alycia Lee and Sudharsan Sundar and Allison Casasola and Rylan Schaeffer and Elyas Obbad and Sanmi Koyejo},
year={2025},
eprint={2306.13840},
archivePrefix={arXiv},
primaryClass={cs.CL},
url={https://arxiv.org/abs/2306.13840},
note={Published as a workshop paper in the Data-centric Machine Learning Research (DMLR) Workshop, ICLR 2024},
}