Virtual character training data generation method and system

By conducting detailed analysis and data construction of virtual characters and dynamically adjusting the training data proportion, the problem of poor settings and single expression style in virtual characters training is solved, and the complex settings and diversified expression of virtual characters are realized, supporting richer dialogue scenes and new character creation.

CN119539006APending Publication Date: 2025-02-28BEIJING MUYAN ZHIYU TECHNOLOGY CO LTD

Patent Information

Application Number
CN202411605064.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-12
Publication Date
2025-02-28

AI Technical Summary

Technical Problem

In the training of virtual characters, the existing technology has problems such as poor character setting ability, single expression style, and difficulty in supporting complex dialogue scenes and new character creation.

Method used

By analyzing the attributes, expressions and application scenarios of virtual characters, detailed character biography and high-quality dialogue corpus data are constructed, and the dialogue content is grouped using clustering algorithms, dynamically adjust the training data proportions, and the large language model is updated to generate dialogue content that conforms to the settings and scenes.

Benefits of technology

It realizes the complex settings and diversified expressions of virtual characters, supports richer dialogue scenes and new character creation, and improves the quality and migration of virtual character training data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119539006A_ABST
    Figure CN119539006A_ABST
Patent Text Reader

Abstract

The invention belongs to the technical field of data generation, and discloses a virtual character training data generation method and system, and the method comprises the steps: analyzing a virtual character, and constructing the attribute, expression mode and application scene of the virtual character; based on the attribute, the expression mode and the application scene of the virtual character, training the large language model, and evaluating the generation effect after training; dynamically adjusting the proportion of the expression modes in the labeling data set according to the evaluation result, and updating the large language model based on the adjusted proportion; and according to the attribute, the expression mode and the target application scene of the target virtual character, generating corresponding dialogue content data by using the updated large language model, and obtaining virtual character training data. The method not only supports complex virtual character setting, but also has the advantages of high mobility and efficient preparation of multi-virtual character data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of data generation, and in particular to a method and system for generating virtual character training data. Background Art

[0002] With the development of generative artificial intelligence, virtual character training methods based on large language models have gradually emerged. However, compared with the pursuit of helpfulness, authenticity, and harmlessness by general large language models, the training effect of virtual characters focuses more on the ultimate satisfaction of character anthropomorphism, socialization, and empathy. The scheme of setting character roles based on prompt engineering and the scheme of using existing character dialogue data (literature or film and television works) as training virtual character corpus only support simple character settings, have a single character expression style, and are only applicable to relatively simple dialogue scenarios.

[0003] At present, there are two main methods for generating data for virtual character training based on traditional large language models:

[0004] 1. A solution for setting character roles based on prompt engineering: Since the large language model uses a large amount of basic data during training, which includes some character role setting information, the character role setting information carried by the large model during training can be evoked through prompt engineering, so that the large language model can imitate the expression of these characters and roles to a certain extent, such as: character role playing (well-known historical or contemporary figures, well-known literary or film and television characters), identity role playing (different professions, different interpersonal relationships, different positions, different ages);

[0005] 2. A solution based on existing character dialogue data as training corpus: extracting corresponding character dialogue data from existing film, television or literary works as the corpus information required for virtual character training.

[0006] However, the traditional data generation method for virtual character training based on large language models has the following disadvantages:

[0007] 1. The solution of setting character roles based on prompt word engineering: It is highly dependent on the basic capabilities of the large language model itself. Only characters that have appeared in the training data can be played and imitated by the model. At the same time, since there is no separate intensive training for the designated role, the character's expression style is relatively simple, and the character setting retention ability is poor, which is prone to the large model hallucination effect, and can only support simple dialogue scenes.

[0008] 2. Solution based on existing character dialogue data as training corpus: After collecting enough character dialogue data, the large language model can indeed imitate the character's expression. However, due to the large amount of character dialogue data in literature or film and television works, and the variety of expressions for different dialogue objects, it is difficult to accurately and stably simulate the character. In addition, the dialogue data can only show the character's expression style, but the character setting and scene dialogue capabilities are weak, and it does not support the creation of new characters.

[0009] Therefore, how to provide a method and system for generating virtual character training data is a problem that needs to be solved urgently. Summary of the invention

[0010] The embodiment of the present invention provides a method for generating virtual character training data to solve the above-mentioned technical problems in the prior art.

[0011] In order to have a basic understanding of some aspects of the disclosed embodiments, a brief summary is given below. This summary is not intended to be a general review, nor is it intended to identify key / important components or to delineate the scope of protection of these embodiments. Its only purpose is to present some concepts in a simple form as a preface to the detailed description that follows.

[0012] According to a first aspect of an embodiment of the present invention, a method for generating virtual character training data is provided.

[0013] In one embodiment, the method for generating virtual character training data includes:

[0014] Analyze virtual characters and construct their attributes, expressions and application scenarios;

[0015] Based on the attributes, expressions and application scenarios of the virtual characters, the large language model is trained and the generation effect after training is evaluated; the proportion of expressions in the annotated dataset is dynamically adjusted according to the evaluation results, and the large language model is updated based on the adjusted proportion;

