Virtual character chat model training method and device, electronic equipment and storage medium

By obtaining the attribute characteristics of user and non-player roles and using large language models to generate dialogue samples, the problem of high data collection cost of virtual character chat model in the existing technology is solved, efficient dialogue sample generation is achieved, and labor costs are reduced.

CN119168071APending Publication Date: 2024-12-20BEIJING QIYI CENTURY SCI & TECH CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202411342927.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-25
Publication Date
2024-12-20

AI Technical Summary

Technical Problem

When generating virtual character chat models, the existing technology needs to screen and adapt data from a large number of literary works, resulting in high labor costs and difficulty in efficiently collecting training data for users' specific preferences, and the inability to effectively support customized plots and NPC intelligent content. generate.

Method used

By obtaining user attribute characteristics and non-player role attribute characteristics, generating role generation instructions, using large language models to generate user role sets and non-player role sets, and generating dialogue samples by combining character interaction pairs, simplifying the process of obtaining dialogue samples and reducing the labor costs.

Benefits of technology

It realizes the direct generation of dialogue samples that meet the attribute characteristics of users and non-player characters, avoids cumbersome screening and adaptation of literary and artistic works, simplifies the data collection process, reduces labor costs, and improves the applicable ability of virtual character chat models.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119168071A_ABST
    Figure CN119168071A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a virtual character chat model training method and device, electronic equipment and a storage medium, and is applied to the technical field of information processing. Formulating a role generation instruction according to the user attribute characteristics and the non-player role attribute characteristics, and directly generating a plurality of roles reflecting character characteristics by a large language model according to the role generation instruction; and dialogue samples corresponding to the role interaction pairs are generated by the large language model, so that the dialogue samples serve as training samples of the virtual role chat model. By applying the method provided by the embodiment of the invention, the user role and the non-player role which reflect the user attribute characteristics and the non-player role attribute characteristics can be directly generated through the pre-trained big language model, and the big language model directly generates the dialogue sample for the role interaction pair formed by the user role and the non-player role; therefore, screening or recompiling from a large number of literature works can be avoided, the mode of obtaining the dialogue samples is simplified, and the labor cost is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of information processing technology, and in particular to a virtual character chat model training method, device, electronic device and storage medium. Background Art

[0002] In the digital age, people are increasingly pursuing emotional communication and personalized experience, especially on online social platforms, where users' need for companionship has always occupied an important position. In this context, the AI ​​(Artificial Intelligence) chat game industry has gradually emerged, in which AI NPC (non-player character) can not only show higher flexibility and realism in daily conversations, but also initially realize the perception and response of user emotions, greatly enriching the user experience.

[0003] In related technologies, relevant technicians usually select training samples that match the preset NPC personality from novels, movies, scripts and other works of art and input them into the virtual character chat model for training, so that the generated NPC can have a conversation with its own personality characteristics and improve the user experience. However, the application of this method requires the screening or adaptation of a large number of literary and artistic works, and the data acquisition method is cumbersome and the labor cost is high. Summary of the invention

[0004] The purpose of the embodiments of the present application is to provide a virtual character chat model training method, device, electronic device and storage medium to reduce the labor cost of obtaining dialogue samples. The specific technical solution is as follows:

[0005] In a first aspect of an embodiment of the present application, a virtual character chat model training method is provided, the method comprising:

[0006] Obtaining user attribute characteristics and non-player character attribute characteristics;

[0007] Generate a character generation instruction according to the user attribute characteristics and the non-player character attribute characteristics;

[0008] Inputting the character generation instruction into a pre-trained large language model, respectively obtaining a user character set and a non-player character set; wherein the user character set includes a plurality of user characters, and the user attribute characteristics of different user characters are not completely the same; and the non-player character set includes a plurality of non-player characters, and the non-player character attribute characteristics of different non-player characters are not completely the same;

[0009] Combining the user character with the non-player character to generate a plurality of sets of character interaction pairs;

[0010] The large language model is used to generate dialogue samples for each group of the role interaction pairs; wherein the dialogue samples are training samples for the virtual role chat model.

[0011] In a possible implementation manner, after combining the user characters of the user character set with the non-player characters of the non-player character set to generate a plurality of sets of character interaction pairs, the method further includes:

[0012] Get the plot synopsis text;

[0013] Using the large language model, generating a plurality of plot texts under the plot outline text for each group of the role interaction pairs;

[0014] The step of using the large language model to generate dialogue samples of each group of the role interaction pairs includes:

[0015] For any role interaction pair, the role interaction pair and multiple plot texts of the role interaction pair are input into the large language model to obtain a dialogue sample of the role interaction pair under the plot outline text.

[0016] In a possible implementation, the using of the large language model to generate a plurality of plot texts for each group of the role interaction pairs under the plot outline text includes:

[0017] Produce storyline generation instructions based on the plot outline text and the character interaction pairs;

[0018] The plot generation instruction is input into the large language model to generate a plurality of plot texts under the plot outline text for each group of the role interaction pairs.

[0019] In a possible implementation, for any role interaction pair, the role interaction pair and a plurality of plot texts of the role interaction pair are input into the large language model to obtain a dialogue sample of the role interaction pair under the plot outline text, including:

[0020] According to each pair of the role interaction pairs and the plot text corresponding to the role interaction pairs, a dialogue triggering instruction is set,

[0021] The dialogue stimulating instruction is input into the large language model to generate a dialogue sample under the plot outline text for each pair of the role interaction pairs.

[0022] In a possible implementation manner, after respectively generating the dialogue samples of each group of the role interaction pairs using the large language model, the method further includes:

[0023] For each dialogue sample, determine whether the dialogue sample contains preset prohibited words, and if so, delete the dialogue sample.

[0024] In a possible implementation manner, after respectively generating the dialogue samples of each group of the role interaction pairs using the large language model, the method further includes:

[0025] For each conversation sample, the first conversation subsample and the first user attribute feature are input into a pre-trained deep learning model to obtain a first discrimination result; wherein the first discrimination result indicates the probability that the content of the first conversation subsample meets the first user attribute feature; the first conversation subsample is the conversation content belonging to the first user role in the conversation sample, and the first user attribute feature is the user attribute feature of the first user role;

[0026] Inputting the second dialogue subsample and the first non-player character attribute feature into the pre-trained deep learning model to obtain a second discrimination result; wherein the second discrimination result indicates the probability that the content of the second dialogue subsample conforms to the first non-player character attribute feature; the second dialogue subsample is the dialogue content belonging to the first non-player character in the dialogue sample, and the first non-player character attribute feature is the non-player character attribute feature of the first non-player character;

[0027] It is determined whether the first discrimination result is greater than or equal to a first preset threshold and whether the second discrimination result is greater than or equal to a second preset threshold; if not, the conversation sample is deleted.

