Virtual character generation method and device
By determining the target prompt words in the virtual role generation method to build a high-quality training data set, and performing model training and fine-tuning, the problems of low data quality and poor interaction in the existing technology are solved, and more efficient virtual role generation and interaction effects are achieved.
Patent Information
- Application Number
- CN202411628631.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-14
- Publication Date
- 2025-03-11
AI Technical Summary
When generating virtual roles, the existing technology faces the problems of data acquisition difficulties, low data quality, single data, biased, difficult to cover most scenarios when generating virtual roles, and difficult to quantify and evaluate virtual roles, resulting in poor interaction effects.
By determining the target prompt word, the data structure of the training data set and the quality evaluation criteria for reply content are determined, a high-quality training data set is generated, and the target virtual role is obtained by selecting the target basic model for training and fine-tuning.
Improve the quality of training data, make the data more matched with the target virtual role, thereby improving the interaction effect of the generated virtual roles, and improving the generation efficiency, ensuring that the virtual role has common basic knowledge and high-quality reply content.
Smart Images

Figure CN119597877A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a method and device for generating a virtual character. Background Art
[0002] When using a large language model to generate a virtual character for a specific character, the existing technology generally needs to obtain data related to the character to generate a data set, and use the data set to train the large model to generate a virtual character corresponding to the specific character. However, the existing technology has problems such as difficulty in obtaining data sets, low data quality, single and biased data, difficulty in covering most scenarios, and difficulty in quantifying and evaluating the generated virtual characters, resulting in poor interaction effects of the generated virtual characters. Summary of the invention
[0003] In view of this, the purpose of the present application is to provide a method and device for generating a virtual character, which determines the data structure of a training data set to be generated according to target prompt words, and then generates a training data set according to the target prompt words and the data structure, which can improve the quality of the training data and make the training data more compatible with the target virtual character, thereby improving the interaction effect of the generated target virtual character; by selecting a target basic model and training and fine-tuning according to a response content quality evaluation standard, the target virtual character can be obtained, which can improve the generation efficiency of the target virtual character and ensure that the target virtual character has common basic knowledge and high-quality response content.
[0004] The embodiment of the present application provides a method for generating a virtual character, the method comprising:
[0005] Determining a target basic model and target prompt words required for generating a target virtual character; wherein the target prompt words are used to describe the character characteristics of the target virtual character;
[0006] Determining the data structure of the training data set to be generated and the quality evaluation standard of the reply content of the target virtual character to be generated according to the target prompt word; wherein the data structure is determined by refining and decomposing the target prompt word, and the data structure includes multiple data dimensions related to the reply content style of the target virtual character;
[0007] Generate a training data set according to the target prompt word and the data structure;
[0008] The target basic model is trained according to the target prompt word, the training data set and the response content quality evaluation standard to obtain the language model of the target virtual character.
[0009] Furthermore, the step of determining the data structure of the training data set to be generated according to the target prompt word includes:
[0010] The training data of multiple historical virtual characters are aggregated, and a standard data dimension set is generated by refining and decomposing the character characteristics; wherein the historical virtual characters are constructed virtual characters with different character characteristics and whose interaction effects meet preset requirements;
[0011] A plurality of data dimensions are selected from the standard data dimension set according to the target prompt word to form a data structure of the training data set.
[0012] Furthermore, generating a training data set according to the target prompt word and the training data set structure includes:
[0013] For each data dimension in the training data set structure, a plurality of first question-answer pairs are generated using a pre-trained language model; wherein the plurality of first question-answer pairs include a plurality of questioning methods and a plurality of replying methods for the data dimension;
[0014] Based on the target prompt word, a plurality of second question-answer pairs that meet the character characteristics of the target virtual character are screened out from the plurality of first question-answer pairs to form the training data set according to the second question-answer pairs.
[0015] Furthermore, the target basic model is trained according to the target prompt word, the training data set and the response content quality evaluation standard to obtain the language model of the target virtual character, including:
[0016] Training the target basic model according to the target prompt word and the training data set to obtain an initial language model of the target virtual character;
[0017] Testing the initial language model to obtain reply content of the initial language model;
[0018] Determining the reply content according to the reply content quality assessment standard;
[0019] If the reply content fails to pass the determination, the initial language model is fine-tuned again until the reply content obtained again passes the determination of the reply content quality evaluation standard, thereby obtaining the language model of the target virtual character.
[0020] Furthermore, the reply content quality evaluation standard includes multiple capability dimensions of the virtual character and a determination standard under each capability dimension; and determining the reply content according to the reply content quality evaluation standard includes:
[0021] For each capability dimension, determine the evaluation score of the response content under each judgment criterion under the capability dimension, and comprehensively obtain the capability score of the response content with respect to the capability dimension;
[0022] Determining whether the capability dimension passes the assessment based on the capability score of the response content regarding the capability dimension;
[0023] If the reply content fails the determination, the initial language model is fine-tuned again, including:
[0024] For the capability dimensions that have not passed the judgment, increase the weight parameter corresponding to the capability dimension during the fine-tuning process.
[0025] Furthermore, the step of determining a target basic model required for generating a target virtual character includes:
[0026] Acquire a model test data set, wherein the model test data set includes at least one test data;
[0027] Get the response information of each basic model in the basic model library for each test data;
[0028] Determine the score of each basic model according to the response information for each test data;
[0029] According to the score of each basic model, the target basic model is determined from the basic model library.
[0030] Furthermore, the prompt words are organized in a tree structure, and the nodes in the tree structure represent the prompt words; and the step of determining the target prompt words required to generate the target virtual character includes:
[0031] Get the description information entered by the user;
[0032] Searching the tree structure for a target node related to the description information;
[0033] Starting from the target node in the tree structure, according to the subordinate nodes of the target node, feeding back guidance information to the user;
[0034] In response to the user's selection operation, the target node's subordinate nodes are entered step by step to obtain the target prompt words required for generating the target virtual character.
[0035] Furthermore, the target prompt words required for generating the target virtual character are determined, including:
[0036] Based on the obtained target generation role, calling a search engine to obtain public information related to the target generation role;
[0037] Generating at least part of the prompt words of the target virtual character based on the public information input analysis model;
[0038] A target prompt word is generated based on any of the user's modification, supplementation, and confirmation operations.
[0039] Furthermore, there are multiple data structures, and generating a training data set according to the target prompt word and the data structure includes:
[0040] A plurality of training data sets are generated according to the target prompt words and the plurality of data structures, wherein different data structures correspond to different training data sets, corresponding to different identities and / or personalities of the target virtual characters.
[0041] The embodiment of the present application also provides a device for generating a virtual character, the device comprising:
[0042] A first determination module is used to determine a target basic model and a target prompt word required to generate a target virtual character; wherein the target prompt word is used to describe the character characteristics of the target virtual character;
[0043] A second determination module is used to determine the data structure of the training data set to be generated and the quality evaluation standard of the reply content of the target virtual character to be generated according to the target prompt word; wherein the data structure is determined by refining and decomposing the target prompt word, and the data structure includes multiple data dimensions related to the reply content style of the target virtual character;
[0044] A generating module, used for generating a training data set according to the target prompt word and the data structure;
[0045] The training module is used to train the target basic model according to the target prompt word, the training data set and the response content quality evaluation standard to obtain the language model of the target virtual character.
[0046] An embodiment of the present application also provides an electronic device, including: a processor, a memory and a bus, wherein the memory stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor and the memory communicate via the bus, and when the machine-readable instructions are executed by the processor, the steps of the method for generating a virtual character as described above are performed.
[0047] An embodiment of the present application further provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the steps of the method for generating a virtual character as described above are executed.
[0048] A method and device for generating a virtual character provided by an embodiment of the present application determine a target basic model and target prompt words required for generating a target virtual character; wherein the target prompt words are used to describe the character characteristics of the target virtual character; according to the target prompt words, a data structure of a training data set to be generated and a quality assessment standard for the reply content of the target virtual character to be generated are determined; wherein the data structure is determined by detailed decomposition of the target prompt words, and the data structure includes multiple data dimensions related to the reply content style of the target virtual character; according to the target prompt words and the data structure, a training data set is generated; according to the target prompt words and the data structure, the target basic model is trained according to the target prompt words, the training data set and the reply content quality assessment standard to obtain a language model of the target virtual character.
[0049] Determining the data structure of the training data set to be generated according to the target prompt words, and then generating the training data set according to the target prompt words and the data structure, can improve the quality of the training data and make the training data more compatible with the target virtual character, thereby improving the interaction effect of the generated target virtual character; by selecting the target basic model and training and fine-tuning according to the response content quality evaluation standard, the target virtual character can be obtained, which can improve the generation efficiency of the target virtual character and ensure that the target virtual character has common basic knowledge and high-quality response content.
[0050] In order to make the above-mentioned objects, features and advantages of the present application more obvious and easy to understand, preferred embodiments are specifically cited below and described in detail with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0051] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0052] Figure 1 A flowchart of a method for generating a virtual character provided in an embodiment of the present application is shown;
[0053] Figure 2 A schematic diagram of the structure of a device for generating a virtual character provided in an embodiment of the present application is shown;
[0054] Figure 3 A schematic structural diagram of an electronic device provided in an embodiment of the present application is shown. DETAILED DESCRIPTION
[0055] To make the purpose, technical scheme and advantages of the embodiments of the present application clearer, the technical scheme in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all of the embodiments. The components of the embodiments of the present application usually described and shown in the drawings here can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the application claimed for protection, but merely represents the selected embodiments of the present application. Based on the embodiments of the present application, each other embodiment obtained by those skilled in the art without making creative work belongs to the scope of protection of the present application.
[0056] Research has found that when using a large language model to generate a virtual character for a specific role, the existing technology generally needs to obtain data related to the role to generate a data set, and use the data set to train the large model to generate a virtual character corresponding to the specific role. However, the existing technology has problems such as difficulty in obtaining data sets, low data quality, single and biased data, difficulty in covering most scenarios, and difficulty in quantifying and evaluating the generated virtual characters, resulting in poor interaction effects of the generated virtual characters.
[0057] Based on this, an embodiment of the present application provides a method for generating a virtual character to improve the interaction effect and generation efficiency of the target virtual character and ensure that the target virtual character has common basic knowledge and high-quality reply content.
[0058] See also Figure 1 , Figure 1 The following is a flow chart of a method for generating a virtual character provided in an embodiment of the present application. Figure 1 As shown in, the generation method provided in the embodiment of the present application includes:
[0059] S101, determining a target basic model and target prompt words required for generating a target virtual character.
[0060] Among them, the target basic model refers to a basic large model that is pre-trained using common basic knowledge, so the model has common basic knowledge.
[0061] The target prompts are used to describe the characteristics of the target virtual character. In the application of large models, how to design effective prompts is the key. The design of effective prompts can not only reflect the specific style and language habits of a specific character, but also guide the model to generate expected responses. More specifically, the target prompts include an overview of a character, such as name, gender, language, age, character background (including family, study, work and life background, such as who are the parents, the school graduated from, where to work, professional position, friends, etc.), personality characteristics (such as introversion, extroversion, main characteristics), etc.
[0062] In this step, the target basic model can be selected from a pre-trained basic model library; on the other hand, the target prompt word can be determined through user input, a pre-built role library, etc.
[0063] In a possible implementation, determining the target basic model required for generating the target virtual character in step S101 may include:
[0064] Obtain a model test data set, wherein the model test data set includes at least one test data; obtain response information of each basic model in the basic model library for each test data; determine the score of each basic model based on the response information for each test data; and determine the target basic model from the basic model library based on the score of each basic model.
[0065] Here, the basic model library includes a variety of pre-trained basic models. The pre-training data and training strategies of different basic models vary greatly, resulting in significant differences in the final results. For example, some large models have a large amount of training data for image data, so they have better model processing capabilities for image data but relatively weaker capabilities for text content processing; some large models have a large amount of training data for text data, so they have better model processing capabilities for article data, but relatively weaker capabilities for dialogue processing.
[0066] Therefore, in specific implementation, a model test data set can be obtained, and each test data can be input into each basic model in the basic model library to obtain the response information of each basic model for each test data, and then the score of each basic model can be determined according to the predetermined evaluation criteria; the higher the dialogue score, the stronger the dialogue processing ability of the basic model. According to the score of each basic model, the target basic model can be determined from the basic model library, for example, the basic model with the highest dialogue score can be selected as the target basic model, or the first few basic models with the highest dialogue scores can be selected and integrated to obtain the target basic model.
[0067] In this way, the determined target basic model can have strong dialogue processing capabilities and general basic knowledge, so that the target virtual character can be obtained through subsequent fine-tuning training, thereby shortening the model training time and improving generation efficiency and interaction effects.
[0068] In another possible implementation, the commonalities of successful reproduction cases can be extracted through analysis of historical virtual character reproduction cases, thereby creating special prompt word content that can significantly improve model performance; then, according to the hierarchical association relationship between prompt words, the prompt words are organized in a tree structure, and the nodes in the tree structure are used to represent the prompt words, and the lines between the nodes represent the hierarchical association relationship between the prompt words. Then, the target prompt words required for generating the target virtual character in step S101 may include:
[0069] The method comprises the steps of obtaining description information input by a user; searching for a target node related to the description information in the tree structure; feeding back guidance information to the user based on the subordinate nodes of the target node starting from the target node in the tree structure; and entering the subordinate nodes of the target node step by step in response to the user's selection operation to obtain the target prompt words required for generating a target virtual character.
[0070] In a specific implementation, the description information input by the user through voice or text can be obtained through a visual interactive interface. Afterwards, the target node related to the description information is searched from the tree structure through semantic analysis methods such as keyword recognition; each target node is used as the starting node to search the lower-level nodes. According to the lower-level nodes directly connected to each target node, guidance information is generated and fed back to the user to guide the user to make a selection in the lower-level nodes. In response to the user's selection operation, a certain lower-level node is entered, and then the lower-level node of this lower-level node is determined and guidance information is generated..., and so on, the lower-level nodes of the target node are entered step by step until the bottom node of the tree structure or the user stops selecting. In this step-by-step selection process, the prompt words corresponding to all the nodes passed can be used as the target prompt words required to generate the target virtual character.
[0071] As an example, after the user enters "character gender", the user enters the prompt word branch corresponding to the gender, and the subordinate nodes may be standard prompt words such as "boss man", "warm man", and "athletic man".
[0072] In this way, the tree structure can improve the efficiency of users in determining target prompt words and quickly search for prompt words that users expect; by guiding the user's interactive operations through guidance information, it can help users easily and comprehensively determine the target prompt words, thereby more accurately describing the character's characteristics, and indirectly achieving the purpose of improving the interactive effect of virtual characters.
[0073] In another possible implementation, determining the target prompt words required for generating the target virtual character in step S101 may also include:
[0074] Based on the acquired target generation role, a search engine is called to acquire public information related to the target generation role; based on the public information input analysis model, at least part of the prompt words of the target virtual role are generated; based on any operation of the user's modification, supplementation, and confirmation operations, the target prompt words are generated.
[0075] Considering that it is labor intensive and inefficient for users to input prompt words from scratch, the embodiment of the present application also provides another method for assisting in generating prompt words based on existing public roles, so as to achieve the purpose of generating prompt words conveniently and quickly.
[0076] Specifically, first, the user can determine the target generated role, which is a public role known to the public, and can be a real public figure or a virtual image. After that, by calling a search engine to search for the target generated role, the public information related to the target generated role can be obtained. After that, the public information is input into the analysis model, and the public information is analyzed from multiple angles to generate at least part of the prompt words of the target virtual role. For example, the public information can be the role profile of the target generated role, and the analysis model can be a natural language processing model. Through the semantic analysis of the role profile, at least one prompt word reflecting the role characteristics can be generated; for another example, the public information can also be a role video of the target generated role, and the analysis model can be an image processing model. Through the image analysis of the video screen, at least one prompt word reflecting the role characteristics can also be generated. Finally, the generated at least part of the prompt words are provided to the user, and the final target prompt words are generated based on any one or more operations of the user to modify, supplement, and confirm the prompt words.
[0077] S102: Determine the data structure of the training data set to be generated and the quality evaluation standard of the reply content of the target virtual character to be generated according to the target prompt word.
[0078] Among them, the data structure is determined by refining and decomposing the target prompt words, and the data structure includes multiple data dimensions related to the reply content style of the target virtual character, that is, the reply content style of the target virtual character can be described through these multiple data dimensions. The data dimensions have a smaller granularity than the prompt words and can describe the target virtual character in a more detailed manner.
[0079] In a possible implementation, determining the data structure of the training data set to be generated according to the target prompt word in step S102 may include:
[0080] The training data of multiple historical virtual characters are aggregated, and a standard data dimension set is generated by refining the characteristics of the characters; multiple data dimensions are selected from the standard data dimension set according to the target prompt words to form the data structure of the training data set.
[0081] Here, historical virtual characters are constructed virtual characters with different character characteristics and whose interaction effects meet preset requirements (i.e., the interaction effects are good enough). By disassembling the character characteristics of historical virtual characters layer by layer according to different scenes and different granularities, a data dimension set that can cover various interaction scenes, interaction objects, and interaction modes can be obtained. Exemplarily, it includes different standard data dimension sets such as personal information, family information, learning information, work information, different ages, different genders, different personalities, one question and one answer, one question and multiple answers, and multiple questions and one answer, for example, a set of 100 standard data dimensions.
[0082] Afterwards, multiple data dimensions can be selected from the standard data dimension set according to the target prompt word to form the data structure of the training data set. For example, 50 standard data dimensions can be obtained from the above 100 standard subdivision dimensions to describe a specific target role according to the role gender in the prompt word; it can also include the design of single-round dialogue and multi-round dialogue, such as how to respond when asked the same question in a single-round dialogue and multi-round dialogue.
[0083] The generated data structure can ensure that the dataset fully covers the character's expression habits and communication style, and accurately reflects the response content style of the target virtual character.
[0084] Furthermore, the quality evaluation standard of the reply content of the target virtual character to be generated can also be determined according to the target prompt word. The reply content quality evaluation standard is used to measure what kind of reply content meets the standard of the target virtual character. Therefore, the reply content quality evaluation standard is related to the role characteristics of the target virtual character, that is, the target prompt word. For example, when the target prompt word is "talkative", the reply content quality evaluation standard requires that the reply content should be more comprehensive and should actively prompt other related questions of the user's consultation question. When the target prompt word is "few words", the reply content quality evaluation standard requires that the number of words in the reply content should be less, and only respond to the user's consultation question.
[0085] In this way, by establishing strict data set standards and response content quality assessment standards, data quality can be ensured and data contamination during the training process can be avoided.
[0086] S103: Generate a training data set according to the target prompt word and the data structure.
[0087] In this step, corresponding training data may be generated under each data dimension included in the data structure according to the target prompt word, thereby forming a training data set.
[0088] In a possible implementation, step S103 may include:
[0089] For each data dimension in the training data set structure, a pre-trained language model is used to generate multiple first question-answer pairs; based on the target prompt words, multiple second question-answer pairs that meet the role characteristics of the target virtual character are screened out from the multiple first question-answer pairs to form the training data set according to the second question-answer pairs.
[0090] Among them, the multiple first question-answer pairs include multiple questioning methods and multiple reply methods for the data dimension. Exemplarily, for each data set dimension, a pre-trained language model is used to automatically generate a number of first question-answer pairs. For example, 100 question-answer pairs are automatically generated for the character name using a language model, including various questioning methods and various reply methods. Afterwards, based on the prompt words, a number of second question-answer pairs that meet the character characteristics under each data dimension are selected as training data sets. For example, 10 question-answer pairs that meet the character characteristics are selected from the 100 question-answer pairs generated by the large language model as training data sets, thereby quickly generating a training data set.
[0091] In this way, through advanced language models, training data can be automatically generated according to target prompt words and data structures, which can quickly expand the data set, improve data diversity and coverage, create high-quality and highly relevant training data, and ensure that the training data is highly consistent with the expected role characteristics.
[0092] In another possible implementation, there are multiple data structures; then step S103 may further include: generating multiple training data sets according to the target prompt word and the multiple data structures.
[0093] It is worth noting that characters have multiple identities in real life, and they behave differently when they are in different identities in real life. For example, they may be well-behaved in the eyes of their parents, enthusiastic in the eyes of their colleagues, and cheerful in the eyes of their classmates. In addition, characters also have multiple personalities in real life, and they behave differently when they are in different personalities in real life, such as being cheerful at one time and depressed at another. It is not static.
[0094] Taking into account the complexity of the role, in order to make the generated target virtual role more emotionally rich and vivid, closer to life, and improve the interaction effect, multiple data structures are defined in the embodiment of the present application. Correspondingly, different data structures correspond to different training data sets, corresponding to different identities and / or personalities of the target virtual role, so that the role characteristics of the target virtual role under different identities and / or personalities can be reflected through multiple data structures, making the language model of the trained target virtual role more realistic.
[0095] Furthermore, the language model of the target virtual character trained based on multiple data structures and multiple training data sets can determine the identity and / or personality of the target virtual character according to the preset conversation background, the context of the conversation process and other information when conversing with the user, and then use the corresponding conversation strategy for conversation output, presenting an adaptive performance.
[0096] S104: training the target basic model according to the target prompt word, the training data set and the response content quality assessment standard to obtain a language model of the target virtual character.
[0097] In an embodiment of the present application, based on a pre-trained target basic model, preliminary training is performed according to target prompt words and a training data set to obtain an initial language model of the target virtual character; then the initial language model is fine-tuned according to the target prompt words, the training data set and the response content quality assessment criteria to obtain the final language model.
[0098] Among them, fine-tuning refers to further training for specific tasks based on the pre-trained model, which usually involves adjusting some or all parameters of the pre-trained model on the dataset of the specific task, so as to achieve the purpose of quickly adapting to new tasks and saving a lot of computing resources and time. At the same time, during the fine-tuning process, the performance of the language model can be monitored in real time according to the response content quality evaluation standard, and the effect can be automatically evaluated at different iteration stages, so as to accurately control the fine-tuning process.
[0099] In a possible implementation, step S104 may include:
[0100] S1041. Train the target basic model according to the target prompt words and the training data set to obtain an initial language model of the target virtual character.
[0101] In this step, the target basic model can be preliminarily trained according to the target prompt words and the training data set to obtain an initial language model; the specific training method can refer to the model training method in the prior art, such as by adjusting the model parameters to minimize the loss function, etc., and this application does not impose any restrictions here.
[0102] S1042: Testing the initial language model to obtain reply content of the initial language model.
[0103] In this step, a preset proportion of question-answer pairs can be extracted from the question-answer pairs of each dimension in the training data set to form a test data set. For example, 2 question-answer pairs are extracted from the above 10 question-answer pairs to form a test data set.
[0104] Optionally, a test data set can also be generated by collecting public information. For example, by collecting conversation content from public interviews, public meetings, etc., and generating test data by refining the conversation content. In particular, for the above-mentioned method of assisting in generating prompt words based on existing public roles, the test data set constructed by collecting public information of public roles is more authentic and reliable, and more in line with the characteristics of public roles.
[0105] Afterwards, the initial language model is tested and evaluated using the test dataset to obtain the response content of the initial language model.
[0106] S1043: Determine the reply content according to the reply content quality assessment standard.
[0107] In this step, whether the reply content meets this standard can be determined based on the reply content quality evaluation standard.
[0108] In one possible implementation, the response content quality evaluation criteria include multiple capability dimensions of the virtual character and the judgment criteria under each capability dimension; for example, the response content quality evaluation criteria include the empathy and generalization capabilities of the virtual character. Empathy refers to the ability of the virtual character to understand and respond to the user's emotional state and show human-like emotional reactions. This ability enables the virtual character to establish a deeper emotional connection with the user and improve the user experience. Generalization ability refers to the ability of the virtual character to handle unseen and diverse inputs and make reasonable responses. This ability enables the virtual character to perform well in different situations, rather than relying solely on predefined rules or data.
[0109] Exemplarily, the judgment criteria under the dimension of generalization ability include: response repetition rate (the probability of giving the same answer to different questions, this parameter needs to be reduced), response efficiency (for example, if the answer is all inner monologue or narration without any substantive content when asked a name, the efficiency is 0), response consistency (for example, testing twice with the same test data set and comparing the consistency of the responses in the two tests), and other parameters.
[0110] Then step S1043 may include: for each capability dimension, determining the evaluation score of the reply content under each judgment criterion under the capability dimension, and comprehensively obtaining the capability score of the reply content with respect to the capability dimension; and determining whether the capability dimension passes the judgment based on the capability score of the reply content with respect to the capability dimension.
[0111] In this way, the response content quality evaluation standard can be used to make a more objective quantitative scoring judgment on the target virtual character, thereby more accurately evaluating the interactive performance of the model.
[0112] S1044: If the reply content fails to pass the determination, the initial language model is fine-tuned again until the reply content obtained again passes the determination of the reply content quality evaluation standard, thereby obtaining the language model of the target virtual character.
[0113] For example, the initial language model can be fine-tuned by using the LORA fine-tuning method to reduce the resource usage of the fine-tuning and achieve the purpose of fast model fine-tuning. The specific implementation method can refer to the prior art, and this application does not make any limitation here.
[0114] The re-fine-tuning of the initial language model includes: for the capability dimension that failed to pass the judgment, increasing the weight parameter corresponding to the capability dimension during the fine-tuning process. In this way, by increasing the weight parameter, the next round of fine-tuning can focus on the capability dimension that failed to pass the judgment of the initial language model to make targeted parameter adjustments, thereby achieving the purpose of improving the model interaction effect.
[0115] S1045: If the reply content passes the determination, the initial language model is determined as the language model of the target virtual character.
[0116] In this step, if all the capability dimensions of the initial language model pass the judgment, then the reply content is determined to pass the judgment (that is, the entire initial language model passes the judgment), and the initial language model can be determined as the language model of the target virtual character, that is, the final target virtual character is generated.
[0117] A method for generating a virtual character provided by an embodiment of the present application includes: determining a target basic model and target prompt words required for generating a target virtual character; wherein the target prompt words are used to describe the character characteristics of the target virtual character; determining a data structure of a training data set to be generated and a response content quality assessment standard of the target virtual character to be generated according to the target prompt words; wherein the data structure is determined by refining and decomposing the target prompt words, and the data structure includes multiple data dimensions related to the response content style of the target virtual character; generating a training data set according to the target prompt words and the data structure; training the target basic model according to the target prompt words, the training data set and the response content quality assessment standard to obtain a language model of the target virtual character.
[0118] In this way, the data structure of the training data set to be generated is determined according to the target prompt words, and then the training data set is generated according to the target prompt words and the data structure. This can improve the quality of the training data and make the training data more compatible with the target virtual character, thereby improving the interaction effect of the generated target virtual character. The target virtual character can be obtained by selecting the target basic model and training and fine-tuning according to the response content quality evaluation standard, which can improve the generation efficiency of the target virtual character and ensure that the target virtual character has common basic knowledge and high-quality response content.
[0119] See also Figure 2 , Figure 2 This is a schematic diagram of the structure of a device for generating a virtual character provided in an embodiment of the present application. Figure 2 As shown in , the generating device 200 includes:
[0120] The first determination module 210 is used to determine the target basic model and target prompt words required to generate the target virtual character; wherein the target prompt words are used to describe the character characteristics of the target virtual character;
[0121] A second determination module 220 is used to determine the data structure of the training data set to be generated and the quality evaluation standard of the reply content of the target virtual character to be generated according to the target prompt word; wherein the data structure is determined by refining and decomposing the target prompt word, and the data structure includes multiple data dimensions related to the reply content style of the target virtual character;
[0122] A generating module 230, configured to generate a training data set according to the target prompt word and the data structure;
[0123] The training module 240 is used to train the target basic model according to the target prompt word, the training data set and the response content quality evaluation standard to obtain the language model of the target virtual character.
[0124] Furthermore, when the second determining module 220 is used to determine the data structure of the training data set to be generated according to the target prompt word, the second determining module 220 is used to:
[0125] The training data of multiple historical virtual characters are aggregated, and a standard data dimension set is generated by refining and decomposing the character characteristics; wherein the historical virtual characters are constructed virtual characters with different character characteristics and whose interaction effects meet preset requirements;
[0126] A plurality of data dimensions are selected from the standard data dimension set according to the target prompt word to form a data structure of the training data set.
[0127] Furthermore, when the generating module 230 is used to generate a training data set according to the target prompt word and the data structure, the generating module 230 is used to:
[0128] For each data dimension in the training data set structure, a plurality of first question-answer pairs are generated using a pre-trained language model; wherein the plurality of first question-answer pairs include a plurality of questioning methods and a plurality of replying methods for the data dimension;
[0129] Based on the target prompt word, a plurality of second question-answer pairs that meet the character characteristics of the target virtual character are screened out from the plurality of first question-answer pairs to form the training data set according to the second question-answer pairs.
[0130] Furthermore, when the training module 240 is used to train the target basic model according to the target prompt word, the training data set and the response content quality evaluation standard to obtain the language model of the target virtual character, the training module 240 is used to:
[0131] Training the target basic model according to the target prompt word and the training data set to obtain an initial language model of the target virtual character;
[0132] Testing the initial language model to obtain reply content of the initial language model;
[0133] Determining the reply content according to the reply content quality assessment standard;
[0134] If the reply content fails to pass the determination, the initial language model is fine-tuned again until the reply content obtained again passes the determination of the reply content quality evaluation standard, thereby obtaining the language model of the target virtual character.
[0135] Furthermore, the reply content quality evaluation standard includes multiple capability dimensions of the virtual character and a judgment standard under each capability dimension; when the training module 240 is used to judge the reply content according to the reply content quality evaluation standard, the training module 240 is used to:
[0136] For each capability dimension, determine the evaluation score of the response content under each judgment criterion under the capability dimension, and comprehensively obtain the capability score of the response content with respect to the capability dimension;
[0137] According to the ability score of the response content regarding the ability dimension, it is determined whether the ability dimension passes the judgment.
[0138] When the reply content fails to pass the determination and the initial language model is fine-tuned again, the training module 240 is used to:
[0139] For the capability dimensions that have not passed the judgment, increase the weight parameter corresponding to the capability dimension during the fine-tuning process.
[0140] Furthermore, when the first determining module 210 is used to determine the target basic model required to generate the target virtual character, the first determining module 210 is used to:
[0141] Acquire a model test data set, wherein the model test data set includes at least one test data;
[0142] Get the response information of each basic model in the basic model library for each test data;
[0143] Determine the score of each basic model according to the response information for each test data;
[0144] According to the score of each basic model, the target basic model is determined from the basic model library.
[0145] Furthermore, the prompt words are organized in a tree structure, and the nodes in the tree structure represent prompt words; when the first determination module 210 is used to determine the target prompt words required to generate the target virtual character, the first determination module 210 is used to:
[0146] Get the description information entered by the user;
[0147] Searching the tree structure for a target node related to the description information;
[0148] Starting from the target node in the tree structure, according to the subordinate nodes of the target node, feeding back guidance information to the user;
[0149] In response to the user's selection operation, the target node's subordinate nodes are entered step by step to obtain the target prompt words required for generating the target virtual character.
[0150] Furthermore, when the first determining module 210 is used to determine the target prompt words required to generate the target virtual character, the first determining module 210 is used to:
[0151] Based on the obtained target generation role, calling a search engine to obtain public information related to the target generation role;
[0152] Generating at least part of the prompt words of the target virtual character based on the public information input analysis model;
[0153] A target prompt word is generated based on any of the user's modification, supplementation, and confirmation operations.
[0154] Furthermore, there are multiple data structures; when the generating module 230 is used to generate a training data set according to the target prompt word and the data structure, the generating module 230 is used to:
[0155] A plurality of training data sets are generated according to the target prompt words and the plurality of data structures, wherein different data structures correspond to different training data sets, corresponding to different identities and / or personalities of the target virtual characters.
[0156] See also Figure 3 , Figure 3 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Figure 3 As shown in , the electronic device 300 includes a processor 310 , a memory 320 and a bus 330 .
[0157] The memory 320 stores machine-readable instructions executable by the processor 310. When the electronic device 300 is running, the processor 310 communicates with the memory 320 via the bus 330. When the machine-readable instructions are executed by the processor 310, the above-mentioned Figure 1 The steps of the method for generating a virtual character in the method embodiment shown, and the specific implementation manner can be found in the method embodiment, which will not be repeated here.
[0158] The present application also provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the computer program can execute the above-mentioned Figure 1 The steps of the method for generating a virtual character in the method embodiment shown, and the specific implementation manner can be found in the method embodiment, which will not be repeated here.
[0159] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0160] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, and the indirect coupling or communication connection of devices or units can be electrical, mechanical or other forms.
[0161] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0162] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0163] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a non-volatile computer-readable storage medium that is executable by a processor. Based on this understanding, the technical solution of the present application can essentially be embodied in the form of a software product, or in other words, the part that contributes to the prior art or the part of the technical solution. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0164] Finally, it should be noted that the above-described embodiments are only specific implementation methods of the present application, which are used to illustrate the technical solutions of the present application, rather than to limit them. The protection scope of the present application is not limited thereto. Although the present application is described in detail with reference to the above-mentioned embodiments, ordinary technicians in the field should understand that any technician familiar with the technical field can still modify the technical solutions recorded in the above-mentioned embodiments within the technical scope disclosed in the present application, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application, and should be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be based on the protection scope of the claims.
Claims
1. A method for generating a virtual character, characterized in that: The generation method comprises: Determining a target basic model and target prompt words required for generating a target virtual character; wherein the target prompt words are used to describe the character characteristics of the target virtual character; Determining the data structure of the training data set to be generated and the quality evaluation standard of the reply content of the target virtual character to be generated according to the target prompt word; wherein the data structure is determined by refining and decomposing the target prompt word, and the data structure includes multiple data dimensions related to the reply content style of the target virtual character; Generate a training data set according to the target prompt word and the data structure; The target basic model is trained according to the target prompt word, the training data set and the response content quality evaluation standard to obtain the language model of the target virtual character.
2. The generation method according to claim 1, characterized in that: The step of determining the data structure of the training data set to be generated according to the target prompt word includes: The training data of multiple historical virtual characters are aggregated, and a standard data dimension set is generated by refining and decomposing the character characteristics; wherein the historical virtual characters are constructed virtual characters with different character characteristics and whose interaction effects meet preset requirements; A plurality of data dimensions are selected from the standard data dimension set according to the target prompt word to form a data structure of the training data set.
3. The generation method according to claim 1, characterized in that: The step of generating a training data set according to the target prompt word and the training data set structure includes: For each data dimension in the training data set structure, a plurality of first question-answer pairs are generated using a pre-trained language model; wherein the plurality of first question-answer pairs include a plurality of questioning methods and a plurality of replying methods for the data dimension; Based on the target prompt word, a plurality of second question-answer pairs that meet the character characteristics of the target virtual character are screened out from the plurality of first question-answer pairs to form the training data set according to the second question-answer pairs.
4. The generation method according to claim 1, characterized in that: The step of training the target basic model according to the target prompt word, the training data set and the response content quality assessment standard to obtain the language model of the target virtual character includes: Training the target basic model according to the target prompt word and the training data set to obtain an initial language model of the target virtual character; Testing the initial language model to obtain reply content of the initial language model; Determining the reply content according to the reply content quality assessment standard; If the reply content fails to pass the determination, the initial language model is fine-tuned again until the reply content obtained again passes the determination of the reply content quality evaluation standard, thereby obtaining the language model of the target virtual character.
5. The generation method according to claim 4, characterized in that: The reply content quality evaluation standard includes multiple capability dimensions of the virtual character and a determination standard under each capability dimension; and determining the reply content according to the reply content quality evaluation standard includes: For each capability dimension, determine the evaluation score of the response content under each judgment criterion under the capability dimension, and comprehensively obtain the capability score of the response content with respect to the capability dimension; Determining whether the capability dimension has passed the assessment based on the capability score of the response content regarding the capability dimension; If the reply content fails the determination, the initial language model is fine-tuned again, including: For the capability dimensions that have not passed the judgment, increase the weight parameter corresponding to the capability dimension during the fine-tuning process.
6. The method according to claim 1, characterized in that The step of determining a target basic model required for generating a target virtual character includes: Acquire a model test data set, wherein the model test data set includes at least one test data; Get the response information of each basic model in the basic model library for each test data; Determine the score of each basic model according to the response information for each test data; According to the score of each basic model, the target basic model is determined from the basic model library.
7. The method according to claim 1, characterized in that The prompt words are organized in a tree structure, and the nodes in the tree structure represent the prompt words; The step of determining the target prompt words required for generating the target virtual character includes: Get the description information entered by the user; Searching the tree structure for a target node related to the description information; Starting from the target node in the tree structure, according to the subordinate nodes of the target node, feeding back guidance information to the user; In response to the user's selection operation, the target node's subordinate nodes are entered step by step to obtain the target prompt words required for generating the target virtual character.
8. The generation method according to claim 1, characterized in that: Determine the target cue words needed to generate the target virtual character, including: Based on the obtained target generation role, calling a search engine to obtain public information related to the target generation role; Generating at least part of the prompt words of the target virtual character based on the public information input analysis model; A target prompt word is generated based on any of the user's modification, supplementation, and confirmation operations.
9. The generation method according to claim 1, characterized in that: There are multiple data structures, and generating a training data set according to the target prompt word and the data structure includes: A plurality of training data sets are generated according to the target prompt words and the plurality of data structures, wherein different data structures correspond to different training data sets, corresponding to different identities and / or personalities of the target virtual characters.
10. A device for generating a virtual character, characterized in that: The generating device comprises: A first determination module is used to determine a target basic model and a target prompt word required to generate a target virtual character; wherein the target prompt word is used to describe the character characteristics of the target virtual character; A second determination module is used to determine the data structure of the training data set to be generated and the quality evaluation standard of the reply content of the target virtual character to be generated according to the target prompt word; wherein the data structure is determined by refining and decomposing the target prompt word, and the data structure includes multiple data dimensions related to the reply content style of the target virtual character; A generating module, used for generating a training data set according to the target prompt word and the data structure; The training module is used to train the target basic model according to the target prompt word, the training data set and the response content quality evaluation standard to obtain the language model of the target virtual character.
Citation Information
Patent Citations
Quadratic element role construction method and system based on large language model
CN117808946A
Application method of dialogue system based on human big language model in industrial scene
CN117932012A
Cited By
Session interaction method and device, electronic equipment and storage medium
CN120162418A
A session interaction method and device, electronic equipment and storage medium
CN120162418B
Virtual robot generation method and device, equipment and storage medium
CN121235107A