# How to generate synthetic data for machine learning To generate synthetic data for training a machine learning model, start with the task, label definition and cases you need more of. Reserve a real test set first, generate only for the training set, and compare models on the same untouched test data. [Read this guide on Ground](https://useground.dev/guides/synthetic-data-for-machine-learning) ## A practical workflow Describe the dataset you need, including the label and how often each class occurs, or upload your training table and ask for more rows. Check the result in the editor before you download it. 1. Reserve a real holdout before you add synthetic rows. 2. Describe the dataset, or upload the training portion and ask for more rows. 3. Check the label mix and the columns that drive it. 4. Compare real-only, synthetic-only and mixed training on the real holdout. ## Work through a rare-event example The Northwind Card export pairs 89,204 transactions with their outcomes. It has 825 confirmed fraud rows, including 181 marked as card testing. Join on transactions_id and check the label counts before fitting a model. For prediction at authorization time, keep only fields available at that time. Exclude dispute status, fraud sequence and other outcomes from the features. Split by customer or time to match your actual decision and measure utility on a real holdout. - [Inspect the Northwind Card dataset](https://useground.dev/examples/northwind-card) - [Download and verify the Northwind Card recipe](https://useground.dev/examples/northwind-card/recipe.md) ## Measure on real data Train one model on real data and one on real plus synthetic data. Evaluate both on the same untouched real holdout. For a rare class, report precision and recall alongside overall results, and compare performance on the cases you generated to fill. If a customer or account has multiple records, split by that entity before generation so examples for the same entity stay on one side of the evaluation. For a forecast, split by time and keep future evidence outside the training data. - [Evaluate synthetic data quality](https://useground.dev/guides/evaluate-synthetic-data-quality) ## Training an LLM calls for task examples Fine-tuning examples pair a task input with a target response. Preference data pairs the same input with a chosen and rejected response. Check that the response is supported by the input and that the exported format matches your trainer. - [Generate synthetic LLM training data](https://useground.dev/guides/llm-fine-tuning-datasets) ## Common questions ### Does synthetic data always improve a model? No. Measure it for your task on real held-out data. ### Are my uploaded rows changed? No. When you extend an upload, your original rows are kept exactly as uploaded and new rows are added beside them. ## Related guides - [How to generate synthetic data](https://useground.dev/guides/generate-synthetic-data): Generate synthetic data by defining what each record represents, which relationships must hold and how you will check the output. Start from a prompt when you need new records, or start from existing data when you need to retain patterns from a source. [Markdown](https://useground.dev/guides/generate-synthetic-data/guide.md). - [What is synthetic data?](https://useground.dev/guides/what-is-synthetic-data): Synthetic data is made-up data with the structure and behavior of real data. Ground builds tabular datasets, often several related tables, from a plain-language request, or adds rows and columns to a table you upload. [Markdown](https://useground.dev/guides/what-is-synthetic-data/guide.md). - [How to evaluate synthetic data quality](https://useground.dev/guides/evaluate-synthetic-data-quality): Evaluate synthetic data at four levels: each value is valid, each row is consistent, combinations are plausible, and the dataset has the right mix of common and rare cases. Then measure it on the task you need it for. [Markdown](https://useground.dev/guides/evaluate-synthetic-data-quality/guide.md). - [How to generate synthetic training data for LLM fine-tuning](https://useground.dev/guides/llm-fine-tuning-datasets): To generate synthetic training data for an LLM, define a task and generate varied inputs with verified reference answers. Use input–answer examples for supervised fine-tuning or chosen–rejected answers for preference training. Check the export against your trainer and evaluate the fine-tuned model on held-out tasks. [Markdown](https://useground.dev/guides/llm-fine-tuning-datasets/guide.md).