[0028] A second aspect of an embodiment of the present application provides a method for generating a dialogue text, which is applied to a business server, and the method includes:

[0029] Receiving a user dialogue instruction input by a client; wherein the user dialogue instruction includes a user dialogue text, a second user character corresponding to the client, and a second non-player character that dialogues with the second user character;

[0030] According to the second user character and the second non-player character, obtaining a second user attribute feature of the second user character and a second non-player character attribute feature of the second non-player character;

[0031] The user conversation text, the second user attribute feature and the second non-player character attribute feature are input into a trained virtual character chat model to obtain the conversation text of the second non-player character, wherein the trained virtual character chat model is trained by any method described in the first aspect of the embodiment of the present application.

[0032] In a third aspect of an embodiment of the present application, a virtual character chat model training device is provided, the device comprising:

[0033] An attribute feature acquisition module, used to acquire user attribute features and non-player character attribute features;

[0034] A role generation instruction making module, used for generating a role generation instruction according to the user attribute characteristics and the non-player character attribute characteristics;

[0035] A role generation module, used for inputting the role generation instruction into a pre-trained large language model to obtain a user role set and a non-player role set respectively; wherein the user role set includes a plurality of user roles, and the user attribute characteristics of different user roles are not completely the same; the non-player role set includes a plurality of non-player roles, and the non-player role attribute characteristics of different non-player roles are not completely the same;

[0036] A role combination module, used for combining the user role with the non-player role to generate multiple groups of role interaction pairs;

[0037] The dialogue sample generation module is used to generate dialogue samples of each group of the role interaction pairs using the large language model; wherein the dialogue samples are training samples of the virtual role chat model.

[0038] In a possible implementation, the device further includes:

[0039] A plot outline text acquisition module is used to acquire the plot outline text;

[0040] A storyline generation module, used to generate a plurality of storyline texts under the storyline outline text for each group of the role interaction pairs by using the large language model;

[0041] The dialogue sample generation module includes a dialogue sample generation submodule,

[0042] The dialogue sample generation submodule is specifically used to input any role interaction pair and multiple plot texts of the role interaction pair into the large language model to obtain the dialogue sample of the role interaction pair under the plot outline text.

[0043] In a possible implementation, the storyline generation module includes:

[0044] A plot generation instruction production submodule, specifically used to produce plot generation instructions according to the plot outline text and each of the character interaction pairs;

[0045] The storyline generation submodule is specifically used to input the storyline generation instruction into the large language model, and generate multiple storyline texts for each group of the role interaction pairs under the storyline outline text.

[0046] In a possible implementation, the dialogue sample generation submodule includes:

[0047] The dialogue stimulating instruction making unit is specifically used to set the dialogue stimulating instruction according to each pair of the said role interaction pairs and the plot text corresponding to the role interaction pairs,

[0048] The dialogue sample generating unit is specifically used to input the dialogue stimulating instruction into the large language model, and generate a dialogue sample for each pair of the role interaction under the plot outline text.

[0049] In a possible implementation, the device further includes:

[0050] The dialogue sample quality review module is used to determine, for each dialogue sample, whether the dialogue sample contains preset banned words, and if so, delete the dialogue sample.

[0051] In a possible implementation, the device further includes:

[0052] A first content fit detection module is used for inputting the first conversation subsample and the first user attribute feature into a pre-trained deep learning model for each conversation sample to obtain a first discrimination result; wherein the first discrimination result indicates the probability that the content of the first conversation subsample meets the first user attribute feature; the first conversation subsample is the conversation content belonging to the first user role in the conversation sample, and the first user attribute feature is the user attribute feature of the first user role;

[0053] A second content fit detection module is used to input the second dialogue subsample and the first non-player character attribute feature into the pre-trained deep learning model to obtain a second discrimination result; wherein the second discrimination result represents the probability that the content of the second dialogue subsample conforms to the first non-player character attribute feature; the second dialogue subsample is the dialogue content belonging to the first non-player character in the dialogue sample, and the first non-player character attribute feature is the non-player character attribute feature of the first non-player character;

[0054] The dialogue sample logic review module is used to determine whether the first discrimination result is greater than or equal to a first preset threshold and whether the second discrimination result is greater than or equal to a second preset threshold. If not, the dialogue sample is deleted.

[0055] In a fourth aspect of the embodiments of the present application, a dialog text generation device is provided, which is applied to a business server, and the device includes:

[0056] A user dialogue instruction receiving module, used for receiving a user dialogue instruction input by a client; wherein the user dialogue instruction includes a user dialogue text, a second user character corresponding to the client, and a second non-player character that dialogues with the second user character;

[0057] a character attribute feature acquisition module, configured to acquire a second user attribute feature of the second user character and a second non-player character attribute feature of the second non-player character according to the second user character and the second non-player character;

[0058] A dialogue text generation module is used to input the user dialogue text, the second user attribute characteristics and the second non-player character attribute characteristics into a trained virtual character chat model to obtain the dialogue text of the second non-player character, wherein the trained virtual character chat model is trained by any method described in the first aspect of the embodiment of the present application.

[0059] Another aspect of the embodiments of the present application further provides an electronic device, including:

[0060] Memory, used to store computer programs;

[0061] The processor is used to implement any of the virtual character chat model training methods or dialogue text generation methods described in the embodiments of the present application when executing the program stored in the memory.

[0062] In another aspect of the implementation of the present application, a computer-readable storage medium is provided, in which a computer program is stored. When the computer program is executed by a processor, any of the virtual character chat model training methods or dialogue text generation methods described above is implemented.

[0063] In another aspect of the implementation of the present application, a computer program product comprising instructions is also provided, which, when executed on a computer, enables the computer to execute any of the virtual character chat model training methods or dialogue text generation methods described above.

[0064] The embodiments of the present application provide a virtual character chat model training method, device, electronic device and storage medium, which formulates a role generation instruction through the collected user attribute characteristics and non-player character attribute characteristics, and uses a pre-trained large language model to directly generate multiple characters that reflect the personality characteristics of the characters according to the role generation instruction, so as to obtain a user character set and a non-player character set; and then the pre-trained large language model generates dialogue samples corresponding to each role interaction pair for the combined multiple role interaction pairs, thereby obtaining a training sample for the virtual character chat model. By using the method of the embodiments of the present application, user characters and non-player characters that reflect the user attribute characteristics and non-player character attribute characteristics can be directly generated through a pre-trained large language model, and dialogue samples can be directly generated for the role interaction pairs composed of user characters and non-player characters by the pre-trained large language model, thereby avoiding screening or adapting from a large number of literary and artistic works, thereby simplifying the method of obtaining dialogue samples and reducing labor costs. BRIEF DESCRIPTION OF THE DRAWINGS

[0065] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art are briefly introduced below.

[0066] Figure 1 A schematic diagram of a first flow chart of a virtual character chat model training method provided in an embodiment of the present application;

