Abstract
Recent advancements in large language models (LLMs) have significantly enhanced their knowledge and generative capabilities, leading to a surge of interest in leveraging LLMs for high-quality data synthesis. However, synthetic data generation via prompting LLMs remains challenging due to LLMs’ limited understanding of target data distributions and the complexity of prompt engineering, especially for structured formatted data. To address these issues, we introduce DiffLM, a controllable data synthesis framework based on variational autoencoder (VAE), which further (1) leverages diffusion models to reserve more information of original distribution and format structure in the learned latent distribution and (2) decouples the learning of target distribution knowledge from the LLM’s generative objectives via a plug-and-play latent feature injection module. As we observed significant discrepancies between the VAE’s latent representations and the real data distribution, the latent diffusion module is introduced into our framework to learn a fully expressive latent distribution. Evaluations on seven real-world datasets with structured formatted data (i.e., Tabular, Code, and Tool data) demonstrate that DiffLM generates high-quality data, with performance on downstream tasks surpassing that of real data by 2%–7% in certain cases.
Introduction
Synthetic data is becoming essential for training machine learning models, especially when real data is scarce, expensive, or privacy-restricted. While LLMs excel at general text generation, they often struggle to produce structured data—such as tabular records, code, or API descriptions—that accurately reflects the statistical distribution of real-world datasets. Standard prompting often fails to capture global distributions, while fine-tuning can lead to catastrophic forgetting or data memorization. DiffLM addresses these challenges by decoupling the learning of a dataset's distribution from the text generation process.
Methodology
The DiffLM framework utilizes a novel architecture that combines Variational Autoencoders (VAEs), latent diffusion models, and frozen Large Language Models (LLMs).
- VAE-based Representation Learning: A trainable encoder (e.g., BERT) compresses structured text into a continuous latent space.
- Latent Space Diffusion: To address the "holes" often found in standard VAE latent spaces, a continuous diffusion model is trained on the latent space itself. This ensures that any sampled point resides on the manifold of real data features.
- Latent Feature Injection: A Multi-Layer Perceptron (MLP) maps these denoised latent vectors into "soft prompt" token embeddings.
- Frozen LLM Decoding: These soft prompts steer a frozen LLM (such as Mistral-v0.3) to generate the final structured text. By keeping the LLM frozen, the system preserves the model's pre-trained world knowledge while forcing it to adhere to the target distribution.
Experimental Results
DiffLM was evaluated across three distinct domains: tabular data (UCI benchmarks), code generation (Flytech), and tool generation (ToolBench).
Tabular Data Performance
DiffLM consistently outperformed existing LLM-based synthetic generators like GReaT. On the Default dataset, an XGBoost classifier trained on DiffLM-generated data achieved a Machine Learning Efficiency (MLE) score of 0.794, notably surpassing the 0.770 score achieved by a model trained on the original real-world data.
Code and Tool Generation
In code generation tasks, pre-training a base Mistral-7B model on DiffLM’s synthetic data improved its zero-shot pass@1 score on HumanEval to 35.37%, a 7% increase over the base model. For tool generation, human evaluators preferred DiffLM’s synthetic API descriptions over real-world data 88% of the time, citing superior clarity and completeness.
Conclusion
By decoupling distribution learning from text generation, DiffLM allows LLMs to act as high-fidelity decoders for complex data structures. The integration of latent diffusion effectively bridges the gap between compressed representations and realistic sampling. Future work will focus on scaling this framework to larger models and exploring its utility in low-resource domain adaptation through automated data flywheels.
Summary updated