AI Briefing
KO

Transformers Enhances Text Generation Control Features

·2022.03.11 09:00

Key point

It introduces the Constrained Beam Search feature in the Transformers library, which controls text generation to include specific words.

Details

Since conventional Beam Search generates tokens sequentially, it is technically very difficult to force a desired word or phrase to appear at a specific point.

Hugging Face's Transformers library addresses this with the Constrained Beam Search feature, which utilizes the force_words_ids argument. This feature allows users the following sophisticated control:

  • Forcing specific words: Encouraging the inclusion of specific words that determine style (e.g., formal vs. informal) during translation
  • Multiple constraints: Including several specific phrases in the output
  • Optional constraints: Setting the model to select and include one phrase among several candidate phrases

This feature greatly enhances the predictability of text generation and the ability to reflect user intent by letting the model itself determine at which point in the generation process to insert the constraints.

This summary was generated automatically by AI. Check the original for the author's claims and context. Copyright belongs to the original author.

Our guide explains how the AI works. Report summary errors, attribution issues, or removal requests via Contact.