[0067] Figure 2 A second flow chart of the virtual character chat model training method provided in an embodiment of the present application;

[0068] Figure 3 A third flow chart of the virtual character chat model training method provided in an embodiment of the present application;

[0069] Figure 4 A fourth flow chart of the virtual character chat model training method provided in an embodiment of the present application;

[0070] Figure 5 A schematic diagram of a flow chart for detecting the degree of fit of the content of a conversation sample provided in an embodiment of the present application;

[0071] Figure 6 A flowchart of the first case of the virtual character chat model training method provided in an embodiment of the present application;

[0072] Figure 7 A schematic diagram of a first situation of a virtual character chatting provided in an embodiment of the present application;

[0073] Figure 8 A flowchart of the second case of the virtual character chat model training method provided in an embodiment of the present application;

[0074] Fig. 9 A schematic diagram of a second situation of a virtual character chatting provided in an embodiment of the present application;

[0075] Fig.10 A flowchart of a method for generating a dialogue text provided in an embodiment of the present application;

[0076] Fig.11 A structural schematic diagram of a virtual character chat model training device provided in an embodiment of the present application;

[0077] Fig.12 A schematic diagram of the structure of a conversation text generation device provided in an embodiment of the present application;

[0078] Fig.13 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0079] The technical solutions in the embodiments of the present application will be described below in conjunction with the drawings in the embodiments of the present application.

[0080] In the context of the digital age, people's pursuit of emotional communication and personalized experience is increasing, especially on online social platforms, where users' need for companionship has always occupied an important position. Traditionally, various chatbots have emerged to try to fill this gap, but due to the limitations of algorithms and technology, the freedom and realism of these robots' conversations are often unsatisfactory, and they are unable to truly understand and respond to users' complex emotions and deep-seated needs. This deficiency mainly stems from two points: first, the immaturity of natural language processing technology, which leads to limited robot understanding ability; second, there is a lack of high-quality and diverse training data to improve the naturalness of the robot's responses and situational adaptability.

[0081] With the rise of large-scale language models, AI has made breakthrough progress in natural language generation and understanding, which has promoted the development of innovative applications such as AI NPCs. These AI NPCs can not only show higher flexibility and realism in daily conversations, but also initially realize the perception and response of user emotions, greatly enriching the user experience. Especially in the fields of games, virtual communities and psychological counseling, users are increasingly eager for highly personalized and deeply immersive interactive experiences.

[0082] However, even with the strong support of LLM, existing chatbot scenarios still face challenges, especially when dealing with complex and changeable plot copies. Such scenarios require robots to not only have superb language skills, but also understand the plot context and actively promote dialogue without always relying on user guidance. In addition, users' expectations of creating and participating in their own designed story lines and role-playing with NPCs customized completely according to their personal preferences are still far from being met by current technology. The reason behind this is that it is difficult to develop a system that supports custom plots and NPCs. NPCs need to generate highly intelligent content and have deep understanding capabilities. In related technologies, people can only generate relevant dialogue samples for training through difficult screening and adaptation from a large number of literary works such as novels and movie scripts. Therefore, how to efficiently collect, organize and use user-specific preference data for NPC training is a problem that needs to be solved by current technology.

[0083] In order to solve at least one of the above problems, the first aspect of the embodiment of the present application provides a virtual character chat model training method, the method comprising: Figure 1 Steps shown:

[0084] Step S101: Obtaining user attribute characteristics and non-player character attribute characteristics.

[0085] In the embodiment of the present application, the user may be the user who actually logs into the game or related application software, or may be the player character controlled by the user in the game. Attribute characteristics refer to characteristics that can determine the individuality of the character. For example, the attribute characteristics may include the character's name, age, social role, personality characteristics, family background, and other dimensions that represent the attribute characteristics of the user or non-player character's personality and background. In practical applications, the attribute characteristics can determine the attribute characteristics of the dimensions that need to be paid attention to based on the actual needs of making NPCs. For example, the user attribute characteristics and non-player character attribute characteristics obtained include the character's name, age, social role, and personality characteristics. It should be noted that each user character and non-player character contains a unique personality and background, that is, the user attributes of each user character are not exactly the same, and the non-player character attribute characteristics of the non-player character are not exactly the same.

[0086] In one example, when a user is actually logging into a game or a related chat application, the server or client may first classify the user who has logged into the client, and classify the user according to the attribute feature information input by the user. For example, according to the personality characteristics input by the user, the user may be classified into a set of users with the same personality characteristics. In this set of users, all users have the same personality characteristics, and the same algorithm may be used to generate related conversations for them.

[0087] Step S102: Generate a character generation instruction according to the user attribute characteristics and the non-player character attribute characteristics.

[0088] The character generation instruction is a language instruction that can be recognized by the large language model. For example, the character generation instruction is a prompt statement used to guide the large language model to create a character. The prompt is a text or instruction pointing to the input of the large language model, which can be a question, a description, a task description, or a part of a conversation record. In the embodiment of the present application, the acquired user attribute features and attribute features of non-player characters can be summarized to generate a character generation instruction.

[0089] In one example, the character generation instruction is a task description. For example, the task description is: "You are a scriptwriter. Now you are given a story outline and a character biography. You need to summarize or invent relevant information of the character corresponding to the character biography, including name, gender, age, relationship status, occupation, skills, world knowledge, hobbies, major experiences, character relationships, personality traits, catchphrases, habitual actions and classic lines, etc. Output in json (JavaScript Object Notation, a lightweight data exchange format), the key is Chinese, and only outputs one character's information. #Story outline {story_text}#Character biography {person_text}#Character information". The task description is input into the large language model, and the large language model can generate character information that meets the requirements based on the input content. The character information is the created character.

[0090] In practical applications, explanations or requirements can also be added to the prompt statement so that the large language model can better output characters that meet the requirements. For example, the following description is added to the above prompt statement: 1. Style characteristics refer to the character's personality and speaking characteristics. They should be as dramatic as possible and described in 2 to 4 phrases. Personality characteristics include vigorous and resolute, dull and shy, and speaking characteristics include literary, rude, stuttering, etc. 2. Occupation can be a formal job or a core identity in the story, such as a student, a concubine, a knight, etc. 3. Skills can include specialties and skills, and there can be multiple values. 4. World knowledge: If the rules of the world in which the character lives are inconsistent with reality, it is necessary to list several background knowledge of the world in which it lives, with no limit on the number. 5. Character relationships include the relationship between the character and some other characters, the identities of other characters, and some experiences of the character and other characters.

[0091] Step S103: input the character generation instruction into a pre-trained large language model to obtain a user character set and a non-player character set respectively.

