Generation method and device of role playing model training data and related medium
By obtaining demand instructions, defining task categories, generating simulated dialogue data and correlating with environmental information systems, and using cognitive system adjustment processing, the problem of insufficient quality of role-playing model training data in the existing technology is solved, and high-quality data is generated and model performance is improved.
Patent Information
- Application Number
- CN202510433233.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-08
- Publication Date
- 2025-07-22
AI Technical Summary
The prior art is difficult to generate high-quality data that meets the training needs of role-playing models, especially in terms of personality traits, multi-round dialogue and multi-theme conversions, and privacy protection.
By obtaining requirements instructions, defining task categories, building task systems, generating simulated dialogue data and correlating it with the environmental information system, using the cognitive system for adjustment and processing, and finally generating high-quality role-playing model training data through the evaluation system.
The quality of the generated training data is significantly improved, meeting the training needs of role-playing models, avoiding personal privacy data leakage, and the model performance is better than that of models trained using open source data.
Smart Images

Figure CN120354131A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data processing, and particularly relates to a method, device, and related medium for generating training data for a role-playing model. Background Art
[0002] In recent years, the rapid development of large language models (LLMs) has enabled their widespread application in multiple fields. Among them, role-playing, as an important application scenario, has received high attention in the industry. To improve the performance of LLMs in role-playing scenarios, a large amount of high-quality training data is required for model fine-tuning and alignment. However, the quality of training data has always been one of the important factors restricting the development of LLMs. Although there are currently methods for obtaining training data, these methods are mainly oriented towards instruction tasks and are difficult to meet the specific needs of role-playing scenarios. Existing technologies are mainly designed for the characteristics of instruction tasks and lack comprehensive support for aspects such as personification features, multi-turn conversations, multi-topic transitions, and privacy protection, making it difficult to meet the training requirements of role-playing models.
[0003] Therefore, there is an urgent need for a new technical method to generate high-quality data suitable for training role-playing models, thereby making up for the deficiencies of existing technologies. Summary of the Invention
[0004] Embodiments of the present invention provide a method, device, and related medium for generating training data for a role-playing model, aiming to solve the problem that the existing training data acquisition methods are difficult to meet the training requirements of role-playing models.
[0005] In a first aspect, embodiments of the present invention provide a method for generating training data for a role-playing model, including:
[0006] Obtaining a requirement instruction for role-playing model training data;
[0007] Defining a task category according to the requirement instruction, and constructing a task system using the task category;
[0008] Generating simulated conversation data using the task system, and simultaneously generating an environmental information system according to the requirement instruction;
[0009] Performing data association on the environmental information system and the simulated conversation data to obtain associated simulated conversation data;
[0010] Performing cognitive adjustment processing on the associated simulated conversation data based on a pre-constructed cognitive system to obtain adjusted simulated conversation data;
[0011] Call the pre-built evaluation system to evaluate the quality of the adjusted simulated dialogue data, and generate the final role-playing model training data.
[0012] In a second aspect, an embodiment of the present invention provides a device for generating role-playing model training data, including:
[0013] A data acquisition unit, configured to acquire a requirement instruction for role-playing model training data;
[0014] A data definition unit, configured to define a task category according to the requirement instruction, and construct a task system by using the task category;
[0015] A data generation unit, configured to generate simulated dialogue data by using the task system, and simultaneously generate an environment information system according to the requirement instruction;
[0016] A data association unit, configured to perform data association on the environment information system and the simulated dialogue data to obtain the associated simulated dialogue data;
[0017] A data adjustment unit, configured to perform cognitive adjustment processing on the associated simulated dialogue data based on a pre-built cognitive system to obtain the adjusted simulated dialogue data;
[0018] A data evaluation unit, configured to call a pre-built evaluation system to evaluate the quality of the adjusted simulated dialogue data, and generate the final role-playing model training data.
[0019] In a third aspect, an embodiment of the present invention provides a computer device, including a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the computer program, the method for generating role-playing model training data in the first aspect is implemented.
[0020] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium. When the computer program is executed by a processor, the method for generating role-playing model training data in the first aspect is implemented.
[0021] An embodiment of the present invention provides a method for generating role-playing model training data, including obtaining a requirement instruction for role-playing model training data; defining a task category according to the requirement instruction, and constructing a task system by using the task category; generating simulated dialogue data by using the task system, and simultaneously generating an environment information system according to the requirement instruction; performing data association on the environment information system and the simulated dialogue data to obtain associated simulated dialogue data; performing cognitive adjustment processing on the associated simulated dialogue data based on a pre-constructed cognitive system to obtain adjusted simulated dialogue data; and calling a pre-constructed evaluation system to perform quality evaluation on the adjusted simulated dialogue data to generate final role-playing model training data. The present invention associates the environment information system with the simulated dialogue data, performs cognitive adjustment processing on the associated simulated dialogue data based on the cognitive system, and finally performs quality evaluation, thereby outputting the final role-playing model training data. In this way, the quality of the training data is improved, and the training requirements of the role-playing model can be met.
[0022] An embodiment of the present invention further provides a device, a computer device, and a storage medium for generating role-playing model training data, which also have the above beneficial effects. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following will briefly introduce the drawings required for the description of the embodiments. Obviously, the following drawings are some embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0024] Figure 1 It is a schematic flowchart of a method for generating role-playing model training data provided by an embodiment of the present invention;
[0025] Figure 2 It is a schematic system diagram of a method for generating role-playing model training data provided by an embodiment of the present invention;
[0026] Figure 3 It is a schematic block diagram of a device for generating role-playing model training data provided by an embodiment of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0027] The following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the drawings in the embodiments of the present invention. Obviously, the described embodiments are some, but not all, of the embodiments of the present invention. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts fall within the protection scope of the present invention.
[0028] It should be understood that when used in this specification and the appended claims, the terms "comprising" and "including" indicate the presence of the described features, wholes, steps, operations, elements, and / or components, but do not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components, and / or their combinations.
[0029] It should also be understood that the terms used in this specification of the present invention are merely for the purpose of describing specific embodiments and are not intended to limit the present invention. As used in this specification of the present invention and the appended claims, unless the context clearly indicates otherwise, the singular forms "a", "an", and "the" are intended to include the plural forms.
[0030] It should be further understood that the term "and / or" used in this specification of the present invention and the appended claims refers to any combination and all possible combinations of one or more of the associated listed items, and includes these combinations.
[0031] Please refer to the following Figure 1 , Figure 1 which is a schematic flowchart of a method for generating role-playing model training data provided for an embodiment of the present invention, specifically including: steps S101 to S106.
[0032] S101. Obtain a requirement instruction for role-playing model training data;
[0033] S102. Define a task category according to the requirement instruction, and construct a task system by using the task category;
[0034] S103. Generate simulated dialogue data by using the task system, and simultaneously generate an environment information system according to the requirement instruction;
[0035] S104. Perform data association on the environment information system and the simulated dialogue data to obtain the associated simulated dialogue data;
[0036] S105. Perform cognitive adjustment processing on the associated simulated dialogue data based on a pre-constructed cognitive system to obtain the adjusted simulated dialogue data;
[0037] S106. Invoke a pre-constructed evaluation system to perform quality evaluation on the adjusted simulated dialogue data to generate the final role-playing model training data.
[0038] Combined with Figure 2As shown, in step S101, through a requirement instruction input by the user or automatically generated by the system, the specific goal of the current task is clarified. For example, the requirement instruction can be "generate conversation data on the topic of weather" or "simulate an emotion soothing scenario in a multi-round chat". The content of the requirement instruction determines the subsequent task design and data generation process.
[0039] In one embodiment, before the step S101, it includes:
[0040] Input the task requirement and chat topic into the task retrieval module of the persona system respectively based on a pre-constructed persona system;
[0041] Use the task retrieval module to retrieve relevant persona information in the database of the persona system;
[0042] When the task retrieval module retrieves the persona information, directly return the retrieval result and use it as the requirement instruction;
[0043] When the task retrieval module fails to retrieve the persona information, call the automatic generation module of the persona system and use a large language model to generate the required persona information;
[0044] Store the persona information generated by the automatic generation module in the persona storage module of the persona system and use it as the requirement instruction.
[0045] In this embodiment, to further improve the generation efficiency and data quality of the role-playing model training data, an operation process based on the persona system is introduced before step S101. Specifically, it includes the following steps:
[0046] Step 1: Input the task requirement and chat topic into the task retrieval module of the persona system through user input or system pre-definition. For example, the task requirement can be "generate conversation data on aviation knowledge", and the chat topic can be "the structure and history of airplanes".
[0047] Step 2: The task retrieval module retrieves persona information related to the task requirement and chat topic in the database of the persona system through keyword matching and semantic analysis. The persona information includes the attributes, personality, occupation, etc. of the role. For example, for the topic of "the structure and history of airplanes", the retrieved persona information is "B is an aviation engineer, familiar with the structure of airplanes and good at explaining it in an easy-to-understand language".
[0048] Step 3: The task retrieval module determines whether there is persona information in the database that matches the task requirement and chat topic: If the persona information is retrieved, directly return the retrieval result and use it as the requirement instruction in step S101. For example, if the above-mentioned role information of the aviation engineer already exists in the database, directly return this persona.
[0049] Step 4: When the task retrieval module fails to retrieve matching persona information, the persona system's automatic generation module will call a large language model and utilize its generation ability to generate new persona information based on the input task requirements and chat topics. For example, when the input is "Generate conversation data about aviation knowledge", the large language model can output the following personas:
[0050] A: A curious young person, interested in the aviation field, often asking basic but interesting questions.
[0051] B: An experienced aviation engineer, patiently answering questions and good at sharing professional knowledge.
[0052] Step 5: The generated persona information is stored in the persona storage module of the persona system. The automatically generated character persona information will be stored in the persona storage module of the persona system for subsequent task retrieval and invocation. During the storage process, the system will label and index the persona information according to certain classification rules (such as domain, topic, personality traits, etc.) for quick retrieval.
[0053] Step 6: The retrieved or generated character persona information is converted into specific requirement instructions.
[0054] In step S102, according to the requirement instructions, the tasks are divided into different categories, such as perception tasks, cognitive tasks, security tasks, and multi-turn dialogue tasks. These task categories respectively correspond to specific dialogue goals. For example, perception tasks are for perceiving environmental information (such as time, date, weather, etc.), cognitive tasks are about knowledge-based and logical questions, security tasks are for testing the model's defense ability, and multi-turn dialogue tasks are about the coherence and topic switching ability of the dialogue. Based on the above task categories, a task system can be constructed.
[0055] In one embodiment, the step S102 includes:
[0056] Determine the task categories related to the task goal according to the requirement instructions; wherein, the task categories include perception tasks, cognitive tasks, security tasks, and multi-turn dialogue tasks;
[0057] Initialize the corresponding theme control module, method control module, and condition control module based on the task categories;
[0058] Use the theme control module to generate a theme range and generate a list of dialogue topics according to the theme range;
[0059] Transmit the list of dialogue topics to the method control module and configure dialogue data generation rules for each dialogue topic;
[0060] Set additional condition parameters in the condition control module based on the above-mentioned dialogue data generation rules to obtain the task system.
[0061] In this embodiment, according to the content of the requirement instruction, determine the task category related to the task objective. The task category is divided into the following four types:
[0062] Perception task: Focus on the model's perception ability of environmental information, such as topics like time, date, weather, etc.;
[0063] Cognition task: Test the knowledge and logic of the model, such as the solution of scientific knowledge, literary questions, etc.;
[0064] Security task: Evaluate the model's response ability in the face of malicious attacks, such as whether it can avoid sensitive topics in role-playing;
[0065] Multi-round dialogue task: Examine the model's dialogue coherence, topic switching ability, and memory ability in long dialogue scenarios;
[0066] For example, if the requirement instruction is "generate dialogue data on the topic of weather", then the task category is determined as a perception task. Based on the task category, initialize the three core modules of the task system, including: the topic control module, the method control module, and the condition control module. Specifically, the topic control module is used to generate the dialogue topic range related to the task, the method control module is used to define the specific rules and methods for generating dialogue data, and the condition control module is used to set additional conditions for generating dialogue data to ensure the diversity and authenticity of the data.
[0067] In the topic control module, generate the topic range according to the task category. For example, for a perception task, the topic range may include "weather conditions", "time period description", etc. Subsequently, the system creates a specific dialogue topic list using the generated topic range. The dialogue is completed by the cooperation of two large language models (actor model and robot model), for example:
[0068] Dialogue topic 1: Talk about weather conditions (sunny, rainy, cloudy).
[0069] Dialogue topic 2: Discuss the morning weather and activities.
[0070] Dialogue topic 3: Describe the evening weather and leisure activities.
[0071] The generated dialogue topic list will be passed to the method control module. In the method control module, configure specific dialogue data generation rules for each dialogue topic. For example:
[0072] Generation rules for dialogue topic 1: Randomly generate weather information (such as "Sunny, temperature 25°C"), and require the actor model to be able to describe weather characteristics, while the robot model provides supplementary information or raises doubts.
[0073] Generation rules for dialogue topic 2: Generate a dialogue in combination with time period information to ensure that the actor model can describe activity suggestions related to the weather according to a specific time point.
[0074] Generation rules for dialogue topic 3: Randomly insert irrelevant topics into the dialogue to test the dialogue coherence of the actor model.
[0075] Subsequently, based on the dialogue data generation rules, additional condition parameters are set in the condition control module. For example: Add a condition to dialogue topic 1, requiring the robot model to provide incorrect weather information in the dialogue to test the correction ability of the actor model. Add a condition to dialogue topic 2, introduce complex time information (such as lunar date, solar term) in the dialogue to test the time cognition ability of the actor model. Add a condition to dialogue topic 3, requiring the actor model to remember and recall the previous dialogue content in the dialogue.
[0076] After setting the additional condition parameters, the theme control module, method control module, and condition control module are combined to construct the final task system. The task system has the ability to flexibly define task categories, rich dialogue topic design capabilities, and powerful data generation rule control capabilities, providing high-quality dialogue data for subsequent steps.
[0077] In step S103, simulated conversations are carried out through two pre-constructed large language models (actor model and robot model). Among them, the actor model simulates the response behavior of the role-playing model, and the robot model simulates the questions and dialogue needs of real users. The task system controls the dialogue content according to the preset theme, for example, generating multi-round dialogue data about scenarios such as sunny days and rainy days in the weather topic. At the same time, to enhance the authenticity and diversity of the dialogue, an environmental information system is constructed. The environmental information system generates virtual environmental data, such as time, location, temperature, weather, wind speed, lunar calendar, etc.
[0078] In one embodiment, step S103 includes:
[0079] Generate the simulated dialogue data based on the dialogue data generation rules and additional condition parameters;
[0080] Generate environmental data associated with the simulated dialogue data according to the demand instruction; wherein, the environmental data includes virtual time data, location data, and weather data;
[0081] Integrate the virtual time data, location data, and weather data respectively to obtain the environmental information system.
[0082] In this embodiment, based on the dialogue data generation rules and additional condition parameters, the task system is used to generate simulated dialogue data. The task system simulates the dialogue between the user and the role-playing model by the interaction of two large language models (actor model and robot model) according to the set dialogue topic and dialogue data generation rules. For example, for the weather topic in the perception task, the dialogue data generation rule can require the robot model to ask weather-related questions and insert error information to test the correction ability of the actor model. When generating the dialogue, the additional condition parameters ensure the diversity and pertinence of the dialogue. For example, it can be required that the robot model suddenly switches topics during the dialogue to test the coherence and adaptability of the actor model. Of course, the dialogue data generation rules and additional condition parameters can also be set to be empty, allowing the dialogue between the actor model and the robot model to play freely within the set topic range, that is, not restricted by the dialogue data generation rules and additional condition parameters.
[0083] After the simulated dialogue data is generated, environmental data associated with the dialogue is created according to the content of the demand instruction. The environmental data includes virtual time data, location data, and weather data, aiming to provide a sense of reality and context relevance for the dialogue. The time data can randomly generate dates and times, and the generated time data will be further parsed into refined information such as day of the week, season, solar term, and whether it is a holiday. The location data can randomly select specific locations and be accurate to the city level. The weather data can generate corresponding virtual weather information based on the time and location. To ensure data diversity, the weather data does not directly query the real weather, but generates virtual weather information by crawling and recombining historical weather data.
[0084] The respectively generated time data, location data, and weather data will be processed in the integration module to construct a complete environmental information system. The integration process includes the following steps:
[0085] Match the generated date with the specific time, such as "XX year XX month XX day, 10:00 am, Thursday, winter, the 29th day of the twelfth lunar month";
[0086] According to the generated location information, associate it with the time data, such as "XX city, XX year XX month XX day 10:00 am";
[0087] Combine the time and location to generate a complete weather description, such as "XX city, XX year XX month XX day 10:00 am, light rain, temperature 15°C, wind speed 5 km / h".
[0088] In step S104, the generated environmental information system is matched with the simulated dialogue data. For example, in a conversation about the weather topic, virtual environmental information such as "light rain in XX City" is embedded in the conversation to make the conversation content more consistent with the environmental background. The associated simulated dialogue data not only has enhanced logic but also better meets the actual scenario requirements.
[0089] In one embodiment, step S104 includes:
[0090] Extract environmental data from the environmental information system based on the simulated dialogue data, and establish a mapping relationship between the environmental data and the simulated dialogue data;
[0091] Embed the environmental parameters into the corresponding simulated dialogue data based on the mapping relationship to expand the simulated dialogue content;
[0092] Perform consistency verification on the simulated dialogue content and output the verification result to obtain the associated simulated dialogue data.
[0093] In this embodiment, relevant environmental data is extracted from the environmental information system based on the context content of the simulated dialogue data. The environmental data includes information such as time, location, and weather. The extracted environmental data is established with a mapping relationship with the simulated dialogue data to ensure that each simulated dialogue content has corresponding environmental background information. The establishment of the mapping relationship is based on the matching of key parameters. After establishing the mapping relationship, the parameters in the environmental data are embedded into the corresponding simulated dialogue data to expand the dialogue content, making it more rich and close to the actual scenario. During the expansion process, the specific parameters and formats of the embedding can be adjusted according to needs to ensure that the dialogue content is natural and fluent and avoid information overload. For example, in the case of a long conversation scenario, only key environmental data such as time and weather can be embedded, while omitting specific location information.
[0094] Further, to ensure the logical consistency between the environmental data and the simulated dialogue content, consistency verification is performed on the expanded simulated dialogue data. The verification content includes:
[0095] Time consistency: Check whether the time mentioned in the conversation matches the environmental data. For example, if the conversation mentions "morning" but the time in the environmental data is "3 pm", it needs to be adjusted;
[0096] Location consistency: Verify whether the location information involved in the conversation is consistent with the environmental data. For example, if the conversation mentions "AA" but the location in the environmental data is "BB", it needs to be corrected;
[0097] Weather consistency: Check whether the weather description in the conversation matches the environmental data. For example, if the conversation mentions "sunny" but the environmental data is "light rain", the conversation content or the weather data needs to be adjusted;
[0098] The verification process is completed through an automated algorithm combined with manual review. The automated verification mainly relies on semantic matching and rule verification to mark contradictory content. Manual review further confirms complex or ambiguous scenarios to ensure the accuracy of the final verification result. After completing the consistency verification, the system outputs the verification result. The data that passes the verification is marked as "association completed", while the data that fails is returned to the environmental information and dialogue generation module for adjustment until it passes the verification.
[0099] In step S105, the associated simulated dialogue data is further processed by the cognitive system. Through cognitive adjustment, the generated dialogue data better meets the actual dialogue needs, thereby enhancing the logic, authenticity, and diversity of the data.
[0100] In one embodiment, step S105 includes:
[0101] Analyze the associated simulated dialogue data using the intent recognition module in the cognitive system and extract user intent data;
[0102] Call the tool module in the cognitive system to enhance the response to the user intent data and obtain a dialogue output result;
[0103] Store the dialogue output result using the memory module in the cognitive system to obtain a memory storage result;
[0104] Perform multi-round dialogue adjustment on the associated simulated dialogue data according to the memory storage result to obtain the adjusted simulated dialogue data.
[0105] In this embodiment, use the intent recognition module in the cognitive system to perform semantic analysis on the associated simulated dialogue data to identify the specific intent of the robot model in the dialogue. The intent recognition module extracts the user's intent information from the dialogue data through semantic parsing, sentiment analysis, and context reasoning, such as the question type, sentiment state, or target requirement. According to the analysis result of the intent recognition module, call the tool module in the cognitive system to generate an enhanced response. The tool module contains various functional components, such as RAG (retrieval-augmented generation) tools, mathematical tools, empathy tools, etc., for processing different types of user intents.
[0106] Specifically, for scientific questions (such as the cause of weather), call the RAG tool to retrieve the relevant knowledge database and generate a scientific and reasonable explanation:
[0107] Robot: Why is it raining today?
[0108] Actor (Invoking RAG tool to generate): It's raining today because a low-pressure system caused by cold air has formed precipitation. As the moist air rises, it cools and condenses, eventually forming rainfall.
[0109] For emotional needs (such as mood soothing), invoke the empathy tool to generate a comforting response:
[0110] Robot: It's raining today. I'm so annoyed!
[0111] Actor (Invoking the empathy tool to generate): Rain can indeed affect one's mood, but perhaps this is exactly a good opportunity to make a cup of hot tea and relax yourself.
[0112] Store the generated dialogue output results to support the context memory ability in long conversation scenarios. The memory module stores the dialogue content as short-term memory or long-term memory:
[0113] Short-term memory: Save the context information of the current dialogue, such as the continuous interaction content between the robot and the actor. Short-term memory is used for quickly retrieving information that may need to be recalled in the current conversation.
[0114] Long-term memory: Store dialogue content that is of great significance or frequently appears, such as user preferences, habitual topics, etc. Long-term memory supports the reference of historical information in future conversations.
[0115] Utilize the storage results of the memory module to adjust the context content in multi-turn conversations to ensure the logic and consistency of the conversations. Multi-turn conversation adjustment includes the following aspects:
[0116] Context coherence: Combine short-term memory to ensure that the conversation can correctly reference previous content. For example:
[0117] Robot (Round 1): Does bad weather affect flying?
[0118] Actor (Round 1): Yes, strong winds and thunderstorm weather may cause flight delays.
[0119] Robot (Round 5): Does strong wind weather really cause flight delays?
[0120] Multi-turn conversation adjustment will reference the answer in Round 1 to ensure that the conversation in Round 5 can respond correctly.
[0121] Historical information integration: Combine long-term memory to supplement conversations related to historical events or preferences. For example:
[0122] Robot (Round 1): I like sunny days.
[0123] Robot (Round 10): The weather has been bad lately. I really miss sunny days!
[0124] The Actor model can utilize long-term memory to extract user preferences and generate responses that are more in line with user needs.
[0125] Through multi-round dialogue adjustment, finally generate adjusted simulated dialogue data to ensure the logic, coherence, and context relevance of the data.
[0126] In step S106, use the pre-built evaluation system to conduct quality inspection on the adjusted simulated dialogue data. After passing the quality assessment, eliminate low-quality data and conduct manual review on the data to ensure the high accuracy and security of the data. Finally, the high-quality role-playing model training data generated through the above steps can be used for model fine-tuning and ability improvement, making the model perform more excellently in role-playing tasks.
[0127] In one embodiment, the step S106 includes:
[0128] Call the automatic evaluation module in the evaluation system to conduct quality assessment on the adjusted simulated dialogue data to obtain evaluation indicators;
[0129] Based on the evaluation indicators, score the adjusted simulated dialogue data, mark the adjusted simulated dialogue data below the score threshold for review, and at the same time output the adjusted simulated dialogue data that is higher than or equal to the score threshold;
[0130] Collect the qualified simulated dialogue data after review and the directly output simulated dialogue data respectively, and integrate them to obtain the final role-playing model training data.
[0131] In this embodiment, the adjusted simulated dialogue data is first subjected to quality assessment through the automatic evaluation module in the evaluation system. The automatic evaluation module conducts multi-dimensional automated analysis and scoring on the simulated dialogue data according to the preset evaluation criteria. The evaluation criteria include:
[0132] Persona consistency: Check whether the dialogue content of the actor model is consistent with the set character settings. For example, when the persona of the actor is "Zhang San", the answer to "What's your name?" must be "Zhang San";
[0133] Security: Evaluate whether the dialogue content complies with security regulations and avoid generating dialogues involving sensitive or inappropriate content;
[0134] Dialogue fluency: Analyze whether the dialogue between the actor and the robot is smooth, logical, and in line with the natural language usage habits;
[0135] Thematic consistency: Determine whether the conversation focuses on the specified conversation theme. For example, whether the conversation content on the weather theme focuses on weather-related issues;
[0136] Task consistency: Verify whether the conversation meets the goal settings in the task system. For example, whether the required data for the target task type (such as perception tasks or security tasks) is generated;
[0137] After each piece of simulated conversation data is evaluated, the system generates a set of evaluation metrics for it. For example:
[0138] Character consistency: 4.8 / 5
[0139] Security: 5.0 / 5
[0140] Conversation fluency: 4.6 / 5
[0141] Thematic consistency: 4.7 / 5
[0142] Task consistency: 4.5 / 5
[0143] The evaluation metrics are further aggregated into a comprehensive score to measure the overall quality of each piece of simulated conversation data. For example, after weighted averaging each evaluation metric, the comprehensive score of a piece of data is 4.7 / 5. Data with a comprehensive score reaching or exceeding the preset threshold (such as 4.5 / 5) is directly output and marked as "qualified". Simulated conversation data with a comprehensive score lower than the preset threshold will be marked as "requiring review" and enter the manual review process. Through scoring and screening, the evaluation system can effectively eliminate low-quality data while ensuring the output efficiency of high-quality data. For simulated conversation data marked as "requiring review", the system will automatically mark the dimension where the problem lies, prompting the review personnel to focus on the inspection. For example: "The thematic consistency score is lower than 3.5, check if it deviates from the conversation theme." "The conversation fluency score is lower than 4.0, check if there are grammar or logic errors." etc.
[0144] Furthermore, the manual review personnel conduct a detailed review and modification of the low-scoring data in combination with the system markings. For example, if it is found that a piece of data has a low score due to theme deviation, the conversation content can be adjusted to make it more in line with the theme. The data passing the review will be re-marked as "qualified" and enter the integration process together with the data automatically evaluated as qualified. After the review is completed, the data automatically evaluated as qualified and the data qualified after review are integrated. During the integration process, the system will further standardize the qualified data, such as unifying the format, removing duplicates, and classifying and storing them, to ensure that the finally generated training data is of high quality, structured, and rich in diversity. Finally, the data automatically evaluated as qualified and the data qualified after review are integrated to generate complete role-playing model training data for subsequent model fine-tuning and ability optimization.
[0145] In summary, the present invention generates high-quality dialogue data automatically for training a role-playing model, improving the quality of the data and the performance of the model. On the one hand, the thousands of dialogue data generated by this system are significantly superior in quality to the open-source data; on the other hand, since the generated data is completely based on virtual personas, the risk of personal privacy data leakage is completely avoided. In addition, in multiple SBS (side-by-side) human evaluations, the role-playing model trained based on the data generated by the present invention performs better than the model trained using open-source data. Especially under various task settings, the ability of the model on the target tasks has been significantly improved, reflecting the important value and application prospects of the present invention in the training of role-playing models.
[0146] Combined with Figure 3 as shown, Figure 3 FIG. 3 is a schematic block diagram of a device for generating training data of a role-playing model provided by an embodiment of the present invention. The device 300 for generating training data of a role-playing model includes:
[0147] A data acquisition unit 301, configured to acquire a demand instruction for training data of a role-playing model;
[0148] A data definition unit 302, configured to define a task category according to the demand instruction, and construct a task system by using the task category;
[0149] A data generation unit 303, configured to generate simulated dialogue data by using the task system, and generate an environment information system according to the demand instruction;
[0150] A data association unit 304, configured to perform data association on the environment information system and the simulated dialogue data to obtain associated simulated dialogue data;
[0151] A data adjustment unit 305, configured to perform cognitive adjustment processing on the associated simulated dialogue data based on a pre-constructed cognitive system to obtain adjusted simulated dialogue data;
[0152] A data evaluation unit 306, configured to call a pre-constructed evaluation system to perform quality evaluation on the adjusted simulated dialogue data, and generate final training data of a role-playing model.
[0153] In this embodiment, the data acquisition unit 301 acquires a requirement instruction for role-playing model training data; the data definition unit 302 defines a task category according to the requirement instruction and constructs a task system by using the task category; the data generation unit 303 generates simulated dialogue data by using the task system, and simultaneously generates an environment information system according to the requirement instruction; the data association unit 304 performs data association on the environment information system and the simulated dialogue data to obtain the associated simulated dialogue data; the data adjustment unit 305 performs cognitive adjustment processing on the associated simulated dialogue data based on a pre-constructed cognitive system to obtain the adjusted simulated dialogue data; the data evaluation unit 306 calls a pre-constructed evaluation system to perform quality evaluation on the adjusted simulated dialogue data to generate the final role-playing model training data.
[0154] In one embodiment, the generating device 300 of the role-playing model training data further includes:
[0155] A requirement construction unit, configured to respectively input a task requirement and a chat topic into a task retrieval module of the persona system based on a pre-constructed persona system;
[0156] A task retrieval unit, configured to use the task retrieval module to retrieve relevant persona information in a database of the persona system;
[0157] A first return unit, configured to directly return the retrieval result as the requirement instruction when the task retrieval module retrieves the persona information;
[0158] A second return unit, configured to call an automatic generation module of the persona system to generate the required persona information by using a large language model when the task retrieval module fails to retrieve the persona information;
[0159] An information storage unit, configured to store the persona information generated by the automatic generation module into a persona storage module of the persona system and use it as the requirement instruction.
[0160] In one embodiment, the data definition unit 302 includes:
[0161] A category definition unit, configured to determine the task category related to the task objective according to the requirement instruction; wherein the task category includes a perception task, a cognitive task, a security task, and a multi-turn dialogue task;
[0162] A category initialization unit, configured to initialize a corresponding theme control module, method control module, and condition control module based on the task category;
[0163] A range generation unit, configured to generate a theme range by using the theme control module and generate a dialogue theme list according to the theme range;
[0164] A rule generation unit, configured to transmit the dialogue topic list to the method control module and configure dialogue data generation rules for each dialogue topic;
[0165] A condition setting unit, configured to set additional condition parameters in the condition control module based on the dialogue data generation rules to obtain the task system.
[0166] In one embodiment, the data generation unit 303 includes:
[0167] A dialogue generation unit, configured to generate the simulated dialogue data based on the dialogue data generation rules and the additional condition parameters;
[0168] An environment generation unit, configured to generate environment data associated with the simulated dialogue data according to the requirement instruction; wherein the environment data includes virtual time data, location data, and weather data;
[0169] An environment integration unit, configured to integrate the virtual time data, location data, and weather data respectively to obtain the environment information system.
[0170] In one embodiment, the data association unit 304 includes:
[0171] A dialogue mapping unit, configured to extract the environment data in the environment information system based on the simulated dialogue data and establish a mapping relationship between the environment data and the simulated dialogue data;
[0172] A data embedding unit, configured to embed the environment parameters into the corresponding simulated dialogue data based on the mapping relationship to expand the simulated dialogue content;
[0173] A data verification unit, configured to perform consistency verification on the simulated dialogue content and output a verification result to obtain the associated simulated dialogue data.
[0174] In one embodiment, the data adjustment unit 305 includes:
[0175] An intention analysis unit, configured to analyze the associated simulated dialogue data by using the intention recognition module in the cognitive system and extract user intention data;
[0176] A data enhancement unit, configured to call the tool module in the cognitive system to perform an enhanced response to the user intention data to obtain a dialogue output result;
[0177] A memory storage unit, configured to store the dialogue output result by using the memory module in the cognitive system to obtain a memory storage result;
[0178] A dialogue adjustment unit for performing multi-round dialogue adjustment on the associated simulated dialogue data according to the memory storage result to obtain the adjusted simulated dialogue data.
[0179] In one embodiment, the data evaluation unit 306 includes:
[0180] A quality evaluation unit for invoking an automatic evaluation module in the evaluation system to perform quality evaluation on the adjusted simulated dialogue data to obtain evaluation indicators;
[0181] A data marking unit for scoring the adjusted simulated dialogue data based on the evaluation indicators, rechecking and marking the adjusted simulated dialogue data below the scoring threshold, and simultaneously outputting the adjusted simulated dialogue data that is higher than or equal to the scoring threshold;
[0182] A data output unit for separately collecting the qualified simulated dialogue data after rechecking and the directly output simulated dialogue data, and integrating them to obtain the final role-playing model training data.
[0183] Since the embodiments in the device part correspond to the embodiments in the method part, please refer to the description of the embodiments in the method part for the embodiments in the device part, which will not be elaborated here.
[0184] The embodiments of the present invention also provide a computer-readable storage medium on which a computer program is stored. When the computer program is executed, the steps provided in the above embodiments can be implemented. The storage medium may include: various media such as USB flash drives, mobile hard disks, read-only memories (ROM), random access memories (RAM), magnetic disks, or optical discs that can store program codes.
[0185] The embodiments of the present invention also provide a computer device, which may include a memory and a processor. When the processor calls the computer program stored in the memory, the steps provided in the above embodiments can be implemented. Of course, the computer device may also include various network interfaces, power supplies, and other components.
[0186] The embodiments in the specification are described in a progressive manner. Each embodiment focuses on the differences from other embodiments. The same or similar parts among the embodiments can be referred to each other. For the system disclosed in the embodiments, since it corresponds to the method disclosed in the embodiments, the description is relatively simple. For the relevant parts, please refer to the description in the method part. It should be noted that for those of ordinary skill in the art in the technical field of the present application, without departing from the principle of the present application, several improvements and modifications can be made to the present application, and these improvements and modifications also fall within the protection scope of the claims of the present application.
[0187] It should also be noted that in this specification, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the term "comprising", "including" or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article or device comprising a series of elements not only includes those elements, but also includes other elements not expressly listed, or elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "comprising an..." does not exclude the presence of additional identical elements in the process, method, article or device comprising the element.
Claims
1. A method for generating role-playing model training data, characterized in that, Including: A requirement instruction for obtaining role-playing model training data; Defining a task category according to the requirement instruction and constructing a task system by using the task category; Generating simulated dialogue data by using the task system, and simultaneously generating an environmental information system according to the requirement instruction; Performing data association on the environmental information system and the simulated dialogue data to obtain the associated simulated dialogue data; Performing cognitive adjustment processing on the associated simulated dialogue data based on a pre-constructed cognitive system to obtain the adjusted simulated dialogue data; Invoking a pre-constructed evaluation system to perform quality evaluation on the adjusted simulated dialogue data to generate the final role-playing model training data.
2. The method for generating role-playing model training data according to claim 1, wherein Before the requirement instruction for obtaining role-playing model training data, it includes: Based on a pre-constructed persona system, respectively inputting a task requirement and a chat topic into the task retrieval module of the persona system; Using the task retrieval module to retrieve relevant persona information in the database of the persona system; When the task retrieval module retrieves the persona information, directly returning the retrieval result and using it as the requirement instruction; When the task retrieval module fails to retrieve the persona information, invoking the automatic generation module of the persona system and using a large language model to generate the required persona information; Storing the persona information generated by the automatic generation module into the persona storage module of the persona system and using it as the requirement instruction.
3. The method for generating role-playing model training data according to claim 1, wherein The step of defining a task category according to the requirement instruction and constructing a task system by using the task category includes: Determining the task category related to the task objective according to the requirement instruction; wherein, the task category includes a perception task, a cognitive task, a security task, and a multi-turn dialogue task; Initializing a corresponding theme control module, method control module, and condition control module based on the task category; Using the theme control module to generate a theme range and generating a dialogue theme list according to the theme range; Transmitting the dialogue theme list to the method control module and configuring dialogue data generation rules for each dialogue theme; Setting additional condition parameters in the condition control module based on the dialogue data generation rules to obtain the task system.
4. The method for generating role-playing model training data according to claim 3, wherein, The step of generating simulated dialogue data by using the task system and simultaneously generating an environmental information system according to the requirement instruction includes: Generating the simulated dialogue data based on the dialogue data generation rules and the additional condition parameters; Generating environmental data associated with the simulated dialogue data according to the requirement instruction; wherein, the environmental data includes virtual time data, location data, and weather data; Integrating the virtual time data, location data, and weather data respectively to obtain the environmental information system.
5. The method for generating role-playing model training data according to claim 1, wherein The step of performing data association on the environmental information system and the simulated dialogue data to obtain the associated simulated dialogue data includes: Extracting the environmental data in the environmental information system based on the simulated dialogue data and establishing a mapping relationship between the environmental data and the simulated dialogue data; Embedding the environmental parameters into the corresponding simulated dialogue data based on the mapping relationship to expand the simulated dialogue content; Perform consistency verification on the simulated dialogue content and output the verification result to obtain the associated simulated dialogue data.
6. The method for generating role-playing model training data according to claim 1, wherein Perform cognitive adjustment processing on the associated simulated dialogue data based on a pre-constructed cognitive system to obtain adjusted simulated dialogue data, including: Analyze the associated simulated dialogue data using the intention recognition module in the cognitive system and extract user intention data; Invoke the tool module in the cognitive system to perform enhanced response on the user intention data to obtain a dialogue output result; Use the memory module in the cognitive system to store the dialogue output result to obtain a memory storage result; Perform multi-round dialogue adjustment on the associated simulated dialogue data according to the memory storage result to obtain the adjusted simulated dialogue data.
7. The method for generating role-playing model training data according to claim 1, wherein Invoke a pre-constructed evaluation system to perform quality evaluation on the adjusted simulated dialogue data to generate final role-playing model training data, including: Invoke the automatic evaluation module in the evaluation system to perform quality evaluation on the adjusted simulated dialogue data to obtain evaluation indicators; Score the adjusted simulated dialogue data based on the evaluation indicators, mark the adjusted simulated dialogue data below the scoring threshold for review, and at the same time output the adjusted simulated dialogue data above or equal to the scoring threshold; Collect the qualified simulated dialogue data after review and the directly output simulated dialogue data respectively, and integrate them to obtain the final role-playing model training data.
8. An apparatus for generating role-playing model training data, characterized in that, Including: A data acquisition unit for acquiring a requirement instruction for role-playing model training data; A data definition unit for defining a task category according to the requirement instruction and constructing a task system using the task category; A data generation unit for generating simulated dialogue data using the task system and generating an environment information system according to the requirement instruction; A data association unit for associating the environment information system with the simulated dialogue data to obtain associated simulated dialogue data; A data adjustment unit for performing cognitive adjustment processing on the associated simulated dialogue data based on a pre-constructed cognitive system to obtain adjusted simulated dialogue data; A data evaluation unit for invoking a pre-constructed evaluation system to perform quality evaluation on the adjusted simulated dialogue data to generate final role-playing model training data.
9. A computer device, characterized in that, Including a memory, a processor, and a computer program stored on the memory and executable on the processor, where the processor implements the method for generating role-playing model training data according to any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, characterized in that, A computer program is stored on a computer-readable storage medium, and when the computer program is executed by a processor, the method for generating role-playing model training data according to any one of claims 1 to 7 is implemented.