Method, device and equipment for assisting session based on generative language model, and medium
By judging the dialogue type in the generative language model and selectively calling the model, the problem of uncontrolled output in professional scenarios is solved, wrong answers and legal risks are avoided, and the efficiency of the model is improved.
Patent Information
- Application Number
- CN202311233430.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-21
- Publication Date
- 2025-03-28
AI Technical Summary
Generative language models are difficult to control output in professional scenarios, and may generate inappropriate content, resulting in incorrect answers, and may cause legal risks, especially in commercial scenarios.
By determining whether the preset usage scenario of the generative language model contains the dialogue type of the conversation to be replied, selectively call the generative language model to generate auxiliary dialogue information to avoid direct incorrect answers.
It effectively avoids the risk of generative language models providing incorrect answers in uncertain scenarios, especially in commercial scenarios, avoids unreasonable commercial commitments, while reducing resource waste and improving the efficiency of model use.
Smart Images

Figure CN119719258A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of semantic analysis, and in particular to a method, apparatus, device and medium for assisting conversation based on a generative language model. Background Art
[0002] A generative language model (GLM) is a model that can generate natural language text. Its goal is to generate continuous text similar to human language based on given context and language rules. Based on the ability of the GLM to generate text based on context, the GLM is often used as a conversational robot to automatically answer user conversations.
[0003] Considering that generative language models are often unconstrained, in professional scenarios, the output of generative language models is often difficult to control and may generate inappropriate content. For example, in commercial scenarios involving business affairs, when generative language models are directly used in customer service robots, they may give wrong answers to situations such as bargaining, which may cause sellers to bear false advertising or breach of contract liability.
[0004] Therefore, how to improve the accuracy of the generative language model is a technical problem that needs to be solved urgently by those skilled in the art. Summary of the invention
[0005] In view of this, embodiments of the present application provide a method, apparatus, device and medium for assisting conversation based on a generative language model, which generates auxiliary dialogue information by selectively calling a generative language model to avoid direct erroneous answers from the generative language model.
[0006] In a first aspect, the present application provides a method for assisting a conversation based on a generative language model, the method comprising: determining a conversation to be replied in response to a conversation triggering operation. Determining the conversation type of the conversation to be replied based on a conversation classification model. Determining whether a preset usage scenario of the generative language model includes the conversation type of the conversation to be replied. If so, inputting the conversation to be replied into the generative language model to determine auxiliary conversation information of the conversation to be replied.
[0007] Optionally, inputting the dialogue to be replied into the generative language model to determine the auxiliary dialogue information of the dialogue to be replied includes: determining injection information based on the dialogue to be replied and its dialogue type. Inputting the injection information into the generative language model. Inputting the dialogue to be replied into the generative language model so that the generative language model determines the auxiliary dialogue information of the dialogue to be replied based on the injection information.
[0008] Optionally, determining the injected information based on the dialogue to be replied and its dialogue type includes: matching the dialogue to be replied and its dialogue type with a preset knowledge base, determining target knowledge information matching the dialogue to be replied, wherein the preset knowledge base includes a plurality of knowledge information. Determining the injected information based on the target knowledge information.
[0009] Optionally, determining the injection information based on the dialogue to be replied and its dialogue type includes: determining a conversation object of the dialogue to be replied and a prompt word template of the conversation object. Determining the injection information based on the conversation object and the prompt word template.
[0010] Optionally, the method further includes: determining whether the dialogue to be replied matches a standard question in a standard question library. If so, generating reply information of the dialogue to be replied based on the standard question corresponding to the dialogue to be replied. If not, executing a step of determining the dialogue type of the dialogue to be replied based on a dialogue classification model.
[0011] Optionally, the method further includes: recording the dialogue to be replied and the auxiliary dialogue information, generating standard questions based on the dialogue to be replied and the corresponding auxiliary dialogue information, and updating the standard question library.
[0012] Optionally, the method further includes: obtaining knowledge information to be sorted. Structuring the knowledge information to be sorted, determining structured knowledge information and its corresponding feature vector, wherein the structured knowledge information is at least part of the knowledge information to be sorted, and the feature vector is related to at least one of the conversation content, the accompanying data, and the conversation type. Constructing a preset knowledge base based on the structured knowledge information and its corresponding feature vector.
[0013] Optionally, determining the conversation to be replied includes: determining the conversation content of the conversation to be replied. Based on the conversation triggering operation, determining the accompanying data of the conversation triggering operation, wherein the accompanying data at least includes the conversation object and the conversation scenario.
[0014] Optionally, the method further includes: determining an initial dialogue classification model. Obtaining historical dialogue information, wherein the historical dialogue information includes historical dialogue content and dialogue labels, and the dialogue labels reflect the dialogue type of the historical dialogue information. Training an initial dialogue classification model based on the historical dialogue information to determine the dialogue classification model, wherein the historical dialogue content is input into the initial dialogue classification model as a training sample of the initial dialogue classification model, and the dialogue labels are used as sample labels of the training samples to update the initial dialogue classification model.
[0015] Optionally, the method further includes: obtaining historical reply data of the generative language model, wherein the historical reply data includes a plurality of dialogue groups replied by the generative language model, dialogue types of the dialogue groups, and accuracy labels. Determining a preset usage scenario of the generative language model based on the historical reply data, wherein the preset usage scenario includes a plurality of dialogue types with accuracy rates higher than a threshold.
[0016] Optionally, for a product pre-sale session, the preset usage scenarios include at least product parameter consultation, quality inspection report consultation, delivery after-sales consultation, and product accessories consultation, and the preset usage scenarios do not include product price inquiry and negotiation and product payment issues.
[0017] Optionally, the method also includes: displaying the auxiliary conversation information in the conversation interface and attaching it to the dialog box of the conversation to be replied, wherein the dialog box is configured with a copy control and a send control corresponding to the auxiliary conversation information, the copy control is used to copy the auxiliary conversation information in response to a trigger operation, and the send control is used to send the auxiliary conversation information in the form of a conversation to the conversation interface in response to the trigger operation.
[0018] In a second aspect, the present application provides a device for assisting conversation based on a generative language model, the device comprising an online conversation module, a conversation recognition module and a model calling module. Among them, the online conversation module is used to determine the conversation to be replied in response to the conversation triggering operation. The conversation recognition module is used to determine the conversation type of the conversation to be replied based on the conversation classification model. It is also used to determine whether the preset usage scenario of the generative language model includes the conversation type of the conversation to be replied. The model calling module is used to input the conversation to be replied into the generative language model when the preset usage scenario of the generative language model includes the conversation type of the conversation to be replied, and determine the auxiliary conversation information of the conversation to be replied.
[0019] In a third aspect, the present application provides an electronic device, the electronic device comprising: a processor and a memory for storing instructions executable by the processor, wherein the processor is configured to execute the instructions to implement the method for assisting conversation based on a generative language model as described in the first aspect.
[0020] In a fourth aspect, the present application provides a computer-readable storage medium having instructions stored thereon. When the instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the method for assisted conversation based on a generative language model as described in the first aspect.
[0021] The embodiments of the present application provide a method, apparatus, device and medium for assisting conversation based on a generative language model. The present application selectively calls the generative language model for conversation assistance by judging whether the preset usage scenario of the generative language model includes the conversation type of the conversation to be replied. In this way, it is possible to avoid the generative language model from providing wrong answers in uncertain scenarios, especially in commercial scenarios, it is possible to avoid the generative language model from making unreasonable commercial promises. In addition, the present application also reduces the waste of resources in unnecessary occasions and improves the efficiency of using the generative language model by selectively calling the generative language model. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the embodiments are briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without creative work.
[0023] Figure 1 It is an application scenario diagram of a conversation system shown in some embodiments of the present application.
[0024] Figure 2 It is an exemplary flow chart of an assisted conversation method shown in some embodiments of the present application.
[0025] Figure 3 This is a schematic diagram of a conversation interface shown in some embodiments of the present application.
[0026] Figure 4 It is a schematic flowchart of a method for determining auxiliary dialogue information shown in some embodiments of the present application.
[0027] Figure 5 This is an example diagram of data transmission in the auxiliary dialogue information determination process shown in some embodiments of the present application.
[0028] Figure 6 It is an exemplary flow chart of another assisted conversation method shown in some embodiments of the present application.
[0029] Figure 7 It is a schematic diagram of the parameter configuration process shown in some embodiments of the present application.
[0030] Figure 8 It is a schematic diagram of a system module of a conversation assistance device shown in some embodiments of the present application. DETAILED DESCRIPTION
[0031] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0032] Exemplary application scenarios
[0033] Figure 1 It is an application scenario diagram of a conversation system shown in some embodiments of the present application.
[0034] like Figure 1As shown, the session system 100 may include a processor 110 , a memory 120 , a first user terminal 130 , a second user terminal 140 , and a network 150 .
[0035] In some embodiments, the conversation system 100 can be configured as a system that provides online conversation services, that is, the first user terminal 130 and the second user terminal 140 can have a conversation through the network 150. During the conversation, the processor 110 can call the instructions in the memory 120 to implement a method for assisting the conversation based on a generative language model. That is, during the conversation, the processor 110 can determine the conversation to be replied in response to the conversation triggering operation. Determine the conversation type of the conversation to be replied based on the conversation classification model. Determine whether the preset usage scenario of the generative language model contains the conversation type of the conversation to be replied. If so, input the conversation to be replied into the generative language model to determine the auxiliary conversation information of the conversation to be replied.
[0036] The processor 110 can process data and / or information obtained from other devices or system components. The processor can execute program instructions based on these data, information and / or processing results to perform one or more functions described in this application. In some embodiments, the processor 110 may include one or more sub-processing devices (e.g., a single-core processing device or a multi-core multi-core processing device). As an example only, the processor 110 may include a central processing unit (CPU), an application-specific integrated circuit (ASIC), an application-specific instruction processor (ASIP), a graphics processing unit (GPU), a physical processing unit (PPU), a digital signal processor (DSP), a field programmable gate array (FPGA), a programmable logic circuit (PLD), a controller, a microcontroller unit, a reduced instruction set computer (RISC), a microprocessor, etc. or any combination thereof.
[0037] The memory 120 may be used to store data and / or instructions. The memory 120 may include one or more storage components, each of which may be an independent device or part of other devices. In some embodiments, the memory 120 may include a random access memory (RAM), a read-only memory (ROM), a mass storage device, a removable memory, a volatile read-write memory, or the like, or any combination thereof. Exemplarily, the mass storage device may include a magnetic disk, an optical disk, a solid-state disk, or the like. In some embodiments, the memory 120 may be implemented on a cloud platform. Data refers to a digital representation of information and may include various types, such as binary data, text data, image data, video data, or the like. An instruction refers to a program that can control a device or a device to perform a specific function.
[0038] A user terminal refers to one or more terminal devices or software used by a user. In some embodiments, the user terminal may be used by one or more users, including users who directly use the service, or other related users. In some embodiments, taking the first user terminal 130 as an example, the first user terminal 130 may be one of the mobile device 131, tablet computer 132, laptop computer 133, desktop computer 134, or any combination thereof, which has input and / or output functions.
[0039] In this application, the first user terminal 130 and the second user terminal 140 may reflect different users in the conversation. As just one example, when the conversation system 100 is configured as a commodity customer service system, the first user terminal 130 may be related to the customer, and the second user terminal 140 may be related to the customer service.
[0040] The network 150 can connect the components of the system and / or connect the system with external resources. The network 150 allows the components to communicate with each other and with other parts outside the system, and promotes the exchange of data and / or information. In some embodiments, the network 150 can be any one or more of a wired network or a wireless network. For example, the network 150 can include a cable network, an optical fiber network, a telecommunications network, the Internet, a local area network (LAN), a wide area network (WAN), a wireless local area network (WLAN), a metropolitan area network (MAN), a public switched telephone network (PSTN), a Bluetooth network, a ZigBee network (ZigBee), a near field communication (NFC), a bus within a device, a line within a device, a cable connection, etc. or any combination thereof. The network connection between the various parts can be one of the above methods, or multiple methods can be adopted. In some embodiments, the network can be a point-to-point, shared, central, or other topological structure or a combination of multiple topological structures. In some embodiments, the network 150 can include one or more network access points. For example, network 150 may include wired or wireless network access points, such as base stations and / or network switching points 151, 152, through which one or more components of system 100 may connect to network 150 to exchange data and / or information.
[0041] In some embodiments, the aforementioned processor 110 and memory 120 may constitute an electronic device (such as a server of a customer service system). The memory 120 may store instructions executable by the processor, and the processor 110 may be configured to execute the instructions to implement the method for assisting conversation based on a generative language model provided in an embodiment of the present application.
[0042] In some embodiments, the memory 120 may be a computer-readable storage medium having instructions stored thereon. When the instructions in the computer-readable storage medium are executed by a processor (such as processor 110) of an electronic device (such as a server), the electronic device is enabled to execute the method for assisted conversation based on a generative language model provided in an embodiment of the present application.
[0043] An exemplary assisted conversation method
[0044] Figure 2 is an exemplary flow chart of an assisted conversation method shown in some embodiments of the present application. In some embodiments, Figure 2 The process P200 shown may be executed by a computing device such as the processor 110 or the auxiliary conversation device 800 .
[0045] like Figure 2 As shown, P200 may include the following steps:
[0046] S210: In response to the conversation triggering operation, determine the conversation to be replied. In some embodiments, S210 may be executed by the online conversation module 810 or specifically by the conversation support module 811.
[0047] S220: Determine the conversation type of the conversation to be replied based on the conversation classification model. In some embodiments, S220 may be performed by the conversation identification module 820.
[0048] S230: Determine whether the preset usage scenario of the generative language model includes the conversation type of the conversation to be replied. In some embodiments, S230 may be performed by the conversation recognition module 820.
[0049] S240: When the judgment result of S230 is yes, input the dialogue to be replied into the generative language model to determine the auxiliary dialogue information of the dialogue to be replied. In some embodiments, S230 may be executed by the model calling module 830.
[0050] In this application, in communication, the content of a single statement by one party can be recorded as a dialogue, and multiple dialogues formed with a communication object (hereinafter referred to as a conversation object) can form a conversation. In the actual interactive page, a dialogue can be a dialog box (also recorded as a dialogue bubble), and a conversation can include multiple dialog boxes related to the conversation object between the two parties.
[0051] A conversation triggering operation may be an interactive operation that generates a conversation. For example, a conversation triggering operation may be the initial conversation in a new conversation generated for a new conversation object (such as a new product or a new order). Exemplarily, after a customer clicks on a product link, they can trigger the "Consult Customer Service" control, enter and send "How is the quality of this product?" At this point, this conversation can be used as an initial conversation to trigger a new conversation. For another example, a conversation triggering operation may be a new conversation added to an existing conversation. Exemplarily, after a user enters the aforementioned question and gets an answer from the customer service, they can ask "What is the shelf life of this product?" to further implement the conversation triggering operation.
[0052] The conversation to be replied may refer to a new conversation corresponding to the conversation triggering operation. In some embodiments, the conversation to be replied may include conversation content and accompanying data. Among them, the conversation content may refer to the text content of the newly added conversation. Such as the aforementioned text information such as "How is the quality of this product?" and "How long is the shelf life of this product?". The accompanying data may refer to other relevant data of the conversation to be replied. For example, the accompanying data can be determined according to the scenario of triggering the conversation, such as the conversation and the conversation to be replied are generated based on the customer consultation control of a specific product page, and the conversation scenario can be pre-sales consultation of the product, and the conversation can correspond to the specific product.
[0053] The dialogue classification model can be a trained natural language processing (NLP) model. The dialogue classification model can identify and classify input dialogues (such as dialogue content) to determine the dialogue type of the input dialogue. For example, the dialogue classification model can be a text classification model based on intent recognition. In some embodiments, the dialogue classification model can be trained based on the initial dialogue classification model. For the training process of the dialogue classification model, please refer to Figure 7 and its related description.
[0054] In this application, multiple dialogue types can be preset, and the actual dialogue type of each dialogue can be a preset dialogue type. Among them, the dialogue type can be represented by a vector, each element can reflect each preset dialogue type, and the element value (such as 0 / 1) can reflect whether the actual dialogue type of the dialogue is the corresponding type. Among them, the preset multiple dialogue types can generally be constructed based on actual business scenarios. For example, for pre-sales service of goods, the preset multiple dialogue types may include product parameter consultation, product bargaining, product comparison consultation, etc.
[0055] A generative language model may refer to a machine learning model built using generative related technologies. Among them, a generative language model is usually based on a statistical model or a neural network model. During the training process, the model learns the probability distribution of the language, that is, the probability of generating the next word based on a given context. By sampling or searching, a generative language model can be used to generate new texts that are similar to the training data but not exactly the same. In some embodiments, the generative language model can be a local model. In some embodiments, the generative language model can also be implemented by a transport model service interface called by a port.
[0056] The preset usage scenario may be a conversation scenario in which the generative language model used in this application has a good answering effect. For example, the preset usage scenario may include a scenario in which the adoption rate / accuracy of the generative language model is high and does not include scenarios that may cause interest disputes. For example, for a third-party shopping platform, the comparison of products from different manufacturers may cause disputes, so the generative language model should not answer conversations in this scenario.
[0057] In some embodiments, after testing, for pre-sales conversations of goods, the preset usage scenarios include at least product parameter consultation, quality inspection report consultation, delivery after-sales consultation, and product accessories consultation, and the preset usage scenarios do not include product inquiry and negotiation and product payment issues.
[0058] Auxiliary conversation information may refer to the output of the generative language model based on the dialogue to be replied. Among them, the auxiliary conversation information can be understood as the output of the generative language model based on the dialogue to be replied, which is not directly presented to the other party, but requires further confirmation by relevant personnel before being fed back to the other party.
[0059] In some embodiments, the aforementioned S210 can be implemented by detecting the conversation triggering operation by the conversation support module 811. That is, when one party (such as a customer) adds a new conversation through an interactive operation (i.e., a conversation triggering operation), the conversation support module 811 can detect the interactive behavior and obtain relevant information of the interactive behavior to determine the conversation to be replied.
[0060] In some embodiments, when executing the aforementioned S210, the conversation support module 811 may first determine the conversation content of the conversation to be replied. Then, based on the conversation triggering operation, determine the accompanying data of the conversation triggering operation. The accompanying data at least includes a conversation object and a conversation scene. For example, the conversation scene and the conversation object may be determined according to the interface generated by the conversation triggering operation as the accompanying data.
[0061] In some embodiments, the aforementioned S220 can be performed by a dialogue classification model configured in the dialogue recognition module 820. That is, the dialogue to be replied (mainly the dialogue content) can be input into the dialogue classification model, and the output result of the dialogue classification model can be used as the dialogue type of the dialogue to be replied. As mentioned above, the output result of the dialogue classification model can be presented in the form of a vector. Among them, each vector element can reflect a dialogue type, and the element value can reflect the possibility of being classified into the dialogue type. The dialogue type corresponding to the element with the largest element value can be used as the dialogue type of the dialogue to be replied.
[0062] In some embodiments, in order to further reduce the calls to the generative language model, before calling the generative language model (such as before identifying the dialogue type), the dialogue to be replied can also be matched with the search-based language model (standard question library). When the standard question library contains the dialogue to be replied, the corresponding standard question and its corresponding answer are directly called to generate the reply information. For more descriptions of the standard question library, see Figure 6 and its related description.
[0063] In some embodiments, the aforementioned S230 can be judged based on whether each dialogue type included in the preset usage scenario includes the dialogue type of the dialogue to be replied. If it is included, it can be determined that the generative language model can answer the question, and S240 can be executed subsequently. If it is not included, it can be determined that the generative language model cannot answer the question, and S260 can be executed subsequently.
[0064] In some embodiments, the aforementioned S240 can be implemented by calling a generative language model. That is, the dialogue to be replied can be input into the generative language model, and the output of the generative language model on the dialogue to be replied is used as auxiliary dialogue information. Among them, calling the generative language model can include using a local model and calling a remote model (such as ChatGPT) through a port.
[0065] In some embodiments, in order to improve the accuracy of the answer and avoid ambiguous references in the dialogue to be replied, before calling the generative language model, injection information can also be determined and input into the generative language model. For more information about injection information, see Figure 4 , 5 and its related contents.
[0066] The above-mentioned method for assisting conversation based on a generative language model (also written as a conversation assistance method) selectively calls the generative language model for conversation assistance by judging whether the preset usage scenario of the generative language model contains the conversation type of the conversation to be replied. In this way, it is possible to avoid the generative language model from providing wrong answers in uncertain scenarios, especially in commercial scenarios, it is possible to avoid the generative language model from making unreasonable commercial promises. In addition, the present application also reduces the waste of resources in unnecessary occasions and improves the efficiency of the use of the generative language model by selectively calling the generative language model.
[0067] In some embodiments, after the auxiliary dialogue information is determined, the relevant personnel can determine the reply content of the dialogue to be replied based on the auxiliary dialogue information. In order to facilitate the relevant personnel to handle, the auxiliary dialogue information can be presented in a specific interface (such as a dialog box of the dialogue to be replied).
[0068] Therefore, after executing S240, the present application may further include:
[0069] S250: Display the auxiliary dialogue information in the conversation interface and attach it to the dialog box of the dialogue to be replied. In some embodiments, S250 may be executed by the information output module 813. For the specific presentation method of S250, please refer to Figure 3 and its related description.
[0070] In some embodiments, when the dialogue to be answered involves a field where a generative language model should not be used (ie, the judgment result of the aforementioned S230 is no), manual operation can be performed directly.
[0071] That is, Figure 2 As shown, P200 may also include:
[0072] S260: When the judgment result of S230 is no, manually reply to the dialogue to be replied. The manual reply can be executed based on the corresponding interface. For details, please refer to Figure 3 and its related description.
[0073] Exemplary Conversational Interface
[0074] Figure 3 is a diagram of a conversation interface shown in some embodiments of the present application. Figure 3 The interactive interface shown may be presented in a terminal (such as the second user terminal 140 ) used by customer service.
[0075] like Figure 3 As shown, the conversation interface 300 may include a dialog box 310 where the conversation to be replied is located, a dialog box 340 for one possible reply, and a dialog box 350 for another possible reply.
[0076] In the dialog box 310 where the to-be-replied conversation is located, the to-be-replied conversation 320 may be presented in text form. Specifically, the dialog box 310 includes the conversation content 321 represented by text and the accompanying data 322. As just one example, Figure 3 The dialogue to be replied to shown can be triggered on the display page of product A, and the corresponding conversation object can be product A, and the conversation scenario can be consultation about product A in the pre-sale stage. The conversation content 321 can include "Does this mobile phone have a single speaker?", which can reflect the customer's doubts about the speaker parameters of product A and can be a product consultation dialogue.
[0077] It should be noted that the accompanying route data 322 may not be presented in text form, that is, the dialog box 310 may not display the accompanying route data 322 .
[0078] Thus, the generative language model can be called to reply. That is, the dialogue to be replied can be input into the generative language model to determine the auxiliary dialogue information 330. The auxiliary dialogue information 330 is configured inside the dialog box 310, specifically below the dialogue to be replied 320. As just an example, for the above question, the reply of the generative language model can be "Product A is a single speaker".
[0079] In some embodiments, the dialog box 310 may also be configured with a copy control 331 and a send control 332 corresponding to the auxiliary dialogue information 330. The copy control 331 is used to copy the auxiliary dialogue information in response to a trigger operation, and the send control 332 is used to send the auxiliary dialogue information 330 to the conversation interface in the form of a dialogue in response to a trigger operation.
[0080] When the send control 332 is triggered, the auxiliary dialogue information 330 can be directly sent to the conversation interface in the form of a dialogue, such as a dialog box 340. When the copy control 331 is triggered, the auxiliary dialogue information 330 can be copied to the clipboard, and then the customer service can paste the auxiliary dialogue information 330 in the text input area and modify and send it, such as a dialog box 350.
[0081] In some embodiments, when the auxiliary dialogue message 330 is inaccurate or the auxiliary dialogue message 330 should not be called, it can be edited and sent directly in the text input area.
[0082] Exemplary injection information determination method
[0083] In some embodiments, to further improve the accuracy of the generative language model, information may be injected into the generative language model input before the generative language model determines the auxiliary dialogue information.
[0084] In some embodiments, the injected information can be understood as a prompt in natural language processing. That is, when the generative language model inputs the injected information, the injected information can be used as the above information, so that the answer of the generative language model is close to the injected information, and the accuracy of the subsequent answer is improved. For example, in the aforementioned consultation dialogue of commodity A, the specification parameters of commodity A can be used as injected information, so that the subsequent answer of the generative language model is based on the specification parameters of commodity A.
[0085] To further illustrate the method for determining the injection information, the present application also provides a process for determining the injection information ( Figure 4 ) and the data transmission process of injected information ( Figure 5 ).Right now Figure 4 It is a schematic flowchart of a method for determining auxiliary dialogue information shown in some embodiments of the present application. Figure 5 This is an example diagram of data transmission in the auxiliary dialogue information determination process shown in some embodiments of the present application. Figure 4 , Figure 5 A method for determining the injection information is described in detail.
[0086] In some embodiments, Figure 4 The process P400 shown can be executed by the database module 840 , and specifically by the structured knowledge base 841 .
[0087] like Figure 4 As shown, P400 may include the following steps:
[0088] S410: Determine the injection information based on the conversation to be replied and its conversation type.
[0089] S420: Input the injected information into the generative language model.
[0090] S430: Input the dialogue to be replied into the generative language model, so that the generative language model determines the auxiliary dialogue information of the dialogue to be replied based on the injected information.
[0091] In this application, the injected information may include a conversation object and its preset information. The conversation object may be used to indicate the direction of a demonstrative pronoun in a subsequent conversation. For example, Figure 3 In the conversation "Is this phone a single speaker?", "this" can specifically refer to the conversation object, namely, product A. To avoid the situation where the demonstrative pronoun is unclear when directly inputting the conversation, the injected information can at least include the conversation object. It should be noted that when the conversation object cannot be determined from the accompanying data / the conversation does not revolve around a specific object (such as chatting), the conversation object can be set to an empty set.
[0092] In some embodiments, the conversation object in the injected information can generally be determined based on the accompanying data of the conversation to be replied. That is, according to the trigger page of the conversation to be replied, the object reflected by the trigger page (generally a commodity) can be used as the conversation object. In some embodiments, the conversation object can also be determined based on the conversation content. When the conversation content mentions a clear subject, the subject can be used as the conversation object.
[0093] The preset information of the conversation object can be determined according to the actual situation. In some embodiments, the preset information may include one or more combinations of prompt word templates, dialogue types, and target knowledge information. Among them, the prompt word template may refer to prompt words directly preset based on the conversation object. When the conversation object is determined, the corresponding prompt word template can be directly called. The target knowledge information may refer to structured knowledge information related to the conversation object, wherein the target knowledge information can be recorded in a structured knowledge base, and the preset knowledge base may include multiple structured knowledge information. To determine the target knowledge information, the target knowledge information matching the conversation to be replied can be determined by matching the conversation to be replied and its conversation type with the preset knowledge base.
[0094] In some embodiments, after determining the conversation object and its preset information, it can be integrated into the injection information as the prompt word (Prompt) of the generative language model, injected into the generative language model in advance, and provide the above information for the dialogue to be replied. In some embodiments, the generative language model can also be configured with a plug-in so that the conversation of the generative language model is strictly based on the content of the injection information. As just one example, the conversation object and the conversation type can be used as the topic and / or identity setting situation, and the prompt word template and the target knowledge information can be used as specific injection data.
[0095] Just as an example, when the conversation object is a second-hand product of commodity A, the prompt word template can be configured as the quality inspection report of the second-hand product, the conversation type can be pre-sales consultation, and the target knowledge information can be the relevant information of commodity A (such as the parameters of commodity A). Then the injection information can be generated as follows "Assume that you are a pre-sales consulting customer service (corresponding to the conversation type), and now communicate with the customer about the second-hand product of commodity A (corresponding to the conversation object). The quality inspection of this second-hand product includes XXX (corresponding to the prompt word template), and the relevant parameters of commodity A are XXX (corresponding to the target knowledge information). Please have a conversation with the customer based on the above content." Among them, the content in brackets only explains the correspondence between the various parts.
[0096] It should be noted that the above-mentioned injected information is only an example, and the specific content of the prompt word template and the target knowledge information can be set according to the actual situation. For example, the prompt word template can also include the style of the injected information and the correspondence between each part and the preset information. The target knowledge information can also include other relevant information of the second-hand goods (such as logistics information, etc.).
[0097] like Figure 5 As shown, after determining the dialogue 510 to be replied and its dialogue content 511 and the accompanying data 512, the conversation object 531 and the prompt word template 532 can be determined based on the accompanying data 512. Then, the dialogue 510 to be replied is input into the dialogue classification model 520 to determine the conversation type 533. Then, the dialogue content 511 and related data (such as the accompanying data 512, the dialogue type 533, etc.) are matched with the preset knowledge base 540 to determine the target knowledge information 534. Finally, based on the conversation object 531, the prompt word template 532, the dialogue type 533 and the target knowledge information 534, the injection information 530 is constructed and input into the generative language model 550, and used as the above information, so that it can output the auxiliary dialogue information 560 based on the dialogue 510 to be replied.
[0098] It should be noted that the various parameters forming the injection information 530 may be defaulted as needed. For example, when a customer is chatting with a customer service representative, the session object 531 may not exist (ie, the session object 531 is an empty set).
[0099] Therefore, the present application improves the correlation between the auxiliary object information and the injected information by using the injected information as the previous information of the generative language model. In addition, the injected information can also solve the reference problem caused by the presence of demonstrative pronouns in the dialogue to be replied, which can further improve the accuracy of the generative language model.
[0100] Another exemplary assisted conversation method
[0101] Figure 6 It is an exemplary flow chart of another assisted conversation method shown in some embodiments of the present application. Figure 6 The process P600 shown is relative to Figure 2 The process P200 shown in the figure adds the steps of standard question identification and auxiliary dialogue information recording, wherein the standard question identification can be performed by the online conversation module 810, specifically, it can be performed by the customer service robot 812. The step of recording auxiliary dialogue information can be performed by the database module 840, specifically, it can be performed by the dialogue database 842.
[0102] like Figure 6 As shown, P600 may include the following steps:
[0103] S610: In response to a conversation triggering operation, determine a conversation to be replied to.
[0104] S620: Determine whether the dialogue to be replied matches a standard question in a standard question library.
[0105] S630. When the judgment result of S620 is yes, generate reply information of the dialogue to be replied based on the standard question corresponding to the dialogue to be replied.
[0106] S640: When the judgment result of S620 is no, determine the dialog type of the dialog to be replied based on the dialog classification model.
[0107] S650: Determine whether the preset usage scenario of the generative language model includes the dialog type of the dialog to be replied.
[0108] S660. When the judgment result of S6500 is yes, the dialogue to be replied is input into the generative language model to determine the auxiliary dialogue information of the dialogue to be replied.
[0109] S670: Record the conversation to be replied and the auxiliary conversation information.
[0110] S680: Generate standard questions based on the dialogue to be replied and its corresponding auxiliary dialogue information, and update the standard question library.
[0111] S690: When the judgment result of S650 is no, manually reply to the dialogue to be replied.
[0112] A standard question may be a question that is clearly described and has a deterministic standard answer, and a standard question may be configured with a corresponding standard answer. A standard question library may be a collection of standard questions. In some embodiments, a database of a search-based language model may be configured based on the standard question library so that the search-based language model can provide corresponding standard answers based on each standard question. The search-based language model that has been configured may be used as a customer service robot 812 to implement the response to the standard question in S630.
[0113] In some embodiments, the aforementioned S620 can be implemented through format matching, that is, characteristic keywords can be constructed for each standard question to form a keyword database, and the keyword database can be used to match the conversation to be replied. When there are specific keywords in the matching results, it can be determined that the conversation to be replied involves standard questions, and can be answered through standard questions corresponding to specific keywords.
[0114] In some embodiments, the aforementioned steps S670 and S680 can be implemented by organizing the dialogue to be replied and its corresponding auxiliary dialogue information, and the dialogue to be replied and its corresponding auxiliary dialogue information can be used as a historical dialogue group, and different processing can be performed according to its question type, answer accuracy, and whether it is a standard question. For example, the actual dialogue type and / or accuracy of the historical dialogue group can be determined first to construct a label so that the historical dialogue group can be used as sample data for training a dialogue classification model or as statistical data for determining a preset usage scenario. For another example, when the historical dialogue group involves standard questions (such as the number of speakers for the aforementioned product A, etc., which have a deterministic answer), the historical dialogue group can be converted into a standard question and the aforementioned standard question library can be updated.
[0115] Therefore, the method for assisting conversation provided by the present application can first determine whether it is a standard question before determining whether to call the generative language model, thereby reducing the call to the generative language model for deterministic questions, thereby reducing the cost of using the generative language model. In addition, relevant information can be updated based on the answer of the generative language model, thereby improving the accuracy of calling the generative language model.
[0116] Exemplary parameter configuration process
[0117] In this application, the objects that need to be configured / trained may include a preset knowledge base, a dialog classification model, and a preset usage scenario. Therefore, this application also provides a parameter configuration process ( Figure 7 ).in, Figure 7 It is a schematic diagram of the parameter configuration process shown in some embodiments of the present application. Figure 7 Specifically, it includes a configuration process 700A of a preset knowledge base, a training process 700B of a dialogue classification model, and a determination process 700C of a preset usage scenario.
[0118] As shown in 700A, in the process of configuring the preset knowledge base 720, the following may be done:
[0119] First, obtain the knowledge information to be sorted 710. The knowledge information to be sorted 710 may include knowledge in multiple dimensions. For commodity sales services, the knowledge to be sorted may include relevant information on platform policies (such as logistics policies, after-sales policies, etc.), relevant information on commodity categories (performance parameters of various types of commodities), relevant information on individual commodities (such as quality inspection reports of specific second-hand commodities, etc.), sales techniques, and other knowledge information.
[0120] Then, the knowledge information to be sorted is structured to determine structured knowledge information 721 and its corresponding feature vector 722. The structured knowledge information 721 is at least part of the knowledge information to be sorted. The feature vector 722 may be related to at least one of the conversation content, the accompanying data, and the conversation type. For example, the structured knowledge information 721 may be the result of cutting the knowledge information to be sorted. Exemplarily, for different types of electronic products and buyers in different regions, different logistics policies and after-sales policies may be included, and each structured knowledge information 721 may reflect the disassembly results of the logistics policies and after-sales policies of each region and each type of commodity, and the corresponding feature vector may reflect each region and each type of commodity.
[0121] Finally, a preset knowledge base 720 is constructed based on the structured knowledge information 721 and its corresponding feature vector 722 , wherein the preset knowledge base 720 may be a collection of each structured knowledge information 721 .
[0122] In some embodiments, the structured knowledge information 721 formed by the above process can also be used as a prompt word template, and the above configuration process 700A can be implemented based on the relevant processing method of the prompt word template. For example, the preset knowledge base 720 can be constructed using Langchain technology.
[0123] As shown in 700B, during the process of training the dialogue classification model 750, the following may be done:
[0124] First, determine the initial dialog classification model 730. The initial dialog classification model 730 may be a dialog classification model 750 without parameter configuration.
[0125] Then, historical conversation information 740 is obtained, wherein the historical conversation information includes historical conversation content 741 and conversation tags 742, and the conversation tags 742 reflect the conversation type of the historical conversation information. The conversation tags 742 can generally be manually marked by staff.
[0126] Finally, the initial dialogue classification model 730 is trained based on the historical dialogue information 740 to determine the dialogue classification model 750. The historical dialogue content 741 is input into the initial dialogue classification model 730 as the sample data of the training sample of the initial dialogue classification model 730, and the dialogue label 742 is used as the sample label of the training sample. The loss function is constructed to update the parameters of the initial dialogue classification model 730 based on the model output of the training sample of the initial dialogue classification model 730 to update the initial dialogue classification model. This step is repeated until the difference between the model output and the dialogue label 742 is less than the threshold or the training reaches the preset threshold or the preset number of trainings is completed, and the trained initial dialogue classification model 730 is used as the dialogue classification model 750.
[0127] As shown in 700C, in the process of determining the preset usage scenario 770, the following may be done:
[0128] First, the historical reply data 760 of the generative language model is obtained. The historical reply data 760 includes multiple dialogue groups 761 replied by the generative language model, dialogue types 762 of the dialogue groups, and accuracy labels 763. The dialogue group may include dialogues to be replied and corresponding auxiliary dialogue information. The dialogue type 762 of the dialogue group may be identified by the dialogue classification model 750 or manually standardized by the staff, and the accuracy label 763 may be used to reflect whether the reply to the dialogue is accurate.
[0129] Then, a preset usage scenario 770 of the generative language model is determined based on the historical reply data 760. The preset usage scenario includes multiple dialog types with accuracy rates higher than a threshold. For example, the accuracy labels of the tag groups of each dialog type can be counted, and the dialog types with accuracy rates higher than a preset threshold can be sorted to determine the preset usage scenario 770.
[0130] In the second-hand commodity transaction, the preset usage scenario 770 may include the following conversation types: commodity parameter consultation, quality inspection report consultation, delivery after-sales consultation, and commodity accessories consultation. To avoid business risks, the following conversation types may not be included: commodity price inquiry and negotiation, and commodity payment issues.
[0131] Exemplary Conversation Assistance Device
[0132] Figure 8 It is a schematic diagram of a system module of a conversation assistance device shown in some embodiments of the present application.
[0133] like Figure 8 As shown, the conversation assistance device 800 (which may also be recorded as a device for generative language model-assisted conversation) may include an online conversation module 810 , a dialogue recognition module 820 , and a model calling module 830 .
[0134] The online conversation module 810 may be configured to determine a conversation to be replied to in response to a conversation triggering operation.
[0135] The dialogue recognition module 820 can be used to determine the dialogue type of the dialogue to be replied based on the dialogue classification model, and also to determine whether the preset usage scenario of the generative language model includes the dialogue type of the dialogue to be replied.
[0136] The model calling module 830 is used to input the dialogue to be replied into the generative language model and determine the auxiliary dialogue information of the dialogue to be replied when the preset usage scenario of the generative language model includes the dialogue type of the dialogue to be replied.
[0137] In some embodiments, the online conversation module 810 may be a collection of related functional modules that support the online conversation system and provide online customer service, wherein the online conversation module 810 may further include a conversation support module 811 , a customer service robot 812 , and an information output module 813 .
[0138] The conversation support module 811 may be a collection of online instant messaging function modules. The conversation support module 811 may be used to receive the conversation content of the conversation to be replied and determine the accompanying data based on the triggering situation of the conversation to be replied.
[0139] The customer service robot 812 can be used to provide automatic responses based on a standard set of questions.
[0140] The information output module 813 is used to send the reply dialogue to the customer. For example, the standard answer of the customer service robot 812 is fed back to the customer.
[0141] In some embodiments, the conversation assistance device 800 may further include a database module 840. The database module 840 may be used to store data. The database module 840 may further include a structured knowledge base 841 for storing structured knowledge information and a conversation database 842 for storing unorganized knowledge and conversation information.
[0142] All the above optional technical solutions can be arbitrarily combined to form optional embodiments of the present application, and will not be described one by one here.
[0143] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0144] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0145] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0146] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0147] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0148] If the function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, and other media that can store program check codes.
[0149] It should be noted that, in the description of this application, the terms "first", "second", "third", etc. are used for descriptive purposes only and cannot be understood as indicating or implying relative importance. In addition, in the description of this application, unless otherwise specified, the meaning of "plurality" is two or more.
[0150] The above description is only a preferred embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, etc. made within the spirit and principles of the present application shall be included in the protection scope of the present application.
Claims
1. A method for assisting conversation based on a generative language model, characterized in that: The method comprises: In response to the conversation triggering operation, determining a conversation to be replied to; Determining the conversation type of the conversation to be replied based on a conversation classification model; Determining whether a preset usage scenario of the generative language model includes the conversation type of the conversation to be replied; If so, the dialogue to be replied is input into a generative language model to determine the auxiliary dialogue information of the dialogue to be replied.
2. The method according to claim 1, characterized in that The step of inputting the dialogue to be replied into a generative language model to determine the auxiliary dialogue information of the dialogue to be replied includes: Determining the injection information based on the conversation to be replied and its conversation type; Inputting the injected information into the generative language model; The dialogue to be replied is input into the generative language model, so that the generative language model determines the auxiliary dialogue information of the dialogue to be replied based on the injected information.
3. The method according to claim 2, characterized in that The step of determining the injection information based on the conversation to be replied and its conversation type includes: Matching the dialogue to be replied and its dialogue type with a preset knowledge base to determine target knowledge information matching the dialogue to be replied, wherein the preset knowledge base includes a plurality of knowledge information; The injection information is determined based on the target knowledge information.
4. The method according to claim 2, characterized in that: The step of determining the injection information based on the conversation to be replied and its conversation type includes: Determine the conversation object of the dialogue to be replied and the prompt word template of the conversation object; The injection information is determined based on the session object and the prompt word template.
5. The method according to claim 1, characterized in that: The method further comprises: Determining whether the dialogue to be replied matches a standard question in a standard question library; If yes, generating reply information of the conversation to be replied based on the standard question corresponding to the conversation to be replied; If not, the step of determining the dialog type of the to-be-replied dialog based on the dialog classification model is performed.
6. The method according to claim 5, characterized in that The method further comprises: Recording the conversation to be replied and the auxiliary conversation information; Generate standard questions based on the dialogue to be replied and its corresponding auxiliary dialogue information, and update the standard question library.
7. The method according to claim 1, characterized in that The method further comprises: Obtain knowledge information to be organized; Performing structured processing on the knowledge information to be sorted, determining structured knowledge information and its corresponding feature vector, wherein the structured knowledge information is at least part of the knowledge information to be sorted, and the feature vector is related to at least one of the conversation content, the accompanying data, and the conversation type; A preset knowledge base is constructed based on the structured knowledge information and its corresponding feature vectors.
8. The method according to claim 1, characterized in that The determining of the dialogue to be replied to includes: Determining the conversation content of the conversation to be replied; Based on the conversation triggering operation, the accompanying data of the conversation triggering operation is determined, wherein the accompanying data at least includes a conversation object and a conversation scenario.
9. The method according to claim 1, characterized in that: The method further comprises: Determine the initial dialogue classification model; Acquiring historical conversation information, wherein the historical conversation information includes historical conversation content and conversation tags, and the conversation tags reflect the conversation type of the historical conversation information; The initial dialogue classification model is trained based on the historical dialogue information to determine the dialogue classification model, wherein the historical dialogue content is input into the initial dialogue classification model as a training sample of the initial dialogue classification model, and the dialogue label is used as a sample label of the training sample to update the initial dialogue classification model.
10. The method according to claim 1, characterized in that The method further comprises: Acquire historical response data of the generative language model, wherein the historical response data includes a plurality of dialogue groups responded by the generative language model, dialogue types of the dialogue groups, and accuracy labels; A preset usage scenario of the generative language model is determined based on the historical reply data, wherein the preset usage scenario includes a plurality of dialogue types with accuracy rates higher than a threshold.
11. The method according to claim 1, characterized in that: For the pre-sale conversation of goods, the preset usage scenarios include at least product parameter consultation, quality inspection report consultation, delivery after-sales consultation and product accessories consultation, and the preset usage scenarios do not include product price inquiry and negotiation and product payment issues.
12. The method according to claim 1, characterized in that The method further comprises: The auxiliary conversation information is displayed in a conversation interface and attached to a dialog box of the conversation to be replied, wherein the dialog box is provided with a copy control and a send control corresponding to the auxiliary conversation information, the copy control is used to copy the auxiliary conversation information in response to a trigger operation, and the send control is used to send the auxiliary conversation information in the form of a conversation to the conversation interface in response to a trigger operation.
13. A device for assisting conversation based on a generative language model, characterized in that: The device comprises: An online conversation module, for determining a conversation to be replied to in response to a conversation triggering operation; A dialogue recognition module, used to determine the dialogue type of the dialogue to be replied based on the dialogue classification model; and also used to determine whether the preset usage scenario of the generative language model includes the dialogue type of the dialogue to be replied; The model calling module is used to input the dialogue to be replied into the generative language model when the preset usage scenario of the generative language model includes the dialogue type of the dialogue to be replied, and determine the auxiliary dialogue information of the dialogue to be replied.
14. An electronic device, characterized in that: The electronic device comprises: a processor and a memory for storing instructions executable by the processor; The processor is configured to execute instructions to implement the method for assisting conversation based on a generative language model as described in any one of claims 1 to 12.
15. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores instructions, and when the instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the method for assisting conversation based on a generative language model as described in any one of claims 1 to 12.