[0092] The user role set includes multiple user roles, and the personalities and backgrounds of different user roles are not completely the same. The non-player role set includes multiple non-player roles, and the personalities and backgrounds of different non-player roles are not completely the same. In the embodiment of the present application, personality refers to the personality characteristics of the user role or non-player role, and background refers to the social background and family background of the user role or non-player role, such as social role, family relationship, etc. In the large language model, personality and background can be expressed by attribute features, so the user attribute features of different user roles are not completely the same, and the non-player role attribute features of different non-player roles are not completely the same.

[0093] In an embodiment of the present application, the large language model may be any large language model (LLM) in the relevant field, for example, it may be GPT-3 (Generative Pre-trained Transformer-3), GPT-4, ChatGLM (Generative Language Model), Wenxin Yiyan, Tongyi Qianwen, iFlytek Spark, etc.

[0094] In one example, the prompt sentence generated by the guiding character in step S102 can be input into the large language model LLM, and the large language model can create user characters and non-player characters with different personalities and backgrounds. Each character can be set with a different story outline or character biography to ensure the diversity of the generated characters, so that each user character and non-player character has a different personality or background.

[0095] After obtaining the user character set and the non-player character set, they can be stored in the server. The storage form can be stored in plain text or formatted, that is, using a database or formatted file to store according to "attribute feature dimensions" and "attribute feature values". In an example, there are two attribute feature dimensions for a character, namely name and gender. When stored in plain text, it can be stored as: "Name: XXX, Gender: XXX". There are many ways to format storage. Taking json format as an example, user characters or non-player characters can be stored as: {"name":"XXX","gender":"XXX"}.

[0096] Step S104: combining the user characters with the non-player characters to generate multiple groups of character interaction pairs.

[0097] The combination of user characters and non-player characters can be a random selection combination or a permutation combination to form a variety of role interaction pairs. In order to enhance the user experience, each user character can be combined with different non-player characters to form a role interaction pair, thereby ensuring that each user character can interact with each non-player character.

[0098] Step S105: using the large language model, respectively generate dialogue samples for each group of role interaction pairs.

[0099] In practical applications, prompt statements can also be used to guide the large language model to generate dialogues. In one example, for each group of role interaction pairs, a prompt statement to guide the characters to have a dialogue can be set based on the attribute characteristics of the user character and the non-player character in the role interaction pair, and the set prompt statement is input into the large language model to guide the large language model to generate dialogue samples for the group of role interaction pairs.

[0100] In addition, when generating dialogue samples, the large language model can also incorporate text describing narration, character actions, and task expressions, thereby enhancing the user's sense of immersion and involvement during subsequent user interactions. The dialogue samples with text describing narration, character actions, and task expressions can be input into the relevant action generation model, so that the relevant characters can perform relevant actions during the dialogue according to the text description in the dialogue sample.

[0101] In an example, the prompt statement guiding the user character and the non-player character can be: "Simulate the scene of the dialogue between the user user and the non-player character NPC, similar to a dialogue novel; the NPC information is: {info_json} The user's name is: USER The user's information is: {user_info} Their relationship is: user is NPC's {relation}".

[0102] Similarly, explanations or requirements can be added to the prompt statement. For example, if narration, action or psychological description is needed, the following requirements can be added to the prompt statement that guides the user character and the non-player character: "1. Use brackets to represent body movements, expressions or psychological activities. The brackets can be placed at the beginning, end or middle of the sentence. The content in the brackets needs to be diverse to avoid repeated words in a paragraph. 2. The output content of the NPC needs to conform to the attribute characteristics of the non-player character. 3. The output content of the NPC must contain rich scenes, actions and psychological descriptions. 5. The output content of the NPC must be sufficiently interesting and can attract the user to further dialogue. The speech cannot sound robotic. 6. The user's name should not appear in the dialogue, and words such as "user" and "NPC" should not appear."

[0103] The dialogue samples are training samples of the virtual character chat model. In practical applications, the dialogue samples generated by the large language model can also be screened, and the screened dialogue samples are selected to train the virtual character chat model to obtain the trained virtual character chat model. The virtual character chat model can be a variety of language generation models, such as RNN (Recurrent Neural Network) language model, LSTM (Long Short-Term Memory) language model, GPT language model, etc.

[0104] The virtual character chat model is used to output text content that matches the NPC's personality and background based on the text input by the user, the attribute characteristics of the user character, and the attribute characteristics of the NPC character. During training, the dialogue sample content corresponding to the user character in the dialogue sample, the user attribute characteristics of the user character, and the non-player character attribute characteristics of the NPC that is talking to the user character need to be input into the virtual character chat model to obtain the NPC dialogue text output by the virtual character chat model. The NPC dialogue sample content in the dialogue sample is compared with the NPC dialogue text output by the virtual character chat model to calculate the loss value of the virtual character chat model. The model parameters of the virtual character chat model are adjusted according to the loss value until the loss value is less than the preset threshold, and the training of the virtual character chat model is completed.

[0105] By applying the method of the embodiment of the present application, dialogue samples that conform to the attribute characteristics of user characters and non-player characters can be directly generated through a large language model, avoiding manual screening or adaptation of literary works such as novels and scripts based on the attribute characteristics of user characters and non-player characters, thereby simplifying the method of obtaining dialogue samples and reducing labor costs.

[0106] In a possible implementation manner, after step S104, the method of the embodiment of the present application further includes: Figure 2 Steps shown:

[0107] Step S201: Obtain plot outline text.

[0108] The plot outline text refers to the narrative clues in the story environment where the user characters and non-player characters are located. The plot outline text can be determined according to the actual application. For example, in a game with a modern urban life background, the plot outline text can be set to unfold around urban life; in another example, in a suspense and reasoning related software, the plot outline text can be set to unfold based on a certain case.

[0109] When obtaining the plot outline text, the narrative clues can be directly described and input into the large language model, or the large language model can generate the plot outline text based on keywords. For example, according to the characteristics that the plot outline text needs to meet, a prompt sentence that guides the large language model to generate the plot outline text is formulated through keywords, and the prompt sentence is input into the large language model to guide the large language model to generate a plot outline text that meets the requirements. The keyword can be a certain emotion, an object, or a time word in the narrative clue.

[0110] Step S202: using the large language model, generate multiple plot texts for each group of role interaction pairs under the plot outline text.

[0111] When the large language model generates plot text, the large language model can also be guided to generate plot text according to the prompt sentence. For example, for each role interaction pair, according to the attribute characteristics of the user role and the non-player role, combined with the plot outline text, a prompt sentence for generating the plot text is constructed, and the prompt sentence is input into the large language model to generate a plot text that is consistent with the identity and personality characteristics of the user role and the non-player role in the group of role interaction pairs, and the plot text under the plot outline text.

[0112] Then step S105 may include the following steps:

[0113] Step S203: For any role interaction pair, the role interaction pair and multiple plot texts of the role interaction pair are input into the large language model to obtain a dialogue sample of the role interaction pair under the plot outline text.

