No more hard-prompts: SoftSRV prompting for synthetic data generation

Giulia DeSalvo, Jean-François Kagy, Lazaros Karydas, Afshin Rostamizadeh, Sanjiv KumarSubmission to ICLR 2025 · Rejected

TL;DR

Generating high-quality synthetic data typically requires painstaking manual "prompt engineering" with discrete text templates. SoftSRV replaces brittle hard-prompt templates with data-driven, continuous "soft prompts" trained via next-token loss on a frozen large language model (LLM). Across coding, math, and reasoning tasks, models fine-tuned on SoftSRV-generated data consistently outperform those trained on human-engineered hard-prompt baselines and closely match target data distributions.

What Problem Does This Paper Address?

Synthetic data generation has become a cornerstone for training and fine-tuning smaller language models. However, standard workflows depend heavily on human-curated hard prompts (e.g., templates with placeholders like [insert example question]). Crafting these prompts is notoriously labor-intensive, idiosyncratic, and sensitive to minor wording changes. Crucially, manual prompting does not directly optimize any data-driven objective, lacking a formal mechanism to align generations with the desired target distribution.

Methods

The authors introduce SoftSRV (Soft prompt-based Synthesis with Randomized Variation), which formulates synthetic prompt design as an optimization problem:

  1. Contextual Soft Prompting: Unlike standard prompt-tuning (which prepends continuous tokens to discrete instructions), SoftSRV feeds the frozen LLM backbone only a learned sequence of continuous embeddings $P_\theta(z)$, bypassing the discrete token embedding layer entirely.
  2. Autoencoder-Style Training: Given an example $x$ from the target training set:
  3. A frozen, lightweight encoder maps $x$ into a deliberately "lossy" sequence embedding $z = \text{emb}(x)$.
  4. A trainable module produces a conditioned soft prompt $P_\theta(z)$.
  5. The frozen LLM $H$ decodes the prompt to reconstruct sequence $x$. Standard next-token prediction loss is backpropagated to update only the prompt parameters $\theta$.
  6. Prompt Parameterizations:
  7. $\text{SS}_{\text{NSP}}$ (Non-Contextual): A single static matrix of soft tokens $P \in \mathbb{R}^{d \times t}$ (no context vector $z$).
  8. $\text{SS}_{\text{MP}k}$ (Mixture of Prompts): Learns $k$ basis prompts combined via softmax weights predicted from context $z$.
  9. $\text{SS}_{\text{MC}}$ (MLP Concatenated): An ensemble of $t$ independent MLPs that each map context $z$ to an individual soft token—the most expressive variant.
  10. Data Generation & Downstream Fine-Tuning: Conditioned soft prompts generate new questions via temperature sampling. Answers are generated using an off-the-shelf LLM, followed by deduplication and test-set n-gram decontamination (13-gram). The synthetic pairs are then used for supervised fine-tuning of a Gemma 2B model.
