train_test_split, stratify, seed
ds.train_test_split(test_size=0.1, seed=42, stratify_by_column="label") returns a DatasetDict with train and test splits. Stratification preserves class balance — required for any classification eval that isn't a uniformly distributed dataset.
concatenate_datasets and interleave_datasets
concatenate_datasets([a, b, c]) stacks rows. interleave_datasets([a, b, c], probabilities=[0.6, 0.3, 0.1]) samples from sources at each step. The latter is the right tool when you're mixing curated + crawled data with a target ratio.