[0114] When multiple plot texts are obtained, a description of the plot can be added when creating prompt statements to guide dialogue generation, so that the dialogue samples generated by the large language model are consistent with the attribute characteristics of the user role and non-player role, and are consistent with the development of the plot.

[0115] By applying the method of the embodiment of the present application, a large language model can be guided to construct multiple plot texts for each character interaction pair, so that when dialogue samples are subsequently generated, the generated dialogue samples can be made to conform to the attribute characteristics of the user role and the non-player role, and to conform to the development of the storyline, thereby improving the user experience.

[0116] In a possible implementation, step S202 may be implemented by the following steps: Figure 3 As shown:

[0117] Step S301: Create storyline generation instructions based on the plot outline text and the interaction pairs of each character.

[0118] Step S302: Input the plot generation instruction into the large language model to generate multiple plot texts for each group of role interaction pairs under the plot outline text.

[0119] In one example, for each role interaction pair, a prompt sentence guiding the generation of the plot text is constructed based on the attribute characteristics of the user role and the non-player role in the role interaction pair, as well as the plot outline text. The prompt sentence is input into the large language model, and the large language model generates multiple plot texts that conform to the attribute characteristics of the user role, the non-player role, and the plot outline text according to the prompt sentence.

[0120] In one example, the prompt sentence that guides the large language model to generate the plot text, that is, the plot generation instruction is: "Please refer to the following example and write a fan fiction about the character and the player. #Reference example##Character information{prepared example character information}##Fan fiction{prepared example novel title}##Novel beginning{prepared example novel beginning}##Character information{character information to be generated}#Output format##Fan fiction...##Novel beginning..."

[0121] Similarly, requirements for the plot text can also be added to the plot generation instruction. The following statement can be added to the above prompt statement: "#Task requirements Please write a character and player fan fiction and the corresponding novel beginning based on the character information below and the above sample. The requirements are as follows: 1) The scene of the story is different from the reference sample and is set in an ancient fictional background; 2) The novel plot is exciting, mainly based on dialogue, and the second person "you" is used to refer to the player; 3) The novel plot creates new scenes and events based on the settings of the original work."

[0122] By applying the method of the embodiment of the present application, a large language model can be guided to construct multiple plot texts for each character interaction pair, so that when dialogue samples are subsequently generated, the generated dialogue samples can be made to conform to the attribute characteristics of the user role and the non-player role, and to conform to the development of the storyline, thereby improving the user experience.

[0123] In a possible implementation, step S203 may be implemented by the following steps: Figure 4 As shown:

[0124] Step S401: setting dialogue triggering instructions according to each pair of role interaction pairs and the plot text corresponding to the role interaction pairs.

[0125] Step S402: Input the dialogue stimulation instruction into the large language model to generate dialogue samples for each pair of role interaction under the plot outline text.

[0126] After obtaining each pair of role interaction pairs and the corresponding storyline of the role interaction pair, compared with step S105, when formulating the prompt statement to guide the generation of dialogue, it is necessary to add the storyline description of the role interaction pair to guide the generation of dialogue samples of the role interaction pair under the plot outline text.

[0127] In one example, the dialogue triggering instruction can be the following exemplary prompt sentence: "Please generate a dialogue between the character and the player based on the following character and plot information. ##Character setting <character information> ##User information <user information> ##Plot information…##Beginning…##Output requirements 1. Output the character dialogue content. 2. The character's dialogue content needs to conform to the respective attribute characteristics in the character information, and the dialogue content must be coherent. 3. The user's name should not appear in the dialogue, nor should words such as "user" and "NPC" appear. " In this example, the character information refers to the non-player character attribute characteristics of the non-player character, and the user information refers to the user attribute characteristics of the user character.

[0128] By applying the method of the embodiment of the present application and setting dialogue stimulation instructions according to each role interaction pair and the corresponding storyline of the role interaction pair, the generated dialogue samples can be made to conform to the attribute characteristics of the user role and the non-player role, and to conform to the development of the storyline, thereby improving the user experience.

[0129] In a possible implementation, after step S105, the method of the embodiment of the present application may further include the following steps:

[0130] For each dialogue sample, determine whether the dialogue sample contains preset prohibited words, and if so, delete the dialogue sample.

[0131] In order to build a good interactive environment and improve the user experience, after the large language model generates a dialogue sample, the dialogue sample can be quality reviewed and purified. The review can be automated using a pre-trained deep learning model or manually conducted in a comprehensive manner. In one example, the dialogue sample can be reviewed by detecting whether it contains preset banned words. Preset banned words can be words that express inconsistent values, unfriendly content, etc. In actual applications, preset banned words can be customized according to actual needs.

[0132] By applying the method of the embodiment of the present application, by reviewing the dialogue samples generated by the large language model and deleting the dialogue samples containing preset banned words, uncivilized words can be avoided, a good interactive environment can be constructed, and the user experience can be improved.

[0133] In a possible implementation, the generated dialogue samples may also be tested for content consistency, such as Figure 5 As shown:

[0134] Step S501: For each conversation sample, input the first conversation sub-sample and the first user attribute feature into a pre-trained deep learning model to obtain a first discrimination result.

[0135] Among them, the first discrimination result represents the probability that the content of the first conversation subsample meets the first user attribute feature; the first conversation subsample is the conversation content belonging to the first user role in the conversation sample, and the first user attribute feature is the user attribute feature of the first user role.

[0136] Step S502: Input the second dialogue sub-sample and the first non-player character attribute feature into a pre-trained deep learning model to obtain a second discrimination result.

[0137] Among them, the second discrimination result represents the probability that the content of the second dialogue subsample meets the first non-player character attribute feature; the second dialogue subsample is the dialogue content belonging to the first non-player character in the dialogue sample, and the first non-player character attribute feature is the non-player character attribute feature of the first non-player character.

[0138] Step S503: Determine whether the first discrimination result is greater than or equal to the first preset threshold and whether the second discrimination result is greater than or equal to the second preset threshold; if not, delete the conversation sample.

[0139] In practical applications, step S501 and step S502 can be performed simultaneously or sequentially. The deep learning model can be a deep learning model used for text quality review in the relevant technology. When training the deep learning model, the deep learning model outputs the probability that the content of the first dialogue subsample meets the user attribute characteristics of the first user character or the probability that the content of the second dialogue subsample meets the non-player character attribute characteristics of the first non-player character. The result of the manual review is taken as the true value, compared with the probability of the deep learning model, and the loss value of the deep learning model is calculated. The parameters of the deep learning model are adjusted according to the loss value to realize the training of the deep learning model.

[0140] In addition, the text quality review software or manual review and judgment can also be used. For example, the first dialogue subsample or the second dialogue subsample is reviewed by intelligent text review software. In addition to reviewing whether the content of the dialogue sample is consistent with the personality and background of the user character and the non-player character, the content of the dialogue sample can also be reviewed to see whether it is consistent with the storyline of the character interaction pair, so as to avoid dialogues between the user character or the non-player character that do not conform to the character setting or the plot setting.

