Sampling with Attribute-Related Information for Controlling Language Models

  • 2022-05-12 12:48:11
  • Shangda Wu, Maosong Sun
  • 5

Abstract

The dominant approaches for controlling language models are based onfine-tuning large language models or prompt engineering. However, these methodsoften require condition-specific data or considerable hand-crafting. We proposea new simple guided decoding method, Gamma Sampling, which does not requirecomplex engineering and any extra data. Gamma Sampling introducesattribute-related information (provided by humans or language modelsthemselves) into the sampling process to guide language models to generatetexts with desired attributes. Experiments on controlling topics and sentimentsof generated text show Gamma Sampling to be superior in diversity, attributerelevance and overall quality of generated samples while maintaining a fastgeneration speed. In addition, we successfully applied Gamma Sampling tocontrol other attributes of language such as relatedness and repetition, whichfurther demonstrates the versatility and effectiveness of this method. GammaSampling is now available in the python package samplings via import gammasampling from samplings.

 

Quick Read (beta)

loading the full paper ...