Hugging Face Blog

Guiding Text Generation with Constrained Beam Search in 🤗 Transformers

arXiv Computation and Language
Oct 1

Making Grid Beam Search Less Greedy

arXiv:2609.39368v1 Announce Type: new Abstract: A common formalism for constraining the output of autoregressive text generation models involves lexical constraints, words or phrases which are requir...

By Sean Papay, Roman Klinger
arXiv Computation and Language
Nov 9

HiFlow: Hierarchical Feedback-Driven Optimization for Constrained Long-Form Text Generation

The paper introduces LoopWeaver, a hierarchical workflow for constrained long‑form text generation that addresses the multi‑objective optimization problem of balancing global structure, local coherence, and constraint satisfaction. LoopWeaver consists of two offline preference‑optimization stages: constraint‑aware planning to produce structured plans, and feasibility filtering to remove invalid plans, followed by a shared deterministic reward that generates preference pairs for both plan‑level and generation‑level direct preference optimization (DPO). During inference, the system remains feed‑forward, generating and revising a complete plan, filtering it, and then producing text segments conditioned on the current sub‑plan and running narrative, achieving improved constraint accuracy and text quality across four LongGenBench‑style scenarios on multiple open‑source backbones.

By Yifan Zhu, Guanting Chen, Bing Wei, Haoran Luo