Role model training and application method and device, equipment and storage medium
Through a two-stage training method, combining general data sets, background data sets and character style data sets, the problem of difficulty in accurately learning domain knowledge in traditional character model training is solved, and the effect of outputting accurate interactive content in the target field is achieved.
Patent Information
- Application Number
- CN202411599042.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-08
- Publication Date
- 2025-01-14
AI Technical Summary
Traditional character model training methods are difficult to accurately learn domain knowledge and role knowledge, resulting in low model accuracy.
By obtaining the general data set, the background data set of the target field and the role style data set, the initial role model is trained in two stages to ensure that the model has the background and role style cognition of the target field on the basis of retaining general capabilities, thus Output interactive content that matches the target area.
Avoid forgetting common knowledge of the model, ensuring that the model outputs accurate interactive content in the target field, improving the accuracy and stability of the model, and avoiding catastrophic forgetting.
Smart Images

Figure CN119303307A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a role model training method, a role model application method, an apparatus, a computer device, a storage medium and a computer program product. Background Art
[0002] With the development of computer technology, artificial intelligence technology has emerged. Artificial intelligence technology is the technology and method of simulating and realizing human intelligence through computer programs or machines. With the development of artificial intelligence technology, artificial intelligence big models have expanded the imagination space of virtual characters in many fields.
[0003] In traditional technology, the general large model is usually fine-tuned based on the domain knowledge dataset and role knowledge dataset of the target domain to obtain a role model suitable for the target domain. However, with this training method, it is difficult for the model to accurately learn domain knowledge and role knowledge, resulting in low model accuracy. Summary of the invention
[0004] Based on this, it is necessary to provide a role model training method, role model application method, device, computer equipment, computer-readable storage medium and computer program product that can improve the accuracy of the model in response to the above technical problems.
[0005] The present application provides a role model training method, comprising:
[0006] Acquire a general data set, acquire a background data set corresponding to a target domain, and acquire a character style data set for a virtual character in the target domain; the general data set includes labeled training data for each of a plurality of domains, the background data set includes a plurality of labeled training data containing background information of the target domain, and the character style data set includes a plurality of labeled training data containing style information of the virtual character;
[0007] Based on the general data set and the background data set, the initial character model corresponding to the target domain is trained in the first stage, and based on the general data set and the character style data set, the initial character model is trained in the second stage to obtain a target character model corresponding to the target domain;
[0008] The target role model is used to output interactive content for feeding back to the target participating object through the target virtual character based on the participating content of the target participating object in the target field and the role identification of the target virtual character.
[0009] The present application also provides a role model training device, comprising:
[0010] A training set acquisition module is used to acquire a general data set, acquire a background data set corresponding to a target domain, and acquire a character style data set for a virtual character in the target domain; the general data set includes labeled training data for each of a plurality of domains, the background data set includes a plurality of labeled training data containing background information of the target domain, and the character style data set includes a plurality of labeled training data containing style information of the virtual character;
[0011] A model training module, configured to perform a first-stage training on an initial character model corresponding to the target domain based on the general data set and the background data set, and perform a second-stage training on the initial character model based on the general data set and the character style data set, so as to obtain a target character model corresponding to the target domain;
[0012] The target role model is used to output interactive content for feeding back to the target participating object through the target virtual character based on the participating content of the target participating object in the target field and the role identification of the target virtual character.
[0013] The present application also provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps described in the above-mentioned role model training method when executing the computer program.
[0014] The present application also provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps described in the above-mentioned role model training method are implemented.
[0015] The present application also provides a computer program product, including a computer program, which implements the steps described in the above-mentioned role model training method when executed by a processor.
[0016] The present application provides a role model application method, including:
[0017] Obtaining the participation content of the target participant in the target field and the role identification of the target virtual role;
[0018] Inputting the participation content and the role identifier into a target role model corresponding to the target domain to obtain interactive content for feeding back to the target participant through the target virtual role;
[0019] Wherein, the target role model is obtained according to the aforementioned role model training method.
[0020] The present application also provides a role model application device, comprising:
[0021] A data acquisition module, used to acquire the participation content of the target participant in the target field and the role identification of the target virtual role;
[0022] A model application module, used for inputting the participation content and the role identification into a target role model corresponding to the target domain, and obtaining interactive content for feeding back to the target participant through the target virtual role;
[0023] Wherein, the target role model is obtained according to the aforementioned role model training method.
[0024] The present application also provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps described in the above-mentioned role model application method when executing the computer program.
[0025] The present application also provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps of the above-mentioned role model application method are implemented.
[0026] The present application also provides a computer program product, including a computer program, which implements the steps of the above-mentioned role model application method when executed by a processor.
[0027] In the above-mentioned role model training method, role model application method, device, computer equipment, storage medium and computer program product, the general data set includes labeled training data of multiple fields, which can prevent the model from forgetting general knowledge; the background data set corresponding to the target field includes a plurality of labeled training data containing background information of the target field, which can help the model learn the background knowledge of the target field; the role style data set for the virtual character in the target field includes a plurality of labeled training data containing style information of the virtual character in the target field, which can help the model learn the role style of the virtual character in the target field. Based on the general data set and the background data set, the initial role model corresponding to the target field is trained in the first stage, so that the initial role model can have the knowledge of the background of the target field while retaining the original general ability. Based on the general data set and the role style data set, the initial role model is trained in the second stage to obtain the target role model corresponding to the target field, so that the target role model can further have the knowledge of the role style of the virtual character in the target field while retaining the original general ability and having the background knowledge of the target field, so that when the target role model is used in the target field, it can output content that conforms to the background of the target field and has the corresponding role style. In this way, when training the role model applied to the target domain, the introduction of a general data set can avoid the loss of the model's original capabilities and the occurrence of catastrophic forgetting, so that the model can steadily converge to the target domain and ensure the model's accuracy. In addition, fine-tuning the model based on the general data set and the background data set first, and then fine-tuning the model based on the general data set and the role style data set, can allow the model to gradually learn the relevant knowledge of the target domain and ensure the model's accuracy. The participation content of the target participant in the target domain and the role identification of the target virtual role are input into the target role model, and the target role model outputs the interactive content that is used to feed back to the target participant through the target virtual role. Since the model has relatively accurate data processing capabilities after training, it can output accurate interactive content. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the related technologies, the drawings required for use in the embodiments or the related technical descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0029] FIG1 is an application environment diagram of a role model training method and a role model application method in one embodiment;
[0030] FIG2 is a schematic diagram of a process flow of a role model training method in one embodiment;
[0031] FIG3 is a schematic diagram of constructing multiple data sets in one embodiment;
[0032] FIG4 is a schematic diagram of constructing a style conversion dataset in one embodiment;
[0033] FIG5 is a schematic diagram of role prompt information in one embodiment;
[0034] FIG6 is a schematic diagram of a reasoning and suggestion data set in one embodiment;
[0035] FIG7 is a schematic diagram of thought chain prompt information in one embodiment;
[0036] FIG8 is a schematic diagram of a process flow of a role model application method in one embodiment;
[0037] FIG9 is a schematic diagram of an interface of an RPG game (Role-playing game) in one embodiment;
[0038] FIG10 is a schematic diagram of a process of training a role model in one embodiment;
[0039] FIG11 is a structural block diagram of a role model training device in one embodiment;
[0040] FIG12 is a structural block diagram of a role model application device in one embodiment;
[0041] FIG13 is a diagram showing the internal structure of a computer device in one embodiment;
[0042] FIG. 14 is a diagram showing the internal structure of a computer device in another embodiment. DETAILED DESCRIPTION
[0043] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0044] The role model training method and role model application method provided in the embodiment of the present application can be applied in the application environment shown in Figure 1. Among them, the terminal 102 communicates with the server 104 through the network. The data storage system can store the data that the server 104 needs to process. The data storage system can be set up separately, integrated on the server 104, or placed on the cloud or other devices. The terminal 102 can be, but is not limited to, various personal computers, laptops, smart phones, tablet computers, Internet of Things devices and portable wearable devices. The Internet of Things devices can be smart speakers, smart TVs, smart air conditioners, smart car devices, projection devices, etc. Portable wearable devices can be smart watches, smart bracelets, head-mounted devices, etc. The head-mounted device can be a virtual reality (VR) device, an augmented reality (AR) device, smart glasses, etc. The server 104 can be an independent physical server, a server cluster or a distributed system consisting of multiple physical servers, or a cloud server that provides cloud computing services.
[0045] It is understood that the terminal and the server can be used alone to execute the role model training method and the role model application method provided in the embodiment of the present application. The terminal and the server can also be used together to execute the role model training method and the role model application method provided in the embodiment of the present application.
[0046] For example, the server obtains a general data set, obtains a background data set corresponding to the target domain, and obtains a character style data set for the virtual character in the target domain, wherein the general data set includes labeled training data of multiple domains, the background data set includes multiple labeled training data containing background information of the target domain, and the character style data set includes multiple labeled training data containing style information of the virtual character. The server performs a first-stage training on the initial character model corresponding to the target domain based on the general data set and the background data set, and performs a second-stage training on the initial character model based on the general data set and the character style data set to obtain a target character model corresponding to the target domain.
[0047] The terminal obtains the participation content of the target participant in the target domain and the role identification of the target virtual character, and sends the participation content and role identification to the server. The server inputs the participation content and role identification into the target role model corresponding to the target domain, and obtains the interactive content for feedback to the target participant through the target virtual character. The server returns the interactive content to the terminal, and the terminal displays the interactive content.
[0048] In one embodiment, as shown in FIG2 , a role model training method is provided, and the method is applied to a computer device as an example, and the computer device can be a terminal or a server. It can be understood that the method can be executed by the terminal or the server itself alone, or can be implemented through the interaction between the terminal and the server. Wherein:
[0049] Step S202, obtaining a general data set, obtaining a background data set corresponding to the target domain, and obtaining a character style data set for a virtual character in the target domain.
[0050] Among them, the general dataset includes labeled training data for each of the multiple fields, that is, the general dataset includes the training data for each of the multiple fields and the training labels corresponding to the training data. The training data and corresponding training labels of a single field contain the relevant knowledge in the single field. The general dataset contains knowledge from multiple fields, which helps to retain the generalist of the model during model training. For example, the general dataset includes question-answer pairs for each of the multiple fields, and the question-answer pairs for a single field contain the relevant knowledge of the single field.
[0051] The target field refers to the industry field to be studied in detail. The target field can construct the required virtual characters, and the virtual characters can provide services to users in the target field. The target field can be selected as needed. For example, the target field can be any field where virtual characters exist, such as games, media, education, tourism, medical care, consulting, etc. A virtual character refers to a fictional character or a digital character. Different fields have their own virtual characters. For example, a virtual character in the game field can be an NPC (non-player character) in the game; a virtual character in the media field can be a digital reporter launched by the media; a virtual character in the tourism field can be a virtual tour guide launched by a scenic spot; and so on. It can be understood that there can be at least one virtual character in a single field. In a single field, different virtual characters can have different personal styles.
[0052] The background data set corresponding to the target domain includes a plurality of labeled training data containing background information of the target domain, that is, the background data set corresponding to the target domain includes a plurality of training data reflecting the background knowledge of the target domain and training labels corresponding to the training data. The background information of the target domain is used to introduce various basic settings of the target domain to frame the content and boundaries of the target domain. For example, the background data set corresponding to the target domain includes question-answer pairs reflecting the background knowledge of the target domain. The background knowledge of the target domain is used to introduce the basic knowledge such as roles, environment, rules, culture and values constructed by the target domain.
[0053] The character style dataset for the virtual character in the target domain includes a plurality of labeled training data containing style information of the virtual character, that is, the character style dataset for the virtual character in the target domain includes a plurality of training data reflecting the character style of the virtual character and training labels corresponding to the training data. There may be multiple virtual characters in the target domain, and the character style dataset may include labeled training data corresponding to each virtual character. For example, the character style dataset for the virtual character in the target domain includes question-answer pairs corresponding to each of the multiple virtual characters in the target domain, the questions in the question-answer pairs are questions asked to the virtual character, and the answers in the question-answer pairs are answers given by the virtual character according to its own character style.
[0054] Specifically, the computer device can obtain a general data set locally or from other devices, obtain a background data set corresponding to the target domain, obtain a character style data set for the virtual character in the target domain, and train a target character model corresponding to the target domain based on the general data set, the background data set and the character style data set.
[0055] In one embodiment, the background data set corresponding to the target domain includes at least one of a world view and role setting summary data set and a world view and role setting question and answer data set. The summary data set includes an introduction text and a core theme corresponding to the introduction text, the introduction text is training data, and the core theme corresponding to the introduction text is a training label corresponding to the training data. The question and answer data set includes question and answer pairs, the questions in the question and answer pairs are training data, and the answers in the question and answer pairs are training labels corresponding to the training data.
[0056] In one embodiment, a character style dataset for a virtual character in a target domain is obtained, including at least one of a style question-answering dataset and a style conversion dataset. The style question-answering dataset includes question-answering pairs with the character style of the virtual character, the questions in the question-answering pairs are training data, and the answers in the question-answering pairs are training labels corresponding to the training data. The style conversion dataset includes style conversion speech pairs, the style conversion speech pairs include non-style speech and styled speech with the character style of the virtual character, the styled speech in the style conversion speech pairs are training data, and the non-style speech in the style conversion speech pairs are training labels corresponding to the training data.
[0057] Step S204, based on the general data set and the background data set, the initial character model corresponding to the target domain is trained in the first stage, and based on the general data set and the character style data set, the initial character model is trained in the second stage to obtain the target character model corresponding to the target domain.
[0058] Among them, the role model is an artificial intelligence model. The role model is used to output data with the role style of the virtual character based on the data input to the role model. For example, in the field of games, the input data of the role model can be questions asked by players to NPCs, and the output data of the role model can be answers with the personal style of NPCs; in the field of media, the input data of the role model can be questions asked by users to digital reporters, and the output data of the role model can be answers with the personal style of digital reporters; in the field of tourism, the input data of the role model can be questions asked by tourists to virtual tour guides, and the output data of the role model can be answers with the personal style of virtual tour guides; and so on.
[0059] The role model corresponding to the target domain refers to a role model dedicated to the target domain. The initial role model refers to a role model to be trained. The target role model refers to a role model that has completed training.
[0060] Specifically, the computer device obtains an initial role model corresponding to the target domain, and performs supervised training on the initial role model based on the general data set, the background data set, and the role style data set to obtain a target role model corresponding to the target domain. It can be understood that a general model can be obtained as the initial role model corresponding to the target domain; the general model can be fine-tuned to obtain the initial role model corresponding to the target domain; and so on. The general model is an artificial intelligence model, and the general model is a model applicable to multiple fields. For example, the general model can be a large language model that is common among multiple fields, and the large language model can handle natural language tasks in any of the multiple fields.
[0061] The initial role model corresponding to the target domain adopts a two-stage training method, and different training data sets are used for model training in different stages. In the first stage of training, the computer device performs supervised training on the initial role model corresponding to the target domain based on the general data set and the background data set. The initial role model trained in the first stage retains the original general capabilities and has the background knowledge of the target domain. Specifically, the training data and the training labels corresponding to the training data can be obtained from the general data set and the background data set, and each training data is input into the initial role model corresponding to the target domain to obtain the prediction labels corresponding to each training data. The model loss is calculated based on the training labels and prediction labels corresponding to each training data, and the model parameters of the initial role model are adjusted based on the model loss until the convergence conditions are met, and the first stage of training is terminated.
[0062] It can be understood that the initial role model corresponding to the target domain is obtained based on the general model. Since there is a large gap in data distribution between the background data set corresponding to the target domain and the training data set of the general model, if the initial role model is fine-tuned directly based on the background data set corresponding to the target domain, it is easy to bring high risks and make it difficult for the model to converge. However, in this application, fine-tuning the initial role model based on the general data set and the background data set can avoid the model from losing its original capabilities and forgetting its original knowledge, so that the model can better learn and integrate the background knowledge of the target domain based on the original knowledge.
[0063] During the second stage of training, the computer device continues to perform supervised training on the initial role model trained in the first stage based on the general data set and the role style data set, and uses the initial role model trained in the second stage as the target role model corresponding to the target domain. It can be understood that different training data in the same training data set can be used in different stages. For example, the general data set includes 2000 supervised training data, the first 1000 training data in the general data set are used in the first stage of training, and the last 1000 training data in the general data set are used in the second stage of training.
[0064] When the target role model is applied, the input data of the target role model includes the participation content of the target participant in the target field and the role identification of the target virtual role, and the output data of the target role model includes the interactive content used to feed back to the target participant through the target virtual role. It can be understood that the interactive content output by the target role model has the role style of the target virtual role.
[0065] The participating object of the target field refers to the participating users of the target field. For example, if the target field is the game field, the reference object of the target field can be a game player; if the target field is the tourism field, the reference object of the target field can be a tourist; if the target field is the education field, the reference object of the target field can be a student; if the target field is the medical field, the reference object of the target field can be a patient; and so on. The participating content of the participating object refers to the participating information of the participating object in the target field. For example, if the participating object is a game player, the participating content of the participating object can be questions asked by the game player in the game, player characteristics of the game player in the game, and so on; if the reference object is a tourist, the participating content of the participating object can be questions asked by the tourist in the travel, tourist characteristics of the tourist in the travel, and so on. It can be understood that the target participating object refers to the participating object to be processed. The target participating object can be any participating object. For example, the target role model in the game field can be used to answer questions from any player.
[0066] The target virtual character refers to the virtual character to be processed. The target virtual character may be any virtual character in the target domain. For example, the user may select a virtual character from the virtual character list as the target virtual character. The role identifier of the target virtual character is used to uniquely identify the target virtual character. For example, the role identifier may be a role name or a role number.
[0067] The target participant's participation content and the target virtual character's role identification are input into the target role model, and the target role model outputs interactive content for feeding back to the target participant through the target virtual character. The interactive content is the interactive information provided by the target virtual character to the target participant. For example, in the target domain, the target participant asks a question to the target virtual character, and the target participant's participation content and the target virtual character's role identification are input into the target role model, and the target role model outputs an answer with the role style of the target virtual character, and the target virtual character feeds back the answer to the target participant.
[0068] In one embodiment, during the first stage of training, the proportion of training data corresponding to the general data set and the proportion of training data corresponding to the background data set can be the same, so that the model can learn the background knowledge of the target field while maintaining the general knowledge. During the second stage of training, the proportion of training data corresponding to the general data set is less than the proportion of training data corresponding to the character style data set. By configuring a small amount of general data, the general ability of the model is not lost, and by configuring a large amount of character style data, the model's processing ability in character style is significantly improved.
[0069] In one embodiment, a reasoning and suggestion dataset corresponding to the target domain is obtained, and the initial role model is further trained in the second stage based on the general dataset, the role style dataset, and the reasoning and suggestion dataset to obtain a target role model corresponding to the target domain. The reasoning and suggestion dataset includes an object feature set and a training label set corresponding to each of multiple participating objects in the target domain. The object feature set corresponding to the participating object includes at least one of the current state feature, historical state feature, and environmental feature of the participating object in the target domain. The training label set corresponding to the participating object includes feature-class training labels and suggestion-class training labels. Feature-class training labels are training labels for object features, including evaluation labels corresponding to each feature in the object feature set. Suggestion-class training labels are training labels for object feature sets, including suggestion labels provided to reference objects.
[0070] In the above-mentioned role model training method, the general data set includes labeled training data of multiple fields, which can prevent the model from forgetting general knowledge; the background data set corresponding to the target field includes multiple labeled training data containing background information of the target field, which can help the model learn the background knowledge of the target field; the role style data set for the virtual character in the target field includes multiple labeled training data containing style information of the virtual character in the target field, which can help the model learn the role style of the virtual character in the target field. Based on the general data set and the background data set, the initial role model corresponding to the target field is trained in the first stage, so that the initial role model can have the background of the target field on the basis of retaining the original general ability. Based on the general data set and the role style data set, the initial role model is trained in the second stage to obtain the target role model corresponding to the target field, which can enable the target role model to further have the role style of the virtual character in the target field on the basis of retaining the original general ability and having the background knowledge of the target field, so that when the target role model is used in the target field, it can output content that conforms to the background of the target field and has the corresponding role style. In this way, when training the role model applied to the target domain, the introduction of a general data set can avoid the loss of the model's original capabilities and the occurrence of catastrophic forgetting, so that the model can steadily converge to the target domain and ensure the model's accuracy. In addition, fine-tuning the model based on the general data set and the background data set first, and then fine-tuning the model based on the general data set and the role style data set, can allow the model to gradually learn the relevant knowledge of the target domain and ensure the model's accuracy. The participation content of the target participant in the target domain and the role identification of the target virtual role are input into the target role model, and the target role model outputs the interactive content that is used to feed back to the target participant through the target virtual role. Since the model has relatively accurate data processing capabilities after training, it can output accurate interactive content.
[0071] In one embodiment, obtaining a background data set corresponding to the target domain includes:
[0072] Obtain the worldview introduction information and role setting introduction information of the target area;
[0073] The world view introduction information and character setting introduction information are divided into multiple introduction segments, and the core themes of each introduction segment are extracted respectively. Based on each introduction segment and the corresponding core themes, a world view and character setting summary dataset is obtained;
[0074] Based on the introduction clips and core themes, multiple question-answer pairs are mined to form a world view and character setting question-answer dataset;
[0075] Based on the world view and role setting summary dataset and the world view and role setting question and answer dataset, the background dataset corresponding to the target field is obtained.
[0076] The target domain's worldview introduction information is information for introducing the target domain's worldview. The target domain's character setting introduction information is information for introducing the character settings of various virtual characters in the target domain.
[0077] Specifically, the computer device can obtain the world view introduction information and character setting introduction information of the target field, construct a world view and character setting summary data set based on the world view introduction information and character setting introduction information, construct a world view and character setting question and answer data set based on the world view and character setting summary data set, and use the world view and character setting summary data set and the world view and character setting question and answer data set as the background data sets corresponding to the target field.
[0078] The computer device can divide the world view introduction information and the character setting introduction information into multiple introduction segments, respectively extract the core theme of each introduction segment, and obtain a world view and character setting summary data set based on each introduction segment and the core theme corresponding to each introduction segment. In the world view and character setting summary data set, the introduction segment is the training data, and the core theme corresponding to the introduction segment is the training label corresponding to the training data. For example, the information extraction is assisted by the summary extraction model, the text introduction segment is input into the summary extraction model, and the summary extraction model outputs the core theme corresponding to the introduction segment. Further, the computer device can mine multiple question-answer pairs based on the introduction segment and the core theme to form a world view and character setting question-answer data set. In the world view and character setting question-answer data set, the questions in the question-answer pair are the training data, and the answers in the question-answer pair are the training labels corresponding to the training data. For example, the question-answer pair mining is assisted by the large language model, the introduction segment and the core theme are input into the large language model, and the large language model outputs the question-answer pair.
[0079] In one embodiment, the worldview and role setting summary data set includes a first summary data set for the worldview of the target field and a second summary data set for the role setting of the virtual character in the target field. The worldview and role setting question and answer data set includes a first question and answer data set for the worldview of the target field and a second question and answer data set for the role setting of the virtual character in the target field. The worldview introduction information is divided into multiple introduction segments, and the core theme of each introduction segment is extracted respectively. Based on each introduction segment and the core theme corresponding to each introduction segment, a first summary data set is obtained. From each introduction segment and the core theme corresponding to each introduction segment, multiple question and answer pairs for the worldview of the target field are mined, and the first question and answer data set is obtained based on each question and answer pair. The role setting introduction information is divided into multiple introduction segments, and the core theme of each introduction segment is extracted respectively. Based on each introduction segment and the core theme corresponding to each introduction segment, a second summary data set is obtained. In the second summary data set, the introduction segment is training data, and the core theme corresponding to the introduction segment is the training label corresponding to the training data. From each introduction segment and the core theme corresponding to each introduction segment, multiple question and answer pairs for the role setting of the virtual character in the target field are mined, and the second question and answer data set is obtained based on each question and answer pair.
[0080] In one embodiment, the core theme of the introduction segment is extracted based on a general model. For example, the general model is a chatbot, the introduction segment is input to the chatbot, the chatbot is asked about the core theme of the input data, and the chatbot outputs the core theme of the introduction segment. Question-answer pairs are mined from the introduction segment and the core theme based on the general model. For example, the introduction segment and the core theme are input to the chatbot, the chatbot is asked to mine question-answer pairs from the input data, and the chatbot outputs the question-answer pairs. The chatbot is a large language model.
[0081] In the above embodiment, the worldview introduction information and the role setting introduction information are used to provide a background for the development of the storyline in the target field, and their content is full of a large number of artistic descriptions. This writing technique easily leads to the dispersion of knowledge points in the worldview introduction information and the role setting introduction information, and the model is difficult to learn. In this application, the worldview introduction information and the role setting introduction information are divided into multiple introduction segments, and the core themes are extracted in segments to accurately refine the knowledge points. Based on each introduction segment and the corresponding core theme, a worldview and role setting summary data set is obtained. Based on the introduction segment and the core theme, multiple question and answer pairs are mined to form a worldview and role setting question and answer data set. The worldview and role setting summary data set and the worldview and role setting question and answer data set are different types of training data sets in the knowledge point concentration, which help the model to fully learn the background knowledge of the target field during model training.
[0082] In one embodiment, obtaining a character style dataset for a virtual character in a target domain includes:
[0083] Obtain a question-answering dataset for the role settings of virtual characters in the target domain;
[0084] Based on the character styles of each virtual character in the target domain, the question-answer pairs in the question-answer dataset are rewritten in style to obtain a style question-answer dataset.
[0085] Based on the style question answering dataset, a character style dataset for virtual characters in the target domain is obtained.
[0086] The question-answer dataset for the role setting of the virtual character in the target domain includes a plurality of question-answer pairs reflecting the role setting of the virtual character in the target domain. Style rewriting of the question-answer pairs refers to converting the question-answer pairs into question-answer pairs with the role style of the virtual character. For example, if the virtual character is a sheep, the question-answer pairs are converted into question-answer pairs with the characteristics of a sheep.
[0087] Specifically, the computer device can obtain a question-and-answer data set for the role setting of the virtual character in the target field, generate a style question-and-answer data set based on the question-and-answer data set, and use the style question-and-answer data set as a role style data set for the virtual character in the target field. It can be understood that the question-and-answer data set is a data set without style or with a single style. The computer device can rewrite the question-and-answer pairs in the question-and-answer data set based on the role style of each virtual character in the target field, obtain multiple style question-and-answer pairs corresponding to each virtual character, and form each style question-and-answer pair into a style question-and-answer data set. For example, a style rewriting model is specially trained, and the question-and-answer pairs in the question-and-answer data set and the role style introduction information of the target virtual character are input into the style rewriting model, and the style rewriting model outputs the style question-and-answer pairs corresponding to the target virtual character.
[0088] In the above embodiment, the question and answer datasets for the character settings of the virtual characters in the target field are rewritten according to the style of the virtual characters to obtain a style question and answer dataset. The style question and answer dataset contains relevant knowledge about the character style of each virtual character in the target field, which helps the model to fully learn the character style of each virtual character during model training.
[0089] In a specific application, referring to Figure 3, taking the game field as an example, based on the game world view data (i.e., world view introduction information) and NPC character setting script data (i.e., character setting introduction information), a world view and character setting question and answer dataset is constructed. Based on the world view and character setting question and answer dataset, a style question and answer dataset is constructed.
[0090] The game world view data and NPC character script data are divided into multiple data fragments. The large language model is used to assist in information extraction. Information is extracted from each data fragment, and the main theme and core content (i.e., core theme) of the data fragment are extracted. The data fragments and core themes are combined into a game world view and character summary data set. When training the role model, the game world view and character summary data set can inject the game world view and NPC character into the model, which helps the model to have a deeper thinking and understanding of the game and character.
[0091] Through the large language model to assist in question and answer generation, a variety of question and answer pairs about the game world view and NPC personality are mined from the fragments and core themes, and the question and answer pairs are combined into a world view and personality question and answer dataset. In order to inject the personality style into the model, the question and answer pairs mined from the fragments and core themes are rewritten in style, and the question and answer pairs with the NPC personality style are combined into a style question and answer dataset. When training the character model, the world view, personality question and answer dataset and style question and answer dataset can effectively enhance the model's diversity and generalization of NPC personality. Differences are presented by different responses from different NPCs to the same question, while generalization is presented by the migration of general responses to personality responses.
[0092] Through the game world view and character summary dataset, world view, character question and answer dataset, and style question and answer dataset, the game world view and character differentiation can be injected into the character model, so that the character model can have an understanding of the basic knowledge of the game and express the semantics and style of thousands of people.
[0093] In one embodiment, obtaining a character style dataset for a virtual character in a target domain includes:
[0094] Obtain the stylish speech of each virtual character in the target field under different events;
[0095] Expand the stylish speech to obtain the stylish generalized speech;
[0096] Based on generalized speech, a dataset of style speech is obtained;
[0097] The style-based speech dataset is de-styled to obtain a style-free speech dataset;
[0098] Based on the style speech dataset and the non-style speech dataset, multiple style conversion speech pairs are constructed to form a style conversion dataset;
[0099] Based on the style transfer dataset, a character style dataset for virtual characters in the target domain is obtained.
[0100] Among them, the target domain involves multiple virtual characters, and various events can occur in the target domain. Different virtual characters usually react differently to the same event, so different virtual characters usually use different words in different events. For example, in the field of games, different events can represent different game plots, and different NPCs have different words in the same game plot. The words of NPCs in specific game plots are words with personal style. Events that occur in the target domain can be random events that occur randomly, or they can be triggered events triggered by participating objects. For example, relevant events can be triggered after participating objects complete a task or meet certain conditions, or they can be plot events that promote the development of the storyline.
[0101] Stylish speech is a speech with style. Stylish speech of virtual characters is speech with the character style of virtual characters. Stylish speech is expanded to obtain stylish generalized speech. Speech expansion expands the original speech into a larger number of new speech, and the original speech and the new speech have similar semantics. Stylish generalized speech is also speech with the character style of virtual characters. Generalized speech is speech obtained through speech expansion.
[0102] De-stylizing the stylized speech means converting the stylized speech into non-stylized speech on the basis of retaining the meaning of the speech. The style conversion speech pair includes a speech, specifically including the stylized speech and the non-stylized speech obtained by de-stylizing the stylized speech.
[0103] Specifically, the computer device can construct a stylized speech dataset for virtual characters in the target domain, convert the stylized speech dataset into a non-styled speech dataset, construct a style conversion dataset based on the stylized speech dataset and the non-styled speech dataset, and use the style conversion dataset as a character style dataset for virtual characters in the target domain.
[0104] The computer device can obtain the styled speech of each virtual character in the target field under different events, expand the styled speech, obtain the styled generalized speech, and form each generalized speech into a styled speech data set. For example, details can be added to the styled speech to obtain the styled generalized speech; the sentence structure of the styled speech can be changed to obtain the styled generalized speech; and so on. Of course, each styled speech and each generalized speech can also be formed into a styled speech data set. The computer device can perform style removal processing on the styled speech data set to obtain a styleless speech data set, convert the styled speech in the styled speech data set into styleless speech, and form each styleless speech into a styleless speech data set. For example, style removal processing is performed through a large language model, the styled speech is input into the large language model, and the large language model outputs the styleless speech. The computer device can construct multiple style conversion speech pairs based on the styled speech data set and the styleless speech data set, form the speech before and after the style removal processing into a style conversion speech pair, and form each style conversion speech pair into a style conversion data set.
[0105] In the above embodiment, the styled speech of each virtual character in the target field under different events is obtained, the styled speech is expanded to obtain the styled generalized speech, and based on the generalized speech, a styled speech dataset is obtained. The data richness of the styled speech dataset can be improved by speech expansion, which is helpful for model training. The styled speech dataset is de-styled to obtain a styleless speech dataset. Based on the styled speech dataset and the styleless speech dataset, multiple style conversion speech pairs are constructed to form a style conversion dataset. The style conversion dataset helps the model learn the ability to convert styleless speech into styled speech during model training.
[0106] In a specific application, referring to FIG4, taking the field of games as an example, first, for each NPC in the game, several stylized speeches under different events can be annotated manually, and each NPC is annotated with N stylized speeches. Then, the speech expansion is performed by imitating the manually annotated style through the large language model, and 1 stylized speech is expanded into M generalized speeches, and the generalized speech is also a stylized speech. Each NPC is expanded from the original N stylized speeches to N×M stylized speeches, thereby constructing a high-quality stylized speech data set. Finally, the stylized speech data set is rewritten into a styleless ordinary speech data set through the large language model, and the styled speech and the rewritten styleless speech are composed of style conversion speech pairs, and the style conversion data set is obtained based on the N×M style conversion speech pairs of each NPC. It can be understood that the speech example in FIG4 is the speech example of the sheep NPC.
[0107] It is difficult to rewrite non-style speech into specific style speech through the role model. Therefore, it is necessary to train the style rewriting ability of the role model based on a rich set of relevant training data. When training the role model based on the style conversion data set, the non-style speech of the virtual character in the style conversion speech pair is used as the training data, and the styled speech of the virtual character in the style conversion speech pair is used as the training label corresponding to the training data. The learning task of the role model is to rewrite the non-style speech into the styled speech with the character style of the virtual character.
[0108] In one embodiment, based on the general data set and the character style data set, the initial character model is trained in the second stage to obtain a target character model corresponding to the target domain, including:
[0109] Obtain a reasoning and suggestion data set corresponding to the target domain; the reasoning and suggestion data set includes an object feature set and a training label set corresponding to each of multiple participating objects in the target domain; the object feature set includes at least one of the current state feature, historical state feature, and environmental feature of the participating object in the target domain; the training label set includes a first type of training label, a second type of training label, and a third type of training label corresponding to the participating object, the first type of training label includes the evaluation and attention degree corresponding to each feature in the object feature set, the second type of training label includes multiple participating suggestions corresponding to the reference object and the suggestion degree corresponding to each participating suggestion, and the third type of training label includes a comprehensive suggestion determined based on multiple reference suggestions;
[0110] Based on the general dataset, character style dataset, and reasoning and suggestion dataset, the initial character model is trained in the second stage to obtain the target character model corresponding to the target domain.
[0111] Among them, the reasoning and suggestion data set includes object feature sets and training label sets corresponding to multiple participating objects in the target domain. The object feature sets corresponding to the participating objects are used to describe the participation of the participating objects. The object feature sets corresponding to the participating objects include the current state features, historical state features, and environmental features of the participating objects in the target domain. The current state features are used to reflect the current state of the reference object, the historical state features are used to reflect the historical state of the reference object, and the environmental features are used to reflect the environment in which the participating objects are located. The state of the reference object can be reflected by at least one information such as the level of the participating object, the progress of the participating object in completing the task, the success rate of the participating object in completing the task, the equipment of the participating object, the number of participation of the participating object, and the participation behavior of the participating object. The training label set corresponding to the participating object includes the first type of training labels, the second type of training labels, and the third type of training labels corresponding to the participating object. The first type of training labels are feature class labels, and the first type of training labels include the evaluation and attention degree corresponding to each feature in the object feature set. The attention degree corresponding to the feature refers to the confidence that the feature is worthy of attention. The higher the attention degree corresponding to the feature, the more attention the feature should be paid. The second type of training labels and the third type of training labels belong to the suggestion class labels. The second type of training labels includes multiple participation suggestions corresponding to the reference object and the suggestion degree corresponding to each participation suggestion. The participation suggestion corresponding to the reference object is an operation suggestion provided to the participant. The suggestion degree corresponding to the participation suggestion refers to the confidence that the participation suggestion is worth executing. The higher the suggestion degree corresponding to the participation suggestion, the more it should be executed. The third type of training labels includes comprehensive suggestions determined based on multiple reference suggestions.
[0112] It can be understood that the object feature set corresponding to the participating objects is the training data, and the training label set corresponding to the participating objects is the training label corresponding to the training data.
[0113] Specifically, during the second stage of training, the computer device can obtain the reasoning and suggestion data set corresponding to the target domain, and perform supervised training on the initial role model trained in the first stage based on the general data set, the role style data set, and the reasoning and suggestion data set to obtain the target role model corresponding to the target domain. The reasoning and suggestion data set is used to deepen the model's understanding of the target domain and improve the accuracy of the model's output of the suggested interactive content.
[0114] In one embodiment, when marking training labels, the first and second labels can be input into a large language model, and the first and second labels are summarized by the large language model, and the large language model outputs a third label. Determining the third label by the large language model helps to reduce labor costs while ensuring accuracy.
[0115] In one embodiment, during the second stage of training, the proportion of training data corresponding to the general data set is smaller than that of the character style data set, and the proportion of training data corresponding to the general data set is smaller than that of the reasoning and suggestion data set. By configuring a small amount of general data, the general capabilities of the model are not lost, and by configuring a large amount of character style data, the model's processing capabilities in character style are improved, and by configuring a large amount of reasoning and suggestion data, the model's reasoning and suggestion data capabilities are improved.
[0116] In the above embodiment, the general data set is used to prevent the model from forgetting general knowledge, the character style data set is used to allow the model to learn the character style of the virtual character, and the reasoning and suggestion data set is used to allow the model to learn to provide suggestions to the participating objects based on the object feature set of the participating objects. Based on the general data set, the character style data set and the reasoning and suggestion data set, the initial character model is trained in the second stage to obtain the target character model corresponding to the target domain, so that the target character model can not only output interactive content with the character style, but also output suggested interactive content.
[0117] In one embodiment, based on the general data set, the character style data set, and the reasoning and suggestion data set, the initial character model is trained in the second stage to obtain a target character model corresponding to the target domain, including:
[0118] Obtain training data and training labels corresponding to the training data from the general dataset, character style dataset, and reasoning and suggestion dataset respectively;
[0119] Input each training data into the initial role model trained in the first stage to obtain the prediction label corresponding to each training data;
[0120] Based on the prediction labels and training labels corresponding to each training data, the model parameters of the initial role model trained in the first stage are adjusted until the convergence conditions are met, and the target role model corresponding to the target domain is obtained.
[0121] Among them, the convergence condition is the condition for judging whether the model has reached convergence. The convergence condition includes but is not limited to at least one of the conditions such as the model loss is greater than the preset loss value, the number of model iterations is greater than the preset number of iterations, and the rate of change of the model loss is less than the preset rate of change.
[0122] Specifically, the computer device obtains training data and training labels corresponding to the training data from the general data set, obtains training data and training labels corresponding to the training data from the character style data set, and obtains training data and training labels corresponding to the training data from the reasoning and suggestion data set. The computer device inputs each training data into the initial character model trained in the first stage, and the initial character model outputs the prediction labels corresponding to each training data. The computer device calculates the model loss based on the prediction labels and training labels corresponding to each training data. The model loss is used to reflect the difference between the prediction label and the training label. The model loss is back-propagated to adjust the model parameters of the initial character model trained in the first stage. Through multiple iterations of training until the convergence condition is met, the target character model corresponding to the target field is obtained.
[0123] In one embodiment, different convergence conditions may be used for the first stage training and the second stage training. The convergence difficulty of the convergence condition of the second stage training is greater than the convergence difficulty of the convergence condition of the first stage training. The convergence difficulty of the convergence condition refers to the degree of effort or complexity required to meet the convergence condition, including considerations of time, computing resources, etc. For example, the preset number of iterations in the convergence condition of the second stage training is greater than the preset number of iterations in the convergence condition of the first stage training.
[0124] In the above embodiment, supervised training is performed on the initial role model trained in the first stage based on the general data set, the role style data set, and the reasoning and suggestion data set, so that the predicted labels output by the role model become closer and closer to the training labels until the convergence conditions are met, and the target role model corresponding to the target domain is obtained, so that the target role model can output accurate interactive content based on the input data and the knowledge learned through training.
[0125] In one embodiment, each training data is input into the initial role model trained in the first stage to obtain the prediction label corresponding to each training data, including:
[0126] For the training data determined from the character style data set, character prompt information of the virtual character corresponding to the training data is obtained; the character prompt information is a content framework set for the character;
[0127] The character prompt information and training data are concatenated and input into the initial character model trained in the first stage to obtain the predicted label corresponding to the training data.
[0128] Among them, the role prompt information is the content framework for the role setting, including the role attributes, role experience, role relationships, role background, role behavior and other information related to the role setting of the virtual character, which is used to prompt the specific character setting of the model virtual character.
[0129] Specifically, for the training data determined from the character style data set, the character prompt information of the virtual character corresponding to the training data is obtained, and the character prompt information and the training data are spliced and input into the initial character model trained in the first stage. The character prompt information is used to assist the character model in understanding the character characteristics of the virtual character so as to output data that conforms to the character hot spots. The initial character model processes the training data with reference to the character prompt information to obtain the predicted label corresponding to the training data, and the initial character model outputs the predicted label corresponding to the training data. For example, the style question and answer pair corresponding to the virtual character A is obtained from the style question and answer data set, and the question in the style question and answer pair is the training data, and the answer is the training label. The character prompt information corresponding to the virtual character A is obtained, and the character prompt information corresponding to the virtual character A is spliced in front of the question, and the splicing result is input into the initial character model trained in the first stage. The initial character model outputs the predicted answer according to the input data, and the predicted answer is the predicted label. For another example, the style conversion speech pair corresponding to the virtual character B is obtained from the style conversion data set, and the styleless speech in the style conversion speech pair is the training data, and the style speech is the training label. Get the role prompt information corresponding to the virtual character B, splice the role prompt information corresponding to the virtual character B in front of the non-styled speech, and splice the task prompt information after the non-styled speech. The task prompt information is used to prompt the model to convert the non-styled speech into the styled speech corresponding to the virtual character reflected by the role prompt information. The splicing result is input into the initial role model trained in the first stage. The initial role model outputs the styled speech according to the input data, and the styled speech output by the initial role model is the predicted label.
[0130] Similarly, when the initial character model is trained in the first stage based on the general data set and the background data set, the character prompt information of the virtual character corresponding to the training data determined from the second question-and-answer data set can also be obtained, and the character prompt information and the training data can be concatenated and input into the initial character model to obtain the predicted label corresponding to the training data.
[0131] In a specific application, taking the field of games as an example, in order to realize the different personalities of multiple NPCs, the content framework of the role setting can be carefully designed in advance for each NPC in the game. The content framework of the role setting of a certain NPC in the game (i.e., the role prompt information) can be shown in Figure 5.
[0132] In the above embodiment, for the training data determined from the character style data set, the character prompt information corresponding to the virtual character and the training data corresponding to the virtual character are spliced, and then input into the initial character model trained in the first stage. The character prompt information can provide the model with prompt information related to the virtual character, assisting the model to make better decisions, so that the initial character model trained in the first stage can output more accurate prediction labels corresponding to the training data.
[0133] In one embodiment, each training data is input into the initial role model trained in the first stage to obtain the prediction label corresponding to each training data, including:
[0134] For the training data determined from the reasoning and suggestion data set, the thinking chain prompt information is obtained; the thinking chain prompt information includes prompt information for the task process, and prompt information for the label definition and range of various training labels; the thinking chain prompt information is used to prompt the model to determine the prediction label set corresponding to the reference object within the label definition and range based on the object feature set corresponding to the participating object according to the task process;
[0135] The thought chain prompt information and training data are spliced and input into the initial role model trained in the first stage to obtain the predicted label corresponding to the training data.
[0136] Among them, the thought chain prompt information includes prompt information for the task flow and prompt information for the label definition and range of various training labels. The prompt information for the task flow is used to prompt the model of the task flow to be executed. The task flow includes a series of ordered steps, which are intended to complete a specific task. The specific task is to output the prediction label set corresponding to the reference object based on the object feature set corresponding to the participating object. The prompt information for the label definition and range of various training labels is used to prompt the model of the label definition of various training labels and the value range of various training labels. The thought chain prompt information is used to prompt the model to determine the prediction label set corresponding to the reference object within the label definition and range based on the object feature set corresponding to the participating object according to the task flow. Similar to the training label set, the training label set includes the first class training labels, the second class training labels and the third class training labels corresponding to the participating objects. The prediction label set includes the first class prediction labels, the second class prediction labels and the third class prediction labels corresponding to the participating objects. The first class training label corresponds to the first class prediction label, the second class training label corresponds to the second class prediction label, and the third class training label corresponds to the third class prediction label.
[0137] Specifically, for the training data determined from the reasoning and suggestion data set, the thinking chain prompt information is obtained, and the thinking chain prompt information and the training data are spliced and input into the initial role model trained in the first stage. The initial role model processes the training data with reference to the thinking chain prompt information to obtain the predicted label corresponding to the training data, and the initial role model outputs the predicted label corresponding to the training data.
[0138] It can be understood that, for the training data determined from the reasoning and suggestion dataset, the predicted labels corresponding to the training data include a predicted label set corresponding to the reference object.
[0139] In the above embodiment, for the training data determined from the reasoning and suggestion data set, thinking chain prompt information is obtained, and the thinking chain prompt information and the training data are spliced and input into the initial role model trained in the first stage. The thinking chain prompt information can guide the model to step by step output the prediction label set corresponding to the reference object, assisting the model to make better decisions, so that the initial role model trained in the first stage can output more accurate prediction labels corresponding to the training data.
[0140] In a specific application, referring to FIG6, taking the game field as an example, the reasoning and suggestion data set in the game field includes the player's player feature set (i.e., object feature set) and three types of annotated data (i.e., training label set). The player's player feature set includes the player's current state features, historical state features, and environmental features. The player's current state features include game level, main line chapter, number of missiles, city level, etc. The player's historical state features include historical death times, historical recipe acquisition, historical copy participation, etc. Environmental features include weather conditions, location, time, etc. The annotator will annotate the three types of data based on the understanding of the game and the specified standards. The first type of annotation is to objectively evaluate and score each feature. For example, if the player's current game level is 3, the corresponding objective evaluation is "level backward". The tendency score (i.e., attention) refers to the confidence of whether the feature is worthy of attention. The higher the tendency score, the more attention the feature should be paid. The second type of annotation is game suggestions. The annotator will select the topN suggestions from the candidate suggestion set based on the objective evaluation and tendency score of each feature, and give the tendency score of each suggestion. The higher the tendency score of a suggestion, the more likely the player should perform the suggested action. The third type of annotation is comprehensive suggestions, which summarize the final styleless suggestion text based on the top N annotated suggestions.
[0141] In the game field, the thought chain prompt information can be shown in Figure 7. When training the role model, the meaning, scope and evaluation rules of each feature are informed to the role model through the thought chain prompt information, and the task is broken down, so that the role model can gradually participate in the process of decomposing a complex problem into sub-problems step by step and solving them in sequence, and guide the role model step by step to infer the results of the above annotations, so that the role model can fully understand the gameplay and data, deepen its understanding of the game, and learn the suggested preferences of manual annotations.
[0142] In one embodiment, the role model training method further includes:
[0143] Get the general model;
[0144] Based on a dedicated data set corresponding to the target domain, the general model is pre-trained to obtain an initial character model corresponding to the target domain; the dedicated data set includes at least one of a background data set, a character style data set, and an inference and suggestion data set corresponding to the target domain.
[0145] The general data set includes training data of multiple fields and training labels corresponding to the training data. The dedicated data set includes training data of a single field and training labels corresponding to the training data. The dedicated data set corresponding to the target field may include at least one of the background data set, character style data set, and reasoning and suggestion data set corresponding to the target field.
[0146] It can be understood that pre-training can specifically be unsupervised training or self-supervised training.
[0147] Specifically, the computer device can obtain a general model, pre-train the general model based on a dedicated data set corresponding to the target domain, and obtain an initial role model corresponding to the target domain, so that the initial role model can learn the intrinsic structure and rules of the relevant data in the target domain, thereby laying a solid foundation for subsequent supervised training.
[0148] In one embodiment, the target domain is a game domain, the virtual character is a non-player character in the game, and the reference object is a game player; the target character model is used to output a game dialogue for feedback to the target game player through the target non-player character based on the player information of the target game player in the game and the character identification of the target non-player character accompanying the target game player.
[0149] Specifically, the method of the present application can be applied to the field of gaming to train role models used for NPC role-playing in the field of gaming, improve the realism of role-playing of non-player characters in the field of gaming, and enhance the interaction between game players and NPCs.
[0150] During model training, a general data set is obtained, a background data set corresponding to the game field is obtained, a character style data set for non-player characters (i.e., NPCs) in the game field is obtained, and an initial character model corresponding to the game field is obtained based on the general model. The initial character model is trained in the first stage based on the general data set and the background data set, and the initial character model is trained in the second stage based on the general data set and the character style data set to obtain a target character model corresponding to the game field. The reasoning and suggestion data set corresponding to the game field can also be obtained, and the initial character model is trained in the second stage based on the general data set, the character style data set, and the reasoning and suggestion data set to obtain a target character model corresponding to the game field.
[0151] When the model is applied, the player information of the target game player in the game and the role identification of the target non-player character accompanying the target game player are input into the target role model, and the target role model outputs a game dialogue that is fed back to the target game player through the target non-player character, and the game dialogue has the role style of the target non-player character.
[0152] It can be understood that the target game player can be any player, and the target non-player character is a non-player character accompanying the target game player. The player information of the game player in the game includes at least one of the player questions and player characteristics. The player questions are questions asked by the game player to the NPC. The player characteristics of the game player include at least one of the current state characteristics, historical state characteristics, and environmental characteristics of the game player. The game dialogue can be used to answer the questions of the game player, and can also be used to provide game suggestions to the game player. For example, when the game player triggers a preset target event, the player characteristics of the game player in the game and the character identification of the non-player character accompanying the game player are input into the target character model, and the target character model outputs the game suggestions for feedback to the game player through the non-player character. The target event can be set as needed, for example, the target event can be that the game player's stay time at the current level exceeds the time threshold; the target event can be that the game player's stay time at the current level exceeds the time threshold; and so on.
[0153] In one embodiment, as shown in FIG8 , a role model application method is provided, and the method is applied to a computer device as an example, and the computer device can be a terminal or a server. It can be understood that the method can be executed by the terminal or the server itself alone, or can be implemented through the interaction between the terminal and the server. Wherein:
[0154] Step S802, obtaining the participation content of the target participating object in the target field and the role identification of the target virtual role.
[0155] Step S804: input the participation content and the role identification into the target role model corresponding to the target domain, and obtain the interactive content for feeding back to the target participant through the target virtual role.
[0156] The target role model is obtained according to the aforementioned role model training method.
[0157] The participating object of the target field refers to the participating users of the target field. For example, if the target field is the game field, the reference object of the target field can be a game player; if the target field is the tourism field, the reference object of the target field can be a tourist; if the target field is the education field, the reference object of the target field can be a student; if the target field is the medical field, the reference object of the target field can be a patient; and so on. The participating content of the participating object refers to the participating information of the participating object in the target field. For example, if the participating object is a game player, the participating content of the participating object can be questions asked by the game player in the game, player characteristics of the game player in the game, and so on; if the reference object is a tourist, the participating content of the participating object can be questions asked by the tourist in the travel, tourist characteristics of the tourist in the travel, and so on. It can be understood that the target participating object refers to the participating object to be processed. The target participating object can be any participating object. For example, the target role model in the game field can be used to answer questions from any player.
[0158] The target virtual character refers to the virtual character to be processed. The target virtual character may be any virtual character in the target domain. For example, the user may select a virtual character from the virtual character list as the target virtual character. The role identifier of the target virtual character is used to uniquely identify the target virtual character. For example, the role identifier may be a role name or a role number.
[0159] The target participant's participation content and the target virtual character's role identification are input into the target role model, and the target role model outputs interactive content for feeding back to the target participant through the target virtual character. The interactive content is the interactive information provided by the target virtual character to the target participant. For example, in the target domain, the target participant asks a question to the target virtual character, and the target participant's participation content and the target virtual character's role identification are input into the target role model, and the target role model outputs an answer with the role style of the target virtual character, and the target virtual character feeds back the answer to the target participant.
[0160] Specifically, during model training, the computer device obtains the target role model corresponding to the target domain through the aforementioned role model training method. During model application, the computer device obtains the participation content of the target participating object in the target domain and the role identification of the target virtual role, inputs the participation content and the role identification into the target role model corresponding to the target domain, and the target role model outputs the interactive content for feedback to the target participating object through the target virtual role. The computer device can display the interactive content output by the target role model to the target participating object through the target virtual role.
[0161] In one embodiment, role prompt information of the target virtual character is obtained, the role prompt information includes the role identification of the target virtual character, the role prompt information and the participation content are input into the target role model corresponding to the target domain, and the interactive content for feeding back to the target participating object through the target virtual character is obtained. The role prompt information can provide the model with prompt information related to the virtual character, helping the model to output more accurate interactive content.
[0162] The above-mentioned role model application method inputs the participation content of the target participating objects in the target field and the role identification of the target virtual character into the target role model, and the target role model outputs the interactive content that is fed back to the target participating objects through the target virtual character. Since the target role model trained by the above-mentioned role model training method has relatively accurate data processing capabilities, it can output precise interactive content, which helps to enhance the interactivity between the target virtual character and the target participating objects.
[0163] In a specific embodiment, the method of the present application can be applied to an RPG game. In an RPG game, a player is responsible for playing one or more characters in a realistic or fictional world. For example, referring to FIG9 , a player can play a knight in a martial arts world. An RPG game can provide an accompanying NPC to accompany the player, and an accompanying NPC specifically for accompanying the player can be developed based on a large model.
[0164] In response to the need for NPC companionship in the game, this application proposes a character model training method that can provide high-quality game suggestions and NPC dialogues with different personality settings. The character model trained by the method of this application (i.e., a large model for role-playing) includes four basic capabilities, including the model's general intelligence level, role and game knowledge, dialogue ability, plot interpretation, and logical reasoning ability. The character model trained by the method of this application can give suggestions or chat about different NPC character personalities in real time based on the player's current status, historical behavior, and preferences.
[0165] In the field of games, in order to improve the quality of character models, this application constructs the following training datasets:
[0166] 1. Game world view and NPC character setting summary dataset (i.e. world view and character setting summary dataset)
[0167] 2. Worldview and character setting question and answer dataset (i.e. worldview and character setting question and answer dataset)
[0168] 3. Style Question Answering Dataset
[0169] 4. Game Knowledge Reasoning and Suggestion Dataset (i.e. Reasoning and Suggestion Dataset)
[0170] 5. Style Transfer Dataset
[0171] 6. General Datasets
[0172] Among them, the game world view and NPC character summary dataset, world view, character question and answer dataset can inject the game world view and NPC character into the large model, which helps the model to have a deeper thinking and understanding of the game and character. The world view and character question and answer dataset can enable the model to have an understanding of the basic knowledge of the game, and show the semantics and style of thousands of people. The style question and answer dataset can make the model have differences and generalization in the NPC's personality. The game knowledge reasoning and suggestion dataset can deepen the model's understanding of the gameplay and player operation, and hope to give players reasonable suggestions and accompany players to grow. The style conversion dataset can inject the unique way of speaking and style of different NPCs into the model. The general dataset can prevent the model from forgetting general knowledge.
[0173] Referring to Figure 10, first, a general large model is obtained as the initial role model. It can be understood that the general large model is a pre-trained language model. The general large model is a model obtained by training after uniformly matching various high-quality industry data. The general large model has certain basic capabilities. It can be understood that the training data of the general large model usually does not contain content related to the game world view knowledge and NPC character background. Therefore, it is necessary to use the game world view and NPC character summary data set, the world view, and the character question and answer data set to supervise the initial role model, fine-tune the model parameters of the initial role model, and inject relevant game knowledge into the general large model. In order to improve the basic dialogue ability of the model, the general data set and the above data set are mixed in a 1:1 ratio during the first stage of training. Through this stage of training, the model already has the knowledge of the game world view and NPC background. In order to improve the NPC style dialogue ability of the model, it is necessary to use the game knowledge reasoning and suggestion set, the style conversion data set, and the style question and answer data set to continue to supervise the initial role model, fine-tune the model parameters of the initial role model, and obtain the target role model. In order to ensure that the general capabilities of the model are not lost, a small amount of general data sets are added during the second stage of training. Through this stage of training, the model has acquired the ability to reason and make suggestions within the game world and the ability to have conversations with NPCs in a specific style.
[0174] When training a model, the training data can be processed by prompts, that is, the training data to be input into the model is processed according to a specific template, and the training task is reconstructed into a form that can better utilize the pre-trained language model. The specific template can be set as needed, for example, the specific template can be a role prompt information, a thought chain prompt information.
[0175] It is understandable that if only domain data from the gaming field is used for model training, the model will easily suffer from catastrophic forgetting. Properly matching domain data and general data in the fine-tuning stage will help increase NPC's reliance on general knowledge. The information presented in the domain data is only the tip of the iceberg that the model needs to learn. Much of the knowledge implied therein cannot be enumerated and stylized in advance. Much of the fragmented and diverse knowledge requires the model to be a generalist. Adding general data can solve this problem.
[0176] Applying this application method to the field of games can achieve the following beneficial effects:
[0177] 1. Improve players’ gaming experience
[0178] Through this application method, the NPC in the game can interact with the player more naturally, provide personalized suggestions and dialogues, and thus greatly enhance the player's gaming experience. Players can feel that each NPC has its own unique personality and way of thinking, and this personalized interaction makes the game world appear more real and rich.
[0179] 2. Enhance the immersion of the game
[0180] The highly anthropomorphic dialogues and behaviors of NPCs make it easier for players to immerse themselves in the storyline of the game. Players are no longer communicating with NPCs with preset scripts, but interacting with characters that can "think". This interaction is more natural and smooth, making it easier for players to invest in the world view of the game.
[0181] 3. Provide dynamic content generation
[0182] This application method allows NPCs to dynamically generate game suggestions based on the player's behavior and the game environment. This means that each player's gaming experience can be unique because the NPC's reactions and suggestions will change based on the player's different choices. This dynamic content generation brings higher replay value to the game.
[0183] 4. Assist players in making decisions
[0184] In games, especially RPG games, players need to make many decisions. This application method enables NPCs to provide insightful suggestions to help players make better decisions. This is not just suggestions based on game rules, but also customized suggestions based on the player's personal game style and historical behavior.
[0185] 5. Promote social interaction among players
[0186] The high degree of anthropomorphism and personalization of NPCs can promote social interaction between players. Players may share their unique interaction experiences with NPCs, or discuss NPCs' suggestions and personality traits, thereby increasing the activity of the player community and interaction between players.
[0187] 6. Reduce game development costs
[0188] Traditional game development requires a lot of script writing and dialogue design work, but this application method can reduce this workload through technical means such as speech expansion, style rewriting, and style removal. This can not only reduce the cost of game development, but also provide more flexibility and creative space in the game development process.
[0189] 7. Increase the scalability of game content
[0190] Since the NPC's dialogue and behavior are generated by the character model, game developers can easily add new content and features by updating the character model without having to remake the game on a large scale. This makes it easier and more efficient to update and expand game content. For example, when the game version is iterated, the target character model corresponding to the old version of the game is updated based on the training data set for the new version of the game to obtain the target character model corresponding to the new version of the game.
[0191] In a specific embodiment, the method of the present application can be applied to the field of tourism. In the field of tourism, each region can launch a virtual tour guide to provide guidance and explanation services to tourists through the virtual tour guide. The method of the present application can highlight the regional differences of the virtual tour guide, so that the virtual tour guide can show the semantics and style of thousands of people.
[0192] For the tourism field, this application constructs the following training data sets:
[0193] 1. Tourism culture worldview and tour guide personality summary dataset
[0194] 2. Worldview and personality question-answering dataset
[0195] 3. Style Question Answering Dataset
[0196] It is understandable that in order to improve the compatibility between regions and virtual tour guides, the virtual tour guides launched in various regions can have their own regional characteristics, and the character style of the virtual tour guides launched in various regions can have their own regional characteristics. For example, the virtual tour guide in the Northeast region can have a Northeast accent and a warm and generous personality.
[0197] 4. Tourism Knowledge Reasoning and Recommendation Dataset
[0198] The tourism knowledge reasoning and recommendation dataset includes a tourist feature set and a training label set of multiple tourists. The tourist feature set includes the current state features, historical state features, and environmental features of tourists. The training label set includes the first type of labels, the second type of labels, and the third type of labels. The first type of training labels includes the evaluation and attention degree corresponding to each feature in the tourist feature set, the second type of training labels includes multiple tourist suggestions corresponding to tourists and the corresponding degree of suggestion of each tourist suggestion, and the third type of training labels includes comprehensive suggestions determined based on multiple tourist suggestions.
[0199] 5. Style Transfer Dataset
[0200] 6. General Datasets
[0201] First, a general large model is obtained as the initial role model. The initial role model is supervised and trained using the tourism culture worldview and tour guide personality summary dataset, worldview, personality question and answer dataset, and general dataset. The model parameters of the initial role model are fine-tuned to inject relevant tourism knowledge into the general large model. The initial role model is further supervised and trained using the tourism knowledge reasoning and suggestion dataset, style transfer dataset, style question and answer dataset, and general dataset. The model parameters of the initial role model are fine-tuned to obtain the target role model.
[0202] The role model trained by the method of the present application can give suggestions or chats with different virtual tour guide characters in real time based on the current state, historical behavior and preferences of the tourists. For example, tourists can have a conversation with the virtual tour guide online. When the tourists need it, the current state characteristics, historical state characteristics and environmental characteristics of the tourists, as well as the guide identification of the virtual tour guide required by the tourists are input into the target role model. The target role model outputs customized travel suggestions for the tourists with the personal characteristics of the virtual tour guide, and the virtual tour guide provides the travel suggestions to the tourists online.
[0203] It can be understood that the present application method can be applied not only to the gaming and tourism fields, but also to other technical fields that require virtual characters.
[0204] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0205] Based on the same inventive concept, the embodiment of the present application also provides a role model training device for implementing the role model training method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more role model training device embodiments provided below can refer to the limitations of the role model training method above, and will not be repeated here.
[0206] Based on the same inventive concept, the embodiment of the present application also provides a role model application device for implementing the role model application method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more role model application device embodiments provided below can refer to the limitations on the role model application method above, and will not be repeated here.
[0207] In one embodiment, as shown in FIG11 , a role model training device is provided, including: a training set acquisition module 1102 and a model training module 1104, wherein:
[0208] The training set acquisition module 1102 is used to obtain a general data set, obtain a background data set corresponding to the target field, and obtain a character style data set for the virtual character in the target field; the general data set includes labeled training data for each of the multiple fields, the background data set includes multiple labeled training data containing background information of the target field, and the character style data set includes multiple labeled training data containing style information of the virtual character.
[0209] Model training module 1104 is used to perform first-stage training on the initial role model corresponding to the target domain based on the general data set and the background data set, and to perform second-stage training on the initial role model based on the general data set and the role style data set to obtain the target role model corresponding to the target domain.
[0210] The target role model is used to output interactive content for feeding back to the target participating object through the target virtual role based on the participating content of the target participating object in the target field and the role identification of the target virtual role.
[0211] In one embodiment, the training set acquisition module 1102 is further used to:
[0212] Obtain the worldview introduction information and role setting introduction information of the target area;
[0213] The world view introduction information and character setting introduction information are divided into multiple introduction segments, and the core themes of each introduction segment are extracted respectively. Based on each introduction segment and the corresponding core themes, a world view and character setting summary dataset is obtained;
[0214] Based on the introduction clips and core themes, multiple question-answer pairs are mined to form a world view and character setting question-answer dataset;
[0215] Based on the world view and role setting summary dataset and the world view and role setting question and answer dataset, the background dataset corresponding to the target field is obtained.
[0216] In one embodiment, the training set acquisition module 1102 is further used to:
[0217] Obtain a question-answering dataset for the role settings of virtual characters in the target domain;
[0218] Based on the character styles of each virtual character in the target domain, the question-answer pairs in the question-answer dataset are rewritten in style to obtain a style question-answer dataset.
[0219] Based on the style question answering dataset, a character style dataset for virtual characters in the target domain is obtained.
[0220] In one embodiment, the training set acquisition module 1102 is further used to:
[0221] Obtain the stylish speech of each virtual character in the target field under different events;
[0222] Expand the stylish speech to obtain the stylish generalized speech;
[0223] Based on generalized speech, a dataset of style speech is obtained;
[0224] The style-based speech dataset is de-styled to obtain a style-free speech dataset;
[0225] Based on the style speech dataset and the non-style speech dataset, multiple style conversion speech pairs are constructed to form a style conversion dataset;
[0226] Based on the style transfer dataset, a character style dataset for virtual characters in the target domain is obtained.
[0227] In one embodiment, the model training module 1104 is further used to:
[0228] Obtain a reasoning and suggestion data set corresponding to the target domain; the reasoning and suggestion data set includes an object feature set and a training label set corresponding to each of multiple participating objects in the target domain; the object feature set includes at least one of the current state feature, historical state feature, and environmental feature of the participating object in the target domain; the training label set includes a first type of training label, a second type of training label, and a third type of training label corresponding to the participating object, the first type of training label includes the evaluation and attention degree corresponding to each feature in the object feature set, the second type of training label includes multiple participating suggestions corresponding to the reference object and the suggestion degree corresponding to each participating suggestion, and the third type of training label includes a comprehensive suggestion determined based on multiple reference suggestions;
[0229] Based on the general dataset, character style dataset, and reasoning and suggestion dataset, the initial character model is trained in the second stage to obtain the target character model corresponding to the target domain.
[0230] In one embodiment, the model training module 1104 is further used to:
[0231] Obtain training data and training labels corresponding to the training data from the general dataset, character style dataset, and reasoning and suggestion dataset respectively;
[0232] Input each training data into the initial role model trained in the first stage to obtain the prediction label corresponding to each training data;
[0233] Based on the prediction labels and training labels corresponding to each training data, the model parameters of the initial role model trained in the first stage are adjusted until the convergence conditions are met, and the target role model corresponding to the target domain is obtained.
[0234] In one embodiment, the model training module 1104 is further used to:
[0235] For the training data determined from the character style data set, character prompt information of the virtual character corresponding to the training data is obtained; the character prompt information is a content framework set for the character;
[0236] The character prompt information and training data are concatenated and input into the initial character model trained in the first stage to obtain the predicted label corresponding to the training data.
[0237] In one embodiment, the model training module 1104 is further used to:
[0238] For the training data determined from the reasoning and suggestion data set, the thinking chain prompt information is obtained; the thinking chain prompt information includes prompt information for the task process, and prompt information for the label definition and range of various training labels; the thinking chain prompt information is used to prompt the model to determine the prediction label set corresponding to the reference object within the label definition and range based on the object feature set corresponding to the participating object according to the task process;
[0239] The thought chain prompt information and training data are spliced and input into the initial role model trained in the first stage to obtain the predicted label corresponding to the training data.
[0240] In one embodiment, the role model training device is further used for:
[0241] Get the general model;
[0242] Based on a dedicated data set corresponding to the target domain, the general model is pre-trained to obtain an initial character model corresponding to the target domain; the dedicated data set includes at least one of a background data set, a character style data set, and an inference and suggestion data set corresponding to the target domain.
[0243] In one embodiment, the target domain is a game domain, the virtual character is a non-player character in the game, and the reference object is a game player; the target character model is used to output a game dialogue for feedback to the target game player through the target non-player character based on the player information of the target game player in the game and the character identification of the target non-player character accompanying the target game player.
[0244] In one embodiment, as shown in FIG. 12 , a role model application device is provided, including: a data acquisition module 1202 and a model application module 1204, wherein:
[0245] The data acquisition module 1202 is used to acquire the participation content of the target participant in the target field and the role identification of the target virtual role;
[0246] Model application module 1204, used to input the participation content and role identification into the target role model corresponding to the target domain, and obtain the interactive content used to feed back to the target participant through the target virtual role;
[0247] The target role model is obtained according to the aforementioned role model training method.
[0248] The above-mentioned role model training device and role model application device can improve the accuracy of the role model and improve the accuracy of the interactive content fed back to the target participating object through the target virtual character in the target field.
[0249] Each module in the above-mentioned role model training device and role model application device can be implemented in whole or in part by software, hardware and their combination. Each of the above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory in the computer device in the form of software, so that the processor can call and execute the corresponding operations of each of the above modules.
[0250] In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be shown in FIG13. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. The processor, the memory and the input / output interface are connected via a system bus, and the communication interface is connected to the system bus via the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store data related to the role model training method and / or the role model application method. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a role model training method and / or a role model application method is implemented.
[0251] In one embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be shown in FIG14. The computer device includes a processor, a memory, an input / output interface, a communication interface, a display unit, and an input device. The processor, the memory, and the input / output interface are connected via a system bus, and the communication interface, the display unit, and the input device are connected to the system bus via the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner may be implemented through WIFI, a mobile cellular network, NFC (near field communication) or other technologies. When the computer program is executed by the processor, a role model training method and / or a role model application method is implemented. The display unit of the computer device is used to form a visually visible picture, which may be a display screen, a projection device, or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covering the display screen, or a button, trackball or touchpad set on the computer device shell, or an external keyboard, touchpad or mouse.
[0252] Those skilled in the art will understand that the structures shown in FIG. 13 and FIG. 14 are merely block diagrams of partial structures related to the scheme of the present application, and do not constitute a limitation on the computer device to which the scheme of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0253] In one embodiment, a computer device is further provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above method embodiments when executing the computer program.
[0254] In one embodiment, a computer-readable storage medium is provided, storing a computer program, which implements the steps in the above method embodiments when executed by a processor.
[0255] In one embodiment, a computer program product is provided. The computer program product includes a computer program. When the computer program is executed by a processor, the steps in the above method embodiments are implemented.
[0256] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.
[0257] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.
[0258] The technical features of the above embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0259] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A role model training method, characterized in that: The method comprises: Acquire a general data set, acquire a background data set corresponding to a target domain, and acquire a character style data set for a virtual character in the target domain; the general data set includes labeled training data for each of a plurality of domains, the background data set includes a plurality of labeled training data containing background information of the target domain, and the character style data set includes a plurality of labeled training data containing style information of the virtual character; Based on the general data set and the background data set, the initial character model corresponding to the target domain is trained in the first stage, and based on the general data set and the character style data set, the initial character model is trained in the second stage to obtain a target character model corresponding to the target domain; The target role model is used to output interactive content for feeding back to the target participating object through the target virtual character based on the participating content of the target participating object in the target field and the role identification of the target virtual character.
2. The method according to claim 1, characterized in that The step of obtaining a background data set corresponding to the target domain includes: Obtain the worldview introduction information and role setting introduction information of the target area; Dividing the world view introduction information and the character setting introduction information into a plurality of introduction segments, respectively extracting the core themes of each introduction segment, and obtaining a world view and character setting summary data set based on each introduction segment and the corresponding core themes; Based on the introduction clip and the core theme, multiple question-answer pairs are mined to form a world view and character setting question-answer data set; Based on the world view and role setting summary data set and the world view and role setting question and answer data set, a background data set corresponding to the target field is obtained.
3. The method according to claim 1, characterized in that: The step of acquiring a character style dataset for a virtual character in the target domain comprises: Obtaining a question-answering dataset for role settings of virtual characters in the target field; Based on the character styles of each virtual character in the target domain, rewriting the question and answer pairs in the question and answer dataset in a style to obtain a style question and answer dataset; Based on the style question-answering dataset, a character style dataset for a virtual character in the target domain is obtained.
4. The method according to claim 1, characterized in that The step of acquiring a character style dataset for a virtual character in the target domain comprises: Obtain the stylish speech of each virtual character in the target field under different events; Expanding the stylish speech to obtain a stylish generalized speech; Based on the generalized speech, a style speech dataset is obtained; Performing de-style processing on the style speech data set to obtain a style-free speech data set; Based on the style speech dataset and the non-style speech dataset, construct a plurality of style conversion speech pairs to form a style conversion dataset; Based on the style conversion dataset, a character style dataset for a virtual character in the target domain is obtained.
5. The method according to claim 1, characterized in that The performing a second-stage training on the initial character model based on the general data set and the character style data set to obtain a target character model corresponding to the target domain includes: Acquire a reasoning and suggestion data set corresponding to the target domain; the reasoning and suggestion data set includes an object feature set and a training label set corresponding to each of a plurality of participating objects in the target domain; the object feature set includes at least one of current state features, historical state features, and environmental features of the participating objects in the target domain; the training label set includes a first type of training label, a second type of training label, and a third type of training label corresponding to the participating objects, the first type of training label includes evaluations and attention levels corresponding to each feature in the object feature set, the second type of training label includes a plurality of participating suggestions corresponding to a reference object and a suggestion level corresponding to each participating suggestion, and the third type of training label includes comprehensive suggestions determined based on the plurality of reference suggestions; Based on the general data set, the character style data set and the reasoning and suggestion data set, the initial character model is trained in the second stage to obtain a target character model corresponding to the target domain.
6. The method according to claim 5, characterized in that The performing second-stage training on the initial role model based on the general data set, the role style data set and the reasoning and suggestion data set to obtain a target role model corresponding to the target domain includes: Acquire training data and training labels corresponding to the training data from the general dataset, the character style dataset, and the reasoning and suggestion dataset respectively; Input each training data into the initial role model trained in the first stage to obtain the prediction label corresponding to each training data; Based on the prediction labels and training labels corresponding to the respective training data, the model parameters of the initial role model trained in the first stage are adjusted until the convergence condition is met, thereby obtaining the target role model corresponding to the target domain.
7. The method according to claim 6, characterized in that The step of inputting each training data into the initial role model trained in the first stage to obtain the prediction label corresponding to each training data includes: For the training data determined from the character style data set, character prompt information of the virtual character corresponding to the training data is obtained; the character prompt information is a content framework set for the character; The character prompt information and training data are concatenated and input into the initial character model trained in the first stage to obtain the predicted label corresponding to the training data.
8. The method according to claim 6, characterized in that The step of inputting each training data into the initial role model trained in the first stage to obtain the prediction label corresponding to each training data includes: For the training data determined from the reasoning and suggestion data set, obtain the thought chain prompt information; the thought chain prompt information includes prompt information for the task process, and prompt information for the label definition and range of various training labels; the thought chain prompt information is used to prompt the model to determine the prediction label set corresponding to the reference object within the label definition and range based on the object feature set corresponding to the participating object according to the task process; The thought chain prompt information and training data are spliced and input into the initial role model trained in the first stage to obtain the predicted label corresponding to the training data.
9. The method according to claim 1, characterized in that: The method further comprises: Get the general model; Based on the dedicated data set corresponding to the target domain, the general model is pre-trained to obtain an initial character model corresponding to the target domain; the dedicated data set includes at least one of a background data set, a character style data set, and an inference and suggestion data set corresponding to the target domain.
10. The method according to any one of claims 1 to 9, characterized in that The target domain is a game domain, the virtual character is a non-player character in the game, and the reference object is a game player; the target character model is used to output a game dialogue for feedback to the target game player through the target non-player character based on the player information of the target game player in the game and the character identification of the target non-player character accompanying the target game player.
11. A role model application method, characterized in that: The method comprises: Obtaining the participation content of the target participant in the target field and the role identification of the target virtual role; Inputting the participation content and the role identifier into a target role model corresponding to the target domain to obtain interactive content for feeding back to the target participant through the target virtual role; Wherein, the target role model is obtained according to the role model training method according to any one of claims 1 to 10.
12. A role model training device, characterized in that: The device comprises: A training set acquisition module is used to acquire a general data set, acquire a background data set corresponding to a target domain, and acquire a character style data set for a virtual character in the target domain; the general data set includes labeled training data for each of a plurality of domains, the background data set includes a plurality of labeled training data containing background information of the target domain, and the character style data set includes a plurality of labeled training data containing style information of the virtual character; A model training module, configured to perform a first-stage training on an initial character model corresponding to the target domain based on the general data set and the background data set, and perform a second-stage training on the initial character model based on the general data set and the character style data set, so as to obtain a target character model corresponding to the target domain; The target role model is used to output interactive content for feeding back to the target participating object through the target virtual character based on the participating content of the target participating object in the target field and the role identification of the target virtual character.
13. A role model application device, characterized in that: The device comprises: A data acquisition module, used to acquire the participation content of the target participant in the target field and the role identification of the target virtual role; A model application module, used for inputting the participation content and the role identification into a target role model corresponding to the target domain, and obtaining interactive content for feeding back to the target participant through the target virtual role; Wherein, the target role model is obtained according to the role model training method according to any one of claims 1 to 10.
14. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 11 are implemented.
15. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 11 are implemented.
16. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 11 are implemented.
Citation Information
Cited By
Controllable dialogue case generation method based on large model
CN120353907A