Forcing Diffuse Distributions out of Language Models

Yiming Zhang, Avi Schwarzschild, Nicholas Carlini, J Zico Kolter, Daphne Ippolito

TL;DR

Large language models (LLMs) struggle to generate truly random or diverse outputs, often exhibiting strong biases. This paper introduces a fine-tuning method that trains LLMs to produce diffuse probability distributions over valid choices, significantly improving output diversity without sacrificing generation quality. This advancement is crucial for applications like synthetic dataset generation, making LLMs more practical for these tasks.

What Problem Does This Paper Address?

Instruction-tuned LLMs, despite being designed to follow user commands, exhibit a surprising deficiency: they are poor at generating random or diverse outputs. For instance, when asked to pick a number between 1 and 10, models like Llama-2 disproportionately favor the number five. Similarly, when asked for a random name, Mistral-7B-Instruct heavily favors "Avery." This lack of diffuse output distributions is a major bottleneck for applications requiring variety, such as generating synthetic datasets for training other models or for creative content generation. The paper aims to bridge this gap by enabling LLMs to produce genuinely diverse and unbiased outputs when requested.

Methods

The core contribution is a fine-tuning method designed to encourage LLMs to output diffuse probability distributions over valid choices. The approach is framed as distribution matching, where the goal is to align the model's output distribution with a desired, diffuse target distribution.

For tasks where the set of valid outputs and their ground truth distribution are known (e.g., random number generation), the method optimizes the cross-entropy loss between the model's predictions and the target distribution. This is equivalent to minimizing the KL-divergence between the model and the ground truth distribution.

For more complex scenarios where the ground truth distribution is unknown or difficult to enumerate (e.g., synthetic biography generation), the method uses a sample of data to approximate the ground truth distribution.

The fine-tuning is performed using LoRA (Low-Rank Adaptation), a parameter-efficient technique that allows for effective fine-tuning of large LLMs with significantly reduced computational resources. This approach trains only a small number of additional parameters, making the process more scalable.

Datasets

The paper evaluates its method on several tasks and uses various datasets implicitly or explicitly:

  • Random Number Generation (RNG): The target distribution is a uniform distribution over a specified range (e.g., 1-10).
  • Baby Names (BABYNAMES): The target distribution is derived from actual baby name data (specifically, US Social Security Administration data for 2022).
  • Synthetic Biographies: For training, a sample of 200 baby names was used. For evaluation, a dataset of fictional biographies was generated, including attributes like first name, last name, gender, birth year, birth place, and profession.
  • Leave-One-Out Generalization Tasks: A set of six tasks were used: BABYNAMES, COUNTRIES, FRUITS, DAYS AND DATES, NUMBERS, and OCCUPATIONS.
  • MT-Bench: Used for evaluating the general capabilities of the fine-tuned models.

No new benchmarks were introduced; rather, existing tasks and datasets were adapted to evaluate the diversity of LLM outputs.

Key Insights and Ideas

  • LLMs have a strong bias towards non-diffuse outputs: Even with explicit instructions for randomness, state-of-the-art LLMs exhibit significant biases, favoring certain outputs over others. This is a fundamental limitation, not just a prompt engineering issue.
  • Fine-tuning can effectively teach diversity: The proposed distribution matching fine-tuning method can successfully train LLMs to produce diffuse distributions, significantly increasing output diversity.
  • Generalization is a key benefit: Models fine-tuned for diffuse outputs on one set of tasks demonstrate strong generalization capabilities to unseen tasks and distributions, even those with very different sample spaces. This suggests that learning to be "random" is a transferable skill.
  • Parameter-efficient fine-tuning is sufficient: LoRA is effective for this task, making it practical to fine-tune large models for diversity without prohibitive computational costs.
  • Improved diversity enhances synthetic data generation: The method dramatically increases the diversity of generated synthetic biographies, making them more useful for downstream tasks and reducing the need for extensive human curation.

Key Results

  • Random Number Generation: Fine-tuned models achieved near-uniform distributions with full coverage and significantly higher entropy compared to baselines.
  • Baby Names: Fine-tuned models showed a substantial increase in coverage and entropy, with a significant portion of generated names being outside the training set.
  • Synthetic Biographies:
    • The fine-tuned model generated four times as many unique first names, three times as many unique birth places, and 1.5 times as many unique careers compared to the baseline.
  • Biases were significantly reduced; for example, the frequency of the name "Evelyn" decreased by 25X, and the birth year 1985 by over 3X.
  • Coverage for categorical attributes increased substantially (e.g., birth year coverage increased from 26 to 67 for the ID-tuned model).
  • Generalization: In leave-one-out experiments, fine-tuned models consistently showed higher entropy across various tasks (e.g., BABYNAMES, COUNTRIES, FRUITS) compared to baselines, even when the task was excluded from the fine-tuning set.
  • General Capabilities: Evaluation on MT-Bench showed minimal differences between baseline and fine-tuned models, indicating that the diversity optimization does not negatively impact general reasoning or instruction-following abilities.

Limitations and Future Work

  • Structured Output Space Assumption: The current method requires access to a set of valid output sequences, making it less directly applicable to truly open-ended generation tasks where the number of targets is practically infinite.
  • Task-Specific Tuning vs. Generalization: While generalization is strong, there can still be sizable generalization gaps between in-distribution and out-of-distribution entropy for certain tasks, suggesting that task-specific tuning remains beneficial when feasible.
  • Future Work:
    • Exploring the limits of the approach for improving diversity in open-ended generation.
  • Applying the method to debias language models by aligning them with ideal distributions of representative instances.
  • Investigating diversity-inducing discrete prompts for closed-source models.

Summary updated

BibTeX
@inproceedings{zhang2024forcing,
  author = {Yiming Zhang and Avi Schwarzschild and Nicholas Carlini and J Zico Kolter and Daphne Ippolito},
  title = {{Forcing Diffuse Distributions out of Language Models}},
  booktitle = {COLM},
  year = {2024},
  url = {https://openreview.net/forum?id=9JY1QLVFPZ},
}
Figure