[0016] According to the attributes, expressions and target application scenarios of the target virtual character, the updated large language model is used to generate corresponding dialogue content data to obtain the virtual character training data.

[0017] In one embodiment, analyzing the virtual character and constructing the attributes, expressions, and application scenarios of the virtual character include:

[0018] Obtain the conversation content data of the virtual characters in the historical database, perform data cleaning and feature vectorization processing, and extract the language features, context features and expression features in the conversation content data;

[0019] According to the extracted language features, context features and expression features, the clustering algorithm is used to group the dialogue content of the virtual characters, and each type of dialogue content should represent a type of virtual characters with similar attributes, expression methods and application scenario characteristics;

[0020] Based on the clustering results, the conversation content in each cluster is analyzed, and the attributes, expressions and application scenario information of the virtual character corresponding to the cluster are extracted; according to the extracted attributes, expressions and application scenario information, labels are added to each conversation content to form a labeled data set.

[0021] In one embodiment, extracting language features, context features, and expression features from the conversation content data includes:

[0022] Use word segmentation tools to segment the dialogue text and mark the parts of speech; calculate the vocabulary diversity index, analyze the complexity of sentence structure, and count the number of clauses and nesting depth indicators; extract sentiment scores based on sentiment analysis tools, and count specific rhetorical techniques or spoken features to capture specific language styles;

[0023] Extract conversation topics based on topic models, determine core content or application scenarios, and analyze the identities and relationship information of the two parties in the conversation; determine time dependencies based on the temporal distribution of conversation content; count conversation rounds, and analyze conversation depth and interaction frequency;

[0024] Use word frequency statistics to identify frequently appearing words or phrases in conversations and determine whether they are catchphrases; use sentiment analysis models to detect the usage rate of exaggerated expressions and use syntactic analysis to identify uncommon word orders; and count the modal particles and rhetorical devices used in conversations.

[0025] In one embodiment, the calculation formula of the vocabulary diversity index is:

[0026]

[0027] Where MSTTR represents the overall lexical diversity index (i.e., the moving average type-token ratio), n represents the number of windows into which the text is segmented, and C i represents the number of unique words in the i-th window, B i Represents the total number of words in the i-th window.

[0028] In one embodiment, based on the clustering results, the conversation content in each cluster is analyzed, and the attributes, expressions, and application scenario information of the virtual character corresponding to the cluster are extracted, including:

[0029] Count the number of conversations in each cluster to determine the size of the cluster; and extract the high-frequency words in each cluster through word frequency statistics to preliminarily determine the main content and theme direction of the cluster;

[0030] Analyze the role titles, addresses, and self-description information in the cluster conversations to determine the basic attributes of the virtual characters; use sentiment analysis tools to analyze the words and tone in the conversations to identify the spiritual attributes of the virtual characters; analyze the social roles and cultural backgrounds of the virtual characters based on the social relationships and background information mentioned in the conversations;

[0031] Count the specific language styles that appear in the cluster and determine the expression characteristics of the conversations within the cluster; use sentiment analysis to count the emotional distribution of the cluster’s conversation content and identify expressions with concentrated sentiment tendencies; analyze the modal particles and rhetoric of the conversations within the cluster and identify the unique expression styles of the virtual characters;

[0032] Use the topic model to classify the conversation content within the cluster and identify the core topic of the cluster conversation; identify specific scene keywords based on the conversation content and words, and judge the actual scene of the conversation; count the conversation rounds, interaction frequency and response time, and judge the interactive characteristics of the application scenario;

[0033] Based on the analysis results, feature labels are generated for each cluster to indicate the attributes, expressions and application scenarios of the virtual characters. The labels of all clusters are summarized to generate a feature table, and the conversation content of each cluster is bound to the label to form a labeled data set.

[0034] In one embodiment, based on the attributes, expressions and application scenarios of the virtual character, the large language model is trained, and the generation effect after the training is evaluated; dynamically adjusting the proportion of expressions in the labeled data set according to the evaluation result, and updating the large language model based on the adjusted proportion includes:

[0035] Use the labeled datasets of virtual characters’ attributes, expressions, and application scenarios to train the Transformer-based deep learning model, and test the dialogue content generated by the Transformer-based deep learning model in different application scenarios;

[0036] Compare whether the generated content conforms to the expression and settings of the virtual character; use text evaluation indicators to evaluate the quality of the generated text, and combine effect evaluation indicators to conduct a comprehensive analysis of the generated effect;

[0037] The proportion of expressions in the labeled dataset is dynamically adjusted according to the resampling method and the evaluation results, and the adjusted labeled dataset is used to update the Transformer-based deep learning model.

[0038] In one embodiment, comparing whether the generated content conforms to the expression and setting of the virtual character; using the text evaluation index to evaluate the quality of the generated text, and combining the effect evaluation index to comprehensively analyze the generated effect include:

[0039] Based on the annotated dataset of virtual characters, the core features of the virtual characters are clarified as a reference for the generated content; the generated content is annotated to confirm whether the expression is consistent with the character setting, and the generated content is scored for expression consistency;

[0040] Calculate the text quality score of the generated content based on the preset text evaluation indicators; evaluate the generation effect score of the generated content based on the preset effect evaluation indicators, analyze the consistency of the generated content in different dialogue rounds, summarize the advantages and disadvantages of the generation effect, and provide feedback basis for model optimization;

