CN114881046A - Training method and device of task session model, computer equipment and storage medium - Google Patents

Training method and device of task session model, computer equipment and storage medium Download PDF

Info

Publication number
CN114881046A
CN114881046A CN202210565619.1A CN202210565619A CN114881046A CN 114881046 A CN114881046 A CN 114881046A CN 202210565619 A CN202210565619 A CN 202210565619A CN 114881046 A CN114881046 A CN 114881046A
Authority
CN
China
Prior art keywords
intention
slot
information
description
session
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.)
Granted
Application number
CN202210565619.1A
Other languages
Chinese (zh)
Other versions
CN114881046B (en
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.)
Ping An Technology Shenzhen Co Ltd
Original Assignee
Ping An Technology Shenzhen 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 Ping An Technology Shenzhen Co Ltd filed Critical Ping An Technology Shenzhen Co Ltd
Priority to CN202210565619.1A priority Critical patent/CN114881046B/en
Publication of CN114881046A publication Critical patent/CN114881046A/en
Application granted granted Critical
Publication of CN114881046B publication Critical patent/CN114881046B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/30Semantic analysis
    • G06F40/35Discourse or dialogue representation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/21Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
    • G06F18/214Generating training patterns; Bootstrap methods, e.g. bagging or boosting
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Artificial Intelligence (AREA)
  • General Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Evolutionary Computation (AREA)
  • Evolutionary Biology (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Health & Medical Sciences (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Computational Linguistics (AREA)
  • General Health & Medical Sciences (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

The invention relates to the technical field of artificial intelligence, and discloses a training method of a task session model, which comprises the following steps: predefining an intention list and slot position information, distributing slot position index marks aiming at each slot position in the slot position information, splicing the slot position information into slot position description information according to the slot position index marks, distributing intention index marks aiming at each intention in the intention list, splicing the intention in the intention list into intention state information according to the intention index marks, responding to a training instruction of a task session model, splicing a session sample carried by the training instruction with the slot position description information and the intention state information, inputting the spliced session sample, the slot position description information and the intention state information into the training instruction for training, adjusting the matching relation between the session sample and the slot position description information and the intention state information by using a preset loss function in the training process until the output value of the network model accords with a preset convergence condition, and determining the trained network model as the task session model. The method can generalize the model to a new prediction task, so that the knowledge learned by the model can be popularized to the intentions of other application scenes.

Description

Training method and device of task session model, computer equipment and storage medium
Technical Field
The invention relates to the technical field of artificial intelligence, in particular to a training method and device for a task session model, computer equipment and a storage medium.
Background
With the continuous development of artificial intelligence technology, task-based session systems are increasingly emphasized by people due to their strong practicability and wide application scenes, and gradually enter the aspects of people's lives. Generally speaking, the overall architecture of the task-based conversation system mainly relates to input of text information, natural language understanding, conversation management and result output, the specific text information may be in a text form obtained by converting a voice signal through a voice recognition module, the natural language understanding may extract key information in the text information, such as graph recognition and slot extraction, the conversation management includes state tracking, conversation policy and the like, and the output result is generated natural language.
Existing task-based session systems often require the integration of more and more services in the process of training a task session model to accommodate a wide variety of predictive tasks, for example, from flight booking services to hotel booking services. However, for each new predicted task, since most task session models are trained on a single task-specific ontology schema, here the ontology schema is typically represented as a list of possible user intents and slot information. If the ontology mode of the training task is changed, new data needs to be collected and the task session model needs to be retrained. Once the ontology model is strict, it is difficult for the model to generalize to a new prediction task, so that the knowledge learned by the model cannot be popularized to the intentions of other application scenarios.
Disclosure of Invention
In view of this, the present invention provides a method, an apparatus, a computer device and a storage medium for training a task session model, and mainly aims to solve the problem that in the prior art, a model is difficult to generalize to a new prediction task, so that knowledge learned by the model is difficult to popularize in the intentions of other application scenarios.
According to an aspect of the present invention, there is provided a method for training a task session model, the method including:
predefining an intention list and slot position information;
distributing a slot index identifier for each slot in the slot information, and splicing the slot information into slot description information according to the slot index identifier;
allocating intention index identifications to each intention in the intention list, and splicing the intentions in the intention list into intention state information according to the intention index identifications;
responding to a training instruction of a task session model, splicing a session sample carried by the training instruction with the slot position description information and the intention state information, and inputting the spliced session sample into a network model for training;
in the training process, a preset loss function is used for adjusting the matching relation among the session sample, the slot position description information and the intention state information until the output value of the network model meets a preset convergence condition, and the trained network model is determined to be used as a task session model.
According to another aspect of the present invention, there is provided a training apparatus for a task session model, the apparatus including:
the defining module is used for predefining an intention list and slot position information;
the first distribution module is used for distributing slot index identifications aiming at each slot in the slot information and splicing the slot information into slot description information according to the slot index identifications;
the second distribution module is used for distributing intention index identifications to each intention in the intention list and splicing the intentions in the intention list into intention state information according to the intention index identifications;
the training module is used for responding to a training instruction of a task session model, splicing a session sample carried by the training instruction with the slot position description information and the intention state information and inputting the spliced session sample into a network model for training;
and the determining module is used for adjusting the matching relation among the session sample, the slot position description information and the intention state information by using a preset loss function in the training process until the output value of the network model meets a preset convergence condition, and determining the trained network model as a task session model.
According to yet another aspect of the present invention, there is provided a computer device comprising a memory storing a computer program and a processor implementing the steps of the method of training a task session model when the computer program is executed.
According to a further aspect of the invention, a computer storage medium is provided, on which a computer program is stored which, when being executed by a processor, carries out the steps of the training method of the task session model.
By means of the technical scheme, the invention provides a training method, a device, computer equipment and a storage medium of a task session model, wherein an intention list and slot position information are defined in advance, a slot position index identifier is distributed aiming at each slot position in the slot position information, the slot position information is spliced into slot position description information according to the slot position index identifier, an intention index identifier is distributed aiming at each intention in the intention list, the intention in the intention list is spliced into intention state information according to the intention index identifier, a session sample carried by a training instruction is spliced with the slot position description information and the intention state information and then input into a network model for training in response to the training instruction of the task session model, and a preset loss function is utilized to adjust the matching relation among the session sample, the slot position description information and the intention state information in the training process until the output value of the network model meets the preset convergence condition, and determining the trained network model as a task session model. Compared with the mode of training a task session model on a single task specific ontology mode in the prior art, the method has the advantages that the applicability of the session task to different application scenes is considered, the session sample is spliced with the slot position description information and the intention state information, all required results are output at one time, the semantic information can be effectively conveyed, the model can learn the matching relation between the slot position or the intention and the session sample in the training process, the semantic understanding of the model in the training process is improved, the model can be generalized to a new prediction task, and the learned knowledge of the model can be popularized to the intentions of other application scenes.
Drawings
Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiments. The drawings are only for purposes of illustrating the preferred embodiments and are not to be construed as limiting the invention. Also, like reference numerals are used to refer to like parts throughout the drawings. In the drawings:
FIG. 1 is a diagram illustrating an application environment of a training method for a task session model according to an embodiment of the present invention;
FIG. 2 is a flow chart illustrating a method for training a task session model according to an embodiment of the present invention;
FIG. 3 is a flowchart illustrating one embodiment of step S10 of FIG. 2;
FIG. 4 is a flowchart illustrating one embodiment of step S20 of FIG. 2;
FIG. 5 is a flowchart illustrating one embodiment of step S30 of FIG. 2;
FIG. 6 is a flowchart illustrating one embodiment of step S40 of FIG. 2;
FIG. 7 is a schematic flow chart diagram illustrating a training method for a conversational task model according to an embodiment of the invention;
FIG. 8 is a flowchart illustrating one embodiment of step S50 of FIG. 2;
FIG. 9 is a schematic diagram of a training apparatus for task session model according to an embodiment of the present invention;
FIG. 10 is a schematic diagram of a computer apparatus according to an embodiment of the invention;
FIG. 11 is a schematic diagram of another embodiment of a computer device.
Detailed Description
Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
The training method of the task session model provided by the embodiment of the invention can be applied to the application environment shown in fig. 1, wherein the client communicates with the server through the network. The method comprises the steps that a service end can predefine an intention list and slot position information, slot position index marks are distributed for each slot position in the slot position information, the slot position information is spliced into slot position description information according to the slot position index marks, intention index marks are distributed for each intention in an intention list, the intention in the intention list is spliced into intention state information according to the intention index marks, a client responds to a training instruction of a task session model, a session sample carried by the training instruction is spliced with the slot position description information and the intention state information and then input to a network model to be trained, finally session information which is extracted from the session sample and respectively matched with the slot position description information and the intention state information is output, and the session information is fed back to the client. In the invention, the applicability of the session task to different application scenes is considered, the session sample is spliced with the slot position description information and the intention state information, all required results are output at one time, the semantic information can be effectively transmitted, so that the model learns the matching relationship between the slot position or the intention and the session sample in the training process, the semantic understanding of the model in the training process is improved, the model can be generalized to a new prediction task, and the knowledge learned by the model can be popularized to the intentions of other application scenes. Among other things, the client may be, but is not limited to, various personal computers, laptops, smartphones, tablets, and portable wearable devices. The server can be implemented by an independent server or a server cluster composed of a plurality of servers. The present invention is described in detail below with reference to specific examples.
Referring to fig. 2, fig. 2 is a schematic flowchart of a method for training a task session model according to an embodiment of the present invention, including the following steps:
s10, predefined intention list and slot information.
According to the training method of the task session model, the trained task session model can be applied to intelligent question-answering engines such as intelligent customer service or intelligent assistants in various scenes, the intelligent question-answering engines are usually realized through a server, the server can receive session sentences initiated by users in real time and make corresponding replies according to the session sentences, and then interactive session context is formed. For example, in the field of ticket booking services, a user may initiate a conversation by telephone or by online chatting, and often needs to respond to some ticket booking questions of the client or assist the user in completing a ticket booking operation by means of an intelligent question and answer engine so as to improve the ticket booking experience of the user. The intelligent question-answering engine needs to understand natural language of user questions, recognize graphs, extract slot positions and the like, further clarify user intentions and slot positions, and further reuse the user questions back and forth according to the intentions and the slot positions.
For example, the conversation sentence initiated by the user is "can help me to order a high-speed railway going to shanghai on wednesday", after receiving the conversation sentence, the intelligent question-answering engine needs to understand a natural language of a user question, recognizes that the user intends to order a train ticket, and sends the slot position to the city on wednesday, wherein the slot position includes date wednesday, and it can be understood that, in an application scene of ordering the train ticket, the user cannot be assisted to complete the operation of ordering the train ticket only through the conversation sentence, and needs to provide other slot position information, and at this time, "certainly, the user wants to go from the station".
The intention in the intention list is a request or a purpose of the user, for example, the user says "how much weather today", the intention is "inquire weather", the user says "i want to order a train ticket", the intention is "order a train ticket", and different application scenes have different intentions correspondingly. The slot position information is equivalent to the intended parameter information, and comprises a slot position and a slot position value, for example, when a user inquires about what the weather of Beijing today is, the parameter information of today and Beijing is abstracted, the parameter information can be abstracted into different classes, each class is a slot position, and in the intention of inquiring weather, two slot positions of time and place can be abstracted according to the current day and the Beijing. Here, the intents in the intention list may be defined according to services involved in the application scenario, for example, services including query ticket, ticket refund, ticket change, etc. may be involved for a ticket booking scenario, and slot information may be defined by extracting well-defined attributes and attribute values of a given entity from a large-scale corpus, for example, well-defined attributes of entities such as departure time, return time, departure city, and departure city, etc. are extracted from the large-scale corpus also for the ticket booking scenario.
It should be understood that the intention list is an intention set around a predetermined scene, each slot is equivalent to a service description in the predetermined scene, and the slot value is a description value corresponding to the service description. As shown in fig. 3, the step S10, namely, the predefining of the intention list and the slot information, includes the following steps:
and S11, acquiring the business data of the predetermined scene from the database aiming at the intention under the predetermined scene, and abstracting the business description of the business data.
S12, traversing each service description, obtaining the description value suitable for being filled into the service description, and associating each service description with the corresponding description value to obtain the slot position information.
For steps S11-S12, in the process of predefining the intention list and slot information, the predetermined scene may be an offline life scene, such as a restaurant, a mall, a movie theater, etc., since different intentions may generate different service data under the predetermined scene, for example, the meal ordering intention of the restaurant scene may generate meal ordering related service data including the number of people ordering, meal ordering time, meal information, etc., the shopping intention of the mall scene may generate shopping related service data, such as purchased goods, colors of goods, performance of goods, etc., here, a database is used to record service data of different scenes stored according to predefined entities and relationships, further abstract service descriptions of the service data, there may be multiple service descriptions in the service data, each service description may serve as a slot, each service description has a corresponding description value, for example, the order time is several points, and the number of orders is 3-5.
It should be noted that, since the description value corresponding to the service description is equivalent to further clarification of the service description, the description value corresponding to each service description herein may be defined in an enumerable form, for example, the service description is beijing airport, the corresponding description value may be defined in a grand airport, south aster airport, capital international airport, or may be defined in a non-enumerable form, for example, the corresponding description value is not limited for the service description reaching a city. Specifically, whether the description value corresponding to the service description is divided into an enumeratable type or not can be judged by traversing each service description, if so, the description value suitable for being filled into the service description is output, each service description is associated with the corresponding description value and then added to the slot position information, and otherwise, the service description is added to the slot position information.
Illustratively, the service description comprises a Beijing railway station, a train type, a seat grade, a departure date and a departure time, wherein the railway station, the train type and the seat grade can be divided into enumerable forms, the departure date and the departure time are divided into enumerable forms, further aiming at the enumerable forms, description values filled to the railway station are output to comprise a Beijing south station, a Beijing west station and a Beijing north station, the description values filled to the train type comprise high-speed rails, motor cars and ordinary express trains, the description values filled to be the grades have A-C grades, the service description and the corresponding description values are associated and then added to the slot information, and aiming at the enumerable forms, the description values corresponding to the service description are not required to be listed, and the service description is directly added to the slot information.
It should be noted here that, because the description value corresponding to some service descriptions may affect the description value corresponding to other service descriptions, the description value corresponding to some service descriptions needs to be adjusted according to the description value corresponding to the affected service description, for example, different train types may affect the selection of seat classes, the description values corresponding to the train type and the high-speed train type include first seat and second seat, and the description value corresponding to the ordinary express train type includes seat and no seat.
Further, considering that there may be different expression forms in the slot information, here, after the intention list and the slot information are defined in advance, preset expressions may be used to perform consistency processing on the intentions in the intention list and the service descriptions in the slot information respectively, so that the intentions in the intention list all use the same expression mode, and the service descriptions in the slot information all use the same expression mode, specifically, descriptive languages may be used to express the slot information or the intention list, and each slot or intention may be accurately described in a human readable and understandable mode, for example, "train-from", train-to "may be processed as" arrival city of train "," departure city of train ", and the like, the specific intention list may be as shown in table 1 below, the slot information may be as shown in table 2 below, considering that the intentions are not all in an activated state during training, the intention for training and the slot corresponding to the intention can be selected by setting the state of the intention in the intention list.
TABLE 1 intention List
Intention to Status of state
View train schedule service
Booking train ticket service Activation
Train ticket change service
Train ticket refunding service
TABLE 2 slot information
Groove position Slot position value
Arrival city of train Shanghai province
Departure city of train Beijing
Arrival time of train Three points in the afternoon
Departure time of train
Date of train operation Wednesday
It is to be understood that the above tables 1 and 2 describe the basic fact slot and intention for dialog state tracking, and the intention in the active state is to subscribe to the train ticket service, and the related information record of the predetermined train ticket service at this time specifically includes "view train time list", "subscribe to the train ticket service", "train ticket change service", "train ticket refund service" in the slot.
S20, distributing slot index marks aiming at each slot in the slot information, and splicing the slot information into slot description information according to the slot index marks.
Considering that different slots in the slot information may have the same type of service description, for example, the departure time and the return time are both time type service descriptions, in order to make the service description that the model can learn from the slot information in the training process, the slot index here identifies an index number corresponding to the service description, for example, S1, S2, S3, etc., and other numbers may also be used. In practical application, S0 may be used to indicate the service description of the arrival time of the train, S1 indicates the service description of the departure date of the train, S2 indicates the service description of the departure date of the train, S3 indicates the service description of the destination of the train, and S4 indicates the service description of the departure time of the train.
It should be understood that the description value corresponding to each service description in the slot information may be divided into an enumerable type, and may also be divided into a non-enumerable type. Specifically, as shown in fig. 4, in step S20, that is, allocating a slot index identifier to each slot in the slot information, and splicing the slot information into slot description information according to the slot index identifier, the method includes the following steps:
and S21, distributing a slot index identifier for each slot in the slot information, and distributing a slot sub-index identifier to the enumerated slot value if the slot value is of an enumeratable type.
And S22, splicing the slot information into slot description information according to the slot index identification and the slot sub-index identification.
For an enumeratable type slot, since the slot value is usually outputable, after the slot is allocated with the slot index identifier, a slot sub-index identifier may be allocated to the enumerated slot value, for example, if the slot value corresponding to the slot "whether to need to be tiled" includes "yes" or "no", then a) and b) may be used as the slot sub-index identifiers, and the number of the slot sub-index identifiers may be increased specifically according to the number of the output slot values. For the non-enumeratable slot, the slot sub-index identifier does not exist, the slot information is further spliced into the slot description information according to the slot index identifier and the slot sub-index identifier, and specifically, all the slot index identifiers and the service descriptions corresponding to the slots can be spliced in a slot index identifier-service description pair form to obtain the slot splicing information.
Illustratively, the slot includes: train arrival time, train departure date, train destination, train departure time, wherein, train departure date is divided into the enumeratable type, and corresponding slot position value includes monday, tuesday, wednesday, and other slot positions are divided into the enumeratable type, and the slot position description information that the concatenation obtained is: s0 train arrival time S1 train departure date a) monday b) tuesday c) wednesday S2 train departure date S3 train destination S4 train departure time.
And S30, allocating intention index identifications to each intention in the intention list, and splicing the intentions in the intention list into intention state information according to the intention index identifications.
Likewise, similar to the process of allocating a slot index identifier to each slot in the slot information in step S20, a corresponding intention index identifier may be allocated for the intention in the intention list. To avoid being identical to the slot index identification here, it may be identified using an index number different from the slot index identification.
It should be understood that the intention in the intention list may include a plurality of lower intentions with explicit directions, and may also be understood as an intention containing a service description, for example, the intention for querying a train ticket may include querying a train ticket from beijing and querying a train ticket from wednesday. Specifically, as shown in fig. 5, in step S30, that is, assigning an intention index identifier to each intention in the intention list, and splicing the intentions in the intention list into intention state information according to the intention index identifier, the method includes the following steps:
and S31, allocating intention index identifications to each intention in the intention list, and if the intention also comprises lower intentions, allocating intention sub-index identifications to the lower intentions.
And S32, splicing the intentions in the intention list into intention state information according to the intention index identification and the intention sub-index identification.
The process of splicing the intention state information specifically may adopt i0 and i1 as intention index identifications similar to the process of splicing the slot description information, and splicing the intentions in the intention list into the intention state information according to the intention index identifications.
Illustratively, the intention list comprises a view train schedule, a train ticket refund, a train ticket change label and a train ticket reservation, the spliced intention state information is identified as i1 according to the intention index, i2 of the view train schedule, i3 of the train ticket refund, i4 of the train ticket change label and i1 of the train ticket reservation.
And S40, responding to a training instruction of a task session model, splicing the session sample carried by the training instruction with the slot description information and the intention state information, and inputting the spliced session sample into a network model for training.
The task session model is used for identifying the intention of the user in the session and corresponding slot position information, can be applied to session assistants of various application servers, assists the service assistants in interpreting the intention of the user, and further replies according to the session content initiated by the user. Here, the session sample corresponds to the dialog content actually generated in the application service scenario, and the dialog contents corresponding to the two parties of the session are marked with symbols, for example, [ user ] represents the session content of the user party, and [ bot ] represents the session content of the session assistant party.
Illustratively, the session samples are: [ user ] can help I reserve a high-speed railway ticket for wednesday to shanghai? [ bot ] of course! From which station do you want to depart? When do you want to go? [ user ] did i want to know, from Beijing, that there is a train that can arrive 3 pm ago in time?
It should be noted that the splicing order of the three is not limited here, and the splicing order may be a session sample, slot description information, intention state information, or may also be slot description information, intention state information, a session sample, or the like. The spliced text information is all results required by one-time output, and most importantly, the slot position information and the intention list mapped by the index are adopted, so that the model can learn the relation between the slot position description information and the slot position index identification and the slot position value, and the relation between the intention state information and the intention index identification and the intention, and the capability of popularizing the knowledge learned by the model to the intention in other application scenes is realized.
Specifically, as shown in fig. 6, in step S40, that is, in response to a training instruction of the task session model, the session sample carried by the training instruction is spliced with the slot description information and the intention state information and then input into the network model for training, which includes the following steps:
and S41, randomly collocating the slot index identification and the slot position, the intention index identification and the intention respectively to form unfixed combination slot position description information and intention state information.
And S42, splicing the session sample carried by the training instruction, the slot description information with unfixed combination and the intention state information, and inputting the spliced session sample, the unfixed combination and the unfixed intention state information into a network model for training.
It can be understood that, since the model trains whether the slot description information and the intention state information match the session sample respectively for the slot index identifier and the intention index identifier in the training process, in order to prevent the model from remembering the association between the slot index identifier and the intention index and the dry practice between the slot index identifier and the intention index, the slot index identifier may be randomly allocated to the slot and the intention index identifier may be randomly allocated to the intention in the training process, and a dynamic configuration is used to make the model consider the slot description information and the intention state information, rather than regard the input as a constant string to make an extensible prediction.
The training process of the slot description information is taken as an example for explanation, a session sample comprises five training samples about a certain train ticket, slot index identifiers are respectively S1-S4, slots are respectively train arrival time, train departure date, train destination and train departure time, a slot index identifier S1 is allocated to a slot position train arrival time in the first sample, a slot index identifier S2 is allocated to a slot position train arrival time in the second sample, a slot index identifier S3 is allocated to a slot position train arrival time in the third sample, the same allocation mode is adopted for other slot positions, so that the input process between the slot index identifier and the slot position is randomly allocated instead of fixed collocation, further, a model learns more contents from the slot description information, and the fixed collocation between the slot index identifier and the slot position is not simply remembered, the help model still has high prediction capability in the invisible scene, but the slot index identification S1 is not related to the slot position of train arrival time as soon as the slot position index identification S1 is seen, because the S2 may represent the slot position of 'time for booking movie tickets' in the future scene. If the model is that the fixed slot index identifier is associated with the slot during the training process, S1 must express the content of the slot, here by disturbing the association of the slot index identifier with the slot, so that the model can really learn useful prediction information from the slot description information.
And S50, in the training process, adjusting the matching relation among the session sample, the slot description information and the intention state information by using a preset loss function until the output value of the network model meets a preset convergence condition, and determining the trained network model as a task session model.
Further, in consideration of the application of the task session model, the output part of the session task model includes the intent matching result entries of the sample session and the intent state information, and the slot matching result states of the sample session and the slot description information. The output format of the slot matching result entries may be the slot index identifier and the slot value, if the slot value is an enumerable type, the slot value may use the slot sub-index identifier, for example, the enumerable type may output the slot matching result as [ states ] S0: three pm, S1 of the enumerable type outputs c option, then the slot matching result is [ states ] S1: S1c, and similarly, the intention matching result entries is in the form of an intention index identifier of an activated intention, for example, only intention i4 is activated, then the intention matching result [ entries ] i4 is output, if a plurality of intents are activated, then a plurality of intention index identifiers of activated intents are output, for example, [ entries ] i1, i2, i3, …, and if the intention is an enumerable type, then the intention matching result may further include the intention sub-index identifier.
The network model uses a T5 model, and the T5 model can provide a unified model architecture, so that various conversation tasks are regarded as tasks in a text-text form, namely, the tasks of inputting texts and outputting texts can be conveniently applied to a series of conversation tasks of evaluating reading comprehension, abstract generation, text classification and the like. Specifically, in the input session sample, unique special symbols < X >, < Y > are used to represent the randomly masked character string in the session sample, and the target sample to be learned by the model is the masked character string, and the special symbols < X >, < Y > at the corresponding positions in the input sample are used as the separation, and finally another special symbol < Z > is added to represent the end of the sequence.
As an embodiment, referring to fig. 7, the representation after splicing may be: s0 train arrival time S1: train departure date a) Monday b) Tuesday c) Wednesday S2: train departure date S3: train destination S4: train departure time i1: view train schedule i2: train ticket refund i3: train ticket change i4: train ticket reservation [ user ] can help I reserve a high-speed railway ticket for Monday to go to Shanghai? [ bot ] of course! From which station do you want to depart? When do you want to go? [ user ] did i want to know at time from Beijing that there is a train that can arrive 3 am? The spliced text information is further input into a network model for training, and the output result is [ states ] S0: three points in the afternoon S1: S1cS2: Beijing S3: Shanghai [ intent ] i 4.
Specifically, as shown in fig. 8, in step S50, that is, in the training process, the matching relationship between the session sample and the slot description information and the intention state information is adjusted by using a preset loss function until the output value of the network model meets a preset convergence condition, and the network model after training is determined as the task session model, including the following steps:
and S51, extracting multiple groups of session information matched with the slot description information and the intention state information from the session sample respectively by using the slot description information and the intention description information which are not fixed in combination in the training process.
And S52, iteratively calculating loss values formed by the output values and the conversation information marked in the conversation sample in advance by using a preset loss function for multiple times.
And S53, if the loss value does not meet the iteration stop condition, adjusting the matching relationship among the session sample, the slot description information and the intention state information, determining that the output value of the network model meets the preset convergence condition when the loss value meets the iteration stop condition, and taking the trained network model as the task session model.
In the related art, the limitation of the ontology mode in the task-based session affects the generalization of the model to tasks in other fields, for example, a session model trained in a "flight booking" scene only knows the intention of the scene, and lacks the ability to generalize its knowledge to the intention in other scenes (such as a movie ticket booking scene), even if there is a new ontology with an overlap to the ontology known to the current task, if the task session model already knows how to book airline tickets, the ability to increase the booking of train tickets also needs to train completely new data, so that the zero-time learning model training of the task-based session can improve the applicability of the model in different application scenes. However, regarding the application of the task-based session in the zero-time learning model training process, the slot position value needs to be predicted in sequence according to different instruction information, as the number of slots increases, the training efficiency is lower and lower, and the slot position value is easy to be oversampled, because most of the Cao plants are in an inactive state at any stage during the session, in contrast, the embodiment of the present invention can predict all states in one-time transmission, and has higher training efficiency.
In an embodiment, a training device for a task session model is provided, and the training device for the task session model corresponds to the training method for the task session model in the above embodiments one to one. As shown in fig. 9, the training device of the task session model includes a definition module 101, a first distribution module 102, a second distribution module 103, a training module 104, and a determination module 105. The functional modules are explained in detail as follows:
a definition module 101, configured to define an intention list and slot information in advance;
the first allocating module 102 is configured to allocate a slot index identifier for each slot in the slot information, and splice the slot information into slot description information according to the slot index identifiers;
a second allocating module 103, configured to allocate an intention index identifier to each intention in the intention list, and splice the intentions in the intention list into intention state information according to the intention index identifier;
the training module 104 is configured to respond to a training instruction of a task session model, splice a session sample carried by the training instruction with the slot position description information and the intention state information, and input the spliced session sample into a network model to be trained for training;
a determining module 105, configured to adjust, by using a preset loss function, a matching relationship between the session sample and the slot description information and the intention state information in a training process until an output value of the network model meets a preset convergence condition, and determine the trained network model as a task session model.
In an embodiment, the intention list is an intention set around a predetermined scene, each slot is equivalent to a service description in the predetermined scene, and a slot bit value is a description value corresponding to the service description, and the definition module is specifically configured to:
acquiring service data of a preset scene from a database aiming at the intention of the preset scene, and abstracting the service description of the service data, wherein the database records the service data of different scenes stored according to a defined entity and a defined relation;
and traversing each service description, acquiring a description value suitable for being filled into the service description, and associating each service description with the corresponding description value to obtain slot position information.
In an embodiment, the definition module is specifically configured to:
traversing each service description, and judging whether the description value corresponding to the service description is divided into an enumeratable type;
if so, outputting description values suitable for being filled into the service descriptions, associating each service description with the corresponding description value and then adding the service description to the slot position information;
otherwise, the service description is added to the slot information.
In an embodiment, the definition module is further configured to:
after the intention list and the slot position information are defined in advance, respectively carrying out consistency processing on the intention in the intention list and the service description in the slot position information by using a preset expression.
In an embodiment, the first allocation module is specifically configured to:
distributing a slot index identifier for each slot in the slot information, and if the slot value is of an enumeratable type, distributing a slot sub-index identifier to the enumerated slot value;
and splicing the slot information into slot description information according to the slot index identification and the slot sub-index identification.
In an embodiment, the second allocating module is specifically configured to:
assigning an intention index identification to each intention in the intention list, and if the intention also comprises a lower intention, assigning an intention sub-index identification to the lower intention;
and splicing the intentions in the intention list into intention state information according to the intention index identification and the intention sub-index identification.
In an embodiment, the training module is specifically configured to:
respectively randomly collocating the slot index identification and the slot position, the intention index identification and the intention to form slot position description information and intention state information which are not fixed in combination;
splicing the session sample carried by the training instruction, the slot position description information with unfixed combination and the intention state information, and inputting the spliced session sample, the unfixed combination and the unfixed intention state information into a network model for training;
the determining module is specifically configured to:
in the training process, the slot position description information and the intention description information which are not fixed in combination are used for respectively extracting a plurality of groups of session information matched with the slot position description information and the intention state information from the session sample;
iteratively calculating the loss value formed by the output value and the session information marked in the session sample in advance by utilizing a preset loss function for multiple times;
if the loss value does not meet the iteration stop condition, adjusting the matching relationship among the session sample, the slot description information and the intention state information, determining that the output value of the network model meets the preset convergence condition when the loss value meets the iteration stop condition, and taking the trained network model as a task session model.
The embodiment provides a training device of a task session model, and in consideration of applicability of a session task to different application scenes, by splicing a session sample with slot description information and intention state information and outputting all required results at one time, semantic information can be effectively conveyed, so that the model learns matching relationships between slots or intentions and the session sample in a training process, semantic understanding of the model in the training process is improved, the model can be generalized to a new prediction task, and knowledge learned by the model can be popularized to intentions of other application scenes.
For specific definition of the training device for the task session model, reference may be made to the above definition of the training method for the task session model, and details are not described here. The modules in the training device of the task session model can be wholly or partially implemented by software, hardware and a combination thereof. The modules can be embedded in a hardware form or independent from a processor in the computer device, and can also be stored in a memory in the computer device in a software form, so that the processor can call and execute operations corresponding to the modules.
In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as shown in fig. 10. The computer device includes a processor, a memory, a network interface, and a database connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes non-volatile and/or volatile storage media, internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of an operating system and computer programs in the non-volatile storage medium. The network interface of the computer device is used for communicating with an external client through a network connection. The computer program is executed by a processor to implement the functions or steps of the service side of a training method of a task session model.
In one embodiment, a computer device is provided, which may be a client, and its internal structure diagram may be as shown in fig. 11. The computer device includes a processor, a memory, a network interface, a display screen, and an input device connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device comprises a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of an operating system and computer programs in the non-volatile storage medium. The network interface of the computer device is used for communicating with an external server through a network connection. The computer program is executed by a processor to implement the functions or steps of a training method client side of a task session model
In one embodiment, a computer device is provided, comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, the processor implementing the following steps when executing the computer program:
predefining an intention list and slot position information;
distributing a slot index identifier for each slot in the slot information, and splicing the slot information into slot description information according to the slot index identifier;
allocating intention index identifications to each intention in the intention list, and splicing the intentions in the intention list into intention state information according to the intention index identifications;
responding to a training instruction of a task session model, splicing a session sample carried by the training instruction with the slot position description information and the intention state information, and inputting the spliced session sample into a network model for training;
in the training process, a preset loss function is used for adjusting the matching relation among the session sample, the slot position description information and the intention state information until the output value of the network model meets a preset convergence condition, and the trained network model is determined to be used as a task session model.
In one embodiment, a computer-readable storage medium is provided, having a computer program stored thereon, which when executed by a processor, performs the steps of:
predefining an intention list and slot position information;
distributing a slot index identifier for each slot in the slot information, and splicing the slot information into slot description information according to the slot index identifier;
allocating intention index identifications to each intention in the intention list, and splicing the intentions in the intention list into intention state information according to the intention index identifications;
responding to a training instruction of a task session model, splicing a session sample carried by the training instruction with the slot position description information and the intention state information, and inputting the spliced session sample into a network model for training;
in the training process, a preset loss function is used for adjusting the matching relation among the session sample, the slot position description information and the intention state information until the output value of the network model meets a preset convergence condition, and the trained network model is determined to be used as a task session model.
It should be noted that, the functions or steps that can be implemented by the computer-readable storage medium or the computer device can be referred to the related descriptions of the server side and the client side in the foregoing method embodiments, and are not described here one by one to avoid repetition.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware instructions of a computer program, which can be stored in a non-volatile computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. Any reference to memory, storage, database, or other medium used in the embodiments provided herein may include non-volatile and/or volatile memory, among others. Non-volatile memory can include read-only memory (ROM), Programmable ROM (PROM), Electrically Programmable ROM (EPROM), Electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDRSDRAM), Enhanced SDRAM (ESDRAM), Synchronous Link DRAM (SLDRAM), Rambus Direct RAM (RDRAM), direct bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
It will be apparent to those skilled in the art that, for convenience and brevity of description, only the above-mentioned division of the functional units and modules is illustrated, and in practical applications, the above-mentioned function distribution may be performed by different functional units and modules according to needs, that is, the internal structure of the apparatus is divided into different functional units or modules to perform all or part of the above-mentioned functions.
The above-mentioned embodiments are only used for illustrating the technical solutions of the present invention, and not for limiting the same; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; such modifications and substitutions do not substantially depart from the spirit and scope of the embodiments of the present invention, and are intended to be included within the scope of the present invention.

Claims (10)

1. A method for training a task session model, the method comprising:
predefining an intention list and slot position information;
distributing a slot index identifier for each slot in the slot information, and splicing the slot information into slot description information according to the slot index identifier;
allocating intention index identifications to each intention in the intention list, and splicing the intentions in the intention list into intention state information according to the intention index identifications;
responding to a training instruction of a task session model, splicing a session sample carried by the training instruction with the slot position description information and the intention state information, and inputting the spliced session sample into a network model for training;
in the training process, a preset loss function is used for adjusting the matching relation among the session sample, the slot position description information and the intention state information until the output value of the network model meets a preset convergence condition, and the trained network model is determined to be used as a task session model.
2. The method according to claim 1, wherein the intention list is intentions set around a predetermined scene, each slot corresponds to a service description in the predetermined scene, and the slot value is a description value corresponding to the service description, and the predefined intention list and slot information specifically include:
acquiring service data of a preset scene from a database aiming at the intention of the preset scene, and abstracting the service description of the service data, wherein the database records the service data of different scenes stored according to a defined entity and a defined relation;
and traversing each service description, acquiring a description value suitable for being filled into the service description, and associating each service description with the corresponding description value to obtain slot position information.
3. The method according to claim 2, wherein the traversing each service description, obtaining description values suitable for being filled into the service description, and associating each service description with a corresponding description value to obtain slot information specifically includes:
traversing each service description, and judging whether the description value corresponding to the service description is divided into an enumeratable type or not;
if so, outputting description values suitable for being filled into the service descriptions, associating each service description with the corresponding description value and then adding the service description to the slot position information;
otherwise, the service description is added to the slot information.
4. The method of claim 1, wherein after the predefined intent list and slot information, the method further comprises:
and respectively carrying out consistency processing on the intention in the intention list and the service description in the slot position information by using a preset expression.
5. The method according to any one of claims 1 to 4, wherein the allocating a slot index identifier for each slot in the slot information and splicing the slot information into slot description information according to the slot index identifier specifically comprises:
distributing a slot index identifier for each slot in the slot information, and if the slot value is of an enumeratable type, distributing a slot sub-index identifier to the enumerated slot value;
and splicing the slot information into slot description information according to the slot index identification and the slot sub-index identification.
6. The method according to any one of claims 1 to 4, wherein the assigning an intention index identifier to each intention in the list of intentions and splicing the intentions in the list of intentions into intention state information according to the intention index identifier specifically comprises:
assigning an intention index identification to each intention in the intention list, and if the intention also comprises a lower intention, assigning an intention sub-index identification to the lower intention;
and splicing the intentions in the intention list into intention state information according to the intention index identification and the intention sub-index identification.
7. The method according to any one of claims 1 to 4, wherein the concatenating the session sample carried by the training instruction with the slot description information and the intention state information and inputting the concatenated sample into a network model for training specifically includes:
respectively randomly collocating the slot index identification and the slot position, the intention index identification and the intention to form slot position description information and intention state information which are not fixed in combination;
splicing the session sample carried by the training instruction, the slot position description information with unfixed combination and the intention state information, and inputting the spliced session sample, the unfixed combination and the unfixed intention state information into a network model for training;
in the training process, a preset loss function is used for adjusting the matching relationship among the session sample, the slot description information and the intention state information until the output value of the network model meets a preset convergence condition, and the network model after training is determined to be used as a task session model, wherein the method comprises the following steps:
in the training process, the slot position description information and the intention description information which are not fixed in combination are used for respectively extracting a plurality of groups of session information matched with the slot position description information and the intention state information from the session sample to be used as output values of a network model;
iteratively calculating the loss value formed by the output value and the session information marked in the session sample in advance by utilizing a preset loss function for multiple times;
if the loss value does not meet the iteration stop condition, adjusting the matching relationship among the session sample, the slot description information and the intention state information, determining that the output value of the network model meets the preset convergence condition when the loss value meets the iteration stop condition, and taking the trained network model as a task session model.
8. An apparatus for training a task session model, the apparatus comprising:
the defining module is used for predefining an intention list and slot position information;
the first distribution module is used for distributing a slot index identifier for each slot in the slot information and splicing the slot information into slot description information according to the slot index identifier;
the second distribution module is used for distributing intention index identifications to each intention in the intention list and splicing the intentions in the intention list into intention state information according to the intention index identifications;
the training module is used for responding to a training instruction of a task session model, splicing a session sample carried by the training instruction with the slot position description information and the intention state information and inputting the spliced session sample into a network model for training;
and the determining module is used for adjusting the matching relation among the session sample, the slot position description information and the intention state information by using a preset loss function in the training process until the output value of the network model meets a preset convergence condition, and determining the trained network model as a task session model.
9. A computer device comprising a memory and a processor, the memory storing a computer program, wherein the processor implements the steps of the method of any one of claims 1 to 7 when executing the computer program.
10. A computer storage medium on which a computer program is stored, characterized in that the computer program, when being executed by a processor, carries out the steps of the method of any one of claims 1 to 7.
CN202210565619.1A 2022-05-23 2022-05-23 Training method and device for task session model, computer equipment and storage medium Active CN114881046B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210565619.1A CN114881046B (en) 2022-05-23 2022-05-23 Training method and device for task session model, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210565619.1A CN114881046B (en) 2022-05-23 2022-05-23 Training method and device for task session model, computer equipment and storage medium

Publications (2)

Publication Number Publication Date
CN114881046A true CN114881046A (en) 2022-08-09
CN114881046B CN114881046B (en) 2023-07-25

Family

ID=82676740

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210565619.1A Active CN114881046B (en) 2022-05-23 2022-05-23 Training method and device for task session model, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114881046B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117555897A (en) * 2023-10-10 2024-02-13 北京百度网讯科技有限公司 Data query method, device, equipment and storage medium based on large model

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20190188590A1 (en) * 2017-12-15 2019-06-20 Microsoft Technology Licensing, Llc Chatbot Integrating Derived User Intent
CN110209446A (en) * 2019-04-23 2019-09-06 华为技术有限公司 The configuration method and device of slot position are combined in a kind of interactive system
CN111309915A (en) * 2020-03-03 2020-06-19 爱驰汽车有限公司 Method, system, device and storage medium for training natural language of joint learning
KR20220039339A (en) * 2020-09-22 2022-03-29 에스케이플래닛 주식회사 Method and apparatus for providing chatbot service based on slot filling

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20190188590A1 (en) * 2017-12-15 2019-06-20 Microsoft Technology Licensing, Llc Chatbot Integrating Derived User Intent
CN110209446A (en) * 2019-04-23 2019-09-06 华为技术有限公司 The configuration method and device of slot position are combined in a kind of interactive system
CN111309915A (en) * 2020-03-03 2020-06-19 爱驰汽车有限公司 Method, system, device and storage medium for training natural language of joint learning
KR20220039339A (en) * 2020-09-22 2022-03-29 에스케이플래닛 주식회사 Method and apparatus for providing chatbot service based on slot filling

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117555897A (en) * 2023-10-10 2024-02-13 北京百度网讯科技有限公司 Data query method, device, equipment and storage medium based on large model

Also Published As

Publication number Publication date
CN114881046B (en) 2023-07-25

Similar Documents

Publication Publication Date Title
US10956683B2 (en) Systems and method for vocabulary management in a natural learning framework
CN109558479B (en) Rule matching method, device, equipment and storage medium
US11010700B2 (en) Identifying task and personality traits
CN111708869B (en) Processing method and device for man-machine conversation
US12086550B2 (en) System for focused conversation context management in a reasoning agent/behavior engine of an agent automation system
CN110008319A (en) Model training method and device based on dialog template
US20220300716A1 (en) System and method for designing artificial intelligence (ai) based hierarchical multi-conversation system
US11727923B2 (en) System and method for virtual conversations
CN112579733B (en) Rule matching method, rule matching device, storage medium and electronic equipment
US11809843B2 (en) Adaptive user interfacing
US11354504B2 (en) Multi-lingual action identification
CN112784029B (en) Business processing method and device based on natural language processing and computer equipment
US20220207384A1 (en) Extracting Facts from Unstructured Text
US20230368773A1 (en) Methods and systems for generating personal virtual agents
CN111639162A (en) Information interaction method and device, electronic equipment and storage medium
CN114357125A (en) Natural language identification method, device and equipment in task type dialogue system
CN114881046B (en) Training method and device for task session model, computer equipment and storage medium
CN113946668A (en) Semantic processing method, system and device based on edge node and storage medium
US11941414B2 (en) Unstructured extensions to rpa
CN114925206A (en) Artificial intelligence body, voice information recognition method, storage medium and program product
US20220207234A1 (en) Context Aware Personalization
JP7182584B2 (en) A method for outputting information of parsing anomalies in speech comprehension
US11195102B2 (en) Navigation and cognitive dialog assistance
CN116108918A (en) Training method and related device for dialogue pre-training model
US20200118008A1 (en) Building domain models from dialog interactions

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant