StyleChat: Learning Recitation-Augmented Memory in LLMs for Stylized Dialogue Generation
Introduction
Large Language Models (LLMs) have demonstrated remarkable capabilities in general conversation. However, they often exhibit "style homogenization," where their outputs default to a neutral, standardized tone due to the diverse nature of their training data. Achieving consistent and nuanced stylized dialogue—such as speaking like a Shakespearean character or a technical expert—remains a challenge. Existing methods like prompting often fail to maintain style over multi-turn interactions, while supervised fine-tuning (SFT) is limited by the scarcity of high-quality parallel stylized datasets.
The Recitation-Augmented Memory Framework
To address these limitations, the authors propose StyleChat, which utilizes a "recite-then-respond" framework. This approach is inspired by Chain-of-Thought (CoT) prompting but is integrated directly into the model's training. Instead of generating a response immediately, the model is trained to first articulate a detailed "style profile" from its internal memory.
The style profile is decomposed into two distinct levels:
- Statistical-Level Profile: Includes general descriptions and representative examples of the target style.
- Linguistic-Level Profile: Captures fine-grained attributes such as Diction (vocabulary choices), Syntax (sentence structure), Figures of Speech (metaphors, personification), and Rhetorical Purpose.
By forcing the model to "recite" these rules before responding, the framework primes the transformer's attention mechanism to focus on specific linguistic patterns relevant to the desired persona.
Training and Inference Process
The core innovation lies in the two-stage generation process during both training and inference.
- Training: The model is fine-tuned to follow the sequence:
Context + Style Name -> Recite Style Profile -> Generate Stylized Response. This embeds the stylistic knowledge into the model's parameters as a form of "augmented memory." - Inference: For "seen" styles (those encountered during training), the model recalls the profile. For "unseen" styles, the model is taught to derive a plausible profile based on the prompt's context and style name before generating the final response.
To further enhance stylistic boundaries, StyleChat employs Multi-Task Style Learning, combining stylized dialogue generation with text style transfer. This forces the model to learn the underlying transformation logic rather than just memorizing specific responses.
The StyleEval Benchmark
The researchers introduced StyleEval, a comprehensive benchmark designed to evaluate stylized dialogue across 38 distinct styles (e.g., Sci-Fi, Cyberpunk, Politeness). The dataset contains 24,728 dialogues, constructed using a pipeline involving GPT-4 for initial generation followed by rigorous human verification to ensure stylistic integrity. StyleEval includes two primary tasks:
- Generation Task: Producing a dialogue response in a specific style.
- Choice Task: A multiple-choice evaluation where the model selects the most stylistically appropriate response from several candidates.
Key Results and Insights
Experimental results demonstrate that StyleChat (based on LLaMA2-7B) significantly outperforms larger models and standard prompting techniques:
- Stylistic Accuracy: In the StyleEval choice task, StyleChat achieved 69.5% accuracy, nearly matching ChatGPT (70.25%) and far exceeding the base LLaMA2-7B (50.5%).
- Zero-Shot Generalization: The recitation strategy proved highly effective for unseen styles, maintaining higher relevance and consistency than standard few-shot prompting.
- Multi-Turn Stability: Unlike baseline models that tend to "drift" back to neutral speech, StyleChat maintains its assigned style consistently across multiple conversational turns.
Conclusion and Future Work
StyleChat demonstrates that explicitly modeling style as a "thought chain" through recitation allows LLMs to better internalize and apply complex linguistic patterns. While the "recite-then-respond" method introduces some inference overhead due to increased token generation, it provides a robust path toward more expressive and controllable AI personas. Future research may explore Mixture of Experts (MoE) architectures to handle even larger sets of conflicting styles and integrate stylistic nuances with deeper character personas.
Summary updated