[0041] The scores of text evaluation indicators and effect evaluation indicators are summarized into a comprehensive evaluation report, and the consistency of the two types of indicators in the generated content is observed; based on the evaluation results, the problem points in the model-generated content are refined, and the feedback results are used for the next round of annotation data adjustment and model fine-tuning.

[0042] In one embodiment, the calculation formula for the text quality score of the generated content is:

[0043]

[0044] Where P 文本 represents the text quality score of the generated content, P BLEU represents the similarity score between the generated text and the reference text in terms of vocabulary, P ROUGE represents the matching degree score between the generated text and the reference text in terms of word sequence and structure, P METEOR represents the semantic similarity and diversity score between the generated text and the reference text, BP represents the penalty term for shorter generated text, N represents the number of n-grams, n-grams represents the number of consecutive words or characters, and w n Represents the weight of each n-grams, p n represents the overlap ratio between the generated text and the reference text in n-grams, L g represents the longest common subsequence length between the generated text and the reference text, L z represents the length of the reference text, P represents the proportion of words in the generated text that exactly match the reference text, α represents the weight used to control precision and recall, and R represents the proportion of words in the generated text that exactly match the reference text.

[0045] In one embodiment, the calculation formula for the generation effect score of the generated content is:

[0046]

[0047] Where P 效果 represents the generation effect score of the generated content, P情感 represents the sentiment consistency score of the generated content, P 风格 represents the style consistency score of the generated content, P 逻辑 represents the logical consistency score of the generated content, E g represents the sentiment score of the generated text, E r represents the sentiment score of the reference text, M g represents the tone and word style feature set in the generated text, M r represents the tone and word style feature set in the annotated text, S i represents the logical consistency score given by human raters, and F represents the total number of scores.

[0048] According to a second aspect of an embodiment of the present invention, a system for generating virtual character training data is provided.

[0049] In one embodiment, the virtual character training data generation system includes:

[0050] A virtual character analysis module is used to analyze the virtual character and construct the attributes, expressions and application scenarios of the virtual character;

[0051] The large language model training and updating module is used to train the large language model based on the attributes, expressions and application scenarios of the virtual characters, and evaluate the generation effect after training; dynamically adjust the proportion of expressions in the annotated data set according to the evaluation results, and update the large language model based on the adjusted proportion;

[0052] The training data generation module is used to generate corresponding dialogue content data using the updated large language model according to the attributes, expressions and target application scenarios of the target virtual character, so as to obtain the virtual character training data.

[0053] According to a third aspect of an embodiment of the present invention, a computer device is provided.

[0054] In some embodiments, the computer device includes a memory and a processor, the memory stores a computer program, and the processor implements the steps of the above method when executing the computer program.

[0055] According to a fourth aspect of embodiments of the present invention, a computer-readable storage medium is provided.

[0056] In one embodiment, the computer-readable storage medium stores a computer program, and the computer program implements the steps of the above method when executed by a processor.

[0057] The technical solution provided by the embodiment of the present invention may have the following beneficial effects:

[0058] 1. Supporting complex virtual character settings: Compared with the solution of setting character roles based on prompt word engineering, the present invention makes the setting of the trained virtual character richer and more three-dimensional by writing detailed character biographies and corresponding high-quality dialogue corpus data.

[0059] 2. Rich expressive ability: Compared with the solution based on existing character dialogue data as training corpus, the present invention can effectively ensure that the trained virtual characters have diverse expression styles and fit the character settings and scene settings by dynamically adjusting the training data ratio and expanding the high-precision corpus data.

[0060] 3. Strong transferability: The training corpus data preparation scheme proposed in the present invention has controllable corpus data construction costs and can be expanded with high-precision data through existing large language models, which has strong transferability. And after multiple practices, the standardized virtual character training data preparation scheme can quickly realize the efficient preparation of multiple virtual character training data.

[0061] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0062] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.

[0063] Figure 1 is a flow chart of a method for generating virtual character training data according to an exemplary embodiment;

[0064] Figure 2 is a structural block diagram of a virtual character training data generation system according to an exemplary embodiment;

[0065] Figure 3 It is a schematic diagram showing the structure of a computer device according to an exemplary embodiment. DETAILED DESCRIPTION

[0066] The following description and accompanying drawings fully illustrate the specific embodiments of this article so that those skilled in the art can practice them. Parts and features of some embodiments may be included in or replace parts and features of other embodiments. The scope of the embodiments of this article includes the entire scope of the claims, as well as all available equivalents of the claims. Herein, the terms "first", "second", etc. are only used to distinguish one element from another, without requiring or implying any actual relationship or order between these elements. In fact, the first element can also be called the second element, and vice versa. Moreover, the terms "include", "comprise" or any other variant thereof are intended to cover non-exclusive inclusion, so that the structure, device or equipment including a series of elements includes not only those elements, but also other elements that are not explicitly listed, or also include elements inherent to such structure, device or equipment. In the absence of more restrictions, the elements defined by the sentence "including one..." do not exclude the existence of other identical elements in the structure, device or equipment including the elements. Each embodiment is described in a progressive manner herein, and each embodiment focuses on the differences from other embodiments, and the same and similar parts between the embodiments can be referred to each other.

