\n
{agent}
\n"
35 |
36 | for response in responses:
37 | role = response["role"]
38 | css_class = "user" if role == "user" else "model"
39 | if "content" in response:
40 | message = response["content"]
41 | elif "parts" in response:
42 | message = " ".join(response["parts"])
43 | html_content += f"
{message}
\n"
44 |
45 | html_content += "
\n"
46 |
47 | html_content += """
48 |
49 |
50 | """
51 |
52 | # Save the HTML content to a file
53 | file_path = 'chat_history_ui_2.html'
54 | with open(file_path, 'w') as file:
55 | file.write(html_content)
56 |
57 | print(file_path)
58 |
59 | if __name__ == "__main__":
60 | parser = argparse.ArgumentParser(description="Make HTML to show chat.")
61 | parser.add_argument("-i", "--input", required=True, help="Path to the conversation log file.")
62 | args = parser.parse_args()
63 | main(args.input)
64 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # LLM Discussion
2 |
3 | Official Implementation of [LLM Discussion: Enhancing the Creativity of Large Language Models via Discussion Framework and Role-Play](https://arxiv.org/abs/2405.06373)
4 |
5 | >Authors : [Li-Chun Lu*](https://github.com/lichun-19), [Shou-Jen Chen*](https://github.com/lawraa), [Tsung-Min Pai](https://github.com/Bai1026), Chan-Hung Yu & Hung-yi Lee, Shao-Hua Sun
6 |
7 | ## Introduction
8 |
9 | This repository contains the implementation of the **"LLM Discussion"** framework, as presented in our COLM 2024 paper. The framework aims to enhance the creativity of large language models (LLMs) through a three-phase discussion process and role-playing techniques. By emulating the human process of collective creativity, LLMs can produce more original and innovative responses.
10 |
11 | ## Abstract
12 |
13 | Large language models (LLMs) have shown exceptional proficiency in natural language processing but often fall short of generating creative and original responses to open-ended questions. To enhance LLM creativity, our key insight is to emulate the human process of inducing collective creativity through engaging discussions with participants from diverse backgrounds and perspectives. To this end, we propose LLM Discussion, a three-phase discussion framework that facilitates vigorous and diverging idea exchanges and ensures convergence to creative answers. Moreover, we adopt a role-playing technique by assigning distinct roles to LLMs to combat the homogeneity of LLMs. We evaluate the efficacy of the proposed framework with the Alternative Uses Test, Similarities Test, Instances Test, and Scientific Creativity Test through both LLM evaluation and human study. Our proposed framework outperforms single-LLM approaches and existing multi-LLM frameworks across various creativity metrics.
14 |
15 | ## Framework Overview
16 |
17 | The LLM Discussion framework is divided into three phases:
18 |
19 | 1. **Initiation Phase**: LLMs are introduced to the discussion topic and objectives.
20 | 2. **Discussion Phase**: Multiple rounds of idea exchanges among LLMs, encouraging active listening and idea building.
21 | 3. **Convergence Phase**: Summarization and convergence of the discussed ideas to produce a collective conclusion.
22 |
23 | 
24 |
25 |
26 | Additionally, LLMs are assigned distinct roles to simulate diverse perspectives and reduce homogeneity in their responses.
27 |
28 |