[0141] By applying the method of the embodiment of the present application, dialogue samples generated by the large language model are reviewed and dialogue samples that do not conform to the personality and background of the user role and non-player character are deleted, thereby avoiding dialogues that do not conform to the character settings or plot settings and improving the user experience.

[0142] The following example is used to specifically illustrate the method of the embodiment of the present application. Figure 6 The flowchart shown is a first case of the virtual character chat model training method provided by the embodiment of the present application. This case can be applicable to the case where the user and the non-player character only have a dialogue, for example, it can be a guide page dialogue when the user enters a game, or it can be a dialogue generated when the user makes a selection, etc. Figure 7 As shown, the user character can interact with the NPC through options.

[0143] In this example, first, according to the user-defined attribute requirements and the NPC-defined attribute requirements, the character generation instructions are formulated, and the LLM generates user data and NPC data. Among them, NPC is a non-player character, and the customized attribute requirements are attribute characteristics. LLM generates user data to generate user characters, and LLM generates NPC data to generate non-player characters.

[0144] Then select the user character and the non-player character to generate a role interaction pair, make a dialogue stimulation instruction based on the role interaction pair, input the dialogue stimulation instruction into the LLM, and guide the LLM to generate a dialogue that meets the requirements, wherein meeting the requirements means meeting the attribute requirements of the user character and the non-player character in the role interaction pair.

[0145] Secondly, the generated dialogue samples are cleaned. That is, a variety of strategies including manual review, semi-automated tools and fully automated processes are used to conduct comprehensive quality control and purification of the generated dialogue samples, eliminate dialogue samples that do not meet logic or quality standards, and perform detailed labeling and cleaning to ensure the quality of the dialogue samples and the pertinence to the role interactions.

[0146] Finally, through advanced machine learning technology, the screened conversation samples are input into the virtual character chat model for training, and the NPC role-playing chat is trained until an NPC chat algorithm and virtual character chat model are trained that can accurately match the needs of specific roles.

[0147] By using the method of the embodiment of the present application, a large language model can be used to directly generate dialogue samples that conform to the attribute characteristics of user characters and non-player characters, thereby avoiding the manual screening or adaptation of literary works such as novels and scripts based on the attribute characteristics of user characters and non-player characters, thereby simplifying the method of obtaining dialogue samples, lowering the threshold for dialogue sample collection, speeding up the efficiency of dialogue sample collection, and reducing the labor cost of dialogue sample collection. When the attribute characteristics or number of user characters or non-player characters are changed, the large language model can be directly used for change iteration, and dialogue samples that conform to user characters and non-player characters can be quickly generated to train the virtual character chat model and improve the applicability of the virtual character chat model to users.

[0148] Figure 8 FIG. 1 is a flowchart of a second case of a virtual character chat model training method provided in an embodiment of the present application. This case can be applied to a case where a user and a non-player character have a conversation in a certain story background, such as Fig. 9 As shown, the user character and the non-player character have a dialogue in the context of a certain story.

[0149] compared to Figure 6 , Figure 8 The virtual character chat model training method shown in the figure adds the operation of generating plots when generating dialogues. After LLM generates user data and NPC data respectively according to the user-defined attribute requirements and the NPC-defined attribute requirements, LLM can also be guided to generate plot outline text according to the plot requirements. Then, for each character interaction pair and story plot, a plot generation instruction is formulated to guide LLM to generate a plot that meets the requirements, where meeting the requirements means meeting the attribute requirements of the user character and the non-player character in the character interaction pair, and meeting the story plot of the plot outline text.

[0150] According to each character interaction pair and the corresponding storyline of each character interaction pair, dialogue stimulation instructions are formulated to guide LLM to generate dialogues that meet the requirements, and the generated sample dialogues are cleaned. The screened dialogue samples are input into the virtual character chat model for training, and NPC role-playing chat is trained until an NPC chat algorithm and virtual character chat model are trained that can accurately match specific role requirements and specific plot requirements.

[0151] By applying the method of the embodiment of the present application, dialogue samples that conform to the attribute characteristics of user characters and non-player characters can be directly generated through a large language model, avoiding manual screening or adaptation of literary works such as novels and scripts based on the attribute characteristics of user characters and non-player characters, thereby simplifying the method of obtaining dialogue samples, lowering the threshold for collecting dialogue samples, speeding up the efficiency of collecting dialogue samples, and reducing the labor cost of collecting dialogue samples.

[0152] A second aspect of the embodiment of the present application provides a method for generating a dialogue text, which is applied to a business server. In addition, when the client meets the requirements for data storage and processing, the method of the embodiment of the present application can also be applied to the client. The method includes the following steps: Fig.10 Steps shown:

[0153] Step S1001: receiving a user dialogue instruction input by a client.

[0154] The user dialogue instruction includes a user dialogue text, a second user character corresponding to the client, and a second non-player character that dialogues with the second user character. The user dialogue text is the text content input by the user when the user controls the character to interact with the NPC. The character controlled by the user is the second user character, and the NPC that interacts with the user is the second non-player character.

[0155] Step S1002: According to the second user character and the second non-player character, a second user attribute feature of the second user character and a second non-player character attribute feature of the second non-player character are obtained.

[0156] In actual applications, the user roles and user attribute characteristics, the non-player roles and non-player role attribute characteristics are stored in the service server, and the service server can search for the second user attribute characteristics of the second user role and the second non-player role attribute characteristics of the second non-player role according to the second user role and the second non-player role. In an example, the second user attribute characteristics and the second non-player role attribute characteristics are searched according to the names of the second user role and the second non-player role.

[0157] Step S1003: input the user dialogue text, the second user attribute feature and the second non-player character attribute feature into the trained virtual character chat model to obtain the dialogue text of the second non-player character.

[0158] The trained virtual character chat model is obtained by training through any method of the first aspect of the embodiment of the present application. By applying the method of the embodiment of the present application, a dialogue text that conforms to the personality and background of the second non-player character can be obtained through the trained virtual character chat model, making the NPC more realistic in interaction and improving the user experience during the chat.

[0159] In a third aspect of the embodiments of the present application, a virtual character chat model training device is provided, the device comprising: Fig.11 The structure shown:

[0160] The attribute feature acquisition module 1101 is used to acquire user attribute features and non-player character attribute features.

[0161] The role generation instruction making module 1102 is used to generate a role generation instruction according to the user attribute characteristics and the non-player character attribute characteristics.

[0162] The role generation module 1103 is used to input the role generation instruction into the pre-trained large language model to obtain a user role set and a non-player role set respectively; wherein the user role set includes multiple user roles, and the user attribute characteristics of different user roles are not completely the same; the non-player role set includes multiple non-player roles, and the non-player role attribute characteristics of different non-player roles are not completely the same.