[0067] The terms "longitudinal", "lateral", "upper", "lower", "front", "back", "left", "right", "vertical", "horizontal", "top", "bottom", "inside", "outside", etc. in this document indicate the orientation or position relationship based on the orientation or position relationship shown in the drawings, and are only for the convenience of describing this document and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, be constructed and operate in a specific orientation, and therefore cannot be understood as a limitation on the present invention. In the description of this document, unless otherwise specified and limited, the terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a mechanical connection or an electrical connection, it can also be the internal communication of two elements, it can be a direct connection, or it can be an indirect connection through an intermediate medium. For ordinary technicians in this field, the specific meanings of the above terms can be understood according to specific circumstances.

[0068] As used herein, the term "plurality" means two or more than two, unless otherwise specified.

[0069] In this document, the character " / " indicates that the preceding and following objects are in an "or" relationship. For example, A / B means: A or B.

[0070] In this article, the term "and / or" is a description of the association relationship between objects, indicating that three relationships may exist. For example, A and / or B means: A or B, or, A and B.

[0071] It should be understood that, although the various steps in the flow chart 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 description in this article, the execution of these steps is not strictly limited in order, and these steps can be executed in other orders. Moreover, at least a portion of the steps in the figure may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these sub-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 portion of the sub-steps or stages of other steps.

[0072] Each module in the device or system of the present application can be implemented in whole or in part by software, hardware, or a combination thereof. The above modules can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to the above modules.

[0073] In the absence of conflict, the embodiments of the present invention and the features of the embodiments may be combined with each other.

[0074] Figure 1 An embodiment of a method for generating virtual character training data according to the present invention is shown.

[0075] In this optional embodiment, the method for generating virtual character training data includes:

[0076] Step S101: Analyze the virtual character to construct the attributes, expression methods and application scenarios of the virtual character.

[0077] The analysis of the virtual character and the construction of the virtual character's attributes, expressions and application scenarios include:

[0078] 1) Obtain the conversation content data of the virtual character in the historical database, perform data cleaning and feature vectorization processing, and extract the language features, context features and expression features in the conversation content data.

[0079] Specifically, the conversation content data of the virtual character in the historical database of this embodiment can be manually input, as follows:

[0080] Preparation of character training needs: determine the training objectives of virtual characters, set the expected character information, expression methods and application scenarios;

[0081] Writing biographical materials: Write detailed biographical materials according to the needs, including the basic attributes of the character (gender, age, appearance, etc.), social attributes (identity, experience, social relations, etc.) and spiritual attributes (character, behavior style, values, etc.), as shown in Table 1 below:

[0082] Table 1 Biography of virtual characters

[0083]

[0084] Expression corpus construction: Based on the detailed information of the character's biography, construct expressions that match the character's settings, such as catchphrases, intonations, and wording habits. For example, if the character likes to repeat his expression three times, you can construct the corpus shown in Table 2 below:

[0085] Table 2 Expression of virtual characters

[0086] Zhang San It's a nice evening. How about going for a walk? Let's go? Let's go? Let's go? user (Lying lazily on the sofa and playing with my phone) I ate too much for dinner and I don’t feel like moving now. Zhang San The air is good, the moonlight is beautiful, if it were like this every day, that would be great! That would be great! That would be great! user (Stepping on Zhang San’s shadow) Sister Zhang San, I stepped on you. Zhang San This is really too much, I'm going to fight back! Be careful~ Be careful~ Be careful~ user It feels really good to go out for a walk like this.

[0087] Conversation scenario corpus construction: By presetting the topics or scenarios discussed by the characters and users, hiring professional screenwriters to write exclusive topic or scenario scripts that match the character settings and expressions, and constructing the high-precision corpus information required for training. For example: conversations about topics such as chasing dramas, losing weight, and work, and conversations in designated scenarios such as walking, vacationing, and playing games. For example, for a scene of running together, you can construct the corpus shown in 3 below:

[0088] Table 3 Conversation contents of virtual characters

[0089]

[0090] Specifically, the extraction of language features, context features and expression features in the conversation content data includes:

[0091] Use word segmentation tools to segment the dialogue text and mark the parts of speech; calculate the vocabulary diversity index, analyze the complexity of sentence structure, and count the number of clauses and nesting depth indicators; extract sentiment scores based on sentiment analysis tools, and count specific rhetorical techniques or spoken features to capture specific language styles.

[0092] Specifically, the calculation formula of the vocabulary diversity index is:

[0093]

[0094] Where MSTTR represents the overall lexical diversity index (i.e., the moving average type-token ratio), n represents the number of windows into which the text is segmented, and C i represents the number of unique words in the i-th window, B i Represents the total number of words in the i-th window.

[0095] Extract conversation topics based on the topic model, determine the core content or application scenarios, and analyze the identities and relationship information of the two parties in the conversation; determine the time dependency based on the temporal distribution of the conversation content; count the conversation rounds, and analyze the depth of the conversation and the frequency of interaction.

[0096] Use word frequency statistics to identify frequently appearing words or phrases in conversations and determine whether they are catchphrases; use sentiment analysis models to detect the usage rate of exaggerated expressions and use syntactic analysis to identify uncommon word orders; and count the modal particles and rhetorical devices used in conversations.

[0097] Specifically, identifying frequent words or phrases through word frequency statistics and determining whether they are catchphrases include:

[0098] Tokenization and preprocessing: Tokenize and preprocess the conversation content to remove stop words and punctuation so that the analysis can focus on meaningful words and phrases.

[0099] Term frequency statistics: Use term frequency statistics (such as TF or TF-IDF) to identify words and phrases that appear frequently across multiple conversations.

[0100] Identify catchphrases: Set a threshold to filter out words or phrases that appear frequently as "possible catchphrases". Compare the contextual usage of these words and phrases to determine whether they appear repeatedly in most conversation scenarios. If so, these phrases or words may be catchphrases.

[0101] Using sentiment analysis models to detect the use of exaggerated expressions includes:

[0102] Load sentiment analysis model: Use sentiment analysis models such as VADER and TextBlob to extract the sentiment score of each conversation.

[0103] Detecting exaggerated expressions: Focus on extreme sentiment values ​​(such as high positive or negative sentiment scores) to determine whether there is exaggerated emotional expression. If extreme words (such as "super", "very", etc.) are used in the sentence and the sentiment score is also high, it may be an exaggerated expression.

[0104] Calculate the usage rate of exaggeration: Count the proportion of sentences containing exaggerated expressions to the total number of sentences as the usage rate indicator of exaggerated expressions.

[0105] Identifying unusual word orders through syntactic analysis includes:

[0106] Syntactic parsing: Use syntactic parsing tools such as spaCy and Stanza to perform dependency syntactic analysis on sentences.

[0107] Uncommon Word Order Detection: Analyze the dependency tree to identify key components such as the subject, predicate, and object of the sentence, and determine whether it conforms to the conventional word order (e.g., subject-verb-object). If the sentence structure shows an unconventional word order (e.g., inversion, passive voice), it is marked as an uncommon word order.

[0108] Statistical analysis of modal particles and rhetorical devices in the dialogue includes:

[0109] Modal Particle Statistics: Pre-build a modal particle dictionary (e.g., "ne", "ba", "a", etc.). Traverse the dialogue content and count the frequency of modal particles in the dictionary.

[0110] Rhetorical Device Identification: Use regular expressions or syntactic analysis to identify rhetorical structures (e.g., rhetorical questions, exaggeration, metaphor, etc.). Tag the detected rhetorical devices and count the frequencies of different rhetorical devices.

[0111] 2) Based on the extracted language features, context features, and expression features, use a clustering algorithm to group the dialogue content of virtual characters, and each category of dialogue content should represent a type of virtual character with similar attributes, expression styles, and application scenario features.

[0112] 3) Based on the clustering results, analyze the dialogue content in each cluster, and extract the attributes, expression styles, and application scenario information of the virtual characters corresponding to the cluster; according to the extracted attributes, expression styles, and application scenario information, add tags to each dialogue content to form an annotated dataset.

[0113] Specifically, the analysis of the dialogue content in each cluster based on the clustering results and the extraction of the attributes, expression styles, and application scenario information of the virtual characters corresponding to the cluster include:

[0114] Count the number of dialogues in each cluster to determine the scale of the cluster; and use the word frequency statistics method to extract the high-frequency words in each cluster to preliminarily judge the main content and theme direction of the cluster.

[0115] Analyze the role titles, appellations, and self-description information in the dialogues within the cluster to judge the basic attributes of the virtual characters; use sentiment analysis tools to analyze the words and tones in the dialogues to identify the mental attributes of the virtual characters; according to the social relationships and background information mentioned in the dialogues, analyze the social roles and cultural backgrounds of the virtual characters.

[0116] Count the specific language styles that appear in the cluster to judge the expression features of the dialogues within the cluster; use sentiment analysis to count the sentiment distribution of the dialogue content in the cluster to identify the expression styles with concentrated sentiment tendencies; analyze the modal particles and rhetorical devices in the dialogues within the cluster to identify the unique expression styles of the virtual characters.

[0117] The topic model is used to classify the conversation content within the cluster and identify the core topics of the cluster conversation; the specific scene keywords are identified based on the conversation content and words, and the actual scene of the conversation is judged; the conversation rounds, interaction frequency and response time are counted to determine the interactive characteristics of the application scenario.

[0118] Based on the analysis results, feature labels are generated for each cluster to indicate the attributes, expressions and application scenarios of the virtual characters. The labels of all clusters are summarized to generate a feature table, and the conversation content of each cluster is bound to the label to form a labeled data set.

[0119] Step S103: Based on the attributes, expressions and application scenarios of the virtual characters, the large language model is trained, and the generation effect after training is evaluated; the proportion of expressions in the annotated data set is dynamically adjusted according to the evaluation results, and the large language model is updated based on the adjusted proportion.

[0120] The method of training the large language model based on the attributes, expressions and application scenarios of the virtual character and evaluating the generation effect after the training; dynamically adjusting the proportion of expressions in the labeled data set according to the evaluation results, and updating the large language model based on the adjusted proportion includes:

