Abstract
Modern Natural Language Generation (NLG) often relies on "black-box" neural encoder-decoder models that, while fluent, lack interpretability and controllability. This paper introduces a novel neural text generation model that employs a Hidden Semi-Markov Model (HSMM) decoder to automatically learn latent, discrete templates from raw data. This architecture allows for explicit control over sentence structure and content selection without the need for expensive hand-engineered templates. Evaluations on the E2E and WikiBio datasets demonstrate that the model achieves performance competitive with state-of-the-art neural systems while providing significantly greater transparency.
Introduction
The dominance of neural encoder-decoder (seq2seq) models in NLG has come at the cost of two critical features: interpretability and controllability. It is often unclear why a model selects specific phrasings or how it maps input data to output tokens. Furthermore, forcing these models to follow a specific plan—such as prioritizing certain attributes over others—is notoriously difficult.
While traditional template-based systems offered high control, they were difficult to scale. This research proposes a "middle ground" by learning template-like structures automatically. By modeling the generation process as a sequence of segments rather than individual words, the system can learn to associate specific latent states with semantic fields in the input data.
Methodology: The Neural HSMM Decoder
The core of the proposed system is the Neural HSMM Decoder. Unlike standard Recurrent Neural Networks (RNNs) that predict text word-by-word, the HSMM models the output as a sequence of segments.
Latent States and Transitions
The model assumes a set of $K$ latent states. A "template" is defined as a sequence of these states. The transition between states, $p(z_{t+1} | z_t, x)$, is conditioned on the current state and the input data $x$. This allows the model to learn logical progressions of information.
Emissions and Learning
Each latent state utilizes its own RNN, equipped with attention and copy mechanisms, to generate a multi-word segment. Through end-to-end learning using a differentiable dynamic program (the backward algorithm), the model learns to specialize states for specific types of information (e.g., name, price, or location). An autoregressive variant (NTemp+AR) further improves fluency by allowing segments to maintain dependencies on previously generated tokens.
Experimental Evaluation
The model was evaluated on two major benchmarks:
- E2E Generation Dataset: Focused on restaurant descriptions with 6-8 attributes.
- WikiBio Dataset: A large-scale dataset (500k examples) for generating Wikipedia biography leads from infoboxes.
Key Insights
The researchers found that latent states naturally aligned with specific data fields. For instance, in WikiBio, specific states consistently handled birth names or nationalities without explicit supervision. A "purity" metric confirmed this alignment, reaching up to 89% for the E2E dataset.
Results
The Neural Template (NTemp) models demonstrated strong performance across both datasets. On the E2E dataset, the NTemp+AR model achieved a BLEU score of 59.80 on the test set. While slightly lower than unconstrained baselines, it offers the unique advantage of structural controllability.
On the WikiBio dataset, the model achieved a BLEU score of 34.8, outperforming the neural language model baselines from the original WikiBio study (34.7).
Conclusion
By integrating the structural benefits of HSMMs with the representational power of neural networks, this work provides a path toward more transparent and controllable NLG. Future work will explore scaling these hierarchical templates to multi-paragraph document generation and explicitly encouraging the learning of diverse template structures.
Summary updated