[0163] The role combination module 1104 is used to combine the user role with the non-player role to generate multiple groups of role interaction pairs.

[0164] The dialogue sample generation module 1105 is used to generate dialogue samples for each group of role interaction pairs using a large language model, wherein the dialogue samples are training samples for the virtual role chat model.

[0165] By using the device of the embodiment of the present application, it is possible to directly generate dialogue samples that conform to the attribute characteristics of the user character and the non-player character through a large language model, thereby avoiding manual screening or adaptation of literary works such as novels and scripts based on the attribute characteristics of the user character and the non-player character, thereby simplifying the method of obtaining dialogue samples and reducing labor costs.

[0166] In a possible implementation manner, the device of the embodiment of the present application may further include:

[0167] The plot outline text acquisition module is used to obtain the plot outline text.

[0168] The storyline generation module is used to use the large language model to generate multiple storyline texts for each group of role interaction pairs under the storyline outline text.

[0169] The dialogue sample generation module includes a dialogue sample generation submodule.

[0170] The dialogue sample generation submodule is specifically used to input any role interaction pair and multiple plot texts of the role interaction pair into the large language model to obtain the dialogue sample of the role interaction pair under the plot outline text.

[0171] By using the device of the embodiment of the present application, a large language model can be guided to construct multiple plot texts for each character interaction pair, so that when dialogue samples are subsequently generated, the generated dialogue samples can be made to conform to the attribute characteristics of the user role and the non-player role, and conform to the development of the storyline, thereby improving the user experience.

[0172] In a possible implementation, the storyline generation module includes:

[0173] The storyline generation instruction production submodule is specifically used to produce storyline generation instructions based on the plot outline text and the interaction pairs of each character.

[0174] The storyline generation submodule is specifically used to input the storyline generation instruction into the large language model, and generate multiple storyline texts for each group of role interaction pairs under the storyline outline text.

[0175] By using the device of the embodiment of the present application, a large language model can be guided to construct multiple plot texts for each character interaction pair, so that when dialogue samples are subsequently generated, the generated dialogue samples can be made to conform to the attribute characteristics of the user role and the non-player role, and conform to the development of the storyline, thereby improving the user experience.

[0176] In a possible implementation, the dialogue sample generation submodule includes:

[0177] The dialogue stimulating instruction production unit is specifically used to set the dialogue stimulating instructions according to each pair of role interaction and the plot text corresponding to the role interaction pair.

[0178] The dialogue sample generation unit is specifically used to input the dialogue stimulation instructions into the large language model to generate dialogue samples for each pair of role interaction under the plot outline text.

[0179] By applying the device of the embodiment of the present application and setting dialogue stimulation instructions according to each role interaction pair and the plot text corresponding to the role interaction pair, the generated dialogue samples can be made to conform to the attribute characteristics of the user role and the non-player role, and to the development of the storyline, thereby improving the user experience.

[0180] In a possible implementation manner, the device of the embodiment of the present application may further include:

[0181] The dialogue sample quality review module is used to determine whether each dialogue sample contains preset banned words. If so, the dialogue sample is deleted.

[0182] In a possible implementation manner, the device of the embodiment of the present application further includes:

[0183] The first content fit detection module is used to input the first conversation sub-sample and the first user attribute feature into a pre-trained deep learning model for each conversation sample to obtain a first discrimination result; wherein the first discrimination result represents the probability that the content of the first conversation sub-sample meets the first user attribute feature; the first conversation sub-sample is the conversation content belonging to the first user role in the conversation sample, and the first user attribute feature is the user attribute feature of the first user role.

[0184] The second content fit detection module is used to input the second dialogue sub-sample and the first non-player character attribute feature into a pre-trained deep learning model to obtain a second discrimination result; wherein the second discrimination result represents the probability that the content of the second dialogue sub-sample conforms to the first non-player character attribute feature; the second dialogue sub-sample is the dialogue content belonging to the first non-player character in the dialogue sample, and the first non-player character attribute feature is the non-player character attribute feature of the first non-player character.

[0185] The dialogue sample logic review module is used to determine whether the first discrimination result is greater than or equal to the first preset threshold and whether the second discrimination result is greater than or equal to the second preset threshold. If not, the dialogue sample is deleted.

[0186] By applying the device of the embodiment of the present application, by reviewing the dialogue samples generated by the large language model, the dialogue samples containing preset banned words and those that do not conform to the personality and background of the user character and the non-player character are deleted, thereby avoiding the occurrence of dialogues that do not conform to the character settings or plot settings, and improving the user experience.

[0187] In a fourth aspect of the embodiments of the present application, a conversation text generation device is provided, which is applied to a business server. The device includes: Fig.12 The structure shown:

[0188] The user dialogue instruction receiving module 1201 is used to receive a user dialogue instruction input by a client; wherein the user dialogue instruction includes a user dialogue text, a second user character corresponding to the client, and a second non-player character that dialogues with the second user character.

[0189] The character attribute feature acquisition module 1202 is used to acquire a second user attribute feature of the second user character and a second non-player character attribute feature of the second non-player character according to the second user character and the second non-player character.

[0190] The dialogue text generation module 1203 is used to input the user dialogue text, the second user attribute characteristics and the second non-player character attribute characteristics into the trained virtual character chat model to obtain the dialogue text of the second non-player character, wherein the trained virtual character chat model is trained by any method described in the first aspect of the embodiment of the present application.

[0191] By applying the device of the embodiment of the present application, a dialogue text that conforms to the personality and background of the second non-player character can be obtained through a trained virtual character chat model, making the NPC more realistic in interaction and improving the user experience during the chat.

[0192] The present application also provides an electronic device, such as Fig.13As shown, it includes a processor 1301, a communication interface 1302, a memory 1303 and a communication bus 1304, wherein the processor 1301, the communication interface 1302, and the memory 1303 communicate with each other through the communication bus 1304.

[0193] Memory 1303, used for storing computer programs;

[0194] The processor 1301 is used to implement the following steps when executing the program stored in the memory 1303:

[0195] Obtaining user attribute characteristics and non-player character attribute characteristics;

[0196] Generate a character generation instruction according to the user attribute characteristics and the non-player character attribute characteristics;

[0197] Inputting the character generation instruction into a pre-trained large language model, respectively obtaining a user character set and a non-player character set; wherein the user character set includes multiple user characters, and user attribute characteristics of different user characters are not completely the same; the non-player character set includes multiple non-player characters, and non-player character attribute characteristics of different non-player characters are not completely the same;

[0198] Combine user characters with non-player characters to generate multiple sets of character interaction pairs;

[0199] Using the large language model, dialogue samples of each group of role interaction pairs are generated respectively; wherein the dialogue samples are training samples of the virtual role chat model.

[0200] or,