[0121] 1) Use the labeled datasets of virtual characters’ attributes, expressions and application scenarios to train the Transformer-based deep learning model, and test the dialogue content generated by the Transformer-based deep learning model in different application scenarios.

[0122] 2) Compare whether the generated content conforms to the expression and settings of the virtual character; use text evaluation indicators to evaluate the quality of the generated text, and combine effect evaluation indicators to conduct a comprehensive analysis of the generated effect.

[0123] Specifically, the comparing whether the generated content conforms to the expression and setting of the virtual character; using the text evaluation index to evaluate the quality of the generated text, and combining the effect evaluation index to comprehensively analyze the generated effect include:

[0124] Based on the annotated dataset of virtual characters, the core features of the virtual characters (such as tone, emotional tendencies, and word style) are clarified as a reference for the generated content; the generated content is annotated to confirm whether the expression is consistent with the character setting, for example: whether specific vocabulary, sentence patterns, and emotional symbols are used; whether the expressed emotions and tone are consistent with the settings of the virtual character (such as humor, formality, and gentleness); and the generated content is scored for expression consistency (such as 1-5 points) to measure the degree of match between the generated content and the character characteristics.

[0125] According to the preset text evaluation indicators (including BLEU, ROUGE and METEOR), the text quality score of the generated content is calculated; based on the preset effect evaluation indicators, the generation effect score of the generated content is evaluated, and the consistency of the generated content in different dialogue rounds is analyzed, the advantages and disadvantages of the generation effect are summarized, and feedback basis is provided for model optimization.

[0126] Specifically, the calculation formula for the text quality score of the generated content is:

[0127]

[0128] The calculation formula for the generation effect score of the generated content is:

[0129]

[0130] Where P 文本 represents the text quality score of the generated content, P BLEU represents the similarity score between the generated text and the reference text in terms of vocabulary, P ROUGE represents the matching degree score between the generated text and the reference text in terms of word sequence and structure, P METEOR represents the semantic similarity and diversity score between the generated text and the reference text, BP represents the penalty for a shorter generated text, N represents the number of n-grams, and n-grams represents the number of consecutive words or characters. For example, when N=1, it represents 1-gram (a single statistic of a word or character, called a "unit" or "word"); when N=2, it represents 2-gram (a statistic of two consecutive words or characters, called a "bigram" or "bigram"); ​​when N=3, it represents 3-gram (a statistic of three consecutive words or characters, called a "trigram" or "trigram"). n Represents the weight of each n-grams, p n represents the overlap ratio between the generated text and the reference text in n-grams, L g represents the longest common subsequence length between the generated text and the reference text, L z represents the length of the reference text, P represents the proportion of words in the generated text that exactly match the reference text, α represents the weight used to control precision and recall, R represents the proportion of words in the generated text that exactly match the reference text, and P 效果 represents the generation effect score of the generated content, P 情感 represents the sentiment consistency score of the generated content, P 风格 represents the style consistency score of the generated content, P 逻辑 represents the logical consistency score of the generated content, E g represents the sentiment score of the generated text, E rrepresents the sentiment score of the reference text, M g represents the tone and word style feature set in the generated text, M r represents the tone and word style feature set in the annotated text, S i represents the logical consistency score given by human raters, and F represents the total number of scores.

[0131] The scores of text evaluation indicators and effect evaluation indicators are summarized into a comprehensive evaluation report, and the consistency of the two types of indicators in the generated content is observed; based on the evaluation results, the problem points in the model-generated content are refined, and the feedback results are used for the next round of annotation data adjustment and model fine-tuning.

[0132] 3) Dynamically adjust the proportion of expressions in the labeled dataset based on the resampling method and the evaluation results, and use the adjusted labeled dataset to update the Transformer-based deep learning model.

[0133] Select a resampling method: Use oversampling or undersampling to adjust the proportion of expressions in the labeled dataset:

[0134] Oversampling: For expressions with a small number of samples but need to be enhanced, increase the proportion of such samples in the data set. New samples can be generated through data enhancement (such as synonym replacement and sentence conversion).

[0135] Undersampling: For expressions with too many samples and good generation effects, their sample sizes can be reduced to balance the proportion of each expression in the dataset.

[0136] Resampling process: According to the evaluation results of each expression, apply appropriate proportion of resampling methods (such as SMOTE or random resampling) to increase or decrease samples to ensure that the distribution of expressions in the adjusted data set is more uniform and meets the model optimization requirements.

[0137] According to the training effect of the virtual character, the proportion of various expressions of the characters in the training corpus under different topics and application scenarios is dynamically adjusted to make the expression of the trained virtual characters more rich and three-dimensional. For example: in the "Running Together" scenario, the proportion of character expressions in the corpus is adjusted to 3% of exaggerated expressions, 5% of catchphrases, and 2% of inverted sentences; in the "Watching TV Series Together" scenario, the proportion of character expressions in the corpus is adjusted to 15% of exaggerated expressions, 30% of catchphrases, and 30% of inverted sentences.

[0138] Step S105: Generate corresponding dialogue content data using the updated large language model according to the target virtual character's attributes, expressions, and target application scenarios to obtain virtual character training data.

