Role playing dialogue method, device and equipment based on large model and medium
By obtaining plot data and character personality, and using large language models to train role-playing models, the problem of low accuracy in answering script questions in the existing technology is solved, and high accuracy answers to scripts and general questions are achieved.
Patent Information
- Application Number
- CN202510398254.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-31
- Publication Date
- 2025-07-18
AI Technical Summary
The existing role-playing model only answers the content related to the character in the script, but lacks understanding of other questions, resulting in low accuracy of the answer results.
By obtaining plot data and character personality, get prompt words, and input them to the preset first language model, obtaining general conversations and inputting them to the preset second language model, and finally obtaining the preset role-playing model based on multiple fine-tuning data and preset script models, improving the accuracy of answering script questions and general questions.
The accuracy of the role-playing model's answers to script questions and general questions is improved, and the model's understanding of user questions is enhanced.
Smart Images

Figure CN120336465A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of intelligent dialogue models. Specifically, it relates to a role-playing dialogue method, device, equipment, and medium based on a large model. Background Art
[0002] With the development of large language models, role-playing chat applications have emerged. Existing role-playing chat applications, such as anime character chatbots, virtual companions, and personal digital agents, can obtain answers that are the same as the character's personality, speaking style, and voice based on the user's questions. Compared with traditional chatbots that required a large number of engineering processes to build and serve specific scenarios in the past, large language models can easily build role-playing models with different identities, personalities, memories, and language habits.
[0003] In the prior art, by using script data to retrain an existing basic model, a role-playing model is obtained to enable answering based on the user's voice data when the user's voice data is acquired. However, this role-playing model only answers questions related to the character in the script and has insufficient understanding ability for other questions, resulting in the problem of answering off-topic and further leading to the technical problem of low accuracy of the answer results. Summary of the Invention
[0004] To overcome the above defects, this application is proposed to provide a solution to solve or at least partially solve the technical problem that the role-playing model only answers questions related to the character in the script and has insufficient understanding ability for other questions, resulting in answering off-topic.
[0005] In a first aspect, this application provides a role-playing dialogue method based on a large model, including:
[0006] Obtain the user's question data;
[0007] Input the question data into a preset role-playing model to obtain an answer;
[0008] Among them, obtaining the preset role-playing model includes:
[0009] Obtain plot data and character personality;
[0010] According to the plot data and the character personality, obtain prompt words;
[0011] Input the prompt words into a preset first large language model to obtain first fine-tuning data;
[0012] Obtain a general dialogue;
[0013] Input the general dialogue into a preset second large language model to obtain second fine-tuning data;
[0014] Based on the first fine-tuning data, the second fine-tuning data, and the preset script model, the preset role-playing model is obtained.
[0015] In a technical solution of the above role-playing dialogue method based on a large model, the obtaining of the prompt according to the plot data and the character personality includes:
[0016] According to the plot data, plot Q&A data is obtained;
[0017] According to the plot Q&A data, the prompt is obtained.
[0018] In a technical solution of the above role-playing dialogue method based on a large model, obtaining the preset second large language model includes:
[0019] Style data is obtained;
[0020] According to the style data, the preset basic language model is trained to obtain the preset second large language model.
[0021] In a technical solution of the above role-playing dialogue method based on a large model, the obtaining of the preset role-playing model according to the first fine-tuning data, the second fine-tuning data, and the preset script model includes:
[0022] The first fine-tuning data and the second fine-tuning data are fused to obtain fused fine-tuning data;
[0023] According to the fused fine-tuning data, the preset script model is trained to obtain the preset role-playing model.
[0024] In a technical solution of the above role-playing dialogue method based on a large model, obtaining the preset script model includes:
[0025] Plot character data and general dialogue data are obtained;
[0026] According to the plot character data and the general dialogue data, the preset third large language model is trained to obtain the preset script model.
[0027] In a technical solution of the above role-playing dialogue method based on a large model, the training of the preset third large language model according to the plot character data and the general dialogue data to obtain the preset script model includes:
[0028] The plot character data and the general dialogue data are preprocessed to obtain preprocessed plot character data and preprocessed general data;
[0029] Mix the preprocessed plot character data and the preprocessed general dialogue data to obtain mixed data;
[0030] Perform segmentation processing on the mixed data to obtain segmented data;
[0031] Train the preset third large language model according to the segmented data to obtain the preset script model.
[0032] In one technical solution of the above-mentioned role-playing dialogue method based on a large model, the method further includes:
[0033] Determine that the answer is a wrong answer;
[0034] Obtain the correct answer;
[0035] Train the preset role-playing model according to the correct answer to obtain a preset updated role-playing model.
[0036] In a second aspect, the present application provides a role-playing dialogue device based on a large model, including:
[0037] An acquisition module for acquiring the question data of the user;
[0038] A question and answer module for inputting the question data into a preset role-playing model to obtain an answer;
[0039] Among them, obtaining the preset role-playing model includes:
[0040] Obtain plot data and character personalities;
[0041] Obtain prompt words according to the plot data and the character personalities;
[0042] Input the prompt words into a preset first large language model to obtain first fine-tuning data;
[0043] Obtain general dialogue;
[0044] Input the general dialogue into a preset second large language model to obtain second fine-tuning data;
[0045] Obtain the preset role-playing model according to the first fine-tuning data, the second fine-tuning data and the preset script model.
[0046] In a third aspect, the present application provides an electronic device, including a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to execute the method according to any one of the first aspect through the computer program.
[0047] Fourthly, the present application provides a computer-readable storage medium, which stores multiple pieces of program codes, and the program codes are adapted to be loaded and run by a processor to execute the method described in any one of the first aspect.
[0048] The present application provides a role-playing dialogue method, device, equipment and medium based on a large model. The method specifically includes: obtaining the question data of a user; inputting the question data into a preset role-playing model to obtain an answer. Among them, obtaining the preset role-playing model includes: obtaining plot data and character personalities; obtaining prompt words according to the plot data and the character personalities; inputting the prompt words into a preset first large language model to obtain first fine-tuning data; obtaining a general dialogue; inputting the general dialogue into a preset second large language model to obtain second fine-tuning data; and obtaining the preset role-playing model according to the first fine-tuning data, the second fine-tuning data and a preset script model, thereby improving the accuracy of the answers of the role-playing model to script questions and general questions. Description of the Drawings
[0049] Referring to the accompanying drawings, the disclosure of the present application will become easier to understand. It is easy for those skilled in the art to understand that: these drawings are only for illustrative purposes and are not intended to limit the protection scope of the present application. In addition, similar numbers in the drawings are used to represent similar components, where:
[0050] Figure 1 is a schematic structural diagram of Embodiment 1 of a role-playing dialogue system provided by an embodiment of the present application;
[0051] Figure 2 is a schematic flowchart of Embodiment 1 of a role-playing dialogue method based on a large model provided by an embodiment of the present application;
[0052] Figure 3 is a schematic flowchart of Embodiment 2 of a role-playing dialogue method based on a large model provided by an embodiment of the present application;
[0053] Figure 4 is a schematic flowchart of Embodiment 3 of a role-playing dialogue method based on a large model provided by an embodiment of the present application;
[0054] Figure 5 is a schematic flowchart of Embodiment 4 of a role-playing dialogue method based on a large model provided by an embodiment of the present application;
[0055] Figure 6 is a schematic flowchart of Embodiment 5 of a role-playing dialogue method based on a large model provided by an embodiment of the present application;
[0056] Figure 7Schematic flowchart of Embodiment 6 of a role-playing dialogue method based on a large model provided by an embodiment of the present application;
[0057] Figure 8 Schematic flowchart of Embodiment 7 of a role-playing dialogue method based on a large model provided by an embodiment of the present application;
[0058] Figure 9 Schematic structural diagram of Embodiment 1 of a role-playing dialogue device based on a large model provided by an embodiment of the present application;
[0059] Figure 10 Schematic structural diagram of Embodiment 1 of an electronic device provided by an embodiment of the present application.
[0060] List of Reference Numerals :
[0061] 11: Training module; 12: Style conversion module; 13: Data fine-tuning module; 14: Interaction module; 21: Acquisition module; 22: Question and answer module; 31: Processor; 32: Memory. Detailed implementation manners
[0062] The following describes some implementation manners of the present application with reference to the accompanying drawings. Those skilled in the art should understand that these implementation manners are only used to explain the technical principle of the present application and are not intended to limit the protection scope of the present application.
[0063] In the description of the present application, "module" and "processor" may include hardware, software, or a combination of both. A module may include a hardware circuit, various suitable sensors, communication ports, memory, and may also include a software part, such as program code, or a combination of software and hardware. The processor may be a central processing unit, a microprocessor, an image processor, a digital signal processor, or any other suitable processor. The processor has data and / or signal processing functions. The processor may be implemented in software, in hardware, or in a combination of both. The non-transitory computer-readable storage medium includes any suitable medium for storing program code, such as magnetic disks, hard disks, optical discs, flash memories, read-only memories, random access memories, and so on. The term "A and / or B" represents all possible combinations of A and B, such as only A, only B, or A and B. The term "at least one A or B" or "at least one of A and B" has a meaning similar to "A and / or B" and may include only A, only B, or A and B. The singular terms "a" and "this" may also include the plural form.
[0064] In the prior art, role-playing robots are divided into two categories: The first category uses prompts and invokes existing large models. This method relies on the powerful capabilities of existing large models and only requires constructing elaborate prompts without training the existing large models. The prompts need to introduce the background knowledge of the role and the answering habits of the role. However, for simple single-round questions, the accuracy of the answers is relatively high. But for questions that delve into the role's background and multi-round questions, there are technical problems resulting in low accuracy of the answers. The second category is to fine-tune the base model. This method requires constructing high-quality instruction fine-tuning data and then fine-tuning the base model according to this data. However, due to the small amount of instruction fine-tuning data, the fine-tuned model can only accurately answer content related to the role in the script. However, for other questions, its understanding ability is poor, resulting in technical problems of low accuracy of the answers. Therefore, both of the above two methods lead to the technical problem of low accuracy of the answers of role-playing robots.
[0065] Based on this, to solve the above technical problems, the present application provides a new role-playing dialogue method based on a large model to achieve improved accuracy of role-playing answers.
[0066] The following uses specific embodiments to elaborate in detail on the technical solutions of the present application and how the technical solutions of the present application solve the above technical problems. These several specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The following will describe the embodiments of the present application in conjunction with the accompanying drawings.
[0067] Figure 1 It is a schematic structural diagram of the first embodiment of a role-playing dialogue system provided by an embodiment of the present application. As Figure 1 shown, the system includes: a training module 11, a style conversion module 12, a data fine-tuning module 13, and an interaction module 14.
[0068] Among them, the data fine-tuning module 13 obtains and generates prompt words according to the plot data and the character personality, and inputs the prompt words into the first large language model to obtain first fine-tuning data. The style conversion module 12 inputs the general dialogue into a preset second large language model to obtain second fine-tuning data. The training module 11 obtains a preset role-playing model according to the first fine-tuning data, the second fine-tuning data, and a preset script model, and sends the preset role-playing model to the question-answering module 14. The interaction module 14 obtains the user's question data and inputs the question data into the preset role-playing model to obtain an answer.
[0069] Figure 2 It is a schematic flow diagram of the first embodiment of a role-playing dialogue method based on a large model provided by an embodiment of the present application. As Figure 2 shown, specifically, the method includes:
[0070] Step S101: Obtain plot data and character personalities.
[0071] In this embodiment, the plot data can be a novel or a movie / TV script. The character personalities are obtained from the descriptions or dialogue content of the characters in the plot data.
[0072] Step S102: Obtain prompt words based on the plot data and character personalities.
[0073] In this embodiment, extract the dialogue data related to the characters in the plot data, and construct prompt words based on the dialogue data and character personalities.
[0074] Step S103: Input the prompt words into a preset first large language model to obtain first fine-tuning data.
[0075] In this embodiment, the first fine-tuning data contains multiple dialogue data related to the characters.
[0076] In this embodiment, for example, the first large language model can be a model such as Llama, Baichuan, etc. that has been pre-trained on a large amount of data.
[0077] Step S104: Obtain general conversations.
[0078] In this embodiment, the general conversations are daily conversations.
[0079] In this embodiment, for example, the general conversations can be extracted from Wikipedia.
[0080] Step S105: Input the general conversations into a preset second large language model to obtain second fine-tuning data.
[0081] In this embodiment, the general conversations do not have the characteristics of the characters. In order to obtain general conversations with character characteristics, it is necessary to construct a general conversation dataset with character characteristics, and train the basic model according to the general conversation dataset with character characteristics to obtain the preset second large language model.
[0082] In this embodiment, the data in the general conversation dataset with character characteristics is relatively small. In order to obtain more general conversation datasets with character characteristics, after inputting the general conversations into the preset second large language model one by one, the second fine-tuning data is obtained. This second fine-tuning data contains multiple general conversation data with character characteristics.
[0083] Step S106: Obtain a preset role-playing model according to the first fine-tuning data, the second fine-tuning data, and the preset script model.
[0084] In this embodiment, train the preset script model according to the first fine-tuning data and the second fine-tuning data to obtain the preset role-playing model.
[0085] Step S107: Obtain the user's question data.
[0086] In this embodiment, the user's question data can be text and voice.
[0087] Step S108: Input the question data into a preset role-playing model to obtain an answer.
[0088] In this embodiment, after the user's question data is input into the preset role-playing model, the role-playing model analyzes the question data to obtain an answer.
[0089] In this embodiment, plot data and character personalities are obtained; according to the plot data and character personalities, prompt words are obtained; the prompt words are input into a preset first large language model to obtain first fine-tuning data; general conversations are obtained; the general conversations are input into a preset second large language model to obtain second fine-tuning data; according to the first fine-tuning data, the second fine-tuning data, and a preset script model, a preset role-playing model is obtained; the user's question data is obtained; the question data is input into the preset role-playing model to obtain an answer. Compared with the prior art, the role-playing model only answers the content related to the characters in the script and has insufficient understanding ability for other questions, resulting in the problem of answering irrelevantly and thus a low accuracy rate of the answer results. In this application, prompt words are obtained according to the plot data and character personalities, and the prompt words are input into the preset first large language model to obtain first fine-tuning data. Then general conversations are obtained, and the general conversations are input into the preset second large language model to obtain second fine-tuning data. Then, according to the first fine-tuning data, the second fine-tuning data, and the preset script model, a preset role-playing model is obtained. Finally, the user's question data is input into the preset role-playing model to obtain an answer, thereby improving the accuracy rate of the answers of the role-playing model.
[0090] Figure 3 It is a schematic flowchart of the second embodiment of a role-playing dialogue method based on a large model provided by an embodiment of the present application. On the basis of the above embodiment, as Figure 3 shown, specifically, a specific way of step S102 is:
[0091] Step S201: Obtain plot Q&A data according to the plot data.
[0092] In this embodiment, in the plot data, the chat content of a single character is interspersed in the scene dialogue. Therefore, it is necessary to extract all the plot Q&A data of a certain character from the plot data.
[0093] Step S202: Obtain prompt words according to the plot Q&A data.
[0094] In this embodiment, the plot Q&A data is input into the pre-trained large language model to obtain dialogue enhancement data. Then, based on the dialogue enhancement data, the prompt is designed.
[0095] In this embodiment, for example, in "Journey to the West", Tang Seng said: You have killed three lives in one day. This time I will no longer keep you. You can go. Sun Wukong: Master, they are really transformed by demons. Input this dialogue into the pre-trained large language model, and the obtained dialogue enhancement data is: User: Sun Wukong, why did you harm three innocent people? Sun Wukong: You have misunderstood me, old Sun. They are not humans, but demons in disguise. You can't tell, but can't I, the Great Sage Equal to Heaven, tell?
[0096] In this embodiment, for example, based on the above dialogue enhancement data, the designed prompt is: Assume you are Sun Wukong in "Journey to the West"; Your character: lively; Your catchphrases and habitual expressions: old Sun.
[0097] In this embodiment, based on the plot data, the plot Q&A data is obtained; based on the plot Q&A data, the prompt is obtained, and further the prompt related to the character-related plot in the script for the user is obtained.
[0098] Figure 4 It is a schematic flowchart of the third embodiment of a role-playing dialogue method based on a large model provided by an embodiment of the present application. On the basis of the above embodiment, as Figure 4 shown, specifically, obtaining the preset second large language model in step S105 includes:
[0099] Step S301: Obtain style data.
[0100] In this embodiment, the style data is data for answering general questions according to the character style.
[0101] In this embodiment, for example, User: What is 1 plus 1? Sun Wukong: This is no challenge for old Sun. It equals 1.
[0102] In this embodiment, multiple style data are constructed according to the character's personality and common expressions.
[0103] Step S302: Perform training processing on the preset basic language model according to the style data to obtain the preset second large language model.
[0104] In this embodiment, the style data and the general Q&A data are combined into a style data group. The preset basic language model is trained using multiple style data groups to obtain the preset second large language model.
[0105] In this embodiment, for example, the preset basic language model can be T5, Bert, or LLM. The general Q&A data is input into the preset second large language model to obtain a plurality of style data.
[0106] In this embodiment, style data is obtained; according to the style data, the preset basic language model is trained to obtain the preset second large language model, and thus a plurality of style data can be obtained.
[0107] Figure 5 This is a schematic flowchart of Embodiment 4 of a role-playing dialogue method based on a large model provided by an embodiment of the present application. On the basis of the above embodiment, as Figure 5 shown, specifically, one implementation manner of step S106 includes:
[0108] Step S401: Fuse the first fine-tuning data and the second fine-tuning data to obtain fused fine-tuning data.
[0109] In this embodiment, according to a preset first ratio, first training data is randomly selected from the first fine-tuning data, and according to a preset second ratio, second training data is randomly selected from the second fine-tuning data. The first training data and the second training data are fused to obtain fused fine-tuning data.
[0110] Step S402: Train the preset script model according to the fused fine-tuning data to obtain a preset role-playing model.
[0111] In this embodiment, the fused fine-tuning data is used, and the cross-entropy loss function is used as the objective function to calculate the loss value of the answer, and the preset script model is trained to obtain a preset role-playing model.
[0112] In this embodiment, the first fine-tuning data and the second fine-tuning data are fused to obtain fused fine-tuning data; the preset script model is trained according to the fused fine-tuning data to obtain a preset role-playing model.
[0113] Figure 6 This is a schematic flowchart of Embodiment 5 of a role-playing dialogue method based on a large model provided by an embodiment of the present application. On the basis of the above embodiment, as Figure 6 shown, specifically, obtaining the preset script model in step S106 includes:
[0114] Step S501: Obtain plot character data and general dialogue data.
[0115] In this embodiment, the plot character data is dialogue data related to characters collected from the script, and the general dialogue data is dialogue data commonly used in daily life.
[0116] Step S502: Train a preset third large language model based on the plot character data and general dialogue data to obtain a preset script model.
[0117] In this embodiment, the third large language model is trained on the publicly available preset third large language model using a public Q&A dataset to obtain a preset script model.
[0118] In this embodiment, obtain the plot character data and general dialogue data; train a preset third large language model based on the plot character data and general dialogue data to obtain a preset script model.
[0119] Figure 7 This is a schematic flowchart of Embodiment 6 of a role-playing dialogue method based on a large model provided by an embodiment of the present application. On the basis of the above embodiments, as Figure 7 shown, specifically, one implementation manner of step S502 includes:
[0120] Step S601: Preprocess the plot character data and general dialogue data to obtain preprocessed plot character data and preprocessed general data.
[0121] In this embodiment, after obtaining the script character data and general dialogue data, in order to ensure the quality of the data, it is necessary to preprocess the script character data to obtain preprocessed plot character data, and preprocess the general dialogue data to obtain preprocessed general data.
[0122] In this embodiment, the preprocessing includes removing duplicates from the script character data and general dialogue data and removing special characters in the data.
[0123] Step S602: Mix the preprocessed plot character data and preprocessed general dialogue data to obtain mixed data.
[0124] In this embodiment, randomly extract data from the preprocessed plot character data according to a preset third ratio to obtain partial preprocessed plot character data, randomly extract data from the preprocessed general dialogue data according to a preset fourth ratio to obtain partial preprocessed general dialogue data, and randomly intersperse the partial preprocessed plot character data into the partial preprocessed general dialogue data to obtain mixed data.
[0125] Step S603: Split the mixed data to obtain split data.
[0126] In this embodiment, split the mixed data according to a fixed length, and then convert the split text into dictionary index data.
[0127] In this embodiment, for example, the fixed length is 2048.
[0128] Step S604: Train a preset third large language model according to the segmented data to obtain a preset script model.
[0129] In this embodiment, according to the segmented data, cross-entropy is used as the objective function to train a preset third large language model to obtain a preset script model.
[0130] In this embodiment, the plot character data and the general dialogue data are preprocessed to obtain preprocessed plot character data and preprocessed general data; the preprocessed plot character data and the preprocessed general dialogue data are mixed to obtain mixed data; the mixed data is segmented to obtain segmented data; according to the segmented data, a preset third large language model is trained to obtain a preset script model.
[0131] Figure 8 This is a schematic flowchart of the seventh embodiment of a role-playing dialogue method based on a large model provided by an embodiment of the present application. As Figure 8 shown, after step S108, the method further includes:
[0132] Step S701: Determine that the answer is a wrong answer.
[0133] In this implementation, after the user hears or sees the answer, the user's expression and voice are obtained, and if it is determined that the user's expression or voice is negative, it is determined that the answer is a wrong answer.
[0134] Step S702: Obtain the correct answer.
[0135] In this embodiment, a voice is played to ask the user for the correct answer, and the user's voice information is collected. After the user says the correct answer, the correct answer voice is converted into text to obtain the correct answer.
[0136] Step S703: Train a preset role-playing model according to the correct answer to obtain a preset updated role-playing model.
[0137] In this embodiment, according to the correct answer, the answer corresponding to the question in the training data is modified, and the preset role-playing model is trained using the modified training data to obtain a preset updated role-playing model.
[0138] In this embodiment, for example, the question and the correct answer corresponding to the question can also be input into a preset reinforcement learning model, so that the reinforcement learning model iteratively trains the correct answer to obtain a pre-trained reinforcement learning model.
[0139] In this embodiment, it is determined that the answer is an incorrect answer; the correct answer is obtained; and based on the correct answer, the preset role-playing model is trained to obtain a preset updated role-playing model, thereby improving the accuracy of the answer.
[0140] Furthermore, the present application also provides a role-playing dialogue device based on a large model.
[0141] Figure 9 FIG. is a schematic structural diagram of Embodiment 1 of a role-playing dialogue device based on a large model provided by an embodiment of the present application. As Figure 9 shown, the role-playing dialogue device based on a large model in the embodiment of the present application mainly includes an acquisition module 21 and a question-and-answer module 22. One or more of the above modules may be combined into one module. In some embodiments, the acquisition module 21 may be configured to acquire the dialogue data of the user. The question-and-answer module 22 may be configured to input the dialogue data into a preset role-playing model to obtain an answer. Among them, obtaining the preset role-playing model includes: obtaining plot data and character personalities; obtaining prompt words according to the plot data and character personalities; inputting the prompt words into a preset first large language model to obtain first fine-tuning data; obtaining general instructions; inputting the general instructions into a preset second large language model to obtain second fine-tuning data; and obtaining a preset role-playing model according to the first fine-tuning data, the second fine-tuning data, and a preset script model.
[0142] The above role-playing dialogue device based on a large model is used to execute Figures 1 to 7 the role-playing dialogue method embodiment based on a large model shown in FIG., and the technical principles, the technical problems solved, and the technical effects produced by the two are similar. Those skilled in the art of the present technology can clearly understand that for the convenience and conciseness of description, the specific working process and related descriptions of the role-playing dialogue device based on a large model can refer to the content described in the embodiment of the role-playing dialogue method based on a large model with the role-playing dialogue device as the execution subject, which will not be elaborated here.
[0143] Those skilled in the art can understand that all or part of the processes in the method of the above-mentioned embodiment of the present application can also be completed by instructing relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium. When the computer program is executed by a processor, the steps of the above-mentioned method embodiments can be implemented. Among them, the computer program includes computer program code, and the computer program code can be in the form of source code, object code, executable file or some intermediate form, etc. The computer-readable storage medium can include: any entity or device, medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory, random access memory, electrical carrier signal, telecommunication signal, and software distribution medium that can carry the computer program code. It should be noted that the content included in the computer-readable storage medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, the computer-readable storage medium does not include electrical carrier signals and telecommunication signals.
[0144] Furthermore, the present application also provides an electronic device.
[0145] Figure 10 It is a schematic structural diagram of Embodiment 1 of an electronic device provided by an embodiment of the present application. As Figure 10 shown, the electronic device includes at least one processor 31 and a memory 32. The memory 32 can be configured to store a program for executing the role-playing dialogue method based on a large model shown in the above-mentioned Figures 1 to 7 embodiment. The processor 31 can be configured to execute the program in the memory 32. The program includes, but is not limited to, a program for executing a role-playing dialogue method based on a large model in the above-mentioned method embodiment. For the convenience of description, only the parts related to the embodiments of the present application are shown. For the specific technical details not disclosed, please refer to the method part of the embodiments of the present application. The electronic device can be a control device formed by various electronic devices.
[0146] Furthermore, the present application also provides a computer-readable storage medium. In an embodiment of a computer-readable storage medium according to the present application, the computer-readable storage medium can be configured to store a program for executing the role-playing dialogue method based on a large model shown in the above-mentioned method Figures 1 to 7 embodiment. The program can be loaded and run by a processor to implement the above-mentioned role-playing dialogue method based on a large model. For the convenience of description, only the parts related to the embodiments of the present application are shown. For the specific technical details not disclosed, please refer to the method part of the embodiments of the present application. The computer-readable storage medium can be a storage device formed by various electronic devices. Optionally, the computer-readable storage medium in the embodiments of the present application is a non-transitory computer-readable storage medium.
[0147] Furthermore, it should be understood that since the settings of the respective modules are only for illustrating the functional units of the device of the present application, the physical devices corresponding to these modules can be the processor itself, or a part of the software in the processor, a part of the hardware, or a part of the combination of software and hardware. Therefore, the number of each module in the figure is only illustrative.
[0148] Those skilled in the art can understand that the respective modules in the device can be adaptively split or combined. Such splitting or combination of specific modules will not cause the technical solution to deviate from the principle of the present application. Therefore, the technical solutions after splitting or combination will all fall within the protection scope of the present application.
[0149] So far, the technical solution of the present application has been described in conjunction with the preferred embodiments shown in the accompanying drawings. However, it is easy for those skilled in the art to understand that the protection scope of the present application is obviously not limited to these specific embodiments. Without departing from the principle of the present application, those skilled in the art can make equivalent changes or substitutions to the relevant technical features, and the technical solutions after these changes or substitutions will all fall within the protection scope of the present application.
Claims
1. A role-playing dialogue method based on a large model, characterized in that, including: Obtain the user's question data; Input the question data into a preset role-playing model to obtain an answer; Among them, obtaining the preset role-playing model includes: Obtain plot data and character personalities; Based on the plot data and the character personalities, obtain prompt words; Input the prompt words into a preset first large language model to obtain first fine-tuning data; Obtain general conversations; Input the general conversations into a preset second large language model to obtain second fine-tuning data; Based on the first fine-tuning data, the second fine-tuning data, and a preset script model, obtain the preset role-playing model.
2. The method according to claim 1, wherein The obtaining the prompt words based on the plot data and the character personalities includes: Based on the plot data, obtain plot Q&A data; Based on the plot Q&A data, obtain the prompt words.
3. The method according to claim 1, wherein Obtaining the preset second large language model includes: Obtain style data; Based on the style data, perform training processing on a preset basic language model to obtain the preset second large language model.
4. The method according to claim 1, wherein The obtaining the preset role-playing model based on the first fine-tuning data, the second fine-tuning data, and a preset script model includes: Fuse the first fine-tuning data and the second fine-tuning data to obtain fused fine-tuning data; Based on the fused fine-tuning data, perform training processing on the preset script model to obtain the preset role-playing model.
5. The method according to claim 1, wherein Obtaining the preset script model includes: Obtain plot character data and general conversation data; Based on the plot character data and the general conversation data, train a preset third large language model to obtain the preset script model.
6. The method according to claim 5, wherein The training the preset third large language model based on the plot character data and the general conversation data to obtain the preset script model includes: Preprocess the plot character data and the general conversation data to obtain preprocessed plot character data and preprocessed general data; Mix the preprocessed plot character data and the preprocessed general conversation data to obtain mixed data; Perform segmentation processing on the mixed data to obtain segmented data; Based on the segmented data, train the preset third large language model to obtain the preset script model.
7. The method according to claim 1, characterized in that, The method further includes: Determine that the answer is an incorrect answer; Obtain the correct answer; Based on the correct answer, train the preset role-playing model to obtain a preset updated role-playing model.
8. A dialogue device based on role-playing of large models, characterized in that, including: An obtaining module, configured to obtain the user's question data; A Q&A module, configured to input the question data into a preset role-playing model to obtain an answer; Among them, obtaining the preset role-playing model includes: Obtain plot data and character personalities; Based on the plot data and the character personalities, obtain prompt words; Input the prompt words into a preset first large language model to obtain first fine-tuning data; Obtain general conversations; Input the general conversations into a preset second large language model to obtain second fine-tuning data; Based on the first fine-tuning data, the second fine-tuning data, and a preset script model, obtain the preset role-playing model.
9. An electronic device, comprising a memory and a processor, characterized in that, A computer program is stored in the memory, and the processor is configured to execute the method according to any one of claims 1 to 7 through the computer program.
10. A computer-readable storage medium storing multiple program codes, characterized in that, The program code is adapted to be loaded and run by a processor to execute the method according to any one of claims 1 to 7.