[0201] Receiving a user dialogue instruction input by a client; wherein the user dialogue instruction includes a user dialogue text, a second user character corresponding to the client, and a second non-player character that dialogues with the second user character;

[0202] According to the second user character and the second non-player character, obtaining a second user attribute feature of the second user character and a second non-player character attribute feature of the second non-player character;

[0203] The user dialogue text, the second user attribute feature and the second non-player character attribute feature are input into the trained virtual character chat model to obtain the dialogue text of the second non-player character, wherein the trained virtual character chat model is trained by any method of the first aspect of the embodiment of the present application.

[0204] The communication bus mentioned in the above terminal can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.

[0205] The communication interface is used for communication between the above terminal and other devices.

[0206] The memory may include a random access memory (RAM) or a non-volatile memory, such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.

[0207] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.

[0208] In another embodiment provided in the present application, a computer-readable storage medium is also provided, in which a computer program is stored. When the computer program is executed by a processor, the virtual character chat model training method or dialogue text generation method described in any of the above embodiments is implemented.

[0209] In another embodiment provided in the present application, a computer program product comprising instructions is also provided, which, when executed on a computer, enables the computer to execute the virtual character chat model training method or dialogue text generation method described in any of the above embodiments.

[0210] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be transmitted from a website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium may be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive Solid State Disk (SSD)), etc.

[0211] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.

[0212] Each embodiment in this specification is described in a related manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device, electronic device, and computer-readable storage medium embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiments.

[0213] The above description is only a preferred embodiment of the present application and is not intended to limit the protection scope of the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application are included in the protection scope of the present application.

Claims

1. A virtual character chat model training method, characterized in that: The method comprises: Obtaining user attribute characteristics and non-player character attribute characteristics; Generate a character generation instruction according to the user attribute characteristics and the non-player character attribute characteristics; Inputting the character generation instruction into a pre-trained large language model, respectively obtaining a user character set and a non-player character set; wherein the user character set includes a plurality of user characters, and the user attribute characteristics of different user characters are not completely the same; and the non-player character set includes a plurality of non-player characters, and the non-player character attribute characteristics of different non-player characters are not completely the same; Combining the user character with the non-player character to generate a plurality of sets of character interaction pairs; The large language model is used to generate dialogue samples for each group of the role interaction pairs; wherein the dialogue samples are training samples for the virtual role chat model.

2. The method according to claim 1, characterized in that After combining the user character with the non-player character to generate a plurality of sets of character interaction pairs, the method further includes: Get the plot synopsis text; Using the large language model, generating a plurality of plot texts under the plot outline text for each group of the role interaction pairs; The step of using the large language model to generate dialogue samples of each group of the role interaction pairs includes: For any role interaction pair, the role interaction pair and multiple plot texts of the role interaction pair are input into the large language model to obtain a dialogue sample of the role interaction pair under the plot outline text.

3. The method according to claim 2, characterized in that The using of the large language model to generate a plurality of plot texts under the plot outline text for each group of the role interaction pairs respectively includes: Produce storyline generation instructions based on the plot outline text and the character interaction pairs; The plot generation instruction is input into the large language model to generate a plurality of plot texts under the plot outline text for each group of the role interaction pairs.

4. The method according to claim 3, characterized in that For any role interaction pair, the role interaction pair and a plurality of plot texts of the role interaction pair are input into the large language model to obtain a dialogue sample of the role interaction pair under the plot outline text, including: According to each pair of the role interaction pairs and the plot text corresponding to the role interaction pairs, a dialogue triggering instruction is set, The dialogue stimulating instruction is input into the large language model to generate a dialogue sample under the plot outline text for each pair of the role interaction pairs.

5. The method according to claim 1, characterized in that After respectively generating the dialogue samples of each group of the role interaction pairs using the large language model, the method further includes: For each dialogue sample, determine whether the dialogue sample contains preset prohibited words, and if so, delete the dialogue sample.

6. The method according to claim 1, characterized in that After respectively generating the dialogue samples of each group of the role interaction pairs using the large language model, the method further includes: For each conversation sample, the first conversation subsample and the first user attribute feature are input into a pre-trained deep learning model to obtain a first discrimination result; wherein the first discrimination result indicates the probability that the content of the first conversation subsample meets the first user attribute feature; the first conversation subsample is the conversation content belonging to the first user role in the conversation sample, and the first user attribute feature is the user attribute feature of the first user role; Inputting the second dialogue subsample and the first non-player character attribute feature into the pre-trained deep learning model to obtain a second discrimination result; wherein the second discrimination result indicates the probability that the content of the second dialogue subsample conforms to the first non-player character attribute feature; the second dialogue subsample is the dialogue content belonging to the first non-player character in the dialogue sample, and the first non-player character attribute feature is the non-player character attribute feature of the first non-player character; It is determined whether the first discrimination result is greater than or equal to a first preset threshold and whether the second discrimination result is greater than or equal to a second preset threshold; if not, the conversation sample is deleted.

7. A method for generating a dialogue text, characterized in that: Applied to a business server, the method comprises: Receiving a user dialogue instruction input by a client; wherein the user dialogue instruction includes a user dialogue text, a second user character corresponding to the client, and a second non-player character that dialogues with the second user character; According to the second user character and the second non-player character, obtaining a second user attribute feature of the second user character and a second non-player character attribute feature of the second non-player character; The user dialogue text, the second user attribute feature and the second non-player character attribute feature are input into a trained virtual character chat model to obtain the dialogue text of the second non-player character, wherein the trained virtual character chat model is trained by any one of the methods described in claims 1-6.

8. A virtual character chat model training device, characterized in that: The device comprises: An attribute feature acquisition module, used to acquire user attribute features and non-player character attribute features; A role generation instruction making module, used for generating a role generation instruction according to the user attribute characteristics and the non-player character attribute characteristics; A role generation module, used for inputting the role generation instruction into a pre-trained large language model to obtain a user role set and a non-player role set respectively; wherein the user role set includes a plurality of user roles, and the user attribute characteristics of different user roles are not completely the same; the non-player role set includes a plurality of non-player roles, and the non-player role attribute characteristics of different non-player roles are not completely the same; A role combination module, used for combining the user role with the non-player role to generate multiple groups of role interaction pairs; The dialogue sample generation module is used to use the large language model to generate dialogue samples for each group of the role interaction pairs; wherein the dialogue samples are training samples for the virtual role chat model.

9. An electronic device, characterized in that: It includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; Memory, used to store computer programs; A processor, for implementing the method steps described in any one of claims 1 to 7 when executing a program stored in a memory.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method steps described in any one of claims 1 to 7 are implemented.

Citation Information

Patent Citations

  • Chat method based on virtual chat role and related device

    CN113987148A

  • Large language model building method and device for generating script content

    CN118153588A

  • Role playing dialogue data generation method and system and computer program product

    CN118403367A