Crafting a Good Prompt or Providing Exemplary Dialogues? A Study of In-Context Learning for Persona-based Dialogue Generation

Jiashu Pu, Yajing Wan, Yuru Zhang, Jing Chen, Ling Cheng, Qian Shao, Yongzhu Chang, Tangjie Lv, Rongsheng ZhangarXiv 2024 · DOI

Introduction

Generating human-like, persona-consistent dialogue is a significant challenge for Large Language Models (LLMs). While models excel at structured tasks, maintaining a consistent character and avoiding robotic responses often requires extensive fine-tuning. This study investigates the effectiveness of In-Context Learning (ICL)—providing instructions or examples within the prompt—as a more accessible alternative. Specifically, it explores whether "showing" (few-shot examples) or "telling" (detailed instructions) is more effective for persona-based dialogue.

Methodology

The researchers evaluated three prominent LLMs: GPT-3.5-turbo, GPT-4, and Baidu’s Ernie. The study compared several prompt construction methods:

  • Prompting vs. Demos: "Prompt Only" (detailed instructions) vs. "Few-Shot Demo" (examples only) vs. a hybrid approach.
  • Retrieval Strategies: Examples were selected randomly, via embedding-based similarity, or by matching the exact conversation context.
  • Ablation Studies: To understand what LLMs learn from examples, the researchers tested "corrupted" demos where labels were randomized, turn orders were shuffled, or individual tokens were scrambled.

Evaluation was conducted using a custom Response Evaluator based on Roberta-Large, trained on 50,000 human-graded samples to measure persona consistency and engagement. This evaluator achieved a Spearman correlation of 0.378 with human experts, significantly outperforming traditional metrics.

Results

The experimental results, summarized in Table 1, reveal several critical trends across the tested models.

Table 1: Performance comparison of different prompt construction methods across three LLMs.

A primary finding is the "Instruction First" rule: optimizing the prompt instruction is the most cost-effective way to improve response quality. For instance, GPT-4's "Prompt Only" score reached 0.476, a substantial leap from the 0.155 "Context Only" baseline. For GPT-3.5 and Ernie, it required approximately 7 to 9 few-shot examples to match the performance of a single well-crafted prompt.

Furthermore, the data highlights a Diversity Paradox. Contrary to expectations, random retrieval of examples often outperformed similarity-based retrieval. This suggests that diverse examples provide higher "information density," preventing the model from converging too narrowly or simply mimicking the provided examples.

Discussion and Key Insights

The study provides deeper insights into the mechanics of In-Context Learning:

  • Robustness to Corruption: LLMs demonstrated surprising resilience to semantic corruption. As shown in the ablation results in Table 1, even when examples had shuffled tokens or incorrect labels (indicated by the $\Delta$ values), performance often remained higher than the baseline. This suggests that models extract high-level stylistic distributions rather than just following simple word-sequence patterns.
  • The Copy-Paste Trap: Providing examples with the exact same conversation context as the query led to the worst performance. Models tended to fall into "co-occurrence reinforcement," where they copied the example response verbatim instead of generating a contextually appropriate new one.

Conclusion

This research demonstrates that while few-shot examples can enhance performance, a well-crafted prompt remains the most efficient tool for persona-based dialogue generation. The findings challenge existing theories of ICL by showing that LLMs can learn from structurally "broken" examples, indicating a more complex underlying mechanism for style and persona adoption. Future work will focus on more sophisticated retrieval methods and exploring these nuances across different languages.

Summary updated

BibTeX
@misc{pu2024crafting,
  author = {Jiashu Pu and Yajing Wan and Yuru Zhang and Jing Chen and Ling Cheng and Qian Shao and Yongzhu Chang and Tangjie Lv and Rongsheng Zhang},
  title = {{Crafting a Good Prompt or Providing Exemplary Dialogues? A Study of In-Context Learning for Persona-based Dialogue Generation}},
  year = {2024},
  eprint = {2402.09954},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2402.09954},
}
Figure