# An Invariant Learning Characterization of Controlled Text Generation

Source: [An Invariant Learning Characterization of Controlled Text Generation](<https://www.sota2.com/research/paper/68fa6f8c1e209131cea4629a>)

Collection index: [llms.txt](<https://www.sota2.com/research/llms.txt>)

Data updated: 2026-01-02T02:51:34.919Z

Authors: Carolina Zheng, Claudia Shi, Keyon Vafa, Amir Feder, David M. Blei

Published: 2023-05-31T21:35:08.000Z

## Abstract

Controlled generation refers to the problem of creating text that contains stylistic or semantic attributes of interest. Many approaches reduce this problem to training a predictor of the desired attribute. For example, researchers hoping to deploy a large language model to produce non-toxic content may use a toxicity classifier to filter generated text. In practice, the generated text to classify, which is determined by user prompts, may come from a wide range of distributions. In this paper, we show that the performance of controlled generation may be poor if the distributions of text in response to user prompts differ from the distribution the predictor was trained on. To address this problem, we cast controlled generation under distribution shift as an invariant learning problem: the most effective predictor should be invariant across multiple text environments. We then discuss a natural solution that arises from this characterization and propose heuristics for selecting natural environments. We study this characterization and the proposed method empirically using both synthetic and real data. Experiments demonstrate both the challenge of distribution shift in controlled generation and the potential of invariance methods in this setting.

## Recorded benchmark results

A research result applies to its stated dataset, split, metric and evaluation configuration. Compare like-for-like settings, preserve the metric's unit and direction, and distinguish paper-reported results from independent reproduction. The best result recorded here is not a claim of exhaustive, current global coverage.

- [Toxicity Classification on RealToxicity Prompts GPT-3 prompted (test)](<https://www.sota2.com/research/sota/toxicity-classification-on-realtoxicity-prompts-gpt-3-prompted-test.md>): Toxicity Classification; RealToxicity Prompts GPT-3 prompted (test); Loss: 0.61.

- [Toxicity Classification on Personification GPT-3 prompted (test)](<https://www.sota2.com/research/sota/toxicity-classification-on-personification-gpt-3-prompted-test.md>): Toxicity Classification; Personification GPT-3 prompted (test); Loss: 0.69.

## Original sources and implementation

[Original paper](<https://arxiv.org/abs/2306.00198>)

[PDF](<https://arxiv.org/pdf/2306.00198.pdf>)

[Implementation](<https://github.com/carolinazheng/invariant-control-gen>)