[0139] Figure 2An embodiment of a virtual character training data generation system of the present invention is shown.

[0140] In this optional embodiment, the virtual character training data generation system includes:

[0141] A virtual character analysis module 201 is used to analyze the virtual character and construct the attributes, expressions and application scenarios of the virtual character;

[0142] The large language model training and updating module 203 is used to train the large language model based on the attributes, expressions and application scenarios of the virtual characters, and evaluate the generation effect after training; dynamically adjust the proportion of expressions in the annotated data set according to the evaluation results, and update the large language model based on the adjusted proportion;

[0143] The training data generation module 205 is used to generate corresponding dialogue content data using the updated large language model according to the attributes, expressions and target application scenarios of the target virtual character, so as to obtain virtual character training data.

[0144] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Figure 3 As shown. The computer device includes a processor, a memory and a network interface connected through a system bus. Among them, 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 static information and dynamic information data. The network 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, the steps in the above method embodiment are implemented.

[0145] Those skilled in the art will understand that Figure 3 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present invention, and does not constitute a limitation on the computer device to which the solution of the present invention 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.

[0146] In addition, the present invention also provides a computer device, 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 embodiment when executing the computer program.

[0147] In addition, the present invention further provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps in the above method embodiment are implemented.

[0148] 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 memory, storage, database or other media used in the embodiments provided by the present invention 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 or optical memory, etc. Volatile memory can include random access memory (RAM) or external cache memory. 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).

[0149] The present invention is not limited to the structures which have been described above and shown in the drawings, and various modifications and changes may be made without departing from the scope thereof. The scope of the present invention is limited only by the appended claims.

Claims

1. A method for generating virtual character training data, characterized in that: include: Analyze virtual characters and construct their attributes, expressions, and application scenarios; Based on the attributes, expressions and application scenarios of the virtual characters, the large language model is trained and the generation effect after training is evaluated; the proportion of expressions in the labeled data set is dynamically adjusted according to the evaluation results, and the large language model is updated based on the adjusted proportion; According to the attributes, expressions and target application scenarios of the target virtual character, the updated large language model is used to generate corresponding dialogue content data to obtain the virtual character training data.

2. The method for generating virtual character training data according to claim 1, characterized in that: Analyze the virtual characters and construct their attributes, expressions and application scenarios, including: Obtain the conversation content data of the virtual characters in the historical database, perform data cleaning and feature vectorization processing, and extract the language features, context features and expression features in the conversation content data; According to the extracted language features, context features and expression features, the clustering algorithm is used to group the dialogue content of the virtual characters, and each type of dialogue content should represent a type of virtual characters with similar attributes, expression methods and application scenario characteristics; Based on the clustering results, the conversation content in each cluster is analyzed, and the attributes, expressions and application scenario information of the virtual character corresponding to the cluster are extracted; according to the extracted attributes, expressions and application scenario information, labels are added to each conversation content to form a labeled data set.

3. The method for generating virtual character training data according to claim 2, characterized in that: The language features, context features and expression features extracted from the conversation content data include: Use word segmentation tools to segment the dialogue text and mark the parts of speech; calculate the vocabulary diversity index, analyze the complexity of sentence structure, and count the number of clauses and nesting depth indicators; extract sentiment scores based on sentiment analysis tools, and count specific rhetorical techniques or spoken features to capture specific language styles; Extract conversation topics based on topic models, determine core content or application scenarios, and analyze the identities and relationship information of the two parties in the conversation; determine time dependencies based on the temporal distribution of conversation content; count conversation rounds, and analyze conversation depth and interaction frequency; Identify frequently appearing words or phrases in conversations through word frequency statistics and determine whether they are catchphrases; use sentiment analysis models to detect the usage rate of exaggerated expressions and identify uncommon word orders through syntactic analysis; and count the modal particles and rhetorical devices used in conversations.

4. The method for generating virtual character training data according to claim 3, characterized in that: The calculation formula of the vocabulary diversity index is: Where MSTTR represents the overall lexical diversity index (i.e., the moving average type-token ratio), n represents the number of windows into which the text is segmented, and C i represents the number of unique words in the i-th window, B i Represents the total number of words in the i-th window.

5. The method for generating virtual character training data according to claim 2, characterized in that: Based on the clustering results, the conversation content in each cluster is analyzed, and the attributes, expressions, and application scenario information of the virtual character corresponding to the cluster are extracted, including: Count the number of conversations in each cluster to determine the size of the cluster; and extract the high-frequency words in each cluster through word frequency statistics to preliminarily determine the main content and theme direction of the cluster; Analyze the role titles, addresses, and self-description information in the cluster conversations to determine the basic attributes of the virtual characters; use sentiment analysis tools to analyze the words and tone in the conversations to identify the spiritual attributes of the virtual characters; analyze the social roles and cultural backgrounds of the virtual characters based on the social relationships and background information mentioned in the conversations; Count the specific language styles that appear in the cluster and determine the expression characteristics of the conversations within the cluster; use sentiment analysis to count the emotional distribution of the cluster’s conversation content and identify the expressions with concentrated sentiment tendencies; analyze the modal particles and rhetoric of the conversations within the cluster and identify the unique expression styles of the virtual characters; Use the topic model to classify the conversation content within the cluster and identify the core topic of the cluster conversation; identify specific scene keywords based on the conversation content and words, and judge the actual scene of the conversation; count the conversation rounds, interaction frequency and response time, and judge the interactive characteristics of the application scenario; Based on the analysis results, feature labels are generated for each cluster to indicate the attributes, expressions and application scenarios of the virtual characters. The labels of all clusters are summarized to generate a feature table, and the conversation content of each cluster is bound to the label to form a labeled data set.

