[go: up one dir, main page]

WO2024255677A1 - Dialogue data generation method and related device thereof - Google Patents

Dialogue data generation method and related device thereof Download PDF

Info

Publication number
WO2024255677A1
WO2024255677A1 PCT/CN2024/097727 CN2024097727W WO2024255677A1 WO 2024255677 A1 WO2024255677 A1 WO 2024255677A1 CN 2024097727 W CN2024097727 W CN 2024097727W WO 2024255677 A1 WO2024255677 A1 WO 2024255677A1
Authority
WO
WIPO (PCT)
Prior art keywords
data
user
items
dialogue
rules
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
PCT/CN2024/097727
Other languages
French (fr)
Chinese (zh)
Inventor
张豪
陈锦耀
武楚涵
刘勇
董振华
唐睿明
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Huawei Technologies Co Ltd
Original Assignee
Huawei Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Huawei Technologies Co Ltd filed Critical Huawei Technologies Co Ltd
Publication of WO2024255677A1 publication Critical patent/WO2024255677A1/en
Anticipated expiration legal-status Critical
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/33Querying
    • G06F16/332Query formulation
    • G06F16/3329Natural language query formulation
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/953Querying, e.g. by the use of web search engines
    • G06F16/9535Search customisation based on user profiles and personalisation
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods

Definitions

  • the embodiments of the present application relate to the field of artificial intelligence (AI) technology, and in particular to a method for generating dialogue data and related equipment.
  • AI artificial intelligence
  • AI-generated content In AI-generated content (AIGC), the conversational model (language big model) with item recommendation function has demonstrated strong natural language understanding and communication capabilities.
  • the model can recommend items to users by having conversations with them, thereby meeting users' item recommendation needs.
  • conversation data for model training through crowdsourcing projects.
  • the staff in the crowdsourcing project can play the role of users and conversation models respectively, and generate conversation data between users and conversation models according to the information provided by the preset knowledge graph.
  • the relevant content in the conversation data and the items recommended to users by the conversation model are extracted by the staff from the knowledge graph.
  • the conversation data can be used to train the recommendation model, and the trained recommendation model can learn the interests and preferences of users, so as to recommend items to users.
  • the entire process of generating dialogue data needs to be the responsibility of the crowdsourcing project staff, which takes a lot of time, that is, the labor cost is too high.
  • the embodiments of the present application provide a method for generating conversation data and related devices thereof, which can effectively improve the efficiency of generating conversation data and reduce the cost of generating conversation data.
  • a first aspect of an embodiment of the present application provides a method for generating conversation data, the method comprising:
  • User data may generally include user attributes and items that the user is interested in.
  • the user attributes may include the user's name, the user's gender, and the user's age, etc.
  • the items that the user is interested in may include items that the user has clicked on, items that the user has browsed, items that the user has commented on, etc.
  • a series of processing can be performed on the user data to obtain items that can be recommended to the user.
  • the items that can be recommended to the user include not only the items that the user is interested in in the user data, but also other items associated with the items that the user is interested in.
  • the preset data generation rules can be updated using the user data and the items that can be recommended to the user, thereby obtaining new data generation rules. It should be noted that the new data generation rules not only constrain the format of the dialogue data between the user and the dialogue model, but also constrain the content of the dialogue data between the user and the dialogue model.
  • the dialogue data between the user and the dialogue model can be generated according to the new data generation rules.
  • the dialogue data between the user and the dialogue model usually includes multiple rounds of interaction, which include multiple rounds of ordinary dialogue and multiple rounds of question and answer.
  • Each round of ordinary dialogue includes a non-question sentence of the user and a reply of the dialogue model (or, each round of ordinary dialogue includes a non-question sentence of the dialogue model and a reply of the user), and each round of question and answer includes a question of the user and an answer of the dialogue model (or, each round of question and answer includes a question of the dialogue model and an answer of the user).
  • the user data may be obtained first.
  • the user data includes the user's attributes and the items that the user is interested in.
  • the user data may be processed to obtain recommended items.
  • the recommended items include items that the user is interested in and items related to the items that the user is interested in.
  • the preset data generation rules may be updated using the user data and the recommended items to obtain new data generation rules.
  • the new data generation rules may be used to generate dialogue data between the user and the dialogue model.
  • the dialogue data includes items recommended to the user by the dialogue model.
  • the items recommended to the user by the dialogue model come from the recommended items.
  • the above process provides a dialogue data generation framework, which can be used to collect
  • the data generation rules preset in the user data set are used to obtain new data generation rules, and the new data generation rules are used to obtain the conversation data between the user and the conversation model. It can be seen that the framework can automatically generate conversation data, and the entire generation process of conversation data does not require human intervention, which can effectively improve the generation efficiency of conversation data and reduce the generation cost of conversation data.
  • the method further includes: determining non-recommended items based on user data; updating preset data generation rules based on user data and recommended items, and obtaining new data generation rules includes: updating preset data generation rules based on user data, recommended items, and non-recommended items, and obtaining new data generation rules.
  • updating preset data generation rules includes: updating preset data generation rules based on user data, recommended items, and non-recommended items, and obtaining new data generation rules.
  • the new data generation rules can make the dialogue data between the user and the dialogue model include the following multiple contents: the user accepts the items recommended by the dialogue model and the user rejects the items recommended by the dialogue model, so that the dialogue data finally generated can be more in line with reality.
  • determining the recommendable items based on user data includes: extracting features from the user data and multiple candidate items to obtain features of the user data and multiple candidate items; calculating the features of the user data and multiple candidate items to obtain the degree of matching between the user data and the multiple candidate items; and determining the candidate items whose degree of matching is greater than or equal to a first threshold as recommendable items.
  • multiple candidate items may be first obtained, so that the features of the user data and the multiple candidate items may be extracted respectively, thereby obtaining the features of the user data and the multiple candidate items accordingly.
  • a series of calculations may be performed on the features of the user data and the multiple candidate items to obtain the degree of matching between the user data and the multiple candidate items, that is, the degree of matching between the user data and the first candidate item, the degree of matching between the user data and the second candidate item, ..., the degree of matching between the user data and the last candidate item.
  • the candidate items whose degree of matching is greater than or equal to the first threshold may be determined as items that can be recommended to the user among the multiple candidate items. In this way, the items that the user is interested in and the items related to the items that the user is interested in can be accurately obtained as items that can be recommended to the user.
  • determining the unrecommended items based on the user data includes: determining the candidate items with a matching degree less than or equal to a second threshold as unrecommended items, where the second threshold is less than the first threshold.
  • the candidate items with a matching degree less than or equal to the second threshold can be determined as unrecommended items from among the multiple candidate items. In this way, items that the user is not interested in can be accurately obtained as items that cannot be recommended to the user.
  • the preset data generation rules include rules that do not need to be supplemented and rules to be supplemented. Based on user data, recommended items and non-recommended items, the preset data generation rules are updated to obtain new data generation rules, including: filling user data, recommended items and non-recommended items into the rules to be supplemented, obtaining supplemented rules, the rules that do not need to be supplemented and the supplemented rules constitute new data generation rules, the rules that do not need to be supplemented are used to set the format of dialogue data, and the supplemented rules are used to set the content of dialogue data.
  • the preset data generation rules may include two parts, one part is the rules that do not need to be supplemented, and the other part is the rules to be supplemented, and the rules to be supplemented have slots that can be filled with content. Then, user data, recommended items and non-recommended items can be filled into the slots of the rules to be supplemented, thereby obtaining supplemented rules.
  • the rules that do not need to be supplemented and the supplemented rules constitute new data generation rules, wherein the rules that do not need to be supplemented are used to set the format of dialogue data between the user and the dialogue model, and the supplemented rules are used to set the content of dialogue data between the user and the dialogue model.
  • the dialogue data obtained based on the new data generation rules has a certain format, and its content includes not only the content of the chat between the user and the dialogue model, but also the content of the user accepting the items recommended by the dialogue model, and even the content of the user rejecting the items recommended by the dialogue model, so that the final generated dialogue data is closer to reality.
  • the method further includes: obtaining target dialogue data from the dialogue data, where the target dialogue data satisfies at least one of the following: all texts contained in the target dialogue data are in a preset text set; the description of the object contained in the target dialogue data conforms to the real description; the object contained in the target dialogue data is a real object; the richness of the content contained in the target dialogue data is greater than or equal to a third threshold.
  • obtaining target dialogue data from the dialogue data where the target dialogue data satisfies at least one of the following: all texts contained in the target dialogue data are in a preset text set; the description of the object contained in the target dialogue data conforms to the real description; the object contained in the target dialogue data is a real object; the richness of the content contained in the target dialogue data is greater than or equal to a third threshold.
  • the method further includes: training the dialogue model based on the target dialogue data to obtain a trained dialogue model.
  • the dialogue model can be trained using the target dialogue data. Conduct training to obtain a trained dialogue model, that is, a dialogue model with the function of item recommendation.
  • the second aspect of an embodiment of the present application provides a data processing method, which is implemented through the trained dialogue model involved in the first aspect.
  • the method includes: obtaining a user's question, which is used to describe the user's item recommendation needs; inputting the user's question into the trained dialogue model to obtain an answer corresponding to the question, and the answer is used to describe the item recommendation results for the user.
  • a third aspect of an embodiment of the present application provides a conversation data generating device, which includes: an acquisition module for acquiring user data, the user data including user attributes and items of interest to the user; a determination module for determining recommendable items based on the user data, the recommendable items including items of interest to the user and items associated with the items of interest to the user; an update module for updating preset data generation rules based on the user data and the recommendable items to obtain new data generation rules; and a generation module for generating conversation data between a user and a conversation model based on the new data generation rules, the conversation data including items recommended to the user by the conversation model, and the items recommended to the user by the conversation model are from the recommendable items.
  • user data can be obtained first, and the user data includes the attributes of the user and the items that the user is interested in. Then, the user data can be processed to obtain recommended items, and the recommended items include items that the user is interested in and items associated with the items that the user is interested in. Then, the preset data generation rules can be updated using the user data and the recommended items to obtain new data generation rules. Finally, the dialogue data between the user and the dialogue model can be generated according to the new data generation rules, and the dialogue data includes the items recommended to the user by the dialogue model, and the items recommended to the user by the dialogue model come from the recommended items.
  • the above process provides a dialogue data generation framework, which can use the data generation rules preset by the collected user data set to obtain new data generation rules, and use the new data generation rules to obtain the dialogue data between the user and the dialogue model. It can be seen that the framework can automatically generate dialogue data, and the entire generation process of dialogue data does not require manual intervention, which can effectively improve the generation efficiency of dialogue data and reduce the generation cost of dialogue data.
  • the determination module is further used to determine non-recommended items based on user data; the update module is used to update preset data generation rules based on user data, recommendable items and non-recommended items to obtain new data generation rules.
  • the determination module is used to: extract features from user data and multiple candidate items to obtain features of the user data and features of the multiple candidate items; calculate the features of the user data and features of the multiple candidate items to obtain a matching degree between the user data and the multiple candidate items; and determine a candidate item having a matching degree greater than or equal to a first threshold as a recommendable item.
  • the determination module is used to determine candidate items whose matching degree is less than or equal to a second threshold as non-recommended items, where the second threshold is less than the first threshold.
  • the preset data generation rules include rules that do not need to be supplemented and rules to be supplemented
  • the update module is used to: fill the user data, recommended items and non-recommended items into the rules to be supplemented to obtain the supplemented rules.
  • the rules that do not need to be supplemented and the supplemented rules constitute new data generation rules.
  • the rules that do not need to be supplemented are used to set the format of the dialogue data, and the supplemented rules are used to set the content of the dialogue data.
  • the device also includes: a screening module, used to obtain target conversation data from the conversation data, and the target conversation data satisfies at least one of the following: all texts contained in the target conversation data are located in a preset text set; the description of the object contained in the target conversation data conforms to the real description; the object contained in the target conversation data is a real object; the richness of the content contained in the target conversation data is greater than or equal to a third threshold.
  • a screening module used to obtain target conversation data from the conversation data, and the target conversation data satisfies at least one of the following: all texts contained in the target conversation data are located in a preset text set; the description of the object contained in the target conversation data conforms to the real description; the object contained in the target conversation data is a real object; the richness of the content contained in the target conversation data is greater than or equal to a third threshold.
  • the device further includes: a training module, configured to train the dialogue model based on target dialogue data to obtain a trained dialogue model.
  • the fourth aspect of an embodiment of the present application provides a data processing device, which includes the trained dialogue model involved in the third aspect, and the device includes: an acquisition module, used to obtain a user's question, and the user's question is used to describe the user's item recommendation needs; a processing module, used to input the user's question into the trained dialogue model to obtain an answer corresponding to the question, and the answer is used to describe the item recommendation result for the user.
  • a fifth aspect of an embodiment of the present application provides a conversation data generating device, which includes a memory and a processor; the memory stores code, and the processor is configured to execute the code.
  • the conversation data generating device performs the method described in the first aspect or any possible implementation method of the first aspect.
  • a sixth aspect of an embodiment of the present application provides a data processing device, which includes a memory and a processor; the memory stores code, and the processor is configured to execute the code.
  • the data processing device executes the method described in the second aspect or any possible implementation method of the second aspect.
  • a seventh aspect of an embodiment of the present application provides a circuit system, which includes a processing circuit, and the processing circuit is configured to execute a method as described in the first aspect, any possible implementation of the first aspect, the second aspect, or any possible implementation of the second aspect.
  • An eighth aspect of an embodiment of the present application provides a chip system, which includes a processor for calling a computer program or computer instructions stored in a memory so that the processor executes a method as described in the first aspect, any possible implementation of the first aspect, the second aspect, or any possible implementation of the second aspect.
  • the processor is coupled to the memory through an interface.
  • the chip system also includes a memory, in which a computer program or computer instructions are stored.
  • a ninth aspect of an embodiment of the present application provides a computer storage medium storing a computer program, which, when executed by a computer, enables the computer to implement the method described in the first aspect, any possible implementation of the first aspect, the second aspect, or any possible implementation of the second aspect.
  • the tenth aspect of the embodiments of the present application provides a computer program product, which stores instructions, which, when executed by a computer, enable the computer to implement the method described in the first aspect, any possible implementation of the first aspect, the second aspect, or any possible implementation of the second aspect.
  • the user data when it is necessary to generate the dialogue data between the user and the dialogue model, the user data may be obtained first, and the user data includes the attributes of the user and the items that the user is interested in. Then, the user data may be processed to obtain the recommended items, and the recommended items include the items that the user is interested in and the items associated with the items that the user is interested in. Then, the preset data generation rules may be updated using the user data and the recommended items, so as to obtain new data generation rules. Finally, the dialogue data between the user and the dialogue model may be generated according to the new data generation rules, and the dialogue data includes the items recommended to the user by the dialogue model, and the items recommended to the user by the dialogue model are from the recommended items.
  • the above process provides a dialogue data generation framework, which may obtain new data generation rules using the data generation rules preset by the collected user data set, and obtain the dialogue data between the user and the dialogue model using the new data generation rules. It can be seen that the framework can automatically generate dialogue data, and the entire generation process of dialogue data does not require manual intervention, which can effectively improve the generation efficiency of dialogue data and reduce the generation cost of dialogue data.
  • FIG1 is a schematic diagram of a structure of an artificial intelligence main framework
  • FIG2a is a schematic diagram of a structure of a data processing system provided in an embodiment of the present application.
  • FIG2b is another schematic diagram of the structure of the data processing system provided in an embodiment of the present application.
  • FIG2c is a schematic diagram of a data processing related device provided in an embodiment of the present application.
  • FIG3 is a schematic diagram of the architecture of the system 100 provided in an embodiment of the present application.
  • FIG4 is a schematic diagram of a structure of a dialogue data generation architecture provided in an embodiment of the present application.
  • FIG5 is a flow chart of a method for generating conversation data according to an embodiment of the present application.
  • FIG6 is a schematic diagram of a user data conversion process provided by an embodiment of the present application.
  • FIG7 is a schematic diagram of a process for obtaining recommendable items according to an embodiment of the present application.
  • FIG8 is a schematic diagram of a process for obtaining data generation rules provided in an embodiment of the present application.
  • FIG9 is a schematic diagram of a process for acquiring conversation data provided in an embodiment of the present application.
  • FIG10 is a schematic diagram of a process for acquiring conversation data provided in an embodiment of the present application.
  • FIG11 is a schematic diagram of a scoring result provided in an embodiment of the present application.
  • FIG12 is another schematic diagram of the scoring results provided in an embodiment of the present application.
  • FIG13 is another schematic diagram of the scoring results provided in an embodiment of the present application.
  • FIG14 is another schematic diagram of the scoring results provided in an embodiment of the present application.
  • FIG15 is a flow chart of a data processing method provided in an embodiment of the present application.
  • FIG16 is a schematic diagram of the structure of a conversation data generating device provided in an embodiment of the present application.
  • FIG17 is a schematic diagram of a structure of a data processing device provided in an embodiment of the present application.
  • FIG18 is a schematic diagram of a structure of an execution device provided in an embodiment of the present application.
  • FIG19 is a schematic diagram of a structure of a training device provided in an embodiment of the present application.
  • FIG. 20 is a schematic diagram of the structure of a chip provided in an embodiment of the present application.
  • the embodiments of the present application provide a method for generating conversation data and related devices thereof, which can effectively improve the efficiency of generating conversation data and reduce the cost of generating conversation data.
  • the conversational model with item recommendation function (also called the language large model with item recommendation function) demonstrates strong natural language understanding and communication capabilities.
  • the model can recommend items to users by having conversations with them, thereby meeting users' item recommendation needs.
  • conversation data for model training through crowdsourcing projects.
  • the staff in the crowdsourcing project can play the role of users and conversation models respectively, and generate conversation data between users and conversation models according to the information provided by the preset knowledge graph.
  • the relevant content in the conversation data and the items recommended to users by the conversation model are extracted by the staff from the knowledge graph.
  • the conversation data can be used to train the recommendation model, and the trained recommendation model can learn the interests and preferences of users, so as to recommend items to users.
  • AI technology is a technical discipline that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence. AI technology obtains the best results by sensing the environment, acquiring knowledge and using knowledge.
  • artificial intelligence technology is a branch of computer science that attempts to understand the essence of intelligence and produce a new intelligent machine that can respond in a similar way to human intelligence.
  • Using artificial intelligence for data processing is a common application of artificial intelligence.
  • the data on the upper layer of the infrastructure is used to represent the data sources in the field of artificial intelligence.
  • the data involves graphics, images, voice, text, and IoT data of traditional devices, including business data of existing systems and perception data such as force, displacement, liquid level, temperature, and humidity.
  • Data processing usually includes data training, machine learning, deep learning, search, reasoning, decision-making and other methods.
  • Reasoning refers to the process of simulating human intelligent reasoning in computers or intelligent systems, using formalized information to perform machine thinking and solve problems based on reasoning control strategies. Typical functions are search and matching.
  • Decision-making refers to the process of making decisions after intelligent information is reasoned, usually providing functions such as classification, sorting, and prediction.
  • Smart products and industry applications refer to the products and applications of artificial intelligence systems in various fields. They are the encapsulation of the overall artificial intelligence solution, which productizes intelligent information decision-making and realizes practical applications. Its application areas mainly include: smart terminals, smart transportation, smart medical care, autonomous driving, smart cities, etc.
  • FIG2a is a schematic diagram of a data processing system provided in an embodiment of the present application, wherein the data processing system includes a user device and a data processing device.
  • the user device includes an intelligent terminal such as a mobile phone, a personal computer or an information processing center.
  • the user device is the initiator of data processing, and as the initiator of a data processing request, a user usually initiates a request through the user device.
  • the above-mentioned data processing device can be a device or server with data processing function such as a cloud server, a network server, an application server and a management server.
  • the data processing device receives data processing requests from the intelligent terminal through an interactive interface, and then performs data processing in the form of machine learning, deep learning, search, reasoning, decision-making, etc. through the memory for storing data and the processor for data processing.
  • the memory in the data processing device can be a general term, including local storage and databases for storing historical data.
  • the database can be on the data processing device or on other network servers.
  • the user device can receive the user's instructions. For example, the user device can obtain the question input/selected by the user, and then initiate a request to the data processing device, so that the data processing device performs a series of processing on the question from the user device, thereby obtaining the processing result of the question.
  • the user device can obtain the question input by the user (for example, the question can describe the user's item recommendation needs), and then the user device can initiate a data processing request to the data processing device, so that the data processing device performs a series of processing on the question based on the data processing request, thereby obtaining the processing result of the question, that is, the corresponding answer (for example, the answer can describe the item recommendation result for the user, that is, the item recommended to the user).
  • the question can describe the user's item recommendation needs
  • the data processing device may execute the data processing method of the embodiment of the present application.
  • Figure 2b is another structural diagram of the data processing system provided in an embodiment of the present application.
  • the user device directly serves as a data processing device.
  • the user device can directly obtain input from the user and directly process it by the hardware of the user device itself.
  • the specific process is similar to that of Figure 2a. Please refer to the above description and will not be repeated here.
  • the user device can receive instructions from the user. For example, the user device can obtain a question input by the user (for example, the question can describe the user's item recommendation needs), and then the user device can perform a series of processing on the question to obtain a processing result of the question, that is, a corresponding answer (for example, the answer can describe the item recommendation result for the user, that is, the item recommended to the user).
  • a question input by the user for example, the question can describe the user's item recommendation needs
  • the user device can perform a series of processing on the question to obtain a processing result of the question, that is, a corresponding answer (for example, the answer can describe the item recommendation result for the user, that is, the item recommended to the user).
  • the user equipment itself can execute the data processing method of the embodiment of the present application.
  • FIG. 2c is a schematic diagram of a data processing related device provided in an embodiment of the present application.
  • the user device in the above Figures 2a and 2b can specifically be the local device 301 or the local device 302 in Figure 2c
  • the data processing device in Figure 2a can specifically be the execution device 210 in Figure 2c
  • the data storage system 250 can store the data to be processed of the execution device 210
  • the data storage system 250 can be integrated on the execution device 210, and can also be set on the cloud or other network servers.
  • the processors in Figures 2a and 2b can perform data training/machine learning/deep learning through a neural network model or other models (for example, a model based on a support vector machine), and use the model finally trained or learned by the data to execute data processing applications on the image, thereby obtaining corresponding processing results.
  • a neural network model or other models for example, a model based on a support vector machine
  • FIG3 is a schematic diagram of the architecture of the system 100 provided in an embodiment of the present application.
  • the execution device 110 configures the input/output
  • the input/output (I/O) interface 112 is used for data interaction with external devices.
  • the user can input data to the I/O interface 112 through the client device 140.
  • the input data may include: various tasks to be scheduled, callable resources and other parameters in the embodiment of the present application.
  • the execution device 110 When the execution device 110 preprocesses the input data, or when the computing module 111 of the execution device 110 performs calculation and other related processing (such as implementing the functions of the neural network model in the present application), the execution device 110 can call the data, code, etc. in the data storage system 150 for corresponding processing, and can also store the data, instructions, etc. obtained by the corresponding processing in the data storage system 150.
  • the I/O interface 112 returns the processing result to the client device 140 so as to provide it to the user.
  • the training device 120 can generate corresponding target models (e.g., the trained dialogue model provided in the embodiment of the present application)/rules based on different training data for different goals or different tasks, and the corresponding target models/rules can be used to achieve the above goals or complete the above tasks, thereby providing the user with the desired results.
  • the training data can be stored in the database 130 and come from the training samples collected by the data collection device 160.
  • the user can manually give input data, and the manual giving can be operated through the interface provided by the I/O interface 112.
  • the client device 140 can automatically send input data to the I/O interface 112. If the client device 140 is required to automatically send input data and needs to obtain the user's authorization, the user can set the corresponding authority in the client device 140.
  • the user can view the results output by the execution device 110 on the client device 140, and the specific presentation form can be a specific method such as display, sound, action, etc.
  • the client device 140 can also be used as a data acquisition terminal to collect the input data of the input I/O interface 112 and the output results of the output I/O interface 112 as shown in the figure as new sample data, and store them in the database 130.
  • the I/O interface 112 directly stores the input data of the input I/O interface 112 and the output results of the output I/O interface 112 as new sample data in the database 130.
  • FIG3 is only a schematic diagram of a system architecture provided by an embodiment of the present application, and the positional relationship between the devices, components, modules, etc. shown in the figure does not constitute any limitation.
  • the data storage system 150 is an external memory relative to the execution device 110. In other cases, the data storage system 150 can also be placed in the execution device 110.
  • a neural network can be obtained by training according to the training device 120.
  • the embodiment of the present application also provides a chip, which includes a neural network processor NPU.
  • the chip can be set in the execution device 110 as shown in Figure 3 to complete the calculation work of the calculation module 111.
  • the chip can also be set in the training device 120 as shown in Figure 3 to complete the training work of the training device 120 and output the target model/rule.
  • Neural network processor NPU is mounted on the main central processing unit (CPU) (host CPU) as a coprocessor, and the main CPU assigns tasks.
  • the core part of NPU is the operation circuit, and the controller controls the operation circuit to extract data from the memory (weight memory or input memory) and perform operations.
  • the arithmetic circuit includes multiple processing units (process engines, PEs) internally.
  • the arithmetic circuit is a two-dimensional systolic array.
  • the arithmetic circuit can also be a one-dimensional systolic array or other electronic circuits capable of performing mathematical operations such as multiplication and addition.
  • the arithmetic circuit is a general-purpose matrix processor.
  • the operation circuit takes the corresponding data of matrix B from the weight memory and caches it on each PE in the operation circuit.
  • the operation circuit takes the matrix A data from the input memory and performs matrix operations with matrix B.
  • the partial results or final results of the matrix are stored in the accumulator.
  • the vector calculation unit can further process the output of the operation circuit, such as vector multiplication, vector addition, exponential operation, logarithmic operation, size comparison, etc.
  • the vector calculation unit can be used for network calculations of non-convolutional/non-FC layers in neural networks, such as pooling, batch normalization, local response normalization, etc.
  • the vector computation unit can store the processed output vector to a unified buffer.
  • the vector computation unit can apply a nonlinear function to the output of the computation circuit, such as a vector of accumulated values, to generate an activation value.
  • the vector computation unit generates a normalized value, a merged value, or both.
  • the processed output vector can be used as an activation input to the computation circuit, such as for use in a subsequent layer in a neural network.
  • the unified memory is used to store input data and output data.
  • the weight data is directly transferred from the external memory to the input memory and/or the unified memory through the direct memory access controller (DMAC), the weight data in the external memory is stored in the weight memory, and the data in the unified memory is stored in the external memory.
  • DMAC direct memory access controller
  • the bus interface unit (BIU) is used to enable interaction between the main CPU, DMAC and instruction fetch memory through the bus.
  • An instruction fetch buffer connected to the controller, used to store instructions used by the controller
  • the controller is used to call the instructions cached in the memory to control the working process of the computing accelerator.
  • the unified memory, input memory, weight memory and instruction fetch memory are all on-chip memories
  • the external memory is a memory outside the NPU, which can be a double data rate synchronous dynamic random access memory (DDR SDRAM), a high bandwidth memory (HBM) or other readable and writable memory.
  • DDR SDRAM double data rate synchronous dynamic random access memory
  • HBM high bandwidth memory
  • a neural network may be composed of neural units, and a neural unit may refer to an operation unit with xs and intercept 1 as input, and the output of the operation unit may be:
  • n is a natural number greater than 1
  • Ws is the weight of xs
  • b is the bias of the neural unit.
  • f is the activation function of the neural unit, which is used to introduce nonlinear characteristics into the neural network to convert the input signal in the neural unit into the output signal.
  • the output signal of the activation function can be used as the input of the next convolutional layer.
  • the activation function can be a sigmoid function.
  • a neural network is a network formed by connecting many of the above-mentioned single neural units together, that is, the output of one neural unit can be the input of another neural unit.
  • the input of each neural unit can be connected to the local receptive field of the previous layer to extract the characteristics of the local receptive field.
  • the local receptive field can be an area composed of several neural units.
  • space is used here because the classified object is not a single thing, but a class of things, and space refers to the collection of all individuals of this class of things.
  • W is a weight vector, and each value in the vector represents the weight value of a neuron in the neural network of this layer.
  • the vector W determines the spatial transformation from the input space to the output space described above, that is, the weight W of each layer controls how to transform the space.
  • the purpose of training a neural network is to finally obtain the weight matrix of all layers of the trained neural network (the weight matrix formed by many layers of vectors W). Therefore, the training process of a neural network is essentially about learning how to control spatial transformations, or more specifically, learning the weight matrix.
  • Neural networks can use the error back propagation (BP) algorithm to correct the size of the parameters in the initial neural network model during the training process, so that the reconstruction error loss of the neural network model becomes smaller and smaller. Specifically, the forward transmission of the input signal to the output will generate error loss, and the error loss information is back-propagated to update the parameters in the initial neural network model, so that the error loss converges.
  • the back propagation algorithm is a back propagation movement dominated by error loss, which aims to obtain the optimal parameters of the neural network model, such as the weight matrix.
  • the method provided in the present application is described below from the training side of the neural network and the application side of the neural network.
  • the dialogue data generation method provided in the embodiment of the present application can generate dialogue data between a user and a dialogue model, and use the dialogue data as training data to train the dialogue model, thereby obtaining a trained dialogue model.
  • the processing of data sequences is involved, which can be specifically applied to data training, machine learning, deep learning and other methods, and the training data (for example, the dialogue data in the dialogue data generation method provided in the embodiment of the present application) is symbolized and formalized for intelligent information modeling, extraction, preprocessing, training, etc., and finally a trained neural network (for example, the trained dialogue model in the dialogue data generation method provided in the embodiment of the present application) is obtained; and the data processing method provided in the embodiment of the present application can use the above-mentioned trained neural network to input input data (for example, the question in the data processing method provided in the embodiment of the present application) into the trained neural network to obtain output data (for example, the answer in the data processing method provided in the embodiment of the present application).
  • the dialogue data generation method and the data processing method provided in the embodiment of the present application are inventions based on the same concept, and can also be understood as two parts in a system, or two stages of an overall process: such as the model training stage and the model application stage.
  • FIG 4 is a structural diagram of the conversation data generation architecture provided in the embodiment of the present application.
  • the architecture includes: obtaining user data in non-text form and converting it into user data in text form. Next, new data generation rules can be generated based on the user data in text form combined with preset data generation rules. Then, the new data generation rules can be used to obtain conversation data. Finally, the target conversation data is filtered out from the conversation data, and the target conversation data can be used as training data to train the final model.
  • the workflow is further introduced below in conjunction with Figure 5.
  • Figure 5 is a flow diagram of the conversation data generation method provided in the embodiment of the present application. As shown in Figure 5, the method includes:
  • 501 Obtain user data, where the user data includes user attributes and items that the user is interested in.
  • User data may be collected first.
  • User data may generally include user attributes (for example, user's name, user's gender, user's age, etc.) and items of user interest (preference) (for example, items that the user has clicked on, items that the user has browsed, items that the user has commented on, etc.).
  • user data can be obtained in the following ways:
  • the user data that can be directly collected is in non-text form, so the collected non-text user data can be converted into text form to facilitate subsequent processing.
  • the user's attributes are generally located in the user's personal information. Therefore, the user's personal information can be collected first (the user's personal information is usually an image or a table, etc.). At this time, the user's attributes are presented in non-text forms such as image form or table form. Then, the user's attributes presented in non-text form can be converted into user attributes presented in text form from the user's personal information.
  • the items that users are interested in are generally located in the user's comments, browsing history, or click history. Therefore, the user's comments, the user's browsing history, or the user's click history can be collected first (the user's comments, the user's browsing history, or the user's click history is usually a table, etc.), and at this time, the items that users are interested in are presented in a non-text form such as a table. Then, the items that users are interested in presented in a non-text form can be converted from the user's comments, the user's browsing history, or the user's click history into items that users are interested in presented in a text form.
  • Figure 6 is a schematic diagram of the user data conversion process provided in an embodiment of the present application
  • the user's profile image, user comments, user browsing history, and user click history can be collected first.
  • the user's profile image presents the following user attribute information: (1) User: Li XX; (2) Age: 22; (3) Location: Shenzhen; (4) Interests: movies and music, etc. Then, the following user attribute information in text form can be identified from the user's profile image: Li XX, a 22-year-old male user living in Shenzhen, whose interests and hobbies are watching movies and listening to music, etc.
  • the user's comments include the following user's movie review information: (1) Movie 1 is the most interesting movie I have ever seen; (2) Movies 2 and 3 are boring, and their plots and performances are not outstanding, etc.
  • the user's browsing/clicking records include the following user's movie browsing information/movie clicking information: (1) Movies watched: Movie 1 and Movie 4, etc.; (2) Movies you want to watch: Movie 5, Movie 6, Movie 7, etc.; (3) Movies you have browsed: Movie 8, Movie 9, etc.
  • the following user movie preference information in text form can be extracted from the user's comments and the user's viewing/clicking records: User Zhang XX likes the following movies: Movie 5, Movie 6, Movie 7, Movie 8, Movie 9, etc., and user Zhang XX has watched the following movies: Movie 1 and Movie 4.
  • the user data can be input into the item sampling model (which is a trained neural network model) to perform a series of processing on the user data through the item sampling model, thereby obtaining items that can be recommended to the user.
  • the items that can be recommended to the user can be presented in the form of an item list, which includes not only the items that the user is interested in in the user data, but also the remaining items associated with the items that the user is interested in.
  • the item sampling model After a series of processing of the user data by the item sampling model, not only the recommended items but also the items that cannot be recommended to the user (that is, the items that the user is not interested in) can be obtained. It should be noted that the items that cannot be recommended to the user can also be presented in the form of an item list.
  • the item sampling model can obtain items that can be recommended to users and items that cannot be recommended to users in the following ways:
  • a preset candidate item pool may be obtained first.
  • the candidate item pool includes multiple candidate items. Therefore, the user data and the multiple candidate items may be input into the item sampling model, so that the item sampling model performs feature extraction (e.g., convolution operation, etc.) on the user data and the multiple candidate items respectively, thereby obtaining features of the user data and features of the multiple candidate items accordingly.
  • feature extraction e.g., convolution operation, etc.
  • the item sampling model can calculate the features of the user data and the features of the multiple candidate items, thereby obtaining the matching degree between the user data and the multiple candidate items, including the matching degree between the user data and the first candidate item, the matching degree between the user data and the second candidate item, ..., the matching degree between the user data and the last candidate item.
  • the item sampling model can determine the candidate items with a matching degree greater than or equal to the first threshold (the size of the first threshold can be set according to actual needs and is not limited here) among the multiple candidate items as items that can be recommended to the user. It should be noted that among the multiple candidate items, some of the candidate items are the same as the items that the user is interested in contained in the user data, so the matching degree between this part of the candidate items and the user data is the largest (significantly greater than the first threshold), and can be determined as items that can be recommended to the user.
  • the candidate items are associated with the items that the user is interested in contained in the user data, so the matching degree between this part of the candidate items and the user data is relatively large (greater than or equal to the first threshold), and can be determined as items that can be recommended to the user. It can be seen that the items that can be recommended to the user include not only the items that the user is interested in in the user data, but also the items associated with the items that the user is interested in.
  • the item sampling model can determine the candidate items with a matching degree less than or equal to the second threshold (the second threshold is less than the first threshold, and the size of the second threshold can be set according to actual needs and is not limited here) among the multiple candidate items as items that cannot be recommended to the user. It should be noted that among the multiple candidate items, some of the candidate items are completely irrelevant to the items that the user is interested in and included in the user data. Therefore, the matching degree between this part of the candidate items and the user data is relatively small (less than or equal to the second threshold), and they can be determined as items that cannot be recommended to the user, that is, items that the user is not interested in.
  • FIG. 7 is a schematic diagram of the acquisition process of the recommended items provided in the embodiment of the present application, and FIG7 is obtained on the basis of FIG6)
  • the candidate movie pool can be obtained, and the candidate movie pool includes 50 candidate movies including movie 1, movie 2, movie 3, ..., movie 50.
  • a recommended movie list and a non-recommended movie list can be obtained, and the recommended movie list includes: movie 1, movie 4, movie 5, ..., movie 20, and the non-recommended movie list includes: movie 2, movie 3, movie 21, ... movie 50.
  • the preset data generation rules are updated to obtain new data generation rules.
  • the preset data generation rules can be updated using the user data and the items that can be recommended to the user, thereby obtaining new data generation rules.
  • the items that can be recommended to the user and the items that cannot be recommended to the user update the preset data generation rules (also called preset data generation instructions) to obtain new data generation rules (also called new data generation instructions).
  • new data generation rules can be obtained in the following ways:
  • the preset data generation rules may include two parts, one part is the rules that do not need to be supplemented (i.e., complete rules), and the other part is the rules to be supplemented (i.e., incomplete rules), and the rules to be supplemented have slots that can be filled with content. Then, user data, recommended items, and non-recommended items can be filled into the slots of the rules to be supplemented, thereby obtaining the supplemented rules.
  • the rules that do not need to be supplemented and the supplemented rules constitute new data generation rules, wherein the rules that do not need to be supplemented are used to set the format of the dialogue data between the user and the dialogue model (for example, the number of question and answer rounds of the dialogue data, the way to start the dialogue data (i.e., the dialogue data is started in the form of small talk), the language style of the dialogue data, the behavioral norms of the user and the dialogue model in the dialogue data, the dialogue data must contain descriptions of items, etc.), and the supplemented rules are used to set the content of the dialogue data between the user and the dialogue model (for example, the dialogue data must consider the user's personal information, the dialogue data must present the user's recommendation needs, the range of recommended items that the dialogue model must meet in the dialogue data, etc.).
  • the rules that do not need to be supplemented are used to set the format of the dialogue data between the user and the dialogue model (for example, the number of question and answer rounds of the dialogue data, the way to start the dialogue data (
  • FIG8 is a schematic diagram of the acquisition process of the data generation rules provided in the embodiment of the present application, and FIG8 is obtained by drawing on the basis of FIG7)
  • 13 preset data generation instructions can be obtained, among which data generation instruction (5), data generation instruction (6), data generation instruction (7), and data generation instruction (10) are all incomplete rules, and the remaining data generation instructions are all complete rules.
  • the preset data generation instructions can be used to supplement the incomplete rules with user attribute information, user preference information, the recommended movie list, and the non-recommended movie list, thereby obtaining 13 new data generation instructions:
  • the dialogue data must contain 10 rounds of questions and answers, but not more than 20 rounds.
  • the dialogue model can only recommend one movie to the user in each round and cannot recommend movies to the user outside the recommended movie list.
  • the conversation model In the conversation data, the conversation model must explore the user’s taste and interest in movies and adjust the recommendation strategy based on user feedback.
  • the user is a 22-year-old male user living in Shenzhen. His hobbies include watching movies and listening to music, etc.
  • the user’s favorite movies are: Movie 1, Movie 4, Movie 5, Movie 6, Movie 7, Movie 8, Movie 9, and so on.
  • the movies that the user dislikes are: Movie 2 and Movie 3.
  • the new data generation rules can be input into the dialogue model (neural network model to be trained), so the dialogue model can generate dialogue data between the user and the dialogue model according to the new data generation rules.
  • the dialogue data between the user and the dialogue model usually includes multiple rounds of interaction, which include multiple rounds of ordinary dialogue and multiple rounds of question and answer.
  • Each round of ordinary dialogue includes a non-question sentence of the user and a reply of the dialogue model (or, each round of ordinary dialogue includes a non-question sentence of the dialogue model and a reply of the user), and each round of question and answer includes a question of the user and an answer of the dialogue model (or, each round of question and answer includes a question of the dialogue model and an answer of the user).
  • the user's question can be to ask the dialogue model to recommend items to the user, and the dialogue model's answer can be the item recommended by the dialogue model to the user.
  • the items recommended by the dialogue model to the user come from recommended items (this can simulate the user accepting the recommendation) or from unrecommended items (this can simulate the user rejecting the recommendation).
  • the user's words can be the chat initiated by the user to the dialogue model, and the dialogue model's reply can be the dialogue model's response to the user's chat, and so on.
  • the content of the final generated dialogue data includes not only the content of the chat between the user and the dialogue model, but also the content of the user accepting the items recommended by the dialogue model, and even the content of the user rejecting the items recommended by the dialogue model, so that the final generated dialogue data is closer to reality.
  • FIG. 9 is a schematic diagram of a process of acquiring dialogue data provided in an embodiment of the present application, and FIG. 9 is drawn on the basis of FIG. 8
  • the 13 new data generation instructions can be input into the dialogue model, so that the dialogue model generates the following dialogue data (including 10 rounds of interaction):
  • Dialogue model How about ⁇ Movie 4>? It's a classic [science fiction] movie.
  • Dialogue Model How about Movie 21? It's a suspenseful thriller with a great cast.
  • Dialogue model ⁇ Movie 15> How is this movie? It is a science fiction movie set in a spaceship.
  • Dialogue Model The main characters are [G] and [J], ⁇ They travel to a new planet in a spaceship. But they wake up from hibernation 90 years early and have to find a way to survive together ⁇ .
  • Dialogue Model Great! My other recommendation is Movie 1. It's a [dystopian] movie about a [teenage death-defying competition].
  • Dialogue Model How about ⁇ Movie 35>? This is another [dystopian] movie about ⁇ a society where people are divided into factions based on their personality traits ⁇ .
  • Dialogue Model How about ⁇ Movie 30>, which is ⁇ a story about a thief who pretends to be a warlord ⁇ .
  • the target dialogue data is used to train the dialogue model to obtain a trained dialogue model.
  • the dialogue data can be input into the data screening model (trained neural network model) to screen out several rounds of interaction from the multiple rounds of interaction contained in the dialogue data. These several rounds of interaction are the target dialogue data.
  • the target dialogue data satisfies at least one of the following: (1) All the texts contained in the target dialogue data are in a preset text set (all the texts contained in the preset text set are non-violation texts, which can also be understood as non-discriminatory, non-prejudiced and non-insulting texts). (2) The description of the object contained in the target dialogue data is consistent with the real description. (3) The objects contained in the target dialogue data are all real objects.
  • the richness of the content contained in the target dialogue data is greater than or equal to a third threshold (the size of the third threshold can be set according to actual needs and is not limited here), wherein the richness of the content contained in the target dialogue data can be calculated based on information such as the number of interaction rounds of the target dialogue data, the length of the target dialogue data, and the number of objects contained in the target dialogue data.
  • Figure 10 is a schematic diagram of the process of obtaining dialogue data provided by an embodiment of the present application, and Figure 10 is drawn on the basis of Figure 9), after obtaining the dialogue data, the dialogue data can be input into the data screening model.
  • the data screening model includes a violation detection module, an entity authenticity detection module, a description authenticity detection module, and a richness detection module, wherein, in the multiple rounds of interactions contained in the dialogue data, the violation detection module can eliminate interactions containing illegal information such as discrimination, prejudice, and insults, the entity authenticity detection module can (with the help of a knowledge graph or information library that records various information such as real movies, real entities, and the relationship between real movies and real entities, etc.) eliminate interactions containing unreal information such as unreal movies and unreal entities (directors, actors, plots), the description authenticity detection module can (with the help of a public search platform that records the real description (introduction) of each movie, etc.) eliminate interactions containing unreal information such as unreal movie descriptions, and the richness detection module can (based on the richness (based on the distinctiveness of questions and answers, questions and answers) The degree of distinction, the degree of difference ... The insufficient interactions are eliminated, and the remaining interactions constitute the target dialogue data.
  • the violation detection module can eliminate interactions containing illegal information such
  • the target dialogue data can be used as training data to train the dialogue model to obtain a trained dialogue model (trained neural network model), that is, a dialogue model with an item recommendation function.
  • a trained dialogue model trained neural network model
  • step 505 is optional. In actual applications, step 505 may not be performed, but the dialogue data obtained in step 504 may be directly used as training data to train the dialogue model and obtain a trained dialogue model.
  • the conversation data generated by the embodiment of the present application can be compared with the conversation data obtained (manually annotated) by the staff of the crowdsourcing project.
  • the comparison results are shown in Table 1:
  • the conversation data generated by the embodiment of the present application and the conversation data obtained (manually annotated) by the staff of the crowdsourcing project can be scored by four evaluators on four additional indicators, namely role consistency, fluency, informativeness and interestingness (the scores of these four indicators are all between 1 and 5 points, where 1 is the worst and 5 is the best), and the scoring results are shown in Figures 11 to 14 (Figure 11 is a schematic diagram of the scoring results provided by the embodiment of the present application, Figure 12 is another schematic diagram of the scoring results provided by the embodiment of the present application, Figure 13 is another schematic diagram of the scoring results provided by the embodiment of the present application, and Figure 14 is another schematic diagram of the scoring results provided by the embodiment of the present application).
  • the user data when it is necessary to generate the dialogue data between the user and the dialogue model, the user data may be obtained first, and the user data includes the attributes of the user and the items that the user is interested in. Then, the user data may be processed to obtain the recommended items, and the recommended items include the items that the user is interested in and the items associated with the items that the user is interested in. Then, the preset data generation rules may be updated using the user data and the recommended items, so as to obtain new data generation rules. Finally, the dialogue data between the user and the dialogue model may be generated according to the new data generation rules, and the dialogue data includes the items recommended to the user by the dialogue model, and the items recommended to the user by the dialogue model are from the recommended items.
  • a neural network model (item collection model, dialogue model and data screening model) is used to replace the manually generated dialogue data. Since the neural network model itself has powerful learning and understanding capabilities, it can accurately generate high-quality dialogue data according to data generation rules, which is beneficial to subsequent data cleaning and evaluation, and can enable the dialogue model obtained by subsequent training to have better performance.
  • FIG. 15 is a flow chart of the data processing method provided in the embodiment of the present application. As shown in FIG. 15 , the method includes:
  • the user's question can be input into the trained dialogue model in the embodiment shown in Figure 5, so as to process the user through the trained dialogue model to obtain an answer corresponding to the question.
  • the answer is used to describe the item recommendation result for the user, that is, the item recommended to the user.
  • FIG16 is a structural diagram of the conversation data generation device provided in the embodiment of the present application. As shown in FIG16, the device includes:
  • the acquisition module 1601 is used to acquire user data, where the user data includes user attributes and items that the user is interested in;
  • a determination module 1602 configured to determine recommendable items based on user data, wherein the recommendable items include items that the user is interested in, and items associated with the items that the user is interested in;
  • the generation module 1604 is used to generate dialogue data between the user and the dialogue model based on the new data generation rule, where the dialogue data includes items recommended by the dialogue model to the user, and the items recommended by the dialogue model to the user are from the recommendable items.
  • the user data when it is necessary to generate the dialogue data between the user and the dialogue model, the user data may be obtained first, and the user data includes the attributes of the user and the items that the user is interested in. Then, the user data may be processed to obtain the recommended items, and the recommended items include the items that the user is interested in and the items associated with the items that the user is interested in. Then, the preset data generation rules may be updated using the user data and the recommended items, so as to obtain new data generation rules. Finally, the dialogue data between the user and the dialogue model may be generated according to the new data generation rules, and the dialogue data includes the items recommended to the user by the dialogue model, and the items recommended to the user by the dialogue model are from the recommended items.
  • the above process provides a dialogue data generation framework, which may obtain new data generation rules using the data generation rules preset by the collected user data set, and obtain the dialogue data between the user and the dialogue model using the new data generation rules. It can be seen that the framework can automatically generate dialogue data, and the entire generation process of dialogue data does not require manual intervention, which can effectively improve the generation efficiency of dialogue data and reduce the generation cost of dialogue data.
  • the determination module is further used to determine non-recommended items based on user data; the update module is used to update preset data generation rules based on user data, recommendable items and non-recommended items to obtain new data generation rules.
  • the determination module is used to: extract features from user data and multiple candidate items to obtain features of the user data and features of the multiple candidate items; calculate the features of the user data and features of the multiple candidate items to obtain a matching degree between the user data and the multiple candidate items; and determine a candidate item having a matching degree greater than or equal to a first threshold as a recommendable item.
  • the determination module is used to determine candidate items whose matching degree is less than or equal to a second threshold as non-recommended items, where the second threshold is less than the first threshold.
  • the preset data generation rules include rules that do not need to be supplemented and rules to be supplemented
  • the update module is used to: fill the user data, recommended items and non-recommended items into the rules to be supplemented to obtain the supplemented rules.
  • the rules that do not need to be supplemented and the supplemented rules constitute new data generation rules.
  • the rules that do not need to be supplemented are used to set the format of the dialogue data, and the supplemented rules are used to set the content of the dialogue data.
  • the device also includes: a screening module, used to obtain target conversation data from the conversation data, and the target conversation data satisfies at least one of the following: all texts contained in the target conversation data are located in a preset text set; the description of the object contained in the target conversation data conforms to the real description; the object contained in the target conversation data is a real object; the richness of the content contained in the target conversation data is greater than or equal to a third threshold.
  • a screening module used to obtain target conversation data from the conversation data, and the target conversation data satisfies at least one of the following: all texts contained in the target conversation data are located in a preset text set; the description of the object contained in the target conversation data conforms to the real description; the object contained in the target conversation data is a real object; the richness of the content contained in the target conversation data is greater than or equal to a third threshold.
  • the device further includes: a training module, configured to train the dialogue model based on target dialogue data to obtain a trained dialogue model.
  • FIG. 17 is a schematic diagram of a structure of a data processing device provided in an embodiment of the present application. As shown in FIG. 17 , the device includes:
  • the acquisition module 1701 is used to acquire the user's question, which is used to describe the user's item recommendation needs.
  • the processing module 1702 is used to input the user's question into the trained dialogue model to obtain an answer corresponding to the question, and the answer is used to describe the item recommendation result for the user.
  • FIG18 is a schematic diagram of the structure of the execution device provided by the present application.
  • the execution device 1800 can be specifically a mobile phone, a tablet, a laptop, a smart wearable device, a server, etc., which is not limited here.
  • the execution device 1800 can be deployed with the data processing device described in the corresponding embodiment of FIG17 to implement FIG15. The function of data processing in the corresponding embodiment.
  • the execution device 1800 includes: a receiver 1801, a transmitter 1802, a processor 1803 and a memory 1804 (wherein the number of processors 1803 in the execution device 1800 can be one or more, and one processor is taken as an example in FIG18), wherein the processor 1803 may include an application processor 18031 and a communication processor 18032.
  • the receiver 1801, the transmitter 1802, the processor 1803 and the memory 1804 may be connected via a bus or other means.
  • the memory 1804 may include a read-only memory and a random access memory, and provides instructions and data to the processor 1803. A portion of the memory 1804 may also include a non-volatile random access memory (NVRAM).
  • NVRAM non-volatile random access memory
  • the memory 1804 stores processor and operation instructions, executable modules or data structures, or subsets thereof, or extended sets thereof, wherein the operation instructions may include various operation instructions for implementing various operations.
  • the processor 1803 controls the operation of the execution device.
  • the various components of the execution device are coupled together through a bus system, wherein the bus system includes not only a data bus but also a power bus, a control bus, and a status signal bus, etc.
  • the bus system includes not only a data bus but also a power bus, a control bus, and a status signal bus, etc.
  • various buses are referred to as bus systems in the figure.
  • the method disclosed in the above embodiment of the present application can be applied to the processor 1803, or implemented by the processor 1803.
  • the processor 1803 can be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit in the processor 1803 or the instruction in the form of software.
  • the above processor 1803 can be a general processor, a digital signal processor (digital signal processing, DSP), a microprocessor or a microcontroller, and can further include an application specific integrated circuit (application specific integrated circuit, ASIC), a field programmable gate array (field-programmable gate array, FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components.
  • the processor 1803 can implement or execute the methods, steps and logic block diagrams disclosed in the embodiments of the present application.
  • the general processor can be a microprocessor or the processor can also be any conventional processor, etc.
  • the steps of the method disclosed in the embodiment of the present application can be directly embodied as a hardware decoding processor to be executed, or a combination of hardware and software modules in the decoding processor can be executed.
  • the software module may be located in a storage medium mature in the art, such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc.
  • the storage medium is located in the memory 1804, and the processor 1803 reads the information in the memory 1804 and completes the steps of the above method in combination with its hardware.
  • the receiver 1801 can be used to receive input digital or character information and generate signal input related to the relevant settings and function control of the execution device.
  • the transmitter 1802 can be used to output digital or character information through the first interface; the transmitter 1802 can also be used to send instructions to the disk group through the first interface to modify the data in the disk group; the transmitter 1802 can also include a display device such as a display screen.
  • the processor 1803 is used to obtain an answer corresponding to the user's question through the trained dialogue model in the corresponding embodiment of Figure 15.
  • FIG. 19 is a structural schematic diagram of the training device provided by the embodiment of the present application.
  • the training device 1900 is implemented by one or more servers.
  • the training device 1900 may have relatively large differences due to different configurations or performances, and may include one or more central processing units (CPU) 1919 (for example, one or more processors) and a memory 1932, and one or more storage media 1930 (for example, one or more mass storage devices) storing application programs 1942 or data 1944.
  • the memory 1932 and the storage medium 1930 can be short-term storage or permanent storage.
  • the program stored in the storage medium 1930 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations in the training device. Furthermore, the central processor 1919 can be configured to communicate with the storage medium 1930 to execute a series of instruction operations in the storage medium 1930 on the training device 1900.
  • the training device 1900 may also include one or more power supplies 1926, one or more wired or wireless network interfaces 1950, one or more input and output interfaces 1958; or, one or more operating systems 1941, such as Windows ServerTM, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM, etc.
  • the training device can execute the dialogue data generation method in the embodiment corresponding to Figure 5 to obtain dialogue data between the user and the dialogue model, and then train the dialogue model based on the dialogue data to obtain a trained dialogue model.
  • An embodiment of the present application also relates to a computer storage medium, in which a program for signal processing is stored.
  • the program When the program is run on a computer, the computer executes the steps executed by the aforementioned execution device, or the computer executes the steps executed by the aforementioned training device.
  • An embodiment of the present application also relates to a computer program product, which stores instructions, which, when executed by a computer, enable the computer to execute the steps executed by the aforementioned execution device, or enable the computer to execute the steps executed by the aforementioned training device.
  • the execution device, training device or terminal device provided in the embodiments of the present application may specifically be a chip, and the chip includes: a processing unit and a communication unit, wherein the processing unit may be, for example, a processor, and the communication unit may be, for example, an input/output interface, a pin or a circuit, etc.
  • the processing unit may execute the computer execution instructions stored in the storage unit so that the chip in the execution device executes the data processing method described in the above embodiment, or so that the chip in the training device executes the data processing method described in the above embodiment.
  • the storage unit is a storage unit in the chip, such as a register, a cache, etc.
  • the storage unit may also be a storage unit located outside the chip in the wireless access device end, such as a read-only memory (ROM) or other types of static storage devices that can store static information and instructions, a random access memory (RAM), etc.
  • ROM read-only memory
  • RAM random access memory
  • FIG. 20 is a schematic diagram of the structure of a chip provided in an embodiment of the present application.
  • the chip can be expressed as a neural network processor NPU 2000.
  • NPU 2000 is mounted on the host CPU (Host CPU) as a coprocessor, and tasks are assigned by the Host CPU.
  • the core part of the NPU is the operation circuit 2003, which is controlled by the controller 2004 to extract matrix data from the memory and perform multiplication operations.
  • the operation circuit 2003 includes multiple processing units (Process Engine, PE) inside.
  • the operation circuit 2003 is a two-dimensional systolic array.
  • the operation circuit 2003 can also be a one-dimensional systolic array or other electronic circuits that can perform mathematical operations such as multiplication and addition.
  • the operation circuit 2003 is a general-purpose matrix processor.
  • the operation circuit takes the corresponding data of matrix B from the weight memory 2002 and caches it on each PE in the operation circuit.
  • the operation circuit takes the matrix A data from the input memory 2001 and performs matrix operation with matrix B.
  • the partial result or final result of the matrix is stored in the accumulator 2008.
  • the unified memory 2006 is used to store input data and output data.
  • the weight data is directly transferred to the weight memory 2002 through the direct memory access controller (DMAC) 2005.
  • the input data is also transferred to the unified memory 2006 through the DMAC.
  • DMAC direct memory access controller
  • BIU stands for Bus Interface Unit, that is, bus interface unit 2013, which is used for the interaction between AXI bus and DMAC and instruction fetch buffer (IFB) 2009.
  • IFB instruction fetch buffer
  • the bus interface unit 2013 (Bus Interface Unit, BIU for short) is used for the instruction fetch memory 2009 to obtain instructions from the external memory, and is also used for the storage unit access controller 2005 to obtain the original data of the input matrix A or the weight matrix B from the external memory.
  • DMAC is mainly used to transfer input data in the external memory DDR to the unified memory 2006 or to transfer weight data to the weight memory 2002 or to transfer input data to the input memory 2001.
  • the vector calculation unit 2007 includes multiple operation processing units, and when necessary, further processes the output of the operation circuit 2003, such as vector multiplication, vector addition, exponential operation, logarithmic operation, size comparison, etc. It is mainly used for non-convolutional/fully connected layer network calculations in neural networks, such as Batch Normalization, pixel-level summation, upsampling of the predicted label plane, etc.
  • the vector calculation unit 2007 can store the processed output vector to the unified memory 2006.
  • the vector calculation unit 2007 can apply a linear function; or a nonlinear function to the output of the operation circuit 2003, such as linear interpolation of the predicted label plane extracted by the convolution layer, and then, for example, a vector of accumulated values to generate an activation value.
  • the vector calculation unit 2007 generates a normalized value, a pixel-level summed value, or both.
  • the processed output vector can be used as an activation input to the operation circuit 2003, for example, for use in a subsequent layer in a neural network.
  • An instruction fetch buffer 2009 connected to the controller 2004, for storing instructions used by the controller 2004;
  • the unified memory 2006, the input memory 2001, the weight memory 2002 and the instruction fetch memory 2009 are all on-chip memories.
  • the external memory is private to the NPU hardware architecture.
  • the processor mentioned in any of the above places may be a general-purpose central processing unit, a microprocessor, an ASIC, or one or more integrated circuits for controlling the execution of the above program.
  • the device embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed over multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment.
  • the connection relationship between the modules indicates that there is a communication connection between them, which may be specifically implemented as one or more communication buses or signal lines.
  • the technicians in the relevant field can clearly understand that the present application can be implemented by software. It can be implemented by hardware, and of course it can also be implemented by dedicated hardware including dedicated integrated circuits, dedicated CPUs, dedicated memories, dedicated components, etc. In general, all functions performed by computer programs can be easily implemented by corresponding hardware, and the specific hardware structures used to implement the same function can also be various, such as analog circuits, digital circuits or dedicated circuits. However, for this application, software program implementation is a better implementation method in most cases.
  • the technical solution of the present application is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a readable storage medium, such as a computer floppy disk, U disk, mobile hard disk, ROM, RAM, disk or optical disk, etc., including a number of instructions to enable a computer device (which can be a personal computer, training equipment, or network equipment, etc.) to execute the methods described in each embodiment of the present application.
  • a readable storage medium such as a computer floppy disk, U disk, mobile hard disk, ROM, RAM, disk or optical disk, etc.
  • all or part of the embodiments may be implemented by software, hardware, firmware or any combination thereof.
  • all or part of the embodiments may be implemented in the form of a computer program product.
  • the computer program product includes one or more computer instructions.
  • the computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices.
  • 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.
  • the computer instructions may be transmitted from a website site, a computer, a training device, or a 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, training device, or data center.
  • the computer-readable storage medium may be any available medium that a computer can store or a data storage device such as a training device, a data center, etc. that includes one or more available media integrations.
  • 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 (SSD)), etc.
  • a magnetic medium e.g., a floppy disk, a hard disk, a tape
  • an optical medium e.g., a DVD
  • a semiconductor medium e.g., a solid-state drive (SSD)

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Databases & Information Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Mathematical Physics (AREA)
  • Data Mining & Analysis (AREA)
  • General Physics & Mathematics (AREA)
  • Artificial Intelligence (AREA)
  • Computational Linguistics (AREA)
  • Biomedical Technology (AREA)
  • Molecular Biology (AREA)
  • Computing Systems (AREA)
  • General Health & Medical Sciences (AREA)
  • Evolutionary Computation (AREA)
  • Biophysics (AREA)
  • Software Systems (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Health & Medical Sciences (AREA)
  • Human Computer Interaction (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The present application discloses a dialogue data generation method and a related device, which can effectively improve the generation efficiency of dialogue data and reduce the generation cost of dialogue data. The method of the present application comprises: when dialogue data between a user and a dialogue model needs to be generated, acquire user data, the user data comprising attributes of the user and items that the user is interested in; processing the user data to obtain recommendable items, the recommendable items comprising the items that the user is interested in and items associated with the items that the user is interested in; updating a preset data generation rule on the basis of the user data and the recommendable items, so as to obtain a new data generation rule; and generating the dialogue data between the user and the dialogue model according to the new data generation rule, wherein the dialogue data comprises items recommended by the dialogue model to the user, and the items recommended by the dialogue model to the user are from the recommendable items.

Description

一种对话数据生成方法及其相关设备A method for generating dialogue data and related device

本申请要求于2023年6月16日提交国家知识产权局、申请号为202310724012.8、发明名称为“一种对话数据生成方法及其相关设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims priority to a Chinese patent application filed with the State Intellectual Property Office on June 16, 2023, with application number 202310724012.8 and invention name “A method for generating conversation data and related devices”, the entire contents of which are incorporated by reference in this application.

技术领域Technical Field

本申请实施例涉及人工智能(artificial intelligence,AI)技术领域,尤其涉及一种对话数据生成方法及其相关设备。The embodiments of the present application relate to the field of artificial intelligence (AI) technology, and in particular to a method for generating dialogue data and related equipment.

背景技术Background Art

在人工智能生成内容(AI-generated content,AIGC)中,具备物品推荐功能的对话模型(语言大模型)表现出了强大的自然语言理解能力以及沟通能力,该模型可通过与用户进行对话的方式来为用户推荐物品(item),从而满足用户的物品推荐需求。In AI-generated content (AIGC), the conversational model (language big model) with item recommendation function has demonstrated strong natural language understanding and communication capabilities. The model can recommend items to users by having conversations with them, thereby meeting users' item recommendation needs.

为了训练出具备物品推荐功能的对话模型,可先通过众包工程来获取用于模型训练的对话数据。具体地,众包工程中的工作人员可分别扮演用户以及对话模型,按照预置的知识图谱提供的信息来生成用户以及对话模型之间的对话数据,对话数据中的相关内容以及对话模型推荐给用户的物品均由工作人员从知识图谱中提取。那么,可利用对话数据来训练推荐模型,所得到训练后的推荐模型可学习用户的兴趣和偏好,从而为用户推荐物品。In order to train a conversation model with item recommendation function, we can first obtain conversation data for model training through crowdsourcing projects. Specifically, the staff in the crowdsourcing project can play the role of users and conversation models respectively, and generate conversation data between users and conversation models according to the information provided by the preset knowledge graph. The relevant content in the conversation data and the items recommended to users by the conversation model are extracted by the staff from the knowledge graph. Then, the conversation data can be used to train the recommendation model, and the trained recommendation model can learn the interests and preferences of users, so as to recommend items to users.

上述过程中,对话数据的整个生成过程均需要由众包工程的工作人员负责,需要耗费大量的时间,即人力成本过高。In the above process, the entire process of generating dialogue data needs to be the responsibility of the crowdsourcing project staff, which takes a lot of time, that is, the labor cost is too high.

发明内容Summary of the invention

本申请实施例提供了一种对话数据生成方法及其相关设备,可有效提升对话数据的生成效率,减小对话数据的生成成本。The embodiments of the present application provide a method for generating conversation data and related devices thereof, which can effectively improve the efficiency of generating conversation data and reduce the cost of generating conversation data.

本申请实施例的第一方面提供了一种对话数据生成方法,该方法包括:A first aspect of an embodiment of the present application provides a method for generating conversation data, the method comprising:

当需要获取对话数据时,可先采集用户数据,用户数据通常可包含用户的属性以及用户感兴趣的物品,其中,用户的属性可包含用户的姓名、用户的性别以及用户的年龄等等,用户感兴趣的物品可包含用户曾经点击过的物品、用户浏览过的物品以及用户评论过的物品等等。When it is necessary to obtain conversation data, user data may be collected first. User data may generally include user attributes and items that the user is interested in. The user attributes may include the user's name, the user's gender, and the user's age, etc. The items that the user is interested in may include items that the user has clicked on, items that the user has browsed, items that the user has commented on, etc.

得到用户数据后,可对用户数据进行一系列的处理,从而得到可推荐给用户的物品。需要说明的是,可推荐给用户的物品不仅包含用户数据中的用户感兴趣的物品,还包含与用户感兴趣的物品相关联的其余物品。After obtaining the user data, a series of processing can be performed on the user data to obtain items that can be recommended to the user. It should be noted that the items that can be recommended to the user include not only the items that the user is interested in in the user data, but also other items associated with the items that the user is interested in.

得到可推荐给用户的物品后,可利用用户数据以及可推荐给用户的物品,对预置的数据生成规则进行更新,从而得到新的数据生成规则。需要说明的是,新的数据生成规则不仅约束了用户与对话模型之间的对话数据的格式,还约束了用户与对话模型之间的对话数据的内容。After obtaining the items that can be recommended to the user, the preset data generation rules can be updated using the user data and the items that can be recommended to the user, thereby obtaining new data generation rules. It should be noted that the new data generation rules not only constrain the format of the dialogue data between the user and the dialogue model, but also constrain the content of the dialogue data between the user and the dialogue model.

得到新的数据生成规则后,可按照新的数据生成规则,生成用户与对话模型之间的对话数据。需要说明的是,用户与对话模型之间的对话数据通常包含多轮交互,多轮交互包含多轮普通对话以及多轮问答,每一轮普通对话包含用户的一句非提问的话以及对话模型的一个答复(或者,每一轮普通对话包含对话模型的一句非提问的话以及用户的一个答复),每一轮问答包含用户的一个提问以及对话模型的一个回答(或者,每一轮问答包含对话模型的一个提问以及用户的一个回答)。After obtaining the new data generation rules, the dialogue data between the user and the dialogue model can be generated according to the new data generation rules. It should be noted that the dialogue data between the user and the dialogue model usually includes multiple rounds of interaction, which include multiple rounds of ordinary dialogue and multiple rounds of question and answer. Each round of ordinary dialogue includes a non-question sentence of the user and a reply of the dialogue model (or, each round of ordinary dialogue includes a non-question sentence of the dialogue model and a reply of the user), and each round of question and answer includes a question of the user and an answer of the dialogue model (or, each round of question and answer includes a question of the dialogue model and an answer of the user).

从上述方法可以看出:当需要生成用户和对话模型之间的对话数据时,可先获取用户数据,用户数据包含用户的属性和用户感兴趣的物品。接着,可对用户数据进行处理,从而得到可推荐的物品,可推荐的物品包含用户感兴趣的物品以及与用户感兴趣的物品相关联的物品。然后,可利用用户数据和可推荐的物品,对预置的数据生成规则进行更新,从而得到新的数据生成规则。最后,可按照新的数据生成规则,以生成用户与对话模型之间的对话数据,对话数据包含对话模型向用户推荐的物品,对话模型向用户推荐的物品来自可推荐的物品。前述过程提供了一种对话数据生成框架,该框架可利用采集得到的 用户数据集合预置的数据生成规则来获取新的数据生成规则,并利用新的数据生成规来得到用户与对话模型之间的对话数据,由此可见,该框架可自动生成对话数据,对话数据的整个生成过程不需人工干预,可有效提升对话数据的生成效率,减小对话数据的生成成本。It can be seen from the above method that when it is necessary to generate dialogue data between a user and a dialogue model, the user data may be obtained first. The user data includes the user's attributes and the items that the user is interested in. Next, the user data may be processed to obtain recommended items. The recommended items include items that the user is interested in and items related to the items that the user is interested in. Then, the preset data generation rules may be updated using the user data and the recommended items to obtain new data generation rules. Finally, the new data generation rules may be used to generate dialogue data between the user and the dialogue model. The dialogue data includes items recommended to the user by the dialogue model. The items recommended to the user by the dialogue model come from the recommended items. The above process provides a dialogue data generation framework, which can be used to collect The data generation rules preset in the user data set are used to obtain new data generation rules, and the new data generation rules are used to obtain the conversation data between the user and the conversation model. It can be seen that the framework can automatically generate conversation data, and the entire generation process of conversation data does not require human intervention, which can effectively improve the generation efficiency of conversation data and reduce the generation cost of conversation data.

在一种可能实现的方式中,该方法还包括:基于用户数据确定不可推荐的物品;基于用户数据和可推荐的物品,更新预置的数据生成规则,得到新的数据生成规则包括:基于用户数据、可推荐的物品和不可推荐的物品,更新预置的数据生成规则,得到新的数据生成规则。前述实现方式中,在对用户数据进行一系列的处理后,不仅可以得到可推荐的物品,还可得到不可推荐给用户的物品(也就是用户不感兴趣的物品)。那么,可利用用户数据、可推荐给用户的物品以及不可推荐给用户的物品,对预置的数据生成规则进行更新,从而得到新的数据生成规则。如此一来,新的数据生成规则可令用户以及对话模型之间的对话数据包含以下多项内容:用户接受对话模型所推荐的物品以及用户拒绝对话模型所推荐的物品,故可以使得最后生成的对话数据更加贴合实际。In one possible implementation, the method further includes: determining non-recommended items based on user data; updating preset data generation rules based on user data and recommended items, and obtaining new data generation rules includes: updating preset data generation rules based on user data, recommended items, and non-recommended items, and obtaining new data generation rules. In the aforementioned implementation, after a series of processing of user data, not only recommended items can be obtained, but also items that cannot be recommended to users (that is, items that users are not interested in) can be obtained. Then, the preset data generation rules can be updated using user data, items that can be recommended to users, and items that cannot be recommended to users, thereby obtaining new data generation rules. In this way, the new data generation rules can make the dialogue data between the user and the dialogue model include the following multiple contents: the user accepts the items recommended by the dialogue model and the user rejects the items recommended by the dialogue model, so that the dialogue data finally generated can be more in line with reality.

在一种可能实现的方式中,基于用户数据确定可推荐的物品包括:对用户数据以及多个候选物品进行特征提取,得到用户数据的特征以及多个候选物品的特征;对用户数据的特征以及多个候选物品的特征进行计算,得到用户数据与多个候选物品之间的匹配度;将匹配度大于或等于第一阈值的候选物品确定为可推荐的物品。前述实现方式中,在得到用户数据后,可先获取多个候选物品,故可对用户数据以及多个候选物品分别进行特征提取,从而相应得到用户数据的特征以及多个候选物品的特征。得到用户数据的特征以及多个候选物品的特征后,可对用户数据的特征以及多个候选物品的特征进行一系列的计算,从而得到用户数据与多个候选物品之间的匹配度,也就是用户数据与第一个候选物品之间的匹配度,用户数据与第二个候选物品之间的匹配度,...,用户数据与最后一个候选物品之间的匹配度。得到用户数据与多个候选物品之间的匹配度后,可在多个候选物品中,将匹配度大于或等于第一阈值的候选物品确定为可推荐给用户的物品。如此一来,可以准确地得到用户感兴趣的物品以及与用户感兴趣的物品相关联的物品,以此作为可推荐给用户的物品。In a possible implementation, determining the recommendable items based on user data includes: extracting features from the user data and multiple candidate items to obtain features of the user data and multiple candidate items; calculating the features of the user data and multiple candidate items to obtain the degree of matching between the user data and the multiple candidate items; and determining the candidate items whose degree of matching is greater than or equal to a first threshold as recommendable items. In the aforementioned implementation, after obtaining the user data, multiple candidate items may be first obtained, so that the features of the user data and the multiple candidate items may be extracted respectively, thereby obtaining the features of the user data and the multiple candidate items accordingly. After obtaining the features of the user data and the multiple candidate items, a series of calculations may be performed on the features of the user data and the multiple candidate items to obtain the degree of matching between the user data and the multiple candidate items, that is, the degree of matching between the user data and the first candidate item, the degree of matching between the user data and the second candidate item, ..., the degree of matching between the user data and the last candidate item. After obtaining the degree of matching between the user data and the multiple candidate items, the candidate items whose degree of matching is greater than or equal to the first threshold may be determined as items that can be recommended to the user among the multiple candidate items. In this way, the items that the user is interested in and the items related to the items that the user is interested in can be accurately obtained as items that can be recommended to the user.

在一种可能实现的方式中,基于用户数据确定不可推荐的物品包括:将匹配度小于或等于第二阈值的候选物品确定为不可推荐的物品,第二阈值小于第一阈值。前述实现方式中,得到用户数据与多个候选物品之间的匹配度后,可在多个候选物品中,将匹配度小于或等于第二阈值的候选物品确定为不可推荐给用户的物品。如此一来,可以准确地得到用户不感兴趣的物品,以此作为不可推荐给用户的物品。In one possible implementation, determining the unrecommended items based on the user data includes: determining the candidate items with a matching degree less than or equal to a second threshold as unrecommended items, where the second threshold is less than the first threshold. In the aforementioned implementation, after obtaining the matching degree between the user data and multiple candidate items, the candidate items with a matching degree less than or equal to the second threshold can be determined as unrecommended items from among the multiple candidate items. In this way, items that the user is not interested in can be accurately obtained as items that cannot be recommended to the user.

在一种可能实现的方式中,预置的数据生成规则包含不需补充的规则以及待补充的规则,基于用户数据、可推荐的物品和不可推荐的物品,更新预置的数据生成规则,得到新的数据生成规则包括:将用户数据、可推荐的物品和不可推荐的物品填充至待补充的规则,得到补充后的规则,不需补充的规则以及补充后的规则构成新的数据生成规则,不需补充的规则用于设置对话数据的格式,补充后的规则用于设置对话数据的内容。前述实现方式中,预置的数据生成规则可包含两部分,一部分为不需补充的规则,另一部分为待补充的规则,待补充的规则具有可填充内容的槽位。那么,可将用户数据、可推荐的物品和不可推荐的物品填充至待补充的规则的槽位中,从而得到补充后的规则。如此一来,不需补充的规则以及补充后的规则构成了新的数据生成规则,其中,不需补充的规则用于设置用户与对话模型之间的对话数据的格式,补充后的规则用于设置用户与对话模型之间的对话数据的内容。那么,基于新的数据生成规则所得到的对话数据,具备一定的格式,且其包含的内容,不仅有用户与对话模型之间进行闲聊的内容,还有用户接受对话模型所推荐的物品的内容,更可以有用户拒绝对话模型所推荐的物品的内容,从而使得最终生成得到的对话数据更贴近于实际。In a possible implementation, the preset data generation rules include rules that do not need to be supplemented and rules to be supplemented. Based on user data, recommended items and non-recommended items, the preset data generation rules are updated to obtain new data generation rules, including: filling user data, recommended items and non-recommended items into the rules to be supplemented, obtaining supplemented rules, the rules that do not need to be supplemented and the supplemented rules constitute new data generation rules, the rules that do not need to be supplemented are used to set the format of dialogue data, and the supplemented rules are used to set the content of dialogue data. In the above implementation, the preset data generation rules may include two parts, one part is the rules that do not need to be supplemented, and the other part is the rules to be supplemented, and the rules to be supplemented have slots that can be filled with content. Then, user data, recommended items and non-recommended items can be filled into the slots of the rules to be supplemented, thereby obtaining supplemented rules. In this way, the rules that do not need to be supplemented and the supplemented rules constitute new data generation rules, wherein the rules that do not need to be supplemented are used to set the format of dialogue data between the user and the dialogue model, and the supplemented rules are used to set the content of dialogue data between the user and the dialogue model. Then, the dialogue data obtained based on the new data generation rules has a certain format, and its content includes not only the content of the chat between the user and the dialogue model, but also the content of the user accepting the items recommended by the dialogue model, and even the content of the user rejecting the items recommended by the dialogue model, so that the final generated dialogue data is closer to reality.

在一种可能实现的方式中,该方法还包括:从对话数据中获取目标对话数据,目标对话数据满足以下至少一项:目标对话数据包含的所有文字均位于预置的文字集合中;目标对话数据包含的针对物品的描述符合真实的描述;目标对话数据包含的物品为真实的物品;目标对话数据包含的内容的丰富度大于或等于第三阈值。前述实现方式中,得到用户与对话模型之间的对话数据后,可从对话数据所包含的多轮交互中,将不满足条件的若干轮交互剔除,并筛选出满足条件的若干轮交互,这若干轮交互即目标对话数据,至此,可完整数据清洗以及评测,所得到的目标对话数据可作为训练数据。In one possible implementation, the method further includes: obtaining target dialogue data from the dialogue data, where the target dialogue data satisfies at least one of the following: all texts contained in the target dialogue data are in a preset text set; the description of the object contained in the target dialogue data conforms to the real description; the object contained in the target dialogue data is a real object; the richness of the content contained in the target dialogue data is greater than or equal to a third threshold. In the aforementioned implementation, after obtaining the dialogue data between the user and the dialogue model, several rounds of interactions that do not meet the conditions can be eliminated from the multiple rounds of interactions contained in the dialogue data, and several rounds of interactions that meet the conditions can be screened out. These several rounds of interactions are the target dialogue data. At this point, the data can be completely cleaned and evaluated, and the obtained target dialogue data can be used as training data.

在一种可能实现的方式中,该方法还包括:基于目标对话数据,对对话模型进行训练,得到训练后的对话模型。前述实现方式中,由于目标对话数据可作为训练数据,故可利用目标对话数据对对话模型 进行训练,从而得到训练后的对话模型,也就是具备物品推荐功能的对话模型。In one possible implementation, the method further includes: training the dialogue model based on the target dialogue data to obtain a trained dialogue model. In the above implementation, since the target dialogue data can be used as training data, the dialogue model can be trained using the target dialogue data. Conduct training to obtain a trained dialogue model, that is, a dialogue model with the function of item recommendation.

本申请实施例的第二方面提供了一种数据处理方法,该方法通过第一方面中所涉及的训练后的对话模型实现,该方法包括:获取用户的提问,用户的提问用于描述用户的物品推荐需求;将用户的提问输入至训练后的对话模型,得到与提问对应的回答,回答用于描述针对用户的物品推荐结果。The second aspect of an embodiment of the present application provides a data processing method, which is implemented through the trained dialogue model involved in the first aspect. The method includes: obtaining a user's question, which is used to describe the user's item recommendation needs; inputting the user's question into the trained dialogue model to obtain an answer corresponding to the question, and the answer is used to describe the item recommendation results for the user.

本申请实施例的第三方面提供了一种对话数据生成装置,该装置包括:获取模块,用于获取用户数据,用户数据包含用户的属性和用户感兴趣的物品;确定模块,用于基于用户数据确定可推荐的物品,可推荐的物品包含用户感兴趣的物品,以及与用户感兴趣的物品相关联的物品;更新模块,用于基于用户数据和可推荐的物品,更新预置的数据生成规则,得到新的数据生成规则;生成模块,用于基于新的数据生成规则,生成用户与对话模型之间的对话数据,对话数据包含对话模型向用户推荐的物品,对话模型向用户推荐的物品来自可推荐的物品。A third aspect of an embodiment of the present application provides a conversation data generating device, which includes: an acquisition module for acquiring user data, the user data including user attributes and items of interest to the user; a determination module for determining recommendable items based on the user data, the recommendable items including items of interest to the user and items associated with the items of interest to the user; an update module for updating preset data generation rules based on the user data and the recommendable items to obtain new data generation rules; and a generation module for generating conversation data between a user and a conversation model based on the new data generation rules, the conversation data including items recommended to the user by the conversation model, and the items recommended to the user by the conversation model are from the recommendable items.

从上述装置可以看出:当需要生成用户和对话模型之间的对话数据时,可先获取用户数据,用户数据包含用户的属性和用户感兴趣的物品。接着,可对用户数据进行处理,从而得到可推荐的物品,可推荐的物品包含用户感兴趣的物品以及与用户感兴趣的物品相关联的物品。然后,可利用用户数据和可推荐的物品,对预置的数据生成规则进行更新,从而得到新的数据生成规则。最后,可按照新的数据生成规则,以生成用户与对话模型之间的对话数据,对话数据包含对话模型向用户推荐的物品,对话模型向用户推荐的物品来自可推荐的物品。前述过程提供了一种对话数据生成框架,该框架可利用采集得到的用户数据集合预置的数据生成规则来获取新的数据生成规则,并利用新的数据生成规来得到用户与对话模型之间的对话数据,由此可见,该框架可自动生成对话数据,对话数据的整个生成过程不需人工干预,可有效提升对话数据的生成效率,减小对话数据的生成成本。It can be seen from the above device that when it is necessary to generate dialogue data between a user and a dialogue model, user data can be obtained first, and the user data includes the attributes of the user and the items that the user is interested in. Then, the user data can be processed to obtain recommended items, and the recommended items include items that the user is interested in and items associated with the items that the user is interested in. Then, the preset data generation rules can be updated using the user data and the recommended items to obtain new data generation rules. Finally, the dialogue data between the user and the dialogue model can be generated according to the new data generation rules, and the dialogue data includes the items recommended to the user by the dialogue model, and the items recommended to the user by the dialogue model come from the recommended items. The above process provides a dialogue data generation framework, which can use the data generation rules preset by the collected user data set to obtain new data generation rules, and use the new data generation rules to obtain the dialogue data between the user and the dialogue model. It can be seen that the framework can automatically generate dialogue data, and the entire generation process of dialogue data does not require manual intervention, which can effectively improve the generation efficiency of dialogue data and reduce the generation cost of dialogue data.

在一种可能实现的方式中,确定模块,还用于基于用户数据确定不可推荐的物品;更新模块,用于基于用户数据、可推荐的物品和不可推荐的物品,更新预置的数据生成规则,得到新的数据生成规则。In one possible implementation, the determination module is further used to determine non-recommended items based on user data; the update module is used to update preset data generation rules based on user data, recommendable items and non-recommended items to obtain new data generation rules.

在一种可能实现的方式中,确定模块,用于:对用户数据以及多个候选物品进行特征提取,得到用户数据的特征以及多个候选物品的特征;对用户数据的特征以及多个候选物品的特征进行计算,得到用户数据与多个候选物品之间的匹配度;将匹配度大于或等于第一阈值的候选物品确定为可推荐的物品。In one possible implementation, the determination module is used to: extract features from user data and multiple candidate items to obtain features of the user data and features of the multiple candidate items; calculate the features of the user data and features of the multiple candidate items to obtain a matching degree between the user data and the multiple candidate items; and determine a candidate item having a matching degree greater than or equal to a first threshold as a recommendable item.

在一种可能实现的方式中,确定模块,用于:将匹配度小于或等于第二阈值的候选物品确定为不可推荐的物品,第二阈值小于第一阈值。In a possible implementation, the determination module is used to determine candidate items whose matching degree is less than or equal to a second threshold as non-recommended items, where the second threshold is less than the first threshold.

在一种可能实现的方式中,预置的数据生成规则包含不需补充的规则以及待补充的规则,更新模块,用于:将用户数据、可推荐的物品和不可推荐的物品填充至待补充的规则,得到补充后的规则,不需补充的规则以及补充后的规则构成新的数据生成规则,不需补充的规则用于设置对话数据的格式,补充后的规则用于设置对话数据的内容。In one possible implementation, the preset data generation rules include rules that do not need to be supplemented and rules to be supplemented, and the update module is used to: fill the user data, recommended items and non-recommended items into the rules to be supplemented to obtain the supplemented rules. The rules that do not need to be supplemented and the supplemented rules constitute new data generation rules. The rules that do not need to be supplemented are used to set the format of the dialogue data, and the supplemented rules are used to set the content of the dialogue data.

在一种可能实现的方式中,该装置还包括:筛选模块,用于从对话数据中获取目标对话数据,目标对话数据满足以下至少一项:目标对话数据包含的所有文字均位于预置的文字集合中;目标对话数据包含的针对物品的描述符合真实的描述;目标对话数据包含的物品为真实的物品;目标对话数据包含的内容的丰富度大于或等于第三阈值。In one possible implementation, the device also includes: a screening module, used to obtain target conversation data from the conversation data, and the target conversation data satisfies at least one of the following: all texts contained in the target conversation data are located in a preset text set; the description of the object contained in the target conversation data conforms to the real description; the object contained in the target conversation data is a real object; the richness of the content contained in the target conversation data is greater than or equal to a third threshold.

在一种可能实现的方式中,该装置还包括:训练模块,用于基于目标对话数据,对对话模型进行训练,得到训练后的对话模型。In one possible implementation, the device further includes: a training module, configured to train the dialogue model based on target dialogue data to obtain a trained dialogue model.

本申请实施例的第四方面提供了一种数据处理装置,该装置包含第三方面中所涉及的训练后的对话模型,该装置包括:获取模块,用于获取用户的提问,用户的提问用于描述用户的物品推荐需求;处理模块,用于将用户的提问输入至训练后的对话模型,得到与提问对应的回答,回答用于描述针对用户的物品推荐结果。The fourth aspect of an embodiment of the present application provides a data processing device, which includes the trained dialogue model involved in the third aspect, and the device includes: an acquisition module, used to obtain a user's question, and the user's question is used to describe the user's item recommendation needs; a processing module, used to input the user's question into the trained dialogue model to obtain an answer corresponding to the question, and the answer is used to describe the item recommendation result for the user.

本申请实施例的第五方面提供了一种对话数据生成装置,该装置包括存储器和处理器;存储器存储有代码,处理器被配置为执行代码,当代码被执行时,对话数据生成装置执行如第一方面或第一方面中任意一种可能的实现方式所述的方法。A fifth aspect of an embodiment of the present application provides a conversation data generating device, which includes a memory and a processor; the memory stores code, and the processor is configured to execute the code. When the code is executed, the conversation data generating device performs the method described in the first aspect or any possible implementation method of the first aspect.

本申请实施例的第六方面提供了一种数据处理装置,该装置包括存储器和处理器;存储器存储有代码,处理器被配置为执行代码,当代码被执行时,数据处理装置执行如第二方面或第二方面中任意一种可能的实现方式所述的方法。 A sixth aspect of an embodiment of the present application provides a data processing device, which includes a memory and a processor; the memory stores code, and the processor is configured to execute the code. When the code is executed, the data processing device executes the method described in the second aspect or any possible implementation method of the second aspect.

本申请实施例的第七方面提供了一种电路系统,该电路系统包括处理电路,该处理电路配置为执行如第一方面、第一方面中任意一种可能的实现方式、第二方面或第二方面中任意一种可能的实现方式所述的方法。A seventh aspect of an embodiment of the present application provides a circuit system, which includes a processing circuit, and the processing circuit is configured to execute a method as described in the first aspect, any possible implementation of the first aspect, the second aspect, or any possible implementation of the second aspect.

本申请实施例的第八方面提供了一种芯片系统,该芯片系统包括处理器,用于调用存储器中存储的计算机程序或计算机指令,以使得该处理器执行如第一方面、第一方面中任意一种可能的实现方式、第二方面或第二方面中任意一种可能的实现方式所述的方法。An eighth aspect of an embodiment of the present application provides a chip system, which includes a processor for calling a computer program or computer instructions stored in a memory so that the processor executes a method as described in the first aspect, any possible implementation of the first aspect, the second aspect, or any possible implementation of the second aspect.

在一种可能的实现方式中,该处理器通过接口与存储器耦合。In a possible implementation manner, the processor is coupled to the memory through an interface.

在一种可能的实现方式中,该芯片系统还包括存储器,该存储器中存储有计算机程序或计算机指令。In a possible implementation, the chip system also includes a memory, in which a computer program or computer instructions are stored.

本申请实施例的第九方面提供了一种计算机存储介质,该计算机存储介质存储有计算机程序,该程序在由计算机执行时,使得计算机实施如第一方面、第一方面中任意一种可能的实现方式、第二方面或第二方面中任意一种可能的实现方式所述的方法。A ninth aspect of an embodiment of the present application provides a computer storage medium storing a computer program, which, when executed by a computer, enables the computer to implement the method described in the first aspect, any possible implementation of the first aspect, the second aspect, or any possible implementation of the second aspect.

本申请实施例的第十方面提供了一种计算机程序产品,该计算机程序产品存储有指令,该指令在由计算机执行时,使得计算机实施如第一方面、第一方面中任意一种可能的实现方式、第二方面或第二方面中任意一种可能的实现方式所述的方法。The tenth aspect of the embodiments of the present application provides a computer program product, which stores instructions, which, when executed by a computer, enable the computer to implement the method described in the first aspect, any possible implementation of the first aspect, the second aspect, or any possible implementation of the second aspect.

本申请实施例中,当需要生成用户和对话模型之间的对话数据时,可先获取用户数据,用户数据包含用户的属性和用户感兴趣的物品。接着,可对用户数据进行处理,从而得到可推荐的物品,可推荐的物品包含用户感兴趣的物品以及与用户感兴趣的物品相关联的物品。然后,可利用用户数据和可推荐的物品,对预置的数据生成规则进行更新,从而得到新的数据生成规则。最后,可按照新的数据生成规则,以生成用户与对话模型之间的对话数据,对话数据包含对话模型向用户推荐的物品,对话模型向用户推荐的物品来自可推荐的物品。前述过程提供了一种对话数据生成框架,该框架可利用采集得到的用户数据集合预置的数据生成规则来获取新的数据生成规则,并利用新的数据生成规来得到用户与对话模型之间的对话数据,由此可见,该框架可自动生成对话数据,对话数据的整个生成过程不需人工干预,可有效提升对话数据的生成效率,减小对话数据的生成成本。In the embodiment of the present application, when it is necessary to generate the dialogue data between the user and the dialogue model, the user data may be obtained first, and the user data includes the attributes of the user and the items that the user is interested in. Then, the user data may be processed to obtain the recommended items, and the recommended items include the items that the user is interested in and the items associated with the items that the user is interested in. Then, the preset data generation rules may be updated using the user data and the recommended items, so as to obtain new data generation rules. Finally, the dialogue data between the user and the dialogue model may be generated according to the new data generation rules, and the dialogue data includes the items recommended to the user by the dialogue model, and the items recommended to the user by the dialogue model are from the recommended items. The above process provides a dialogue data generation framework, which may obtain new data generation rules using the data generation rules preset by the collected user data set, and obtain the dialogue data between the user and the dialogue model using the new data generation rules. It can be seen that the framework can automatically generate dialogue data, and the entire generation process of dialogue data does not require manual intervention, which can effectively improve the generation efficiency of dialogue data and reduce the generation cost of dialogue data.

附图说明BRIEF DESCRIPTION OF THE DRAWINGS

图1为人工智能主体框架的一种结构示意图;FIG1 is a schematic diagram of a structure of an artificial intelligence main framework;

图2a为本申请实施例提供的数据处理系统的一个结构示意图;FIG2a is a schematic diagram of a structure of a data processing system provided in an embodiment of the present application;

图2b为本申请实施例提供的数据处理系统的另一结构示意图;FIG2b is another schematic diagram of the structure of the data processing system provided in an embodiment of the present application;

图2c为本申请实施例提供的数据处理的相关设备的一个示意图;FIG2c is a schematic diagram of a data processing related device provided in an embodiment of the present application;

图3为本申请实施例提供的系统100架构的一个示意图;FIG3 is a schematic diagram of the architecture of the system 100 provided in an embodiment of the present application;

图4为本申请实施例提供的对话数据生成架构的一个结构示意图;FIG4 is a schematic diagram of a structure of a dialogue data generation architecture provided in an embodiment of the present application;

图5为本申请实施例提供的对话数据生成方法的一个流程示意图;FIG5 is a flow chart of a method for generating conversation data according to an embodiment of the present application;

图6为本申请实施例提供的用户数据的转换过程的一个示意图;FIG6 is a schematic diagram of a user data conversion process provided by an embodiment of the present application;

图7为本申请实施例提供的可推荐的物品的获取过程的一个示意图;FIG7 is a schematic diagram of a process for obtaining recommendable items according to an embodiment of the present application;

图8为本申请实施例提供的数据生成规则的获取过程的一个示意图;FIG8 is a schematic diagram of a process for obtaining data generation rules provided in an embodiment of the present application;

图9为本申请实施例提供的对话数据的获取过程的一个示意图;FIG9 is a schematic diagram of a process for acquiring conversation data provided in an embodiment of the present application;

图10为本申请实施例提供的对话数据的获取过程的一个示意图;FIG10 is a schematic diagram of a process for acquiring conversation data provided in an embodiment of the present application;

图11为本申请实施例提供的评分结果的一个示意图;FIG11 is a schematic diagram of a scoring result provided in an embodiment of the present application;

图12为本申请实施例提供的评分结果的另一示意图;FIG12 is another schematic diagram of the scoring results provided in an embodiment of the present application;

图13为本申请实施例提供的评分结果的另一示意图;FIG13 is another schematic diagram of the scoring results provided in an embodiment of the present application;

图14为本申请实施例提供的评分结果的另一示意图;FIG14 is another schematic diagram of the scoring results provided in an embodiment of the present application;

图15为本申请实施例提供的数据处理方法的一个流程示意图;FIG15 is a flow chart of a data processing method provided in an embodiment of the present application;

图16为本申请实施例提供的对话数据生成装置的一个结构示意图;FIG16 is a schematic diagram of the structure of a conversation data generating device provided in an embodiment of the present application;

图17为本申请实施例提供的数据处理装置的一个结构示意图;FIG17 is a schematic diagram of a structure of a data processing device provided in an embodiment of the present application;

图18为本申请实施例提供的执行设备的一个结构示意图;FIG18 is a schematic diagram of a structure of an execution device provided in an embodiment of the present application;

图19为本申请实施例提供的训练设备的一个结构示意图; FIG19 is a schematic diagram of a structure of a training device provided in an embodiment of the present application;

图20为本申请实施例提供的芯片的一个结构示意图。FIG. 20 is a schematic diagram of the structure of a chip provided in an embodiment of the present application.

具体实施方式DETAILED DESCRIPTION

本申请实施例提供了一种对话数据生成方法及其相关设备,可有效提升对话数据的生成效率,减小对话数据的生成成本。The embodiments of the present application provide a method for generating conversation data and related devices thereof, which can effectively improve the efficiency of generating conversation data and reduce the cost of generating conversation data.

本申请的说明书和权利要求书及上述附图中的术语“第一”、“第二”等是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。应该理解这样使用的术语在适当情况下可以互换,这仅仅是描述本申请的实施例中对相同属性的对象在描述时所采用的区分方式。此外,术语“包括”和“具有”以及他们的任何变形,意图在于覆盖不排他的包含,以便包含一系列单元的过程、方法、系统、产品或设备不必限于那些单元,而是可包括没有清楚地列出的或对于这些过程、方法、产品或设备固有的其它单元。The terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and need not be used to describe a specific order or sequential order. It should be understood that the terms used in this way can be interchangeable under appropriate circumstances, which is only to describe the distinction mode adopted by the objects of the same attributes when describing in the embodiments of the present application. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, so that the process, method, system, product or equipment comprising a series of units need not be limited to those units, but may include other units that are not clearly listed or inherent to these processes, methods, products or equipment.

在AIGC中,具备物品推荐功能的对话模型(也可以称为具备物品推荐功能的语言大模型)表现出了强大的自然语言理解能力以及沟通能力,该模型可通过与用户进行对话的方式来为用户推荐物品,从而满足用户的物品推荐需求。In AIGC, the conversational model with item recommendation function (also called the language large model with item recommendation function) demonstrates strong natural language understanding and communication capabilities. The model can recommend items to users by having conversations with them, thereby meeting users' item recommendation needs.

为了训练出具备物品推荐功能的对话模型,可先通过众包工程来获取用于模型训练的对话数据。具体地,众包工程中的工作人员可分别扮演用户以及对话模型,按照预置的知识图谱提供的信息来生成用户以及对话模型之间的对话数据,对话数据中的相关内容以及对话模型推荐给用户的物品均由工作人员从知识图谱中提取。那么,可利用对话数据来训练推荐模型,所得到训练后的推荐模型可学习用户的兴趣和偏好,从而为用户推荐物品。In order to train a conversation model with item recommendation function, we can first obtain conversation data for model training through crowdsourcing projects. Specifically, the staff in the crowdsourcing project can play the role of users and conversation models respectively, and generate conversation data between users and conversation models according to the information provided by the preset knowledge graph. The relevant content in the conversation data and the items recommended to users by the conversation model are extracted by the staff from the knowledge graph. Then, the conversation data can be used to train the recommendation model, and the trained recommendation model can learn the interests and preferences of users, so as to recommend items to users.

上述过程中,对话数据的整个生成过程均需要由众包工程的工作人员负责,人员培训的时间较长,且提取信息也需耗费工作人员大量的时间,由此可见,以这种方式来生成对话数据所需的人力成本过高。In the above process, the entire process of generating dialogue data needs to be the responsibility of the crowdsourcing project staff. The staff training time is long, and extracting information also takes a lot of staff time. It can be seen that the manpower cost required to generate dialogue data in this way is too high.

进一步地,由于众包工程的工作人员的教育背景存在差异,不同的工作人员针对知识图谱的理解不同,这样会导致生成的对话数据的质量存在偏差,不仅导致后续的数据清洗以及评测存在困难,还会导致后续训练得到的对话模型的性能较差。Furthermore, due to the differences in educational backgrounds of the crowdsourcing project staff, different staff members have different understandings of the knowledge graph, which will lead to deviations in the quality of the generated dialogue data, which will not only make subsequent data cleaning and evaluation difficult, but also lead to poor performance of the subsequent trained dialogue model.

为了解决上述问题,本申请实施例提供了一种对话数据生成方法,该方法可结合人工智能(artificial intelligence,AI)技术实现。AI技术是利用数字计算机或者数字计算机控制的机器模拟、延伸和扩展人的智能的技术学科,AI技术通过感知环境、获取知识并使用知识获得最佳结果。换句话说,人工智能技术是计算机科学的一个分支,它企图了解智能的实质,并生产出一种新的能以人类智能相似的方式做出反应的智能机器。利用人工智能进行数据处理是人工智能常见的一个应用方式。In order to solve the above problems, the embodiment of the present application provides a method for generating dialogue data, which can be implemented in combination with artificial intelligence (AI) technology. AI technology is a technical discipline that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence. AI technology obtains the best results by sensing the environment, acquiring knowledge and using knowledge. In other words, artificial intelligence technology is a branch of computer science that attempts to understand the essence of intelligence and produce a new intelligent machine that can respond in a similar way to human intelligence. Using artificial intelligence for data processing is a common application of artificial intelligence.

首先对人工智能系统总体工作流程进行描述,请参见图1,图1为人工智能主体框架的一种结构示意图,下面从“智能信息链”(水平轴)和“IT价值链”(垂直轴)两个维度对上述人工智能主题框架进行阐述。其中,“智能信息链”反映从数据的获取到处理的一列过程。举例来说,可以是智能信息感知、智能信息表示与形成、智能推理、智能决策、智能执行与输出的一般过程。在这个过程中,数据经历了“数据—信息—知识—智慧”的凝练过程。“IT价值链”从人智能的底层基础设施、信息(提供和处理技术实现)到系统的产业生态过程,反映人工智能为信息技术产业带来的价值。First, the overall workflow of the artificial intelligence system is described. Please refer to Figure 1. Figure 1 is a structural diagram of the main framework of artificial intelligence. The following is an explanation of the above artificial intelligence theme framework from the two dimensions of "intelligent information chain" (horizontal axis) and "IT value chain" (vertical axis). Among them, the "intelligent information chain" reflects a series of processes from data acquisition to processing. For example, it can be a general process of intelligent information perception, intelligent information representation and formation, intelligent reasoning, intelligent decision-making, intelligent execution and output. In this process, the data has undergone a condensation process of "data-information-knowledge-wisdom". The "IT value chain" reflects the value that artificial intelligence brings to the information technology industry from the underlying infrastructure of human intelligence, information (providing and processing technology implementation) to the industrial ecology process of the system.

(1)基础设施(1) Infrastructure

基础设施为人工智能系统提供计算能力支持,实现与外部世界的沟通,并通过基础平台实现支撑。通过传感器与外部沟通;计算能力由智能芯片(CPU、NPU、GPU、ASIC、FPGA等硬件加速芯片)提供;基础平台包括分布式计算框架及网络等相关的平台保障和支持,可以包括云存储和计算、互联互通网络等。举例来说,传感器和外部沟通获取数据,这些数据提供给基础平台提供的分布式计算系统中的智能芯片进行计算。The infrastructure provides computing power support for the AI system, enables communication with the outside world, and supports it through the basic platform. It communicates with the outside world through sensors; computing power is provided by smart chips (CPU, NPU, GPU, ASIC, FPGA and other hardware acceleration chips); the basic platform includes distributed computing frameworks and networks and other related platform guarantees and support, which can include cloud storage and computing, interconnected networks, etc. For example, sensors communicate with the outside world to obtain data, and these data are provided to the smart chips in the distributed computing system provided by the basic platform for calculation.

(2)数据(2) Data

基础设施的上一层的数据用于表示人工智能领域的数据来源。数据涉及到图形、图像、语音、文本,还涉及到传统设备的物联网数据,包括已有系统的业务数据以及力、位移、液位、温度、湿度等感知数据。The data on the upper layer of the infrastructure is used to represent the data sources in the field of artificial intelligence. The data involves graphics, images, voice, text, and IoT data of traditional devices, including business data of existing systems and perception data such as force, displacement, liquid level, temperature, and humidity.

(3)数据处理 (3) Data processing

数据处理通常包括数据训练,机器学习,深度学习,搜索,推理,决策等方式。Data processing usually includes data training, machine learning, deep learning, search, reasoning, decision-making and other methods.

其中,机器学习和深度学习可以对数据进行符号化和形式化的智能信息建模、抽取、预处理、训练等。Among them, machine learning and deep learning can symbolize and formalize data for intelligent information modeling, extraction, preprocessing, and training.

推理是指在计算机或智能系统中,模拟人类的智能推理方式,依据推理控制策略,利用形式化的信息进行机器思维和求解问题的过程,典型的功能是搜索与匹配。Reasoning refers to the process of simulating human intelligent reasoning in computers or intelligent systems, using formalized information to perform machine thinking and solve problems based on reasoning control strategies. Typical functions are search and matching.

决策是指智能信息经过推理后进行决策的过程,通常提供分类、排序、预测等功能。Decision-making refers to the process of making decisions after intelligent information is reasoned, usually providing functions such as classification, sorting, and prediction.

(4)通用能力(4) General capabilities

对数据经过上面提到的数据处理后,进一步基于数据处理的结果可以形成一些通用的能力,比如可以是算法或者一个通用系统,例如,翻译,文本的分析,计算机视觉的处理,语音识别,图像的识别等等。After the data has undergone the data processing mentioned above, some general capabilities can be further formed based on the results of the data processing, such as an algorithm or a general system, for example, translation, text analysis, computer vision processing, speech recognition, image recognition, etc.

(5)智能产品及行业应用(5) Smart products and industry applications

智能产品及行业应用指人工智能系统在各领域的产品和应用,是对人工智能整体解决方案的封装,将智能信息决策产品化、实现落地应用,其应用领域主要包括:智能终端、智能交通、智能医疗、自动驾驶、智慧城市等。Smart products and industry applications refer to the products and applications of artificial intelligence systems in various fields. They are the encapsulation of the overall artificial intelligence solution, which productizes intelligent information decision-making and realizes practical applications. Its application areas mainly include: smart terminals, smart transportation, smart medical care, autonomous driving, smart cities, etc.

接下来介绍几种本申请的应用场景。Next, several application scenarios of this application are introduced.

图2a为本申请实施例提供的数据处理系统的一个结构示意图,该数据处理系统包括用户设备以及数据处理设备。其中,用户设备包括手机、个人电脑或者信息处理中心等智能终端。用户设备为数据处理的发起端,作为数据处理请求的发起方,通常由用户通过用户设备发起请求。FIG2a is a schematic diagram of a data processing system provided in an embodiment of the present application, wherein the data processing system includes a user device and a data processing device. The user device includes an intelligent terminal such as a mobile phone, a personal computer or an information processing center. The user device is the initiator of data processing, and as the initiator of a data processing request, a user usually initiates a request through the user device.

上述数据处理设备可以是云服务器、网络服务器、应用服务器以及管理服务器等具有数据处理功能的设备或服务器。数据处理设备通过交互接口接收来自智能终端的数据处理请求,再通过存储数据的存储器以及数据处理的处理器环节进行机器学习,深度学习,搜索,推理,决策等方式的数据处理。数据处理设备中的存储器可以是一个统称,包括本地存储以及存储历史数据的数据库,数据库可以在数据处理设备上,也可以在其它网络服务器上。The above-mentioned data processing device can be a device or server with data processing function such as a cloud server, a network server, an application server and a management server. The data processing device receives data processing requests from the intelligent terminal through an interactive interface, and then performs data processing in the form of machine learning, deep learning, search, reasoning, decision-making, etc. through the memory for storing data and the processor for data processing. The memory in the data processing device can be a general term, including local storage and databases for storing historical data. The database can be on the data processing device or on other network servers.

在图2a所示的数据处理系统中,用户设备可以接收用户的指令,例如用户设备可以获取用户输入/选择的提问,然后向数据处理设备发起请求,使得数据处理设备针对来自用户设备的提问执行一系列的处理,从而得到该提问的处理结果。示例性的,用户设备可以获取用户输入的提问(例如,该提问可描述用户的物品推荐需求),然后用户设备可向数据处理设备发起数据处理请求,使得数据处理设备基于数据处理请求,对该提问以进行一系列的处理,从而得到该提问的处理结果,即相应的回答(例如,该回答可描述针对用户的物品推荐结果,也就是推荐给用户的物品)。In the data processing system shown in FIG. 2a, the user device can receive the user's instructions. For example, the user device can obtain the question input/selected by the user, and then initiate a request to the data processing device, so that the data processing device performs a series of processing on the question from the user device, thereby obtaining the processing result of the question. Exemplarily, the user device can obtain the question input by the user (for example, the question can describe the user's item recommendation needs), and then the user device can initiate a data processing request to the data processing device, so that the data processing device performs a series of processing on the question based on the data processing request, thereby obtaining the processing result of the question, that is, the corresponding answer (for example, the answer can describe the item recommendation result for the user, that is, the item recommended to the user).

在图2a中,数据处理设备可以执行本申请实施例的数据处理方法。In FIG. 2 a , the data processing device may execute the data processing method of the embodiment of the present application.

图2b为本申请实施例提供的数据处理系统的另一结构示意图,在图2b中,用户设备直接作为数据处理设备,该用户设备能够直接获取来自用户的输入并直接由用户设备本身的硬件进行处理,具体过程与图2a相似,可参考上面的描述,在此不再赘述。Figure 2b is another structural diagram of the data processing system provided in an embodiment of the present application. In Figure 2b, the user device directly serves as a data processing device. The user device can directly obtain input from the user and directly process it by the hardware of the user device itself. The specific process is similar to that of Figure 2a. Please refer to the above description and will not be repeated here.

在图2b所示的数据处理系统中,用户设备可以接收用户的指令,例如用户设备可以获取用户输入的提问(例如,该提问可描述用户的物品推荐需求),然后用户设备可对该提问以进行一系列的处理,从而得到该提问的处理结果,即相应的回答(例如,该回答可描述针对用户的物品推荐结果,也就是推荐给用户的物品)。In the data processing system shown in FIG2b , the user device can receive instructions from the user. For example, the user device can obtain a question input by the user (for example, the question can describe the user's item recommendation needs), and then the user device can perform a series of processing on the question to obtain a processing result of the question, that is, a corresponding answer (for example, the answer can describe the item recommendation result for the user, that is, the item recommended to the user).

在图2b中,用户设备自身就可以执行本申请实施例的数据处理方法。In FIG. 2b , the user equipment itself can execute the data processing method of the embodiment of the present application.

图2c为本申请实施例提供的数据处理的相关设备的一个示意图。FIG. 2c is a schematic diagram of a data processing related device provided in an embodiment of the present application.

上述图2a和图2b中的用户设备具体可以是图2c中的本地设备301或者本地设备302,图2a中的数据处理设备具体可以是图2c中的执行设备210,其中,数据存储系统250可以存储执行设备210的待处理数据,数据存储系统250可以集成在执行设备210上,也可以设置在云上或其它网络服务器上。The user device in the above Figures 2a and 2b can specifically be the local device 301 or the local device 302 in Figure 2c, and the data processing device in Figure 2a can specifically be the execution device 210 in Figure 2c, wherein the data storage system 250 can store the data to be processed of the execution device 210, and the data storage system 250 can be integrated on the execution device 210, and can also be set on the cloud or other network servers.

图2a和图2b中的处理器可以通过神经网络模型或者其它模型(例如,基于支持向量机的模型)进行数据训练/机器学习/深度学习,并利用数据最终训练或者学习得到的模型针对图像执行数据处理应用,从而得到相应的处理结果。The processors in Figures 2a and 2b can perform data training/machine learning/deep learning through a neural network model or other models (for example, a model based on a support vector machine), and use the model finally trained or learned by the data to execute data processing applications on the image, thereby obtaining corresponding processing results.

图3为本申请实施例提供的系统100架构的一个示意图,在图3中,执行设备110配置输入/输出 (input/output,I/O)接口112,用于与外部设备进行数据交互,用户可以通过客户设备140向I/O接口112输入数据,所述输入数据在本申请实施例中可以包括:各个待调度任务、可调用资源以及其他参数。FIG3 is a schematic diagram of the architecture of the system 100 provided in an embodiment of the present application. In FIG3, the execution device 110 configures the input/output The input/output (I/O) interface 112 is used for data interaction with external devices. The user can input data to the I/O interface 112 through the client device 140. The input data may include: various tasks to be scheduled, callable resources and other parameters in the embodiment of the present application.

在执行设备110对输入数据进行预处理,或者在执行设备110的计算模块111执行计算等相关的处理(比如进行本申请中神经网络模型的功能实现)过程中,执行设备110可以调用数据存储系统150中的数据、代码等以用于相应的处理,也可以将相应处理得到的数据、指令等存入数据存储系统150中。When the execution device 110 preprocesses the input data, or when the computing module 111 of the execution device 110 performs calculation and other related processing (such as implementing the functions of the neural network model in the present application), the execution device 110 can call the data, code, etc. in the data storage system 150 for corresponding processing, and can also store the data, instructions, etc. obtained by the corresponding processing in the data storage system 150.

最后,I/O接口112将处理结果返回给客户设备140,从而提供给用户。Finally, the I/O interface 112 returns the processing result to the client device 140 so as to provide it to the user.

值得说明的是,训练设备120可以针对不同的目标或称不同的任务,基于不同的训练数据生成相应的目标模型(例如,本申请实施例提供的训练后的对话模型)/规则,该相应的目标模型/规则即可以用于实现上述目标或完成上述任务,从而为用户提供所需的结果。其中,训练数据可以存储在数据库130中,且来自于数据采集设备160采集的训练样。It is worth noting that the training device 120 can generate corresponding target models (e.g., the trained dialogue model provided in the embodiment of the present application)/rules based on different training data for different goals or different tasks, and the corresponding target models/rules can be used to achieve the above goals or complete the above tasks, thereby providing the user with the desired results. The training data can be stored in the database 130 and come from the training samples collected by the data collection device 160.

在图3中所示情况下,用户可以手动给定输入数据,该手动给定可以通过I/O接口112提供的界面进行操作。另一种情况下,客户设备140可以自动地向I/O接口112发送输入数据,如果要求客户设备140自动发送输入数据需要获得用户的授权,则用户可以在客户设备140中设置相应权限。用户可以在客户设备140查看执行设备110输出的结果,具体的呈现形式可以是显示、声音、动作等具体方式。客户设备140也可以作为数据采集端,采集如图所示输入I/O接口112的输入数据及输出I/O接口112的输出结果作为新的样本数据,并存入数据库130。当然,也可以不经过客户设备140进行采集,而是由I/O接口112直接将如图所示输入I/O接口112的输入数据及输出I/O接口112的输出结果,作为新的样本数据存入数据库130。In the case shown in FIG. 3 , the user can manually give input data, and the manual giving can be operated through the interface provided by the I/O interface 112. In another case, the client device 140 can automatically send input data to the I/O interface 112. If the client device 140 is required to automatically send input data and needs to obtain the user's authorization, the user can set the corresponding authority in the client device 140. The user can view the results output by the execution device 110 on the client device 140, and the specific presentation form can be a specific method such as display, sound, action, etc. The client device 140 can also be used as a data acquisition terminal to collect the input data of the input I/O interface 112 and the output results of the output I/O interface 112 as shown in the figure as new sample data, and store them in the database 130. Of course, it is also possible not to collect through the client device 140, but the I/O interface 112 directly stores the input data of the input I/O interface 112 and the output results of the output I/O interface 112 as new sample data in the database 130.

值得注意的是,图3仅是本申请实施例提供的一种系统架构的示意图,图中所示设备、器件、模块等之间的位置关系不构成任何限制,例如,在图3中,数据存储系统150相对执行设备110是外部存储器,在其它情况下,也可以将数据存储系统150置于执行设备110中。如图3所示,可以根据训练设备120训练得到神经网络。It is worth noting that FIG3 is only a schematic diagram of a system architecture provided by an embodiment of the present application, and the positional relationship between the devices, components, modules, etc. shown in the figure does not constitute any limitation. For example, in FIG3, the data storage system 150 is an external memory relative to the execution device 110. In other cases, the data storage system 150 can also be placed in the execution device 110. As shown in FIG3, a neural network can be obtained by training according to the training device 120.

本申请实施例还提供的一种芯片,该芯片包括神经网络处理器NPU。该芯片可以被设置在如图3所示的执行设备110中,用以完成计算模块111的计算工作。该芯片也可以被设置在如图3所示的训练设备120中,用以完成训练设备120的训练工作并输出目标模型/规则。The embodiment of the present application also provides a chip, which includes a neural network processor NPU. The chip can be set in the execution device 110 as shown in Figure 3 to complete the calculation work of the calculation module 111. The chip can also be set in the training device 120 as shown in Figure 3 to complete the training work of the training device 120 and output the target model/rule.

神经网络处理器NPU,NPU作为协处理器挂载到主中央处理器(central processing unit,CPU)(host CPU)上,由主CPU分配任务。NPU的核心部分为运算电路,控制器控制运算电路提取存储器(权重存储器或输入存储器)中的数据并进行运算。Neural network processor NPU, NPU is mounted on the main central processing unit (CPU) (host CPU) as a coprocessor, and the main CPU assigns tasks. The core part of NPU is the operation circuit, and the controller controls the operation circuit to extract data from the memory (weight memory or input memory) and perform operations.

在一些实现中,运算电路内部包括多个处理单元(process engine,PE)。在一些实现中,运算电路是二维脉动阵列。运算电路还可以是一维脉动阵列或者能够执行例如乘法和加法这样的数学运算的其它电子线路。在一些实现中,运算电路是通用的矩阵处理器。In some implementations, the arithmetic circuit includes multiple processing units (process engines, PEs) internally. In some implementations, the arithmetic circuit is a two-dimensional systolic array. The arithmetic circuit can also be a one-dimensional systolic array or other electronic circuits capable of performing mathematical operations such as multiplication and addition. In some implementations, the arithmetic circuit is a general-purpose matrix processor.

举例来说,假设有输入矩阵A,权重矩阵B,输出矩阵C。运算电路从权重存储器中取矩阵B相应的数据,并缓存在运算电路中每一个PE上。运算电路从输入存储器中取矩阵A数据与矩阵B进行矩阵运算,得到的矩阵的部分结果或最终结果,保存在累加器(accumulator)中。For example, suppose there is an input matrix A, a weight matrix B, and an output matrix C. The operation circuit takes the corresponding data of matrix B from the weight memory and caches it on each PE in the operation circuit. The operation circuit takes the matrix A data from the input memory and performs matrix operations with matrix B. The partial results or final results of the matrix are stored in the accumulator.

向量计算单元可以对运算电路的输出做进一步处理,如向量乘,向量加,指数运算,对数运算,大小比较等等。例如,向量计算单元可以用于神经网络中非卷积/非FC层的网络计算,如池化(pooling),批归一化(batch normalization),局部响应归一化(local response normalization)等。The vector calculation unit can further process the output of the operation circuit, such as vector multiplication, vector addition, exponential operation, logarithmic operation, size comparison, etc. For example, the vector calculation unit can be used for network calculations of non-convolutional/non-FC layers in neural networks, such as pooling, batch normalization, local response normalization, etc.

在一些实现种,向量计算单元能将经处理的输出的向量存储到统一缓存器。例如,向量计算单元可以将非线性函数应用到运算电路的输出,例如累加值的向量,用以生成激活值。在一些实现中,向量计算单元生成归一化的值、合并值,或二者均有。在一些实现中,处理过的输出的向量能够用作到运算电路的激活输入,例如用于在神经网络中的后续层中的使用。In some implementations, the vector computation unit can store the processed output vector to a unified buffer. For example, the vector computation unit can apply a nonlinear function to the output of the computation circuit, such as a vector of accumulated values, to generate an activation value. In some implementations, the vector computation unit generates a normalized value, a merged value, or both. In some implementations, the processed output vector can be used as an activation input to the computation circuit, such as for use in a subsequent layer in a neural network.

统一存储器用于存放输入数据以及输出数据。The unified memory is used to store input data and output data.

权重数据直接通过存储单元访问控制器(direct memory access controller,DMAC)将外部存储器中的输入数据搬运到输入存储器和/或统一存储器、将外部存储器中的权重数据存入权重存储器,以及将统一存储器中的数据存入外部存储器。 The weight data is directly transferred from the external memory to the input memory and/or the unified memory through the direct memory access controller (DMAC), the weight data in the external memory is stored in the weight memory, and the data in the unified memory is stored in the external memory.

总线接口单元(bus interface unit,BIU),用于通过总线实现主CPU、DMAC和取指存储器之间进行交互。The bus interface unit (BIU) is used to enable interaction between the main CPU, DMAC and instruction fetch memory through the bus.

与控制器连接的取指存储器(instruction fetch buffer),用于存储控制器使用的指令;An instruction fetch buffer connected to the controller, used to store instructions used by the controller;

控制器,用于调用指存储器中缓存的指令,实现控制该运算加速器的工作过程。The controller is used to call the instructions cached in the memory to control the working process of the computing accelerator.

一般地,统一存储器,输入存储器,权重存储器以及取指存储器均为片上(On-Chip)存储器,外部存储器为该NPU外部的存储器,该外部存储器可以为双倍数据率同步动态随机存储器(doubledata rate synchronous dynamic random access memory,DDR SDRAM)、高带宽存储器(high bandwidth memory,HBM)或其他可读可写的存储器。Generally, the unified memory, input memory, weight memory and instruction fetch memory are all on-chip memories, and the external memory is a memory outside the NPU, which can be a double data rate synchronous dynamic random access memory (DDR SDRAM), a high bandwidth memory (HBM) or other readable and writable memory.

由于本申请实施例涉及大量神经网络的应用,为了便于理解,下面先对本申请实施例涉及的相关术语及神经网络等相关概念进行介绍。Since the embodiments of the present application involve the application of a large number of neural networks, in order to facilitate understanding, the relevant terms and related concepts such as neural networks involved in the embodiments of the present application are first introduced below.

(1)神经网络(1) Neural Network

神经网络可以是由神经单元组成的,神经单元可以是指以xs和截距1为输入的运算单元,该运算单元的输出可以为:
A neural network may be composed of neural units, and a neural unit may refer to an operation unit with xs and intercept 1 as input, and the output of the operation unit may be:

其中,s=1、2、……n,n为大于1的自然数,Ws为xs的权重,b为神经单元的偏置。f为神经单元的激活函数(activation functions),用于将非线性特性引入神经网络中,来将神经单元中的输入信号转换为输出信号。该激活函数的输出信号可以作为下一层卷积层的输入。激活函数可以是sigmoid函数。神经网络是将许多个上述单一的神经单元联结在一起形成的网络,即一个神经单元的输出可以是另一个神经单元的输入。每个神经单元的输入可以与前一层的局部接受域相连,来提取局部接受域的特征,局部接受域可以是由若干个神经单元组成的区域。Where s=1, 2, ...n, n is a natural number greater than 1, Ws is the weight of xs, and b is the bias of the neural unit. f is the activation function of the neural unit, which is used to introduce nonlinear characteristics into the neural network to convert the input signal in the neural unit into the output signal. The output signal of the activation function can be used as the input of the next convolutional layer. The activation function can be a sigmoid function. A neural network is a network formed by connecting many of the above-mentioned single neural units together, that is, the output of one neural unit can be the input of another neural unit. The input of each neural unit can be connected to the local receptive field of the previous layer to extract the characteristics of the local receptive field. The local receptive field can be an area composed of several neural units.

神经网络中的每一层的工作可以用数学表达式y=a(Wx+b)来描述:从物理层面神经网络中的每一层的工作可以理解为通过五种对输入空间(输入向量的集合)的操作,完成输入空间到输出空间的变换(即矩阵的行空间到列空间),这五种操作包括:1、升维/降维;2、放大/缩小;3、旋转;4、平移;5、“弯曲”。其中1、2、3的操作由Wx完成,4的操作由+b完成,5的操作则由a()来实现。这里之所以用“空间”二字来表述是因为被分类的对象并不是单个事物,而是一类事物,空间是指这类事物所有个体的集合。其中,W是权重向量,该向量中的每一个值表示该层神经网络中的一个神经元的权重值。该向量W决定着上文所述的输入空间到输出空间的空间变换,即每一层的权重W控制着如何变换空间。训练神经网络的目的,也就是最终得到训练好的神经网络的所有层的权重矩阵(由很多层的向量W形成的权重矩阵)。因此,神经网络的训练过程本质上就是学习控制空间变换的方式,更具体的就是学习权重矩阵。The work of each layer in the neural network can be described by the mathematical expression y=a(Wx+b): From a physical level, the work of each layer in the neural network can be understood as completing the transformation from the input space to the output space (i.e., the row space to the column space of the matrix) through five operations on the input space (the set of input vectors). These five operations include: 1. Dimension increase/reduction; 2. Zoom in/out; 3. Rotation; 4. Translation; 5. "Bending". Among them, operations 1, 2, and 3 are completed by Wx, operation 4 is completed by +b, and operation 5 is implemented by a(). The word "space" is used here because the classified object is not a single thing, but a class of things, and space refers to the collection of all individuals of this class of things. Among them, W is a weight vector, and each value in the vector represents the weight value of a neuron in the neural network of this layer. The vector W determines the spatial transformation from the input space to the output space described above, that is, the weight W of each layer controls how to transform the space. The purpose of training a neural network is to finally obtain the weight matrix of all layers of the trained neural network (the weight matrix formed by many layers of vectors W). Therefore, the training process of a neural network is essentially about learning how to control spatial transformations, or more specifically, learning the weight matrix.

因为希望神经网络的输出尽可能的接近真正想要预测的值,所以可以通过比较当前网络的预测值和真正想要的目标值,再根据两者之间的差异情况来更新每一层神经网络的权重向量(当然,在第一次更新之前通常会有初始化的过程,即为神经网络中的各层预先配置参数),比如,如果网络的预测值高了,就调整权重向量让它预测低一些,不断的调整,直到神经网络能够预测出真正想要的目标值。因此,就需要预先定义“如何比较预测值和目标值之间的差异”,这便是损失函数(loss function)或目标函数(objective function),它们是用于衡量预测值和目标值的差异的重要方程。其中,以损失函数举例,损失函数的输出值(loss)越高表示差异越大,那么神经网络的训练就变成了尽可能缩小这个loss 的过程。Because we want the output of the neural network to be as close as possible to the value we really want to predict, we can compare the current network's predicted value with the target value we really want, and then update the weight vector of each layer of the neural network based on the difference between the two (of course, there is usually an initialization process before the first update, which is to pre-configure parameters for each layer in the neural network). For example, if the network's predicted value is high, adjust the weight vector to make it predict a lower value, and keep adjusting it until the neural network can predict the target value we really want. Therefore, it is necessary to pre-define "how to compare the difference between the predicted value and the target value", which is the loss function or objective function, which are important equations used to measure the difference between the predicted value and the target value. Taking the loss function as an example, the higher the output value (loss) of the loss function, the greater the difference, so the training of the neural network becomes to minimize this loss as much as possible. process.

(2)反向传播算法(2) Back propagation algorithm

神经网络可以采用误差反向传播(back propagation,BP)算法在训练过程中修正初始的神经网络模型中参数的大小,使得神经网络模型的重建误差损失越来越小。具体地,前向传递输入信号直至输出会产生误差损失,通过反向传播误差损失信息来更新初始的神经网络模型中参数,从而使误差损失收敛。反向传播算法是以误差损失为主导的反向传播运动,旨在得到最优的神经网络模型的参数,例如权重矩阵。Neural networks can use the error back propagation (BP) algorithm to correct the size of the parameters in the initial neural network model during the training process, so that the reconstruction error loss of the neural network model becomes smaller and smaller. Specifically, the forward transmission of the input signal to the output will generate error loss, and the error loss information is back-propagated to update the parameters in the initial neural network model, so that the error loss converges. The back propagation algorithm is a back propagation movement dominated by error loss, which aims to obtain the optimal parameters of the neural network model, such as the weight matrix.

下面从神经网络的训练侧和神经网络的应用侧对本申请提供的方法进行描述。The method provided in the present application is described below from the training side of the neural network and the application side of the neural network.

本申请实施例提供的对话数据生成方法,可生成用户和对话模型之间的对话数据,并以对话数据作为训练数据,针对对话模型进行训练,从而得到训练后的对话模型。在模型训练的过程中,涉及数据序列的处理,具体可以应用于数据训练、机器学习、深度学习等方法,对训练数据(例如,本申请实施例提供的对话数据生成方法中的对话数据)进行符号化和形式化的智能信息建模、抽取、预处理、训练等,最终得到训练好的神经网络(例如,本申请实施例提供的对话数据生成方法中的训练后的对话模型);并且,本申请实施例提供的数据处理方法可以运用上述训练好的神经网络,将输入数据(例如,本申请实施例提供的数据处理方法中的提问)输入到所述训练好的神经网络中,得到输出数据(例如,本申请实施例提供的数据处理方法中的回答)。需要说明的是,本申请实施例提供的对话数据生成方法和数据处理方法是基于同一个构思产生的发明,也可以理解为一个系统中的两个部分,或一个整体流程的两个阶段:如模型训练阶段和模型应用阶段。The dialogue data generation method provided in the embodiment of the present application can generate dialogue data between a user and a dialogue model, and use the dialogue data as training data to train the dialogue model, thereby obtaining a trained dialogue model. In the process of model training, the processing of data sequences is involved, which can be specifically applied to data training, machine learning, deep learning and other methods, and the training data (for example, the dialogue data in the dialogue data generation method provided in the embodiment of the present application) is symbolized and formalized for intelligent information modeling, extraction, preprocessing, training, etc., and finally a trained neural network (for example, the trained dialogue model in the dialogue data generation method provided in the embodiment of the present application) is obtained; and the data processing method provided in the embodiment of the present application can use the above-mentioned trained neural network to input input data (for example, the question in the data processing method provided in the embodiment of the present application) into the trained neural network to obtain output data (for example, the answer in the data processing method provided in the embodiment of the present application). It should be noted that the dialogue data generation method and the data processing method provided in the embodiment of the present application are inventions based on the same concept, and can also be understood as two parts in a system, or two stages of an overall process: such as the model training stage and the model application stage.

本申请实施例提供的对话数据生成方法可应用于图4所示的对话数据生成架构中,图4为本申请实施例提供的对话数据生成架构的一个结构示意图,如图4所示,该架构包括:获取非文本形式的用户数据,将其转换为文本形式的用户数据。接着,可基于文本形式的用户数据结合预置的数据生成规则生成新的数据生成规则。然后,可利用新的数据生成规得到对话数据。最后,从对话数据中筛选出目标对话数据,目标对话数据可作为训练数据,从而训练得到最终的模型。为了进一步了解该对话数据生成架构的工作流程,下文结合图5对该工作流程作进一步的介绍。图5为本申请实施例提供的对话数据生成方法的一个流程示意图,如图5所示,该方法包括:The conversation data generation method provided in the embodiment of the present application can be applied to the conversation data generation architecture shown in Figure 4. Figure 4 is a structural diagram of the conversation data generation architecture provided in the embodiment of the present application. As shown in Figure 4, the architecture includes: obtaining user data in non-text form and converting it into user data in text form. Next, new data generation rules can be generated based on the user data in text form combined with preset data generation rules. Then, the new data generation rules can be used to obtain conversation data. Finally, the target conversation data is filtered out from the conversation data, and the target conversation data can be used as training data to train the final model. In order to further understand the workflow of the conversation data generation architecture, the workflow is further introduced below in conjunction with Figure 5. Figure 5 is a flow diagram of the conversation data generation method provided in the embodiment of the present application. As shown in Figure 5, the method includes:

501、获取用户数据,用户数据包含用户的属性和用户感兴趣的物品。501. Obtain user data, where the user data includes user attributes and items that the user is interested in.

本实施例中,当需要获取对话数据时,可先采集用户数据,用户数据通常可包含用户的属性(例如,用户的姓名、用户的性别以及用户的年龄等等)以及用户感兴趣(偏好)的物品(例如,用户曾经点击过的物品、用户浏览过的物品以及用户评论过的物品等等)。In this embodiment, when it is necessary to obtain conversation data, user data may be collected first. User data may generally include user attributes (for example, user's name, user's gender, user's age, etc.) and items of user interest (preference) (for example, items that the user has clicked on, items that the user has browsed, items that the user has commented on, etc.).

具体地,可通过以下方式获取用户数据:Specifically, user data can be obtained in the following ways:

在采集用户数据时,通常可直接采集得到的是非文本形式的用户数据,故可将采集得到的非文本形式的用户数据转换为文本形式的用户数据,以方便后续处理。When collecting user data, usually the user data that can be directly collected is in non-text form, so the collected non-text user data can be converted into text form to facilitate subsequent processing.

对于用户的属性而言,用户的属性一般位于用户的个人信息中。因此,可先采集用户的个人信息(用户的个人信息通常是一张图像或一张表格等等),此时,用户的属性是以图像形式或表格形式等非文本形式呈现的。那么,可从用户的个人信息中,将以非文本形式呈现的用户的属性转换为以文本形式呈现的用户的属性。As for the user's attributes, the user's attributes are generally located in the user's personal information. Therefore, the user's personal information can be collected first (the user's personal information is usually an image or a table, etc.). At this time, the user's attributes are presented in non-text forms such as image form or table form. Then, the user's attributes presented in non-text form can be converted into user attributes presented in text form from the user's personal information.

对于用户感兴趣的物品而言,用户感兴趣的物品一般位于用户的评论、浏览记录或点击记录中。因此,可先采集用户的评论、用户的浏览记录或用户的点击记录(用户的评论、用户的浏览记录或用户的点击记录通常是一张表格等等),此时,用户感兴趣的物品是以表格形式等非文本形式呈现的。那么,可从用户的评论、用户的浏览记录或用户的点击记录中,将以非文本形式呈现的用户感兴趣的物品转换为以文本形式呈现的用户感兴趣的物品。For items that users are interested in, the items that users are interested in are generally located in the user's comments, browsing history, or click history. Therefore, the user's comments, the user's browsing history, or the user's click history can be collected first (the user's comments, the user's browsing history, or the user's click history is usually a table, etc.), and at this time, the items that users are interested in are presented in a non-text form such as a table. Then, the items that users are interested in presented in a non-text form can be converted from the user's comments, the user's browsing history, or the user's click history into items that users are interested in presented in a text form.

例如,如图6所示(图6为本申请实施例提供的用户数据的转换过程的一个示意图),以电影推荐场景为例,可先采集用户的轮廓(profile)图像,用户的评论、用户的浏览记录以及用户的点击记录。For example, as shown in Figure 6 (Figure 6 is a schematic diagram of the user data conversion process provided in an embodiment of the present application), taking the movie recommendation scenario as an example, the user's profile image, user comments, user browsing history, and user click history can be collected first.

用户的轮廓图像呈现有以下用户的用户属性信息:(1)用户:李XX;(2)年龄:22;(3)位置:深圳;(4)兴趣:电影和音乐等等。那么,可从用户的轮廓图像中,识别出以下文本形式的用户属性信息:李XX,一位生活在深圳的22岁的男性用户,其兴趣爱好是看电影和听音乐等等。 The user's profile image presents the following user attribute information: (1) User: Li XX; (2) Age: 22; (3) Location: Shenzhen; (4) Interests: movies and music, etc. Then, the following user attribute information in text form can be identified from the user's profile image: Li XX, a 22-year-old male user living in Shenzhen, whose interests and hobbies are watching movies and listening to music, etc.

用户的评论包含以下用户的电影评论信息:(1)电影1是我看过的最有趣的电影;(2)电影2和电影3很无聊,其剧情和表演都不出彩等等。用户的浏览/点击记录包含以下用户的电影浏览信息/电影点击信息:(1)观看过的电影:电影1以及电影4等等;(2)想观看的电影:电影5、电影6以及电影7等等;(3)浏览过的电影:电影8、以及电影9等等。那么,可从用户的评论、用户的观看/点击记录中,提取出以下文本形式的用户电影偏好信息:用户张XX喜欢以下电影:电影5、电影6、电影7、电影8以及电影9等等,且用户张XX曾经观看过以下电影:电影1以及电影4。The user's comments include the following user's movie review information: (1) Movie 1 is the most interesting movie I have ever seen; (2) Movies 2 and 3 are boring, and their plots and performances are not outstanding, etc. The user's browsing/clicking records include the following user's movie browsing information/movie clicking information: (1) Movies watched: Movie 1 and Movie 4, etc.; (2) Movies you want to watch: Movie 5, Movie 6, Movie 7, etc.; (3) Movies you have browsed: Movie 8, Movie 9, etc. Then, the following user movie preference information in text form can be extracted from the user's comments and the user's viewing/clicking records: User Zhang XX likes the following movies: Movie 5, Movie 6, Movie 7, Movie 8, Movie 9, etc., and user Zhang XX has watched the following movies: Movie 1 and Movie 4.

502、基于用户数据确定可推荐的物品,可推荐的物品包含用户感兴趣的物品,以及与用户感兴趣的物品相关联的物品。502. Determine recommendable items based on user data, where the recommendable items include items that the user is interested in and items associated with the items that the user is interested in.

得到用户数据后,可将用户数据输入至物品采样模型(为已训练的神经网络模型),以通过物品采样模型对用户数据进行一系列的处理,从而得到可推荐给用户的物品。需要说明的是,可推荐给用户的物品可以物品列表的形式呈现,该物品列表不仅包含用户数据中的用户感兴趣的物品,还包含与用户感兴趣的物品相关联的其余物品。After obtaining the user data, the user data can be input into the item sampling model (which is a trained neural network model) to perform a series of processing on the user data through the item sampling model, thereby obtaining items that can be recommended to the user. It should be noted that the items that can be recommended to the user can be presented in the form of an item list, which includes not only the items that the user is interested in in the user data, but also the remaining items associated with the items that the user is interested in.

进一步地,在通过物品采样模型对用户数据进行一系列的处理后,不仅可以得到可推荐的物品,还可得到不可推荐给用户的物品(也就是用户不感兴趣的物品)。需要说明的是,不可推荐给用户的物品也可以物品列表的形式呈现。Furthermore, after a series of processing of the user data by the item sampling model, not only the recommended items but also the items that cannot be recommended to the user (that is, the items that the user is not interested in) can be obtained. It should be noted that the items that cannot be recommended to the user can also be presented in the form of an item list.

具体地,物品采样模型可通过以下方式获取可推荐给用户的物品以及不可推荐给用户的物品:Specifically, the item sampling model can obtain items that can be recommended to users and items that cannot be recommended to users in the following ways:

(1)在得到用户数据后,可先获取预置的候选物品池,候选物品池包含多个候选物品,故可将用户数据以及多个候选物品输入至物品采样模型,以使得物品采样模型对用户数据以及多个候选物品分别进行特征提取(例如,卷积操作等等),从而相应得到用户数据的特征以及多个候选物品的特征。(1) After obtaining the user data, a preset candidate item pool may be obtained first. The candidate item pool includes multiple candidate items. Therefore, the user data and the multiple candidate items may be input into the item sampling model, so that the item sampling model performs feature extraction (e.g., convolution operation, etc.) on the user data and the multiple candidate items respectively, thereby obtaining features of the user data and features of the multiple candidate items accordingly.

(2)得到用户数据的特征以及多个候选物品的特征后,物品采样模型可对用户数据的特征以及多个候选物品的特征进行计算,从而得到用户数据与多个候选物品之间的匹配度,包括用户数据与第一个候选物品之间的匹配度,用户数据与第二个候选物品之间的匹配度,...,用户数据与最后一个候选物品之间的匹配度。(2) After obtaining the features of the user data and the features of the multiple candidate items, the item sampling model can calculate the features of the user data and the features of the multiple candidate items, thereby obtaining the matching degree between the user data and the multiple candidate items, including the matching degree between the user data and the first candidate item, the matching degree between the user data and the second candidate item, ..., the matching degree between the user data and the last candidate item.

(3)得到用户数据与多个候选物品之间的匹配度后,物品采样模型可在多个候选物品中,将匹配度大于或等于第一阈值(第一阈值的大小可根据实际需求进行设置,此处不做限制)的候选物品确定为可推荐给用户的物品。需要说明的是,在多个候选物品中,有一部分候选物品与用户数据包含的用户感兴趣的物品是相同的,故这一部分候选物品与用户数据之间的匹配度是最大的(明显大于第一阈值),可确定为可推荐给用户的物品。而且,在多个候选物品中,还有一部分候选物品与用户数据包含的用户感兴趣的物品是相关联的,故这一部分候选物品与用户数据之间的匹配度是较大的(大于或等于第一阈值),可确定为可推荐给用户的物品。由此可见,可推荐给用户的物品不仅包含用户数据中的用户感兴趣的物品,还包含与用户感兴趣的物品相关联的物品。(3) After obtaining the matching degree between the user data and multiple candidate items, the item sampling model can determine the candidate items with a matching degree greater than or equal to the first threshold (the size of the first threshold can be set according to actual needs and is not limited here) among the multiple candidate items as items that can be recommended to the user. It should be noted that among the multiple candidate items, some of the candidate items are the same as the items that the user is interested in contained in the user data, so the matching degree between this part of the candidate items and the user data is the largest (significantly greater than the first threshold), and can be determined as items that can be recommended to the user. Moreover, among the multiple candidate items, some of the candidate items are associated with the items that the user is interested in contained in the user data, so the matching degree between this part of the candidate items and the user data is relatively large (greater than or equal to the first threshold), and can be determined as items that can be recommended to the user. It can be seen that the items that can be recommended to the user include not only the items that the user is interested in in the user data, but also the items associated with the items that the user is interested in.

(4)得到用户数据与多个候选物品之间的匹配度后,物品采样模型可在多个候选物品中,将匹配度小于或等于第二阈值(第二阈值小于第一阈值,第二阈值的大小可根据实际需求进行设置,此处不做限制)的候选物品确定为不可推荐给用户的物品。需要说明的是,在多个候选物品中,有一部分候选物品与用户数据包含的用户感兴趣的物品是完全不相关的,故这一部分候选物品与用户数据之间的匹配度是较小的(小于或等于第二阈值),可确定为不可推荐给用户的物品,也就是用户不感兴趣的物品。(4) After obtaining the matching degree between the user data and multiple candidate items, the item sampling model can determine the candidate items with a matching degree less than or equal to the second threshold (the second threshold is less than the first threshold, and the size of the second threshold can be set according to actual needs and is not limited here) among the multiple candidate items as items that cannot be recommended to the user. It should be noted that among the multiple candidate items, some of the candidate items are completely irrelevant to the items that the user is interested in and included in the user data. Therefore, the matching degree between this part of the candidate items and the user data is relatively small (less than or equal to the second threshold), and they can be determined as items that cannot be recommended to the user, that is, items that the user is not interested in.

依旧如上述例子,如图7所示(图7为本申请实施例提供的可推荐的物品的获取过程的一个示意图,图7是在图6的基础上绘制得到的),在得到用户属性信息以及用户偏好信息后,可将获取候选电影池,候选电影池包含电影1、电影2、电影3、...、电影50这50部候选电影。将用户属性信息、用户偏好信息以及候选电影池输入至物品采样模型后,可得到推荐电影列表以及非推荐电影列表,推荐电影列表包含:电影1、电影4、电影5、...、电影20,非推荐电影列表包含:电影2、电影3、电影21、...电影50。Still as in the above example, as shown in FIG7 (FIG. 7 is a schematic diagram of the acquisition process of the recommended items provided in the embodiment of the present application, and FIG7 is obtained on the basis of FIG6), after obtaining the user attribute information and the user preference information, the candidate movie pool can be obtained, and the candidate movie pool includes 50 candidate movies including movie 1, movie 2, movie 3, ..., movie 50. After inputting the user attribute information, the user preference information and the candidate movie pool into the item sampling model, a recommended movie list and a non-recommended movie list can be obtained, and the recommended movie list includes: movie 1, movie 4, movie 5, ..., movie 20, and the non-recommended movie list includes: movie 2, movie 3, movie 21, ... movie 50.

503、基于用户数据和可推荐的物品,更新预置的数据生成规则,得到新的数据生成规则。503. Based on the user data and the recommended items, the preset data generation rules are updated to obtain new data generation rules.

得到可推荐给用户的物品后,可利用用户数据以及可推荐给用户的物品,对预置的数据生成规则进行更新,从而得到新的数据生成规则。After obtaining items that can be recommended to the user, the preset data generation rules can be updated using the user data and the items that can be recommended to the user, thereby obtaining new data generation rules.

进一步地,若不仅得到可推荐给用户的物品,还得到不可推荐给用户的物品,则可利用用户数据、 可推荐给用户的物品以及不可推荐给用户的物品,对预置的数据生成规则(也可以称为预置的数据生成指令)进行更新,从而得到新的数据生成规则(也可以称为新的数据生成指令)。Furthermore, if not only items that can be recommended to users but also items that cannot be recommended to users are obtained, user data, The items that can be recommended to the user and the items that cannot be recommended to the user update the preset data generation rules (also called preset data generation instructions) to obtain new data generation rules (also called new data generation instructions).

具体地,可通过以下方式获取新的数据生成规则:Specifically, new data generation rules can be obtained in the following ways:

值得注意的是,预置的数据生成规则可包含两部分,一部分为不需补充的规则(即完整的规则),另一部分为待补充的规则(即不完整的规则),待补充的规则具有可填充内容的槽位。那么,可将用户数据、可推荐的物品和不可推荐的物品填充至待补充的规则的槽位中,从而得到补充后的规则。如此一来,不需补充的规则以及补充后的规则构成了新的数据生成规则,其中,不需补充的规则用于设置用户与对话模型之间的对话数据的格式(例如,对话数据的问答轮数、对话数据的启动方式(即对话数据以闲聊的方式启动)、对话数据的语言风格、对话数据中用户与对话模型的行为准则、对话数据需包含针对物品的描述等等),补充后的规则用于设置用户与对话模型之间的对话数据的内容(例如,对话数据需考虑用户的个人信息、对话数据需呈现用户的推荐需求、对话数据中对话模型需满足的物品推荐范围等等)。It is worth noting that the preset data generation rules may include two parts, one part is the rules that do not need to be supplemented (i.e., complete rules), and the other part is the rules to be supplemented (i.e., incomplete rules), and the rules to be supplemented have slots that can be filled with content. Then, user data, recommended items, and non-recommended items can be filled into the slots of the rules to be supplemented, thereby obtaining the supplemented rules. In this way, the rules that do not need to be supplemented and the supplemented rules constitute new data generation rules, wherein the rules that do not need to be supplemented are used to set the format of the dialogue data between the user and the dialogue model (for example, the number of question and answer rounds of the dialogue data, the way to start the dialogue data (i.e., the dialogue data is started in the form of small talk), the language style of the dialogue data, the behavioral norms of the user and the dialogue model in the dialogue data, the dialogue data must contain descriptions of items, etc.), and the supplemented rules are used to set the content of the dialogue data between the user and the dialogue model (for example, the dialogue data must consider the user's personal information, the dialogue data must present the user's recommendation needs, the range of recommended items that the dialogue model must meet in the dialogue data, etc.).

依旧如上述例子,如图8所示(图8为本申请实施例提供的数据生成规则的获取过程的一个示意图,图8是在图7的基础上绘制得到的),在得到推荐电影列表以及非推荐电影列表后,可获取预置的13条数据生成指令,其中,数据生成指令(5)、数据生成指令(6)、数据生成指令(7)、数据生成指令(10)均为不完整的规则,其余数据生成指令均为完整的规则。那么,可利用用户属性信息、用户偏好信息、推荐电影列表以及非推荐电影列表对预置的数据生成指令对不完整的规则进行补充,从而得到新的13条数据生成指令:Still taking the above example as shown in FIG8 (FIG8 is a schematic diagram of the acquisition process of the data generation rules provided in the embodiment of the present application, and FIG8 is obtained by drawing on the basis of FIG7), after obtaining the recommended movie list and the non-recommended movie list, 13 preset data generation instructions can be obtained, among which data generation instruction (5), data generation instruction (6), data generation instruction (7), and data generation instruction (10) are all incomplete rules, and the remaining data generation instructions are all complete rules. Then, the preset data generation instructions can be used to supplement the incomplete rules with user attribute information, user preference information, the recommended movie list, and the non-recommended movie list, thereby obtaining 13 new data generation instructions:

(1)对话数据必须包含10轮问答,但不得超过20轮问答。(1) The dialogue data must contain 10 rounds of questions and answers, but not more than 20 rounds.

(2)对话数据必须以用户(提问方)和对话模型(回答方)之间的闲聊启动。(2) The dialogue data must start with a casual chat between the user (questioner) and the dialogue model (answerer).

(3)对话模型每轮仅能向用户推荐一部电影,且不能在推荐电影列表之外向用户推荐电影。(3) The dialogue model can only recommend one movie to the user in each round and cannot recommend movies to the user outside the recommended movie list.

(4)在对话数据中,对话模型必须探索用户对电影的品味以及兴趣,并根据用户的反馈调整推荐策略。(4) In the conversation data, the conversation model must explore the user’s taste and interest in movies and adjust the recommendation strategy based on user feedback.

(5)用户是一位生活在深圳的22岁的男性用户,其兴趣爱好是看电影和听音乐等等。(5) The user is a 22-year-old male user living in Shenzhen. His hobbies include watching movies and listening to music, etc.

(6)用户喜欢的电影有:电影1、电影4、电影5、电影6、电影7、电影8以及电影9等等。(6) The user’s favorite movies are: Movie 1, Movie 4, Movie 5, Movie 6, Movie 7, Movie 8, Movie 9, and so on.

(7)用户不喜欢的电影有:电影2以及电影3。(7) The movies that the user dislikes are: Movie 2 and Movie 3.

(8)用户应逐步表达自己的兴趣,如果电影不符合自己的喜好或已经看过,应拒绝观看。(8) Users should gradually express their interests and refuse to watch a movie if it does not suit their preferences or if they have already seen it.

(9)用户可以询问更多的细节,例如演员,导演,剧情,或者关于电影的介绍。(9) Users can ask for more details, such as actors, directors, plot, or an introduction to the movie.

(10)可推荐的电影:电影1、电影4、电影5、...、电影20,不可推荐的电影:电影2、电影3、电影21、...电影50。(10) Recommendable movies: Movie 1, Movie 4, Movie 5, ..., Movie 20; unrecommended movies: Movie 2, Movie 3, Movie 21, ..., Movie 50.

(11)对话数据中提到的电影都应附上符号“<>”。(11) Movies mentioned in the conversation data should be accompanied by the symbol “<>”.

(12)对话数据中所有提到的与电影相关的实体,如导演、演员、类型、演员等,都应附上符号“[]”。(12) All movie-related entities mentioned in the conversation data, such as director, actor, genre, actor, etc., should be enclosed by the symbol “[]”.

(13)所有关于一部电影的描述或解释都应该附上符号“{}”。(13) All descriptions or explanations of a film should be enclosed by the symbols “{}”.

504、基于新的数据生成规则,生成用户与对话模型之间的对话数据,对话数据包含对话模型向用户推荐的物品,对话模型向用户推荐的物品来自可推荐的物品。504. Generate dialogue data between the user and the dialogue model based on the new data generation rule, where the dialogue data includes items recommended by the dialogue model to the user, and the items recommended by the dialogue model to the user are from the recommendable items.

得到新的数据生成规则后,可将新的数据生成规则输入至对话模型(待训练的神经网络模型),故对话模型可按照新的数据生成规则,来生成用户与对话模型之间的对话数据。需要说明的是,用户与对话模型之间的对话数据通常包含多轮交互,多轮交互包含多轮普通对话以及多轮问答,每一轮普通对话包含用户的一句非提问的话以及对话模型的一个答复(或者,每一轮普通对话包含对话模型的一句非提问的话以及用户的一个答复),每一轮问答包含用户的一个提问以及对话模型的一个回答(或者,每一轮问答包含对话模型的一个提问以及用户的一个回答)。After obtaining the new data generation rules, the new data generation rules can be input into the dialogue model (neural network model to be trained), so the dialogue model can generate dialogue data between the user and the dialogue model according to the new data generation rules. It should be noted that the dialogue data between the user and the dialogue model usually includes multiple rounds of interaction, which include multiple rounds of ordinary dialogue and multiple rounds of question and answer. Each round of ordinary dialogue includes a non-question sentence of the user and a reply of the dialogue model (or, each round of ordinary dialogue includes a non-question sentence of the dialogue model and a reply of the user), and each round of question and answer includes a question of the user and an answer of the dialogue model (or, each round of question and answer includes a question of the dialogue model and an answer of the user).

值得注意的是,在多轮问答的某一轮问答中,用户的提问可以为令对话模型为用户推荐物品,对话模型的回答可以为对话模型向用户推荐的物品,且对话模型向用户推荐的物品来源于可推荐的物品(这样可以模拟用户接受推荐),也可以来源于不可推荐的物品(这样可以模拟用户拒绝推荐)。当然,在多轮普通对话的某一轮对话中,用户的话可以为用户向对话模型发起的闲聊,对话模型的答复为对话模型针对用户的闲聊所进行的回应等等。 It is worth noting that in a round of multi-round Q&A, the user's question can be to ask the dialogue model to recommend items to the user, and the dialogue model's answer can be the item recommended by the dialogue model to the user. The items recommended by the dialogue model to the user come from recommended items (this can simulate the user accepting the recommendation) or from unrecommended items (this can simulate the user rejecting the recommendation). Of course, in a round of multi-round ordinary dialogue, the user's words can be the chat initiated by the user to the dialogue model, and the dialogue model's reply can be the dialogue model's response to the user's chat, and so on.

如此一来,最终生成得到的对话数据所包含的内容,不仅有用户与对话模型之间进行闲聊的内容,还有用户接受对话模型所推荐的物品的内容,更可以有用户拒绝对话模型所推荐的物品的内容,从而使得最终生成得到的对话数据更贴近于真实。In this way, the content of the final generated dialogue data includes not only the content of the chat between the user and the dialogue model, but also the content of the user accepting the items recommended by the dialogue model, and even the content of the user rejecting the items recommended by the dialogue model, so that the final generated dialogue data is closer to reality.

依旧如上述例子,如图9所示(图9为本申请实施例提供的对话数据的获取过程的一个示意图,图9是在图8的基础上绘制得到的),得到新的13条数据生成指令后,可将新的13条数据生成指令输入对话模型,以使得对话模型生成以下对话数据(包含10轮交互):Still in the above example, as shown in FIG. 9 (FIG. 9 is a schematic diagram of a process of acquiring dialogue data provided in an embodiment of the present application, and FIG. 9 is drawn on the basis of FIG. 8), after obtaining 13 new data generation instructions, the 13 new data generation instructions can be input into the dialogue model, so that the dialogue model generates the following dialogue data (including 10 rounds of interaction):

用户:嗨,你有什么电影推荐给我吗?User: Hi, do you have any movie recommendations for me?

对话模型:当然,你喜欢什么类型的电影?Dialogue Model: Of course, what kind of movies do you like?

用户:我喜欢科幻小说和反乌托邦电影。User: I like science fiction and dystopian movies.

对话模型:<电影4>怎么样?这是一部经典[科幻]电影。Dialogue model: How about <Movie 4>? It's a classic [science fiction] movie.

用户:我已经看过那部了。你有其他的推荐吗?User: I've already seen that one. Do you have any other recommendations?

对话模型:<电影21>怎么样?这是一部演员阵容强大的悬疑[惊悚]片。Dialogue Model: How about Movie 21? It's a suspenseful thriller with a great cast.

用户:我不太喜欢恐怖片。你有更多科幻或反乌托邦题材的作品吗?User: I'm not a big fan of horror movies. Do you have more sci-fi or dystopian titles?

对话模型:<电影15>这部电影怎么样?这是一部以宇宙飞船为背景的科幻电影。Dialogue model: <Movie 15> How is this movie? It is a science fiction movie set in a spaceship.

用户:听起来很有趣!能详细介绍一下吗?User:That sounds interesting! Can you tell me more about it?

对话模型:主演是[克XX]和[珍XX],{他们乘坐飞船前往一个新的星球。但它们提前90年从冬眠中醒来,不得不想办法共同生存}。Dialogue Model: The main characters are [G] and [J], {They travel to a new planet in a spaceship. But they wake up from hibernation 90 years early and have to find a way to survive together}.

用户:我好像听说过,这个我还没有观看过,我后续会看它的。User: I seem to have heard of it, but I haven’t watched it yet. I will watch it later.

对话模型:太好了!我的另一个推荐是<电影1>。这是一部[反乌托邦]电影,讲的是{青少年殊死搏斗的比赛}。Dialogue Model: Great! My other recommendation is Movie 1. It's a [dystopian] movie about a [teenage death-defying competition].

用户:我其实看过那部,我很喜欢它。你有什么其他的推荐吗?User: I actually saw that one and I loved it. Do you have any other recommendations?

对话模型:<电影35>怎么样?这是另一部[反乌托邦]电影,讲述的是{一个社会,人们被根据他们的个性特征来划分派系}。Dialogue Model: How about <Movie 35>? This is another [dystopian] movie about {a society where people are divided into factions based on their personality traits}.

用户:我不是很喜欢这类型的电影。你还有别的吗?User: I don't really like this type of movie. Do you have any other ones?

对话模型:<电影50>怎么样呢?它这是经典科幻电影<电影49>的续集。Dialogue Model: How about Movie 50? It is the sequel to the classic sci-fi movie Movie 49.

用户:我没有看过原版的<电影49>,所以我不认为我能看懂续集。你还有别的吗?User: I haven't seen the original Movie 49, so I don't think I'd understand the sequel. Do you have anything else?

对话模型:<电影30>怎么样,它是{一部关于一个冒充军阀的小偷的故事}。Dialogue Model: How about <Movie 30>, which is {a story about a thief who pretends to be a warlord}.

用户:那不是我的菜。我想现在我还是会坚持看<电影15>。谢谢你的推荐!User: That's not my cup of tea. I think I'll stick to Movie 15 for now. Thanks for the recommendation!

505、从对话数据中获取目标对话数据,目标对话数据用于对对话模型进行训练,得到训练后的对话模型。505. Obtain target dialogue data from the dialogue data. The target dialogue data is used to train the dialogue model to obtain a trained dialogue model.

得到用户与对话模型之间的对话数据后,可将对话数据输入至数据筛选模型(已训练的神经网络模型),以从对话数据所包含的多轮交互中,筛选出若干轮交互,这若干轮交互即目标对话数据。需要说明的是,目标对话数据满足以下至少一项:(1)目标对话数据包含的所有文字均位于预置的文字集合(预置的文字集合中所包含的所有文字均为非违规的文字,也可以理解为非歧视、非偏见以及非辱骂等文字)中。(2)目标对话数据包含的针对物品的描述符合真实的描述。(3)目标对话数据包含的物品均为真实的物品。(4)目标对话数据包含的内容的丰富度大于或等于第三阈值(第三阈值的大小可根据实际需求进行设置,此处不做限制),其中,目标对话数据包含的内容的丰富度可基于目标对话数据的交互轮数、目标对话数据的长度以及目标对话数据所包含的物品数量等信息进行计算得到。After obtaining the dialogue data between the user and the dialogue model, the dialogue data can be input into the data screening model (trained neural network model) to screen out several rounds of interaction from the multiple rounds of interaction contained in the dialogue data. These several rounds of interaction are the target dialogue data. It should be noted that the target dialogue data satisfies at least one of the following: (1) All the texts contained in the target dialogue data are in a preset text set (all the texts contained in the preset text set are non-violation texts, which can also be understood as non-discriminatory, non-prejudiced and non-insulting texts). (2) The description of the object contained in the target dialogue data is consistent with the real description. (3) The objects contained in the target dialogue data are all real objects. (4) The richness of the content contained in the target dialogue data is greater than or equal to a third threshold (the size of the third threshold can be set according to actual needs and is not limited here), wherein the richness of the content contained in the target dialogue data can be calculated based on information such as the number of interaction rounds of the target dialogue data, the length of the target dialogue data, and the number of objects contained in the target dialogue data.

依旧如上述例子,如图10所示(图10为本申请实施例提供的对话数据的获取过程的一个示意图,图10是在图9的基础上绘制得到的),得到对话数据后,可将对话数据输入至数据筛选模型中。数据筛选模型包含违规检测模块、实体真实性检测模块、描述真实性检测模块以及丰富度检测模块,其中,在对话数据所包含的多轮交互中,违规检测模块可将包含歧视、偏见、辱骂等违规信息的交互剔除,实体真实性检测模块可(借助记录有真实电影、真实实体、真实电影与真实实体之间的关系等各种信息的知识图或信息库等等)将包含不真实的电影以及不真实的实体(导演、演员、剧情)等不真实信息的交互剔除,描述真实性检测模块可(借助记录有各个电影的真实描述(介绍)的公共搜索平台等等)将包含不真实的电影描述等不真实信息的交互剔除,丰富度检测模块可将丰富度(基于问答的区别度、问答 的长度、问答的轮数、问答包含的电影以及实体数量等各项指标计算得到)不足的交互剔除,剩余的其余交互则构成了目标对话数据。Still as in the above example, as shown in Figure 10 (Figure 10 is a schematic diagram of the process of obtaining dialogue data provided by an embodiment of the present application, and Figure 10 is drawn on the basis of Figure 9), after obtaining the dialogue data, the dialogue data can be input into the data screening model. The data screening model includes a violation detection module, an entity authenticity detection module, a description authenticity detection module, and a richness detection module, wherein, in the multiple rounds of interactions contained in the dialogue data, the violation detection module can eliminate interactions containing illegal information such as discrimination, prejudice, and insults, the entity authenticity detection module can (with the help of a knowledge graph or information library that records various information such as real movies, real entities, and the relationship between real movies and real entities, etc.) eliminate interactions containing unreal information such as unreal movies and unreal entities (directors, actors, plots), the description authenticity detection module can (with the help of a public search platform that records the real description (introduction) of each movie, etc.) eliminate interactions containing unreal information such as unreal movie descriptions, and the richness detection module can (based on the richness (based on the distinctiveness of questions and answers, questions and answers) The degree of distinction, the degree of difference ... The insufficient interactions are eliminated, and the remaining interactions constitute the target dialogue data.

进一步地,得到目标对话数据后,可将目标对话数据作为训练数据,以此来训练对话模型,得到训练后的对话模型(已训练的神经网络模型),也就是具备物品推荐功能的对话模型。Furthermore, after obtaining the target dialogue data, the target dialogue data can be used as training data to train the dialogue model to obtain a trained dialogue model (trained neural network model), that is, a dialogue model with an item recommendation function.

应理解,步骤505是可选的,在实际应用中,可不执行步骤505,而是直接将步骤504所得到的对话数据直接作为训练数据,以此来训练对话模型,得到训练后的对话模型。It should be understood that step 505 is optional. In actual applications, step 505 may not be performed, but the dialogue data obtained in step 504 may be directly used as training data to train the dialogue model and obtain a trained dialogue model.

此外,可将本申请实施例生成的对话数据与众包工程的工作人员得到(人工标注)的对话数据进行比较,比较结果如表1所示:
In addition, the conversation data generated by the embodiment of the present application can be compared with the conversation data obtained (manually annotated) by the staff of the crowdsourcing project. The comparison results are shown in Table 1:

基于表1可知,本申请实施例得到的对话数据的质量优于人工标注所得到的对话数据。Based on Table 1, it can be seen that the quality of the dialogue data obtained in the embodiment of the present application is better than the dialogue data obtained by manual annotation.

进一步地,还可将本申请实施例生成的对话数据与众包工程的工作人员得到(人工标注)的对话数据,由四个评论员(evaluator)在角色一致性(role consistency),流畅性(fluency),知识性(informativeness)以及趣味性(interestingness)这额外的四个指标上分别进行评分(这四个指标的打分均在1分至5分之间,其中,1分最差,5分最好),评分结果如图11至图14所示(图11为本申请实施例提供的评分结果的一个示意图,图12为本申请实施例提供的评分结果的另一示意图,图13为本申请实施例提供的评分结果的另一示意图,图14为本申请实施例提供的评分结果的另一示意图)。Furthermore, the conversation data generated by the embodiment of the present application and the conversation data obtained (manually annotated) by the staff of the crowdsourcing project can be scored by four evaluators on four additional indicators, namely role consistency, fluency, informativeness and interestingness (the scores of these four indicators are all between 1 and 5 points, where 1 is the worst and 5 is the best), and the scoring results are shown in Figures 11 to 14 (Figure 11 is a schematic diagram of the scoring results provided by the embodiment of the present application, Figure 12 is another schematic diagram of the scoring results provided by the embodiment of the present application, Figure 13 is another schematic diagram of the scoring results provided by the embodiment of the present application, and Figure 14 is another schematic diagram of the scoring results provided by the embodiment of the present application).

基于图11至图14可知,本申请实施例得到的对话数据,在角色一致性,流畅性,知识性以及趣味性这些指标上的得分均优于人工标注所得到的对话数据,即本申请实施例得到的对话数据的质量较好。Based on Figures 11 to 14, it can be seen that the dialogue data obtained in the embodiments of the present application has better scores in terms of role consistency, fluency, knowledge and fun than the dialogue data obtained by manual annotation, that is, the quality of the dialogue data obtained in the embodiments of the present application is better.

本申请实施例中,当需要生成用户和对话模型之间的对话数据时,可先获取用户数据,用户数据包含用户的属性和用户感兴趣的物品。接着,可对用户数据进行处理,从而得到可推荐的物品,可推荐的物品包含用户感兴趣的物品以及与用户感兴趣的物品相关联的物品。然后,可利用用户数据和可推荐的物品,对预置的数据生成规则进行更新,从而得到新的数据生成规则。最后,可按照新的数据生成规则,以生成用户与对话模型之间的对话数据,对话数据包含对话模型向用户推荐的物品,对话模型向用户推荐的物品来自可推荐的物品。前述过程提供了一种对话数据生成框架,该框架可利用采集得到的用户数据集合预置的数据生成规则来获取新的数据生成规则,并利用新的数据生成规来得到用户与对话模型之间的对话数据,由此可见,该框架可自动生成对话数据,对话数据的整个生成过程不需人工干预,可有效提升对话数据的生成效率,减小对话数据的生成成本。In the embodiment of the present application, when it is necessary to generate the dialogue data between the user and the dialogue model, the user data may be obtained first, and the user data includes the attributes of the user and the items that the user is interested in. Then, the user data may be processed to obtain the recommended items, and the recommended items include the items that the user is interested in and the items associated with the items that the user is interested in. Then, the preset data generation rules may be updated using the user data and the recommended items, so as to obtain new data generation rules. Finally, the dialogue data between the user and the dialogue model may be generated according to the new data generation rules, and the dialogue data includes the items recommended to the user by the dialogue model, and the items recommended to the user by the dialogue model are from the recommended items. The above process provides a dialogue data generation framework, which may obtain new data generation rules using the data generation rules preset by the collected user data set, and obtain the dialogue data between the user and the dialogue model using the new data generation rules. It can be seen that the framework can automatically generate dialogue data, and the entire generation process of dialogue data does not require manual intervention, which can effectively improve the generation efficiency of dialogue data and reduce the generation cost of dialogue data.

进一步地,本申请实施例提供的对话数据生成框架中,由神经网络模型(物品采集模型、对话模型以及数据筛选模型)来替代人工生成对话数据,由于神经网络模型自身具备强大的学习和理解能力,可以准确按照数据生成规则生成质量较优的对话数据,有利于后续的数据清洗以及评测,且可使得后续训练得到的对话模型具备较优的性能。Furthermore, in the dialogue data generation framework provided in the embodiment of the present application, a neural network model (item collection model, dialogue model and data screening model) is used to replace the manually generated dialogue data. Since the neural network model itself has powerful learning and understanding capabilities, it can accurately generate high-quality dialogue data according to data generation rules, which is beneficial to subsequent data cleaning and evaluation, and can enable the dialogue model obtained by subsequent training to have better performance.

以上是对本申请实施例提供的对话数据生成方法所进行的详细说明,以下将对本申请实施例提供的数据处理方法进行介绍。图15为本申请实施例提供的数据处理方法的一个流程示意图,如图15所示,该方法包括:The above is a detailed description of the method for generating conversation data provided in the embodiment of the present application. The following is an introduction to the data processing method provided in the embodiment of the present application. FIG. 15 is a flow chart of the data processing method provided in the embodiment of the present application. As shown in FIG. 15 , the method includes:

1501、获取用户的提问,用户的提问用于描述用户的物品推荐需求。1501. Obtain the user's question, where the user's question is used to describe the user's item recommendation needs.

本实施例中,当用户存在物品推荐需求时,可获取来自用户的文本形式的提问,该提问用于描述用户的物品推荐需求。In this embodiment, when a user has a demand for item recommendation, a textual question from the user may be obtained, where the question is used to describe the user's demand for item recommendation.

1502、将用户的提问输入至训练后的对话模型,得到与提问对应的回答,回答用于描述针对用户的物品推荐结果。1502. Input the user's question into the trained dialogue model to obtain an answer corresponding to the question, and the answer is used to describe the item recommendation result for the user.

得到用户的提问后,可将用户的提问输入至图5所示实施例中的训练后的对话模型,以通过训练后的对话模型对用户进行处理,从而得到与提问对应的回答,回答用于描述针对用户的物品推荐结果,也就是推荐给用户的物品。 After obtaining the user's question, the user's question can be input into the trained dialogue model in the embodiment shown in Figure 5, so as to process the user through the trained dialogue model to obtain an answer corresponding to the question. The answer is used to describe the item recommendation result for the user, that is, the item recommended to the user.

以上是对本申请实施例提供的数据处理方法所进行的详细说明,以下将对本申请实施例提供的对话数据生成装置以及数据处理装置进行介绍。图16为本申请实施例提供的对话数据生成装置的一个结构示意图,如图16所示,该装置包括:The above is a detailed description of the data processing method provided in the embodiment of the present application. The following is an introduction to the conversation data generation device and the data processing device provided in the embodiment of the present application. FIG16 is a structural diagram of the conversation data generation device provided in the embodiment of the present application. As shown in FIG16, the device includes:

获取模块1601,用于获取用户数据,用户数据包含用户的属性和用户感兴趣的物品;The acquisition module 1601 is used to acquire user data, where the user data includes user attributes and items that the user is interested in;

确定模块1602,用于基于用户数据确定可推荐的物品,可推荐的物品包含用户感兴趣的物品,以及与用户感兴趣的物品相关联的物品;A determination module 1602, configured to determine recommendable items based on user data, wherein the recommendable items include items that the user is interested in, and items associated with the items that the user is interested in;

更新模块1603,用于基于用户数据和可推荐的物品,更新预置的数据生成规则,得到新的数据生成规则;An updating module 1603, used to update the preset data generation rules based on the user data and the recommended items to obtain new data generation rules;

生成模块1604,用于基于新的数据生成规则,生成用户与对话模型之间的对话数据,对话数据包含对话模型向用户推荐的物品,对话模型向用户推荐的物品来自可推荐的物品。The generation module 1604 is used to generate dialogue data between the user and the dialogue model based on the new data generation rule, where the dialogue data includes items recommended by the dialogue model to the user, and the items recommended by the dialogue model to the user are from the recommendable items.

本申请实施例中,当需要生成用户和对话模型之间的对话数据时,可先获取用户数据,用户数据包含用户的属性和用户感兴趣的物品。接着,可对用户数据进行处理,从而得到可推荐的物品,可推荐的物品包含用户感兴趣的物品以及与用户感兴趣的物品相关联的物品。然后,可利用用户数据和可推荐的物品,对预置的数据生成规则进行更新,从而得到新的数据生成规则。最后,可按照新的数据生成规则,以生成用户与对话模型之间的对话数据,对话数据包含对话模型向用户推荐的物品,对话模型向用户推荐的物品来自可推荐的物品。前述过程提供了一种对话数据生成框架,该框架可利用采集得到的用户数据集合预置的数据生成规则来获取新的数据生成规则,并利用新的数据生成规来得到用户与对话模型之间的对话数据,由此可见,该框架可自动生成对话数据,对话数据的整个生成过程不需人工干预,可有效提升对话数据的生成效率,减小对话数据的生成成本。In the embodiment of the present application, when it is necessary to generate the dialogue data between the user and the dialogue model, the user data may be obtained first, and the user data includes the attributes of the user and the items that the user is interested in. Then, the user data may be processed to obtain the recommended items, and the recommended items include the items that the user is interested in and the items associated with the items that the user is interested in. Then, the preset data generation rules may be updated using the user data and the recommended items, so as to obtain new data generation rules. Finally, the dialogue data between the user and the dialogue model may be generated according to the new data generation rules, and the dialogue data includes the items recommended to the user by the dialogue model, and the items recommended to the user by the dialogue model are from the recommended items. The above process provides a dialogue data generation framework, which may obtain new data generation rules using the data generation rules preset by the collected user data set, and obtain the dialogue data between the user and the dialogue model using the new data generation rules. It can be seen that the framework can automatically generate dialogue data, and the entire generation process of dialogue data does not require manual intervention, which can effectively improve the generation efficiency of dialogue data and reduce the generation cost of dialogue data.

在一种可能实现的方式中,确定模块,还用于基于用户数据确定不可推荐的物品;更新模块,用于基于用户数据、可推荐的物品和不可推荐的物品,更新预置的数据生成规则,得到新的数据生成规则。In one possible implementation, the determination module is further used to determine non-recommended items based on user data; the update module is used to update preset data generation rules based on user data, recommendable items and non-recommended items to obtain new data generation rules.

在一种可能实现的方式中,确定模块,用于:对用户数据以及多个候选物品进行特征提取,得到用户数据的特征以及多个候选物品的特征;对用户数据的特征以及多个候选物品的特征进行计算,得到用户数据与多个候选物品之间的匹配度;将匹配度大于或等于第一阈值的候选物品确定为可推荐的物品。In one possible implementation, the determination module is used to: extract features from user data and multiple candidate items to obtain features of the user data and features of the multiple candidate items; calculate the features of the user data and features of the multiple candidate items to obtain a matching degree between the user data and the multiple candidate items; and determine a candidate item having a matching degree greater than or equal to a first threshold as a recommendable item.

在一种可能实现的方式中,确定模块,用于:将匹配度小于或等于第二阈值的候选物品确定为不可推荐的物品,第二阈值小于第一阈值。In a possible implementation, the determination module is used to determine candidate items whose matching degree is less than or equal to a second threshold as non-recommended items, where the second threshold is less than the first threshold.

在一种可能实现的方式中,预置的数据生成规则包含不需补充的规则以及待补充的规则,更新模块,用于:将用户数据、可推荐的物品和不可推荐的物品填充至待补充的规则,得到补充后的规则,不需补充的规则以及补充后的规则构成新的数据生成规则,不需补充的规则用于设置对话数据的格式,补充后的规则用于设置对话数据的内容。In one possible implementation, the preset data generation rules include rules that do not need to be supplemented and rules to be supplemented, and the update module is used to: fill the user data, recommended items and non-recommended items into the rules to be supplemented to obtain the supplemented rules. The rules that do not need to be supplemented and the supplemented rules constitute new data generation rules. The rules that do not need to be supplemented are used to set the format of the dialogue data, and the supplemented rules are used to set the content of the dialogue data.

在一种可能实现的方式中,该装置还包括:筛选模块,用于从对话数据中获取目标对话数据,目标对话数据满足以下至少一项:目标对话数据包含的所有文字均位于预置的文字集合中;目标对话数据包含的针对物品的描述符合真实的描述;目标对话数据包含的物品为真实的物品;目标对话数据包含的内容的丰富度大于或等于第三阈值。In one possible implementation, the device also includes: a screening module, used to obtain target conversation data from the conversation data, and the target conversation data satisfies at least one of the following: all texts contained in the target conversation data are located in a preset text set; the description of the object contained in the target conversation data conforms to the real description; the object contained in the target conversation data is a real object; the richness of the content contained in the target conversation data is greater than or equal to a third threshold.

在一种可能实现的方式中,该装置还包括:训练模块,用于基于目标对话数据,对对话模型进行训练,得到训练后的对话模型。In one possible implementation, the device further includes: a training module, configured to train the dialogue model based on target dialogue data to obtain a trained dialogue model.

图17为本申请实施例提供的数据处理装置的一个结构示意图,如图17所示,该装置包括:FIG. 17 is a schematic diagram of a structure of a data processing device provided in an embodiment of the present application. As shown in FIG. 17 , the device includes:

获取模块1701,用于获取用户的提问,用户的提问用于描述用户的物品推荐需求。The acquisition module 1701 is used to acquire the user's question, which is used to describe the user's item recommendation needs.

处理模块1702,用于将用户的提问输入至训练后的对话模型,得到与提问对应的回答,回答用于描述针对用户的物品推荐结果。The processing module 1702 is used to input the user's question into the trained dialogue model to obtain an answer corresponding to the question, and the answer is used to describe the item recommendation result for the user.

需要说明的是,上述装置各模块/单元之间的信息交互、执行过程等内容,由于与本申请方法实施例基于同一构思,其带来的技术效果与本申请方法实施例相同,具体内容可参考本申请实施例前述所示的方法实施例中的叙述,此处不再赘述。It should be noted that the information interaction, execution process, etc. between the modules/units of the above-mentioned device are based on the same concept as the method embodiment of the present application, and the technical effects they bring are the same as those of the method embodiment of the present application. For specific contents, please refer to the description in the method embodiment shown above in the embodiment of the present application, and will not be repeated here.

本申请实施例还涉及一种执行设备,图18为本申请实施例提供的执行设备的一个结构示意图。如图18所示,执行设备1800具体可以表现为手机、平板、笔记本电脑、智能穿戴设备、服务器等,此处不做限定。其中,执行设备1800上可部署有图17对应实施例中所描述的数据处理装置,用于实现图15 对应实施例中数据处理的功能。具体的,执行设备1800包括:接收器1801、发射器1802、处理器1803和存储器1804(其中执行设备1800中的处理器1803的数量可以一个或多个,图18中以一个处理器为例),其中,处理器1803可以包括应用处理器18031和通信处理器18032。在本申请的一些实施例中,接收器1801、发射器1802、处理器1803和存储器1804可通过总线或其它方式连接。The present application also relates to an execution device. FIG18 is a schematic diagram of the structure of the execution device provided by the present application. As shown in FIG18, the execution device 1800 can be specifically a mobile phone, a tablet, a laptop, a smart wearable device, a server, etc., which is not limited here. The execution device 1800 can be deployed with the data processing device described in the corresponding embodiment of FIG17 to implement FIG15. The function of data processing in the corresponding embodiment. Specifically, the execution device 1800 includes: a receiver 1801, a transmitter 1802, a processor 1803 and a memory 1804 (wherein the number of processors 1803 in the execution device 1800 can be one or more, and one processor is taken as an example in FIG18), wherein the processor 1803 may include an application processor 18031 and a communication processor 18032. In some embodiments of the present application, the receiver 1801, the transmitter 1802, the processor 1803 and the memory 1804 may be connected via a bus or other means.

存储器1804可以包括只读存储器和随机存取存储器,并向处理器1803提供指令和数据。存储器1804的一部分还可以包括非易失性随机存取存储器(non-volatile random access memory,NVRAM)。存储器1804存储有处理器和操作指令、可执行模块或者数据结构,或者它们的子集,或者它们的扩展集,其中,操作指令可包括各种操作指令,用于实现各种操作。The memory 1804 may include a read-only memory and a random access memory, and provides instructions and data to the processor 1803. A portion of the memory 1804 may also include a non-volatile random access memory (NVRAM). The memory 1804 stores processor and operation instructions, executable modules or data structures, or subsets thereof, or extended sets thereof, wherein the operation instructions may include various operation instructions for implementing various operations.

处理器1803控制执行设备的操作。具体的应用中,执行设备的各个组件通过总线系统耦合在一起,其中总线系统除包括数据总线之外,还可以包括电源总线、控制总线和状态信号总线等。但是为了清楚说明起见,在图中将各种总线都称为总线系统。The processor 1803 controls the operation of the execution device. In a specific application, the various components of the execution device are coupled together through a bus system, wherein the bus system includes not only a data bus but also a power bus, a control bus, and a status signal bus, etc. However, for the sake of clarity, various buses are referred to as bus systems in the figure.

上述本申请实施例揭示的方法可以应用于处理器1803中,或者由处理器1803实现。处理器1803可以是一种集成电路芯片,具有信号的处理能力。在实现过程中,上述方法的各步骤可以通过处理器1803中的硬件的集成逻辑电路或者软件形式的指令完成。上述的处理器1803可以是通用处理器、数字信号处理器(digital signal processing,DSP)、微处理器或微控制器,还可进一步包括专用集成电路(application specific integrated circuit,ASIC)、现场可编程门阵列(field-programmable gate array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件。该处理器1803可以实现或者执行本申请实施例中的公开的各方法、步骤及逻辑框图。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。结合本申请实施例所公开的方法的步骤可以直接体现为硬件译码处理器执行完成,或者用译码处理器中的硬件及软件模块组合执行完成。软件模块可以位于随机存储器,闪存、只读存储器,可编程只读存储器或者电可擦写可编程存储器、寄存器等本领域成熟的存储介质中。该存储介质位于存储器1804,处理器1803读取存储器1804中的信息,结合其硬件完成上述方法的步骤。The method disclosed in the above embodiment of the present application can be applied to the processor 1803, or implemented by the processor 1803. The processor 1803 can be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit in the processor 1803 or the instruction in the form of software. The above processor 1803 can be a general processor, a digital signal processor (digital signal processing, DSP), a microprocessor or a microcontroller, and can further include an application specific integrated circuit (application specific integrated circuit, ASIC), a field programmable gate array (field-programmable gate array, FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The processor 1803 can implement or execute the methods, steps and logic block diagrams disclosed in the embodiments of the present application. The general processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in the embodiment of the present application can be directly embodied as a hardware decoding processor to be executed, or a combination of hardware and software modules in the decoding processor can be executed. The software module may be located in a storage medium mature in the art, such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory 1804, and the processor 1803 reads the information in the memory 1804 and completes the steps of the above method in combination with its hardware.

接收器1801可用于接收输入的数字或字符信息,以及产生与执行设备的相关设置以及功能控制有关的信号输入。发射器1802可用于通过第一接口输出数字或字符信息;发射器1802还可用于通过第一接口向磁盘组发送指令,以修改磁盘组中的数据;发射器1802还可以包括显示屏等显示设备。The receiver 1801 can be used to receive input digital or character information and generate signal input related to the relevant settings and function control of the execution device. The transmitter 1802 can be used to output digital or character information through the first interface; the transmitter 1802 can also be used to send instructions to the disk group through the first interface to modify the data in the disk group; the transmitter 1802 can also include a display device such as a display screen.

本申请实施例中,在一种情况下,处理器1803,用于通过图15对应实施例中的训练后的对话模型,获取与用户的提问对应的回答。In an embodiment of the present application, in one case, the processor 1803 is used to obtain an answer corresponding to the user's question through the trained dialogue model in the corresponding embodiment of Figure 15.

本申请实施例还涉及一种训练设备,图19为本申请实施例提供的训练设备的一个结构示意图。如图19所示,训练设备1900由一个或多个服务器实现,训练设备1900可因配置或性能不同而产生比较大的差异,可以包括一个或一个以上中央处理器(central processing units,CPU)1919(例如,一个或一个以上处理器)和存储器1932,一个或一个以上存储应用程序1942或数据1944的存储介质1930(例如一个或一个以上海量存储设备)。其中,存储器1932和存储介质1930可以是短暂存储或持久存储。存储在存储介质1930的程序可以包括一个或一个以上模块(图示没标出),每个模块可以包括对训练设备中的一系列指令操作。更进一步地,中央处理器1919可以设置为与存储介质1930通信,在训练设备1900上执行存储介质1930中的一系列指令操作。The embodiment of the present application also relates to a training device, and FIG. 19 is a structural schematic diagram of the training device provided by the embodiment of the present application. As shown in FIG. 19 , the training device 1900 is implemented by one or more servers. The training device 1900 may have relatively large differences due to different configurations or performances, and may include one or more central processing units (CPU) 1919 (for example, one or more processors) and a memory 1932, and one or more storage media 1930 (for example, one or more mass storage devices) storing application programs 1942 or data 1944. Among them, the memory 1932 and the storage medium 1930 can be short-term storage or permanent storage. The program stored in the storage medium 1930 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations in the training device. Furthermore, the central processor 1919 can be configured to communicate with the storage medium 1930 to execute a series of instruction operations in the storage medium 1930 on the training device 1900.

训练设备1900还可以包括一个或一个以上电源1926,一个或一个以上有线或无线网络接口1950,一个或一个以上输入输出接口1958;或,一个或一个以上操作系统1941,例如Windows ServerTM,Mac OS XTM,UnixTM,LinuxTM,FreeBSDTM等等。The training device 1900 may also include one or more power supplies 1926, one or more wired or wireless network interfaces 1950, one or more input and output interfaces 1958; or, one or more operating systems 1941, such as Windows ServerTM, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM, etc.

具体的,训练设备可以执行图5对应实施例中的对话数据生成方法,得到用户与对话模型之间的对话数据,从而基于对话数据对对话模型进行训练,从而得到训练后的对话模型。Specifically, the training device can execute the dialogue data generation method in the embodiment corresponding to Figure 5 to obtain dialogue data between the user and the dialogue model, and then train the dialogue model based on the dialogue data to obtain a trained dialogue model.

本申请实施例还涉及一种计算机存储介质,该计算机可读存储介质中存储有用于进行信号处理的程序,当其在计算机上运行时,使得计算机执行如前述执行设备所执行的步骤,或者,使得计算机执行如前述训练设备所执行的步骤。An embodiment of the present application also relates to a computer storage medium, in which a program for signal processing is stored. When the program is run on a computer, the computer executes the steps executed by the aforementioned execution device, or the computer executes the steps executed by the aforementioned training device.

本申请实施例还涉及一种计算机程序产品,该计算机程序产品存储有指令,该指令在由计算机执行时使得计算机执行如前述执行设备所执行的步骤,或者,使得计算机执行如前述训练设备所执行的步骤。 An embodiment of the present application also relates to a computer program product, which stores instructions, which, when executed by a computer, enable the computer to execute the steps executed by the aforementioned execution device, or enable the computer to execute the steps executed by the aforementioned training device.

本申请实施例提供的执行设备、训练设备或终端设备具体可以为芯片,芯片包括:处理单元和通信单元,所述处理单元例如可以是处理器,所述通信单元例如可以是输入/输出接口、管脚或电路等。该处理单元可执行存储单元存储的计算机执行指令,以使执行设备内的芯片执行上述实施例描述的数据处理方法,或者,以使训练设备内的芯片执行上述实施例描述的数据处理方法。可选地,所述存储单元为所述芯片内的存储单元,如寄存器、缓存等,所述存储单元还可以是所述无线接入设备端内的位于所述芯片外部的存储单元,如只读存储器(read-only memory,ROM)或可存储静态信息和指令的其他类型的静态存储设备,随机存取存储器(random access memory,RAM)等。The execution device, training device or terminal device provided in the embodiments of the present application may specifically be a chip, and the chip includes: a processing unit and a communication unit, wherein the processing unit may be, for example, a processor, and the communication unit may be, for example, an input/output interface, a pin or a circuit, etc. The processing unit may execute the computer execution instructions stored in the storage unit so that the chip in the execution device executes the data processing method described in the above embodiment, or so that the chip in the training device executes the data processing method described in the above embodiment. Optionally, the storage unit is a storage unit in the chip, such as a register, a cache, etc. The storage unit may also be a storage unit located outside the chip in the wireless access device end, such as a read-only memory (ROM) or other types of static storage devices that can store static information and instructions, a random access memory (RAM), etc.

具体的,请参阅图20,图20为本申请实施例提供的芯片的一个结构示意图,所述芯片可以表现为神经网络处理器NPU 2000,NPU 2000作为协处理器挂载到主CPU(Host CPU)上,由Host CPU分配任务。NPU的核心部分为运算电路2003,通过控制器2004控制运算电路2003提取存储器中的矩阵数据并进行乘法运算。Specifically, please refer to FIG. 20 , which is a schematic diagram of the structure of a chip provided in an embodiment of the present application. The chip can be expressed as a neural network processor NPU 2000. NPU 2000 is mounted on the host CPU (Host CPU) as a coprocessor, and tasks are assigned by the Host CPU. The core part of the NPU is the operation circuit 2003, which is controlled by the controller 2004 to extract matrix data from the memory and perform multiplication operations.

在一些实现中,运算电路2003内部包括多个处理单元(Process Engine,PE)。在一些实现中,运算电路2003是二维脉动阵列。运算电路2003还可以是一维脉动阵列或者能够执行例如乘法和加法这样的数学运算的其它电子线路。在一些实现中,运算电路2003是通用的矩阵处理器。In some implementations, the operation circuit 2003 includes multiple processing units (Process Engine, PE) inside. In some implementations, the operation circuit 2003 is a two-dimensional systolic array. The operation circuit 2003 can also be a one-dimensional systolic array or other electronic circuits that can perform mathematical operations such as multiplication and addition. In some implementations, the operation circuit 2003 is a general-purpose matrix processor.

举例来说,假设有输入矩阵A,权重矩阵B,输出矩阵C。运算电路从权重存储器2002中取矩阵B相应的数据,并缓存在运算电路中每一个PE上。运算电路从输入存储器2001中取矩阵A数据与矩阵B进行矩阵运算,得到的矩阵的部分结果或最终结果,保存在累加器(accumulator)2008中。For example, suppose there is an input matrix A, a weight matrix B, and an output matrix C. The operation circuit takes the corresponding data of matrix B from the weight memory 2002 and caches it on each PE in the operation circuit. The operation circuit takes the matrix A data from the input memory 2001 and performs matrix operation with matrix B. The partial result or final result of the matrix is stored in the accumulator 2008.

统一存储器2006用于存放输入数据以及输出数据。权重数据直接通过存储单元访问控制器(Direct Memory Access Controller,DMAC)2005,DMAC被搬运到权重存储器2002中。输入数据也通过DMAC被搬运到统一存储器2006中。The unified memory 2006 is used to store input data and output data. The weight data is directly transferred to the weight memory 2002 through the direct memory access controller (DMAC) 2005. The input data is also transferred to the unified memory 2006 through the DMAC.

BIU为Bus Interface Unit即,总线接口单元2013,用于AXI总线与DMAC和取指存储器(Instruction Fetch Buffer,IFB)2009的交互。BIU stands for Bus Interface Unit, that is, bus interface unit 2013, which is used for the interaction between AXI bus and DMAC and instruction fetch buffer (IFB) 2009.

总线接口单元2013(Bus Interface Unit,简称BIU),用于取指存储器2009从外部存储器获取指令,还用于存储单元访问控制器2005从外部存储器获取输入矩阵A或者权重矩阵B的原数据。The bus interface unit 2013 (Bus Interface Unit, BIU for short) is used for the instruction fetch memory 2009 to obtain instructions from the external memory, and is also used for the storage unit access controller 2005 to obtain the original data of the input matrix A or the weight matrix B from the external memory.

DMAC主要用于将外部存储器DDR中的输入数据搬运到统一存储器2006或将权重数据搬运到权重存储器2002中或将输入数据数据搬运到输入存储器2001中。DMAC is mainly used to transfer input data in the external memory DDR to the unified memory 2006 or to transfer weight data to the weight memory 2002 or to transfer input data to the input memory 2001.

向量计算单元2007包括多个运算处理单元,在需要的情况下,对运算电路2003的输出做进一步处理,如向量乘,向量加,指数运算,对数运算,大小比较等等。主要用于神经网络中非卷积/全连接层网络计算,如Batch Normalization(批归一化),像素级求和,对预测标签平面进行上采样等。The vector calculation unit 2007 includes multiple operation processing units, and when necessary, further processes the output of the operation circuit 2003, such as vector multiplication, vector addition, exponential operation, logarithmic operation, size comparison, etc. It is mainly used for non-convolutional/fully connected layer network calculations in neural networks, such as Batch Normalization, pixel-level summation, upsampling of the predicted label plane, etc.

在一些实现中,向量计算单元2007能将经处理的输出的向量存储到统一存储器2006。例如,向量计算单元2007可以将线性函数;或,非线性函数应用到运算电路2003的输出,例如对卷积层提取的预测标签平面进行线性插值,再例如累加值的向量,用以生成激活值。在一些实现中,向量计算单元2007生成归一化的值、像素级求和的值,或二者均有。在一些实现中,处理过的输出的向量能够用作到运算电路2003的激活输入,例如用于在神经网络中的后续层中的使用。In some implementations, the vector calculation unit 2007 can store the processed output vector to the unified memory 2006. For example, the vector calculation unit 2007 can apply a linear function; or a nonlinear function to the output of the operation circuit 2003, such as linear interpolation of the predicted label plane extracted by the convolution layer, and then, for example, a vector of accumulated values to generate an activation value. In some implementations, the vector calculation unit 2007 generates a normalized value, a pixel-level summed value, or both. In some implementations, the processed output vector can be used as an activation input to the operation circuit 2003, for example, for use in a subsequent layer in a neural network.

控制器2004连接的取指存储器(instruction fetch buffer)2009,用于存储控制器2004使用的指令;An instruction fetch buffer 2009 connected to the controller 2004, for storing instructions used by the controller 2004;

统一存储器2006,输入存储器2001,权重存储器2002以及取指存储器2009均为On-Chip存储器。外部存储器私有于该NPU硬件架构。The unified memory 2006, the input memory 2001, the weight memory 2002 and the instruction fetch memory 2009 are all on-chip memories. The external memory is private to the NPU hardware architecture.

其中,上述任一处提到的处理器,可以是一个通用中央处理器,微处理器,ASIC,或一个或多个用于控制上述程序执行的集成电路。The processor mentioned in any of the above places may be a general-purpose central processing unit, a microprocessor, an ASIC, or one or more integrated circuits for controlling the execution of the above program.

另外需说明的是,以上所描述的装置实施例仅仅是示意性的,其中所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部模块来实现本实施例方案的目的。另外,本申请提供的装置实施例附图中,模块之间的连接关系表示它们之间具有通信连接,具体可以实现为一条或多条通信总线或信号线。It should also be noted that the device embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed over multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. In addition, in the drawings of the device embodiments provided by the present application, the connection relationship between the modules indicates that there is a communication connection between them, which may be specifically implemented as one or more communication buses or signal lines.

通过以上的实施方式的描述,所属领域的技术人员可以清楚地了解到本申请可借助软件加必需的通 用硬件的方式来实现,当然也可以通过专用硬件包括专用集成电路、专用CPU、专用存储器、专用元器件等来实现。一般情况下,凡由计算机程序完成的功能都可以很容易地用相应的硬件来实现,而且,用来实现同一功能的具体硬件结构也可以是多种多样的,例如模拟电路、数字电路或专用电路等。但是,对本申请而言更多情况下软件程序实现是更佳的实施方式。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在可读取的存储介质中,如计算机的软盘、U盘、移动硬盘、ROM、RAM、磁碟或者光盘等,包括若干指令用以使得一台计算机设备(可以是个人计算机,训练设备,或者网络设备等)执行本申请各个实施例所述的方法。Through the above description of the implementation mode, the technicians in the relevant field can clearly understand that the present application can be implemented by software. It can be implemented by hardware, and of course it can also be implemented by dedicated hardware including dedicated integrated circuits, dedicated CPUs, dedicated memories, dedicated components, etc. In general, all functions performed by computer programs can be easily implemented by corresponding hardware, and the specific hardware structures used to implement the same function can also be various, such as analog circuits, digital circuits or dedicated circuits. However, for this application, software program implementation is a better implementation method in most cases. Based on such an understanding, the technical solution of the present application is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a readable storage medium, such as a computer floppy disk, U disk, mobile hard disk, ROM, RAM, disk or optical disk, etc., including a number of instructions to enable a computer device (which can be a personal computer, training equipment, or network equipment, etc.) to execute the methods described in each embodiment of the present application.

在上述实施例中,可以全部或部分地通过软件、硬件、固件或者其任意组合来实现。当使用软件实现时,可以全部或部分地以计算机程序产品的形式实现。In the above embodiments, all or part of the embodiments may be implemented by software, hardware, firmware or any combination thereof. When implemented by software, all or part of the embodiments may be implemented in the form of a computer program product.

所述计算机程序产品包括一个或多个计算机指令。在计算机上加载和执行所述计算机程序指令时,全部或部分地产生按照本申请实施例所述的流程或功能。所述计算机可以是通用计算机、专用计算机、计算机网络、或者其他可编程装置。所述计算机指令可以存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一计算机可读存储介质传输,例如,所述计算机指令可以从一个网站站点、计算机、训练设备或数据中心通过有线(例如同轴电缆、光纤、数字用户线(DSL))或无线(例如红外、无线、微波等)方式向另一个网站站点、计算机、训练设备或数据中心进行传输。所述计算机可读存储介质可以是计算机能够存储的任何可用介质或者是包含一个或多个可用介质集成的训练设备、数据中心等数据存储设备。所述可用介质可以是磁性介质,(例如,软盘、硬盘、磁带)、光介质(例如,DVD)、或者半导体介质(例如固态硬盘(Solid State Disk,SSD))等。 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 devices. 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, a computer, a training device, or a 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, training device, or data center. The computer-readable storage medium may be any available medium that a computer can store or a data storage device such as a training device, a data center, etc. that includes one or more available media integrations. 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 (SSD)), etc.

Claims (17)

一种对话数据生成方法,其特征在于,所述方法包括:A method for generating conversation data, characterized in that the method comprises: 获取用户数据,所述用户数据包含用户的属性和所述用户感兴趣的物品;Acquire user data, wherein the user data includes attributes of the user and items of interest to the user; 基于所述用户数据确定可推荐的物品,所述可推荐的物品包含所述用户感兴趣的物品,以及与所述用户感兴趣的物品相关联的物品;Determining recommendable items based on the user data, wherein the recommendable items include items that the user is interested in and items associated with the items that the user is interested in; 基于所述用户数据和所述可推荐的物品,更新预置的数据生成规则,得到新的数据生成规则;Based on the user data and the recommendable items, updating a preset data generation rule to obtain a new data generation rule; 基于所述新的数据生成规则,生成所述用户与对话模型之间的对话数据,所述对话数据包含所述对话模型向所述用户推荐的物品,所述对话模型向所述用户推荐的物品来自所述可推荐的物品。Based on the new data generation rule, dialogue data between the user and the dialogue model is generated, wherein the dialogue data includes items recommended by the dialogue model to the user, and the items recommended by the dialogue model to the user are from the recommendable items. 根据权利要求1所述的方法,其特征在于,所述方法还包括:The method according to claim 1, characterized in that the method further comprises: 基于所述用户数据确定不可推荐的物品;determining non-recommended items based on the user data; 所述基于所述用户数据和所述可推荐的物品,更新预置的数据生成规则,得到新的数据生成规则包括:The updating of the preset data generation rules based on the user data and the recommended items to obtain new data generation rules includes: 基于所述用户数据、所述可推荐的物品和所述不可推荐的物品,更新预置的数据生成规则,得到新的数据生成规则。Based on the user data, the recommendable items and the non-recommended items, the preset data generation rules are updated to obtain new data generation rules. 根据权利要求2所述的方法,其特征在于,所述基于所述用户数据确定可推荐的物品包括:The method according to claim 2, wherein determining the recommendable items based on the user data comprises: 对所述用户数据以及多个候选物品进行特征提取,得到所述用户数据的特征以及所述多个候选物品的特征;Extracting features from the user data and the multiple candidate items to obtain features of the user data and features of the multiple candidate items; 对所述用户数据的特征以及所述多个候选物品的特征进行计算,得到所述用户数据与所述多个候选物品之间的匹配度;Calculating the features of the user data and the features of the multiple candidate items to obtain a matching degree between the user data and the multiple candidate items; 将匹配度大于或等于第一阈值的候选物品确定为可推荐的物品。The candidate items whose matching degree is greater than or equal to the first threshold are determined as recommendable items. 根据权利要求3所述的方法,其特征在于,所述基于所述用户数据确定不可推荐的物品包括:The method according to claim 3, characterized in that determining the unrecommended items based on the user data comprises: 将匹配度小于或等于第二阈值的候选物品确定为不可推荐的物品,所述第二阈值小于所述第一阈值。The candidate items whose matching degree is less than or equal to a second threshold are determined as non-recommended items, where the second threshold is less than the first threshold. 根据权利要求2至4任意一项所述的方法,其特征在于,所述预置的数据生成规则包含不需补充的规则以及待补充的规则,所述基于所述用户数据、所述可推荐的物品和所述不可推荐的物品,更新预置的数据生成规则,得到新的数据生成规则包括:The method according to any one of claims 2 to 4, characterized in that the preset data generation rules include rules that do not need to be supplemented and rules to be supplemented, and the updating of the preset data generation rules based on the user data, the recommendable items and the non-recommended items to obtain new data generation rules comprises: 将所述用户数据、所述可推荐的物品和所述不可推荐的物品填充至所述待补充的规则,得到补充后的规则,所述不需补充的规则以及所述补充后的规则构成新的数据生成规则,所述不需补充的规则用于设置所述对话数据的格式,所述补充后的规则用于设置所述对话数据的内容。The user data, the recommendable items and the non-recommended items are filled into the rules to be supplemented to obtain the supplemented rules. The rules that do not need to be supplemented and the supplemented rules constitute new data generation rules. The rules that do not need to be supplemented are used to set the format of the conversation data, and the supplemented rules are used to set the content of the conversation data. 根据权利要求1至5任意一项所述的方法,其特征在于,所述方法还包括:The method according to any one of claims 1 to 5, characterized in that the method further comprises: 从所述对话数据中获取目标对话数据,所述目标对话数据满足以下至少一项:Target conversation data is obtained from the conversation data, where the target conversation data satisfies at least one of the following: 所述目标对话数据包含的所有文字均位于预置的文字集合中;All the characters included in the target dialogue data are in a preset character set; 所述目标对话数据包含的针对物品的描述符合真实的描述;The description of the object contained in the target conversation data conforms to the real description; 所述目标对话数据包含的物品为真实的物品;The objects included in the target conversation data are real objects; 所述目标对话数据包含的内容的丰富度大于或等于第三阈值。The richness of the content contained in the target conversation data is greater than or equal to a third threshold. 根据权利要求6所述的方法,其特征在于,所述方法还包括:The method according to claim 6, characterized in that the method further comprises: 基于所述目标对话数据,对所述对话模型进行训练,得到训练后的对话模型。Based on the target dialogue data, the dialogue model is trained to obtain a trained dialogue model. 一种对话数据生成装置,其特征在于,所述装置包括:A device for generating conversation data, characterized in that the device comprises: 获取模块,用于获取用户数据,所述用户数据包含用户的属性和所述用户感兴趣的物品;An acquisition module, used to acquire user data, wherein the user data includes attributes of the user and items of interest to the user; 确定模块,用于基于所述用户数据确定可推荐的物品,所述可推荐的物品包含所述用户感兴趣的物品,以及与所述用户感兴趣的物品相关联的物品;A determination module, configured to determine recommendable items based on the user data, wherein the recommendable items include items that the user is interested in and items associated with the items that the user is interested in; 更新模块,用于基于所述用户数据和所述可推荐的物品,更新预置的数据生成规则,得到新的数据生成规则;An updating module, configured to update a preset data generation rule based on the user data and the recommended items to obtain a new data generation rule; 生成模块,用于基于所述新的数据生成规则,生成所述用户与对话模型之间的对话数据,所述对话数据包含所述对话模型向所述用户推荐的物品,所述对话模型向所述用户推荐的物品来自所述可推荐的物品。 A generation module is used to generate dialogue data between the user and the dialogue model based on the new data generation rule, wherein the dialogue data includes items recommended by the dialogue model to the user, and the items recommended by the dialogue model to the user are from the recommendable items. 根据权利要求8所述的装置,其特征在于,所述确定模块,还用于基于所述用户数据确定不可推荐的物品;The device according to claim 8, characterized in that the determination module is further used to determine non-recommended items based on the user data; 所述更新模块,用于基于所述用户数据、所述可推荐的物品和所述不可推荐的物品,更新预置的数据生成规则,得到新的数据生成规则。The updating module is used to update the preset data generation rules based on the user data, the recommendable items and the non-recommended items to obtain new data generation rules. 根据权利要求9所述的装置,其特征在于,所述确定模块,用于:The device according to claim 9, characterized in that the determining module is used to: 对所述用户数据以及多个候选物品进行特征提取,得到所述用户数据的特征以及所述多个候选物品的特征;Extracting features from the user data and the multiple candidate items to obtain features of the user data and features of the multiple candidate items; 对所述用户数据的特征以及所述多个候选物品的特征进行计算,得到所述用户数据与所述多个候选物品之间的匹配度;Calculating the features of the user data and the features of the multiple candidate items to obtain a matching degree between the user data and the multiple candidate items; 将匹配度大于或等于第一阈值的候选物品确定为可推荐的物品。The candidate items whose matching degree is greater than or equal to the first threshold are determined as recommendable items. 根据权利要求10所述的装置,其特征在于,所述确定模块,用于:The device according to claim 10, characterized in that the determining module is used to: 将匹配度小于或等于第二阈值的候选物品确定为不可推荐的物品,所述第二阈值小于所述第一阈值。The candidate items whose matching degree is less than or equal to a second threshold are determined as non-recommended items, where the second threshold is less than the first threshold. 根据权利要求9至11任意一项所述的装置,其特征在于,所述预置的数据生成规则包含不需补充的规则以及待补充的规则,所述更新模块,用于:The device according to any one of claims 9 to 11, characterized in that the preset data generation rules include rules that do not need to be supplemented and rules to be supplemented, and the updating module is used to: 将所述用户数据、所述可推荐的物品和所述不可推荐的物品填充至所述待补充的规则,得到补充后的规则,所述不需补充的规则以及所述补充后的规则构成新的数据生成规则,所述不需补充的规则用于设置所述对话数据的格式,所述补充后的规则用于设置所述对话数据的内容。The user data, the recommendable items and the non-recommended items are filled into the rules to be supplemented to obtain the supplemented rules. The rules that do not need to be supplemented and the supplemented rules constitute new data generation rules. The rules that do not need to be supplemented are used to set the format of the conversation data, and the supplemented rules are used to set the content of the conversation data. 根据权利要求8至12任意一项所述的装置,其特征在于,所述装置还包括:The device according to any one of claims 8 to 12, characterized in that the device further comprises: 筛选模块,用于从所述对话数据中获取目标对话数据,所述目标对话数据满足以下至少一项:A screening module is used to obtain target conversation data from the conversation data, where the target conversation data satisfies at least one of the following: 所述目标对话数据包含的所有文字均位于预置的文字集合中;All the characters included in the target dialogue data are in a preset character set; 所述目标对话数据包含的针对物品的描述符合真实的描述;The description of the object contained in the target conversation data conforms to the real description; 所述目标对话数据包含的物品为真实的物品;The objects included in the target conversation data are real objects; 所述目标对话数据包含的内容的丰富度大于或等于第三阈值。The richness of the content contained in the target conversation data is greater than or equal to a third threshold. 根据权利要求13所述的装置,其特征在于,所述装置还包括:The device according to claim 13, characterized in that the device further comprises: 训练模块,用于基于所述目标对话数据,对所述对话模型进行训练,得到训练后的对话模型。The training module is used to train the dialogue model based on the target dialogue data to obtain a trained dialogue model. 一种对话数据生成装置,其特征在于,所述装置包括存储器和处理器;所述存储器存储有代码,所述处理器被配置为执行所述代码,当所述代码被执行时,所述对话数据生成装置执行如权利要求1至7任意一项所述的方法。A conversation data generating device, characterized in that the device comprises a memory and a processor; the memory stores codes, the processor is configured to execute the codes, and when the codes are executed, the conversation data generating device performs the method according to any one of claims 1 to 7. 一种计算机存储介质,其特征在于,所述计算机存储介质存储有一个或多个指令,所述指令在由一个或多个计算机执行时使得所述一个或多个计算机实施权利要求1至7任一所述的方法。A computer storage medium, characterized in that the computer storage medium stores one or more instructions, and when the instructions are executed by one or more computers, the one or more computers implement any one of the methods described in claims 1 to 7. 一种计算机程序产品,其特征在于,所述计算机程序产品存储有指令,所述指令在由计算机执行时,使得所述计算机实施权利要求1至7任意一项所述的方法。 A computer program product, characterized in that the computer program product stores instructions, and when the instructions are executed by a computer, the computer implements the method according to any one of claims 1 to 7.
PCT/CN2024/097727 2023-06-16 2024-06-06 Dialogue data generation method and related device thereof Pending WO2024255677A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202310724012.8A CN116910201A (en) 2023-06-16 2023-06-16 Dialogue data generation method and related equipment thereof
CN202310724012.8 2023-06-16

Publications (1)

Publication Number Publication Date
WO2024255677A1 true WO2024255677A1 (en) 2024-12-19

Family

ID=88363815

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2024/097727 Pending WO2024255677A1 (en) 2023-06-16 2024-06-06 Dialogue data generation method and related device thereof

Country Status (2)

Country Link
CN (1) CN116910201A (en)
WO (1) WO2024255677A1 (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116910201A (en) * 2023-06-16 2023-10-20 华为技术有限公司 Dialogue data generation method and related equipment thereof
CN117786414B (en) * 2024-02-23 2024-05-10 云南联合视觉科技有限公司 Method for constructing medical instruction data set

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7720720B1 (en) * 2004-08-05 2010-05-18 Versata Development Group, Inc. System and method for generating effective recommendations
CN111026932A (en) * 2019-12-20 2020-04-17 北京百度网讯科技有限公司 Man-machine conversation interaction method and device, electronic equipment and storage medium
WO2022198983A1 (en) * 2021-03-23 2022-09-29 苏州大学 Conversation recommendation method and apparatus, electronic device, and storage medium
WO2023065859A1 (en) * 2021-10-20 2023-04-27 华为技术有限公司 Item recommendation method and apparatus, and storage medium
CN116108267A (en) * 2022-12-19 2023-05-12 华为技术有限公司 A kind of recommended method and related equipment
CN116910201A (en) * 2023-06-16 2023-10-20 华为技术有限公司 Dialogue data generation method and related equipment thereof

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108009287A (en) * 2017-12-25 2018-05-08 北京中关村科金技术有限公司 A kind of answer data creation method and relevant apparatus based on conversational system
KR102445365B1 (en) * 2018-03-19 2022-09-20 현대자동차주식회사 Dialogue processing apparatus, vehicle having the same and dialogue processing method
CN111737444B (en) * 2020-08-17 2020-11-20 腾讯科技(深圳)有限公司 Dialog generation method and device and electronic equipment

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7720720B1 (en) * 2004-08-05 2010-05-18 Versata Development Group, Inc. System and method for generating effective recommendations
CN111026932A (en) * 2019-12-20 2020-04-17 北京百度网讯科技有限公司 Man-machine conversation interaction method and device, electronic equipment and storage medium
WO2022198983A1 (en) * 2021-03-23 2022-09-29 苏州大学 Conversation recommendation method and apparatus, electronic device, and storage medium
WO2023065859A1 (en) * 2021-10-20 2023-04-27 华为技术有限公司 Item recommendation method and apparatus, and storage medium
CN116108267A (en) * 2022-12-19 2023-05-12 华为技术有限公司 A kind of recommended method and related equipment
CN116910201A (en) * 2023-06-16 2023-10-20 华为技术有限公司 Dialogue data generation method and related equipment thereof

Also Published As

Publication number Publication date
CN116910201A (en) 2023-10-20

Similar Documents

Publication Publication Date Title
CN111931062B (en) Training method and related device of information recommendation model
CN110263324B (en) Text processing method, model training method and device
US20190303768A1 (en) Community Question Answering-Based Article Recommendation Method, System, and User Device
WO2025002350A1 (en) Data processing method and related apparatus
CN115510313A (en) Information recommendation method and device, storage medium and computer equipment
WO2023284716A1 (en) Neural network searching method and related device
WO2025001486A1 (en) Recommendation method and apparatus
US20250225398A1 (en) Data processing method and related apparatus
WO2024255677A1 (en) Dialogue data generation method and related device thereof
WO2024255755A1 (en) Data processing method and related device
WO2021136058A1 (en) Video processing method and device
WO2025040048A1 (en) Data processing method and apparatus
WO2024239983A1 (en) Method and apparatus for controllable generation
WO2025016416A1 (en) Data processing method and related apparatus
WO2025026210A1 (en) Data processing method and apparatus
CN112529149A (en) Data processing method and related device
WO2024002167A1 (en) Operation prediction method and related apparatus
WO2023051678A1 (en) Recommendation method and related device
WO2024255781A1 (en) Data processing method and related apparatus
WO2024230757A1 (en) Data processing method and related apparatus
CN116204709A (en) Data processing method and related device
WO2024160186A1 (en) Model training method and related device
WO2025021142A1 (en) Object detection method and related device thereof
CN119848227A (en) Query intent understanding and search result generation
WO2025016352A1 (en) Video evaluation method and related devices thereof

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 24822628

Country of ref document: EP

Kind code of ref document: A1