Stylized Knowledge-Grounded Dialogue Generation via Disentangled Template Rewriting

Qingfeng Sun, Can Xu, Huang Hu, Yujing Wang, Jian Miao, Xiubo Geng, Yining Chen, Fei Xu, Daxin Jiang

TL;DR

Researchers at Microsoft have developed Disentangled Template Rewriting (DTR), a framework that allows dialogue agents to be both factually accurate and stylistically engaging (e.g., polite or enthusiastic). By decoupling factual content from stylistic expression, DTR generates knowledgeable responses in specific styles without requiring expensive, specialized datasets that combine both attributes.

What Problem Does This Paper Address?

Current Knowledge-Grounded Dialogue (KDG) models are excellent at being "rational"—they can pull facts from Wikipedia to answer user queries. However, they are often "pedantic" and dry, lacking the personality needed for long-term user engagement.

As shown in Figure 1, a standard KDG model might provide a technically correct but robotic answer. While we have models that can generate stylized text (like sentiment transfer), they often struggle to maintain factual integrity. The core challenge is the lack of parallel data: there are no massive datasets containing triples of <context, knowledge, stylized response>. We have factual dialogues and we have stylized text (like product reviews), but rarely both together.

Figure 1: The KDG models only produce a pedantic re- sponse, which lacks emotion and attraction compared with the responses with polite style, positive and nega- tive sentiments.

Methods

The authors propose a Generate-Disentangle-Rewrite paradigm. Instead of trying to generate a stylized, factual response in one go, they break it down into three distinct steps:

  1. Knowledge-Grounded Generation ($G_G$): A standard Transformer-based model generates a factual, albeit "pedantic," response based on the context and provided knowledge.
  2. Sequential Style Disentangling ($F$): A BERT-based module identifies style-related tokens in the generated response and replaces them with a generic mask [*]. This creates a "style-agnostic template" that preserves the core knowledge fragments.
  3. Style Rewriting ($G_R$): A rewriter takes this template and fills in the [*] masks with new tokens that reflect the target style (e.g., changing "I dislike" to "I fall in love with").
Figure 2: Overview of DTR. The sequential style disentangler can find out and replace the style-related tokens in generated response with [*] and produce a template. Then, the style rewriter transfers the template to a new response in the target style.

Training without Supervision

Since no paired data exists, the authors use two clever tricks:

  • Weakly Supervised Initialization: They observed that denoising autoencoders trained on a style corpus are much better at reconstructing common style words (like "good") than specific entities (like "pizza"). As illustrated in Figure 4, this difference in reconstruction distance provides a signal to help the model learn what constitutes "style" versus "content" without manual labels.
  • Reinforcement Learning (RL): The model is fine-tuned using the REINFORCE algorithm. It receives rewards based on Style Intensity (from a pre-trained classifier) and Semantic Similarity (to ensure the final response still means the same thing as the original factual one).
Figure 4: The positive sentiment word “good” is easier to be reconstructed than the knowledge word “pizza” in the sentence, where the wrong prediction “beef” would hurt the knowledge preservation and confuse the dia- logue theme.

Datasets

The model was evaluated on two major dialogue benchmarks:

  • Wizard of Wikipedia (WoW): Dialogues where one participant has access to Wikipedia fragments.
  • Topical Chat: Knowledge-grounded conversations based on wiki articles and Reddit facts.

For styles, they used:

  • Amazon Product Reviews: To learn "Positive" and "Negative" sentiments.
  • Politeness Dataset: A collection of sentences categorized by levels of politeness.

Key Insights and Ideas

  • Explicit Decoupling: The most significant "aha moment" is that mixing knowledge and style implicitly is too difficult for unsupervised models. By explicitly separating "knowledge fragments" from "style fragments," the model ensures that facts aren't lost during the stylistic makeover.
  • The "Style Template" as a Bridge: The style-agnostic template acts as a universal interface, allowing the model to bridge the gap between factual dialogue data and monolingual style data.
  • Knowledge Regularization: Using semantic similarity as an RL reward is crucial. It prevents the rewriter from hallucinating or deleting facts just to satisfy the style classifier.

Key Results

DTR significantly outperformed previous state-of-the-art stylized dialogue methods (like StyleDGPT and StylizedDU) across all metrics.

  • Relevance: On the Wizard of Wikipedia (Positive style) task, DTR achieved an F1 score of 31.3, compared to StyleDGPT's 21.7.
  • Knowledge Preservation: Human evaluators found that DTR preserved knowledge much better than baselines, which often "lost" the factual part of the sentence during style transfer.
  • Attractiveness: Introducing a positive or polite style significantly increased the "attractiveness" and engagement of the responses compared to standard KDG models.
Figure 5: F1 of DTR and StyleDGPT (positive), and SOTA KDG models in different evaluation settings.

Limitations and Future Work

  • Replace Rate Sensitivity: The performance is sensitive to the "replace rate" ($P_r$)—the percentage of tokens the disentangler masks. As shown in Figure 6, there is a clear trade-off between factual relevance and stylistic diversity.
  • Negative Sentiment Impact: The authors noted that while the model can successfully adopt a negative style, it often makes the agent less attractive to talk to, suggesting that "style" isn't always a net positive for engagement.
  • Future Directions: The authors suggest exploring more complex, multi-attribute styles and improving the disentangler's ability to handle long-range dependencies in templates.

Summary updated

BibTeX
@inproceedings{sun2022stylized,
  author = {Qingfeng Sun and Can Xu and Huang Hu and Yujing Wang and Jian Miao and Xiubo Geng and Yining Chen and Fei Xu and Daxin Jiang},
  title = {{Stylized Knowledge-Grounded Dialogue Generation via Disentangled Template Rewriting}},
  booktitle = {Conference of the North American Chapter of the Association for Computational Linguistics},
  year = {2022},
  doi = {10.18653/v1/2022.naacl-main.241},
}
Figure