6. The method for generating virtual character training data according to claim 1, characterized in that: Based on the attributes, expressions and application scenarios of virtual characters, the large language model is trained and the generation effect after training is evaluated; Dynamically adjust the proportion of expressions in the labeled dataset according to the evaluation results, and update the large language model based on the adjusted proportion, including: Use the labeled datasets of virtual characters’ attributes, expressions, and application scenarios to train the Transformer-based deep learning model, and test the dialogue content generated by the Transformer-based deep learning model in different application scenarios; Compare whether the generated content conforms to the expression and settings of the virtual character; use text evaluation indicators to evaluate the quality of the generated text, and combine effect evaluation indicators to conduct a comprehensive analysis of the generated effect; The proportion of expressions in the labeled dataset is dynamically adjusted according to the resampling method and the evaluation results, and the adjusted labeled dataset is used to update the Transformer-based deep learning model.

7. The method for generating virtual character training data according to claim 6, characterized in that: Compare whether the generated content conforms to the expression and settings of the virtual character; use text evaluation indicators to evaluate the quality of the generated text, and combine effect evaluation indicators to conduct a comprehensive analysis of the generated effect, including: Based on the annotated dataset of virtual characters, the core features of the virtual characters are clarified as a reference for the generated content; the generated content is annotated to confirm whether the expression is consistent with the character setting, and the generated content is scored for expression consistency; Calculate the text quality score of the generated content based on the preset text evaluation indicators; evaluate the generation effect score of the generated content based on the preset effect evaluation indicators, analyze the consistency of the generated content in different dialogue rounds, summarize the advantages and disadvantages of the generation effect, and provide feedback basis for model optimization; The scores of text evaluation indicators and effect evaluation indicators are summarized into a comprehensive evaluation report, and the consistency of the two types of indicators in the generated content is observed; based on the evaluation results, the problem points in the model-generated content are refined, and the feedback results are used for the next round of annotation data adjustment and model fine-tuning.

8. The method for generating virtual character training data according to claim 7, characterized in that: The calculation formula for the text quality score of the generated content is: Where P 文本 represents the text quality score of the generated content, P BLEU represents the similarity score between the generated text and the reference text in terms of vocabulary, P ROUGE represents the matching degree score between the generated text and the reference text in terms of word sequence and structure, P METEOR represents the semantic similarity and diversity score between the generated text and the reference text, BP represents the penalty term for shorter generated text, N represents the number of n-grams, n-grams represents the number of consecutive words or characters, and w n Represents the weight of each n-grams, p n represents the overlap ratio between the generated text and the reference text in n-grams, L g represents the longest common subsequence length between the generated text and the reference text, L z represents the length of the reference text, P represents the proportion of words in the generated text that exactly match the reference text, α represents the weight used to control precision and recall, and R represents the proportion of words in the generated text that exactly match the reference text.

9. The method for generating virtual character training data according to claim 7, characterized in that: The calculation formula for the generation effect score of the generated content is: Where P 效果 represents the generation effect score of the generated content, P 情感 represents the sentiment consistency score of the generated content, P 风格 represents the style consistency score of the generated content, P 逻辑 represents the logical consistency score of the generated content, E g represents the sentiment score of the generated text, E r represents the sentiment score of the reference text, M g represents the tone and word style feature set in the generated text, M r represents the tone and word style feature set in the annotated text, S i represents the logical consistency score given by human raters, and F represents the total number of scores.

10. A virtual character training data generation system, characterized in that: include: A virtual character analysis module is used to analyze the virtual character and construct the attributes, expressions and application scenarios of the virtual character; The large language model training and updating module is used to train the large language model based on the attributes, expressions and application scenarios of the virtual characters, and evaluate the generation effect after training; dynamically adjust the proportion of expressions in the labeled data set according to the evaluation results, and update the large language model based on the adjusted proportion; The training data generation module is used to generate corresponding dialogue content data using the updated large language model according to the attributes, expressions and target application scenarios of the target virtual character, so as to obtain the virtual character training data.

Citation Information

Patent Citations

  • Dialogue model training method and device and dialogue response method and device

    CN115495568A

  • Virtual character generation method and device

    CN116932719A

  • Multi-modal large model construction system for multiple information sources

    CN117349675A

Cited By

  • Personalized learning plan recommendation method and system

    CN119848220A

  • Interactive control method for virtual simulation training of power operation and maintenance

    CN120375662A

  • Conversational virtual assistant tuning method and system

    CN120804887A

  • Conversational virtual assistant tuning method and system

    CN120804887B

  • Large language model role interaction system based on plot driving and tool calling

    CN121598807A