Target Example (x) ──► Lossy Embedder ──► Context (z) ──► SoftSRV P_θ(z) ──► Frozen LLM ──► Synthetic Text (x')
                                                                                 │
                                          Loss(x, x') ── (Backprop) ─────────────┘

Datasets

The authors evaluated SoftSRV across three diverse domains using existing benchmarks (no new benchmarks were introduced):

  • Code: MBPP (Mostly Basic Python Problems; 384 training examples), evaluated on 3-shot pass@1.
  • Math: GSM8K (Grade school math word problems; 7,473 training examples), evaluated on 5-shot pass@1.
  • Reasoning: BoolQ (Yes/no reading comprehension based on Wikipedia passages; 9,427 training examples), evaluated on binary classification accuracy.
  • External Comparison: TinyGSM, a curated, programmatic math reasoning dataset generated by GPT-3.5.

Key Insights and Ideas

  • Continuous Prompts Outperform Discrete Text: Continuous soft tokens can steer LLM generation toward specific concept subspaces far more expressively than discrete text tokens, which are constrained to fixed vocabularies.
  • Contextual Conditioning Is Critical: Moving from a non-contextual prompt ($\text{SS}_{\text{NSP}}$) to the non-linear context-dependent prompt ($\text{SS}_{\text{MC}}$) substantially boosted fine-tuning quality, showing that conditioning on lossy seed vectors allows the prompt to cover complex, multi-modal distributions.
  • Domain-Agnostic Generality: Hard-prompt baselines required extensive trial-and-error per domain (e.g., prompt iterations, explicit requests to diversify outputs). SoftSRV used identical training hyperparameters (prompt length 128, learning rate $5\times 10^{-6}$, 20k steps) across all tasks without manual intervention.

Key Results

Fine-tuning Gemma 2B on synthetic data generated by SoftSRV ($\text{SS}_{\text{MC}}$) showed clear advantages:

  • MBPP (Coding): $\text{SS}_{\text{MC}}$ reached 37.8% max pass@1, surpassing both standard hard-prompt baselines (32.6%) and models fine-tuned on the actual human training fold (31.4%).
  • GSM8K (Math): $\text{SS}_{\text{MC}}$ reached 47.8% max accuracy, beating standard hard prompts (45.6%), self-refine hard prompts (43.5%), and human train data (44.1%), performing competitively with the hand-tailored TinyGSM pipeline.
  • BoolQ (Reasoning): $\text{SS}_{\text{MC}}$ achieved 85.4% max accuracy, outperforming hard prompts (85.1%), though lagging behind human training data (87.7%).
  • Data Scaling: On BoolQ, increasing synthetic samples from 20K to 100K improved $\text{SS}_{\text{MC}}$ downstream performance 1.8× faster than hard prompting.
  • Distribution Matching (MAUVE): $\text{SS}_{\text{MC}}$ synthetic datasets matched target test distributions significantly better than hard prompts, posting MAUVE scores of 0.991 on GSM8K (vs. 0.914 for hard prompts) and 0.995 on BoolQ (vs. 0.784 for hard prompts).

Limitations and Future Work

  • Long Context / Unstructured Text: On BoolQ, where synthetic generation requires drafting lengthy passages on arbitrary topics, synthetic data did not surpass the ground-truth training set.
  • Alternative PEFT Architectures: The framework currently focuses on soft prompt matrices/MLPs; the authors note exploring Low-Rank Adaptation (LoRA) or prefix tuning as promising extensions.
  • Adaptive Sampling: Context vectors $z$ were sampled directly from the training fold. The authors suggest dynamically selecting or perturbing context vectors based on downstream model errors to adaptively generate targeted data.

Summary updated

Abstract

We present a novel soft-prompt based framework, SoftSRV, that leverages a frozen pre-trained large language model (LLM) to generate targeted synthetic text sequences. Given a sample from the target distribution, our proposed framework uses data-driven loss minimization to train a parameterized ``variable'' soft-prompt. This soft-prompt is then used to steer the frozen LLM to generate synthetic sequences that are similar to the target distribution. We argue that SoftSRV provides a practical improvement over common hard-prompting approaches that rely on human-curated prompt-templates, which can be idiosyncratic, labor intensive to craft, and may need to be specialized per domain. We empirically evaluate SoftSRV and other baselines, using a frozen large decoder-only model to generate synthetic fine-tuning data for a small Gemma model. To test generality, we evaluate across three different domains (coding, math, reasoning) without any particular specialization to each domain. In this challenging setting, SoftSRV significantly improves upon hard-prompt baselines, generating data with superior fine-tuning performance and that better matches the target distribution according to the {\sc mauve} similarity metric.
BibTeX
@inproceedings{desalvo2025no,
  author = {Giulia DeSalvo and Jean-François Kagy and Lazaros Karydas and Afshin Rostamizadeh and Sanjiv Kumar},
  title = {{No more hard-prompts: SoftSRV prompting for synthetic data generation}},
  booktitle = {SynthData @ ICLR},
  year = {2025},
  url = {https://openreview.net/forum?id=Nd2Ml58XwC},
}
Figure