Method and device for automatically finding and optimizing the optimal threshold of text similarity

By calculating the vector representation and similarity matrix of the question list, it automatically finds and optimizes the text similarity threshold in the FAQ question and answer model, solving the problem that fixed thresholds cannot adapt to different data sets, and improving the accuracy and recall of robot question and answer.

CN112329428BActive Publication Date: 2024-08-27T&I NET COMM CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202011374448.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-11-30
Publication Date
2024-08-27
Estimated Expiration
2040-11-30

AI Technical Summary

Technical Problem

In the existing FAQ question and answer model, the fixed text similarity threshold cannot be adapted to the question and answer pair data sets in different scenarios, resulting in the robot question and answer effect being unable to achieve the best accuracy and recall rate.

Method used

By calculating the vector representation in the question list, the question similarity matrix and the category average similarity matrix are formed, and the appropriate similarity threshold is automatically found and optimized, including using NLP technology or deep learning pre-training model for text representation, and judging and adjusting the question category. Configure to ensure that the similarity between classes does not exceed the class average similarity.

Benefits of technology

It improved the accuracy of the FAQ question and answer model, discovered extended question configuration issues in the data set, optimized the performance of the conversational robot, and increased the accuracy by 3 percentage points without reducing the recall rate.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112329428B
    Figure CN112329428B
Patent Text Reader

Abstract

The present invention provides a method and device for automatically finding and optimizing the best threshold of text similarity. The method includes: calculating the question similarity matrix according to the vector representation of each question in the question list; traversing the question categories and the question similarity matrix to obtain the question category average similarity matrix; judging whether there is an inter-class question similarity greater than the category average similarity; if so, finding the existing configuration problem and repeating the above operation until there is no longer a situation where the inter-class question similarity is greater than the category average similarity; when there is no longer a situation where the inter-class question similarity is greater than the category average similarity, traversing the question category average similarity matrix to obtain the optimal similarity threshold. The method and device for automatically finding and optimizing the best threshold of text similarity provided by the present invention can automatically find a similarity threshold suitable for the robot's configured data set.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of machine question answering, and in particular to a method and device for automatically finding and optimizing an optimal threshold value of text similarity. Background Art

[0002] In response to the needs of user information acquisition, the core processing step of the FAQ question-answering model of the conversational robot is to encode the user's question text into a representation vector, and then calculate the similarity between the vector and the encoding vector of each question in the configured question set or the list of similar questions recalled in the previous step. Questions with similarities exceeding the system configuration threshold are regarded as hit questions, and then the corresponding answers are replied to the user. The similarity threshold is generally set to a fixed value based on experience, such as 0.75, 0.8, 0.85, etc.

[0003] Whether the threshold setting is reasonable directly affects the performance of the FAQ question-answering model. However, a fixed similarity threshold cannot adapt to different question-answer pair data sets in different scenarios, and the robot trainer cannot estimate a suitable threshold based on the configured question-answer pair data, resulting in the configured robot question-answering effect failing to achieve the optimal accuracy and recall rate. Summary of the invention

[0004] The technical problem to be solved by the present invention is to provide a method and device for automatically finding and optimizing the optimal threshold of text similarity, which can automatically find the similarity threshold suitable for the robot's configured data set. In order to solve the above technical problems, the present invention provides a method for automatically finding and optimizing the optimal threshold of text similarity, the method comprising: calculating the question similarity matrix according to the vector representation of each question in the question list; traversing the question categories and the question similarity matrix to obtain the question category average similarity matrix; judging whether there is an inter-class question similarity greater than the category average similarity; if so, finding the existing configuration problem, and repeating the above operation until there is no longer a situation where the inter-class question similarity is greater than the category average similarity; when there is no longer a situation where the inter-class question similarity is greater than the category average similarity, traversing the question category average similarity matrix to obtain the optimal similarity threshold.

[0005] In some embodiments, the method further includes: forming a question category list before calculating the question similarity matrix based on the vector representation of each question in the question list; and obtaining the vector representation of each question text using an NLP technology text representation algorithm or a deep learning pre-trained model.

[0006] In some implementations, the NLP technical text representation algorithm includes: a TFIDF word frequency statistics algorithm.

[0007] In some implementations, the further step includes: before forming the question category list, obtaining a question list configured by FAQ data of the conversational robot.

[0008] In some embodiments, determining whether there is an inter-class question similarity greater than the category average similarity includes: selecting a question from a question list; calculating the category average similarity of the question based on the category configuration of the question; and determining, based on the question similarity matrix, whether the inter-class question similarities related to the question are all less than the category average similarity.

[0009] In addition, the present invention also provides a device for automatically searching for and optimizing the optimal threshold value of text similarity, the device comprising: one or more processors; a storage device for storing one or more programs; when the one or more programs are executed by the one or more processors, the one or more processors implement the method for automatically searching for and optimizing the optimal threshold value of text similarity as described above.

[0010] After adopting such a design, the present invention has at least the following advantages:

[0011] Automatically find the similarity threshold suitable for the robot's configured data set. The FAQ question-answering model improves the precision by 3 percentage points without reducing the recall rate.

[0012] The process of calculating the average similarity within and between classes of questions can find the extended question configurations with problems in the FAQ dataset. This can be used as a health check tool for the chatbot configuration to further optimize the problems found.

[0013] Subsequently, unmatched or mismatched questions in actual conversations will be marked and added to the robot configuration. After recalculating the similarity threshold, the performance of the robot's FAQ question-answering model can be continuously optimized. BRIEF DESCRIPTION OF THE DRAWINGS

[0014] The above is only an overview of the technical solution of the present invention. In order to more clearly understand the technical means of the present invention, the present invention is further described in detail below in conjunction with the accompanying drawings and specific implementation methods.

[0015] Figure 1 It is a flow chart of a method for automatically finding and optimizing an optimal threshold value of text similarity provided by an embodiment of the present invention;

[0016] Figure 2 It is a flow chart of a method for automatically finding and optimizing an optimal threshold value of text similarity provided by an embodiment of the present invention;

[0017] Figure 3 It is a structural diagram of a device for automatically finding and optimizing an optimal threshold value of text similarity provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0018] The preferred embodiments of the present invention are described below in conjunction with the accompanying drawings. It should be understood that the preferred embodiments described herein are only used to illustrate and explain the present invention, and are not used to limit the present invention.

[0019] Figure 1 The flow chart of the method for automatically finding and optimizing the optimal threshold value of text similarity provided by the embodiment of the present invention is shown. Figure 1 ,The method for automatically finding and optimizing the optimal threshold of text similarity includes the following steps:

[0020] S11, obtaining a question list configured by FAQ data of the conversational robot.

[0021] S12, forming a list of question categories, and using an NLP technology text representation algorithm or a deep learning pre-training model to obtain a vector representation of each question text.

[0022] Typically, an NLP technology text representation algorithm or a deep learning pre-training model can be: TFIDF word frequency statistics algorithm.

[0023] S13, calculating the question similarity matrix according to the vector representation of each question in the question list.

[0024] S14, traverse the question categories and question similarity matrices to obtain the question category average similarity matrix.

[0025] S15, determine whether there is a situation where the similarity between the problems of different classes is greater than the average similarity between the categories. If there is a situation where the similarity between the problems of different classes is greater than the average similarity between the categories, execute S16. If there is no situation where the similarity between the problems of different classes is greater than the average similarity between the categories, execute S18.

[0026] The judgment process can be to traverse each question in the question list to see whether there is a question whose inter-class similarity is greater than the average similarity of the category.

[0027] S16, optimized FAQ configuration.

[0028] Here, FAQ configuration can be understood as another form of question category configuration. Moreover, FAQ configuration usually includes the category attribution of different questions.

[0029] After the operation of optimizing the FAQ configuration is completed, the operation of S11 is performed.

[0030] S17, generating FAQ question configuration data of the dialogue robot according to the FAQ configuration.

[0031] S18, traverse the average similarity matrix of the question categories to obtain the optimal similarity threshold.

[0032] Figure 2FIG. 2 shows the process of automatically finding and optimizing the text similarity optimal threshold value provided by another embodiment of the present invention. Figure 2 ,The method for automatically finding and optimizing the optimal threshold of text similarity includes the following steps:

[0033] S21, obtaining a question list configured by FAQ data of the conversational robot.

[0034] S22, forming a list of question categories, and using an NLP technology text representation algorithm or a deep learning pre-training model to obtain a vector representation of each question text.

[0035] S23, calculating the question similarity matrix according to the vector representation of each question in the question list.

[0036] S24, traverse the question categories and question similarity matrices to obtain the question category average similarity matrix.

[0037] S25, determine whether there is a situation where the similarity between the problems of different classes is greater than the average similarity between the categories. If there is a situation where the similarity between the problems of different classes is greater than the average similarity between the categories, execute S26. If there is no situation where the similarity between the problems of different classes is greater than the average similarity between the categories, execute S27.

[0038] S26, optimize the problem list configuration, and execute S23 after completion.

[0039] S27, traverse the average similarity matrix of the question categories to obtain the optimal similarity threshold.

[0040] Figure 2 The illustrated embodiments and Figure 1 The biggest difference of the illustrated embodiment is that after each configuration optimization adjustment, the data acquisition and data preprocessing operations are no longer run from the beginning, but the similarity matrix and subsequent operations are directly calculated based on the adjusted configuration.

[0041] Figure 3 The structure of the device for automatically finding and optimizing the optimal threshold of text similarity is shown. Figure 3 For example, the device 300 for automatically finding and optimizing the optimal threshold of text similarity can be used to serve as a device for setting a text similarity threshold in a text processing system. As described herein, the device 300 for automatically finding and optimizing the optimal threshold of text similarity can be used to implement the automatic optimization adjustment function of the text similarity threshold in a text processing system in a microservice system. The device 300 for automatically finding and optimizing the optimal threshold of text similarity can be implemented in a single node, or the functions of the device 300 for automatically finding and optimizing the optimal threshold of text similarity can be implemented in multiple nodes in a network. Those skilled in the art should appreciate that the term device for automatically finding and optimizing the optimal threshold of text similarity includes devices in a broad sense, Figure 3The apparatus 300 for automatically searching for and optimizing the optimal threshold value of text similarity shown in the text is only one example. The apparatus 300 for automatically searching for and optimizing the optimal threshold value of text similarity is included for the purpose of clarity of description, and is not intended to limit the application of the present invention to a specific apparatus embodiment for automatically searching for and optimizing the optimal threshold value of text similarity or a certain type of apparatus embodiment for automatically searching for and optimizing the optimal threshold value of text similarity. At least some of the features / methods described in the present invention can be implemented in a network device or component, such as the apparatus 300 for automatically searching for and optimizing the optimal threshold value of text similarity. For example, the features / methods in the present invention can be implemented in hardware, firmware and / or software installed and run on the hardware. The apparatus 300 for automatically searching for and optimizing the optimal threshold value of text similarity can be any device that processes, stores and / or forwards data frames through a network, such as a server, a client, a data source, etc. Figure 3 As shown, the text similarity optimal threshold automatic search and optimization device 300 may include a transceiver (Tx / Rx) 310, which may be a transmitter, a receiver, or a combination thereof. Tx / Rx310 may be coupled to multiple ports 350 (e.g., an uplink interface and / or a downlink interface) for sending and / or receiving frames from other nodes. A processor 330 may be coupled to Tx / Rx310 to process frames and / or determine which nodes to send frames to. The processor 330 may include one or more multi-core processors and / or a memory device 332, which may be used as a data memory, a buffer, etc. The processor 330 may be implemented as a general-purpose processor, or may be part of one or more application specific integrated circuits (ASICs) and / or digital signal processors (DSPs).

[0042] The above description is only a preferred embodiment of the present invention and does not limit the present invention in any form. Those skilled in the art may make some simple modifications, equivalent changes or modifications using the technical contents disclosed above, which all fall within the protection scope of the present invention.

Claims

1. A method for automatically finding and optimizing the optimal threshold of text similarity, characterized in that: include: Get the question list of the FAQ data configuration of the conversational robot; Form a list of question categories and use NLP technology text representation algorithms or deep learning pre-trained models to obtain vector representations of each question text; Calculate the question similarity matrix based on the vector representation of each question in the question list; Select a question from the question list; According to the category configuration of the question, calculate the average category similarity of the question; According to the problem similarity matrix, determine whether the similarity between the problems related to the problem is greater than the average similarity of the category; If there is a situation where the inter-class question similarity is greater than the average class similarity, the corresponding class configuration is optimized, and the question list of the FAQ data configuration of the conversational robot is obtained in a loop until there is no situation where the inter-class question similarity is greater than the average class similarity; When there is no longer a situation where the inter-class question similarity is greater than the category average similarity, the question category average similarity matrix is ​​traversed to obtain the optimal similarity threshold.

2. The method for automatically finding and optimizing the optimal threshold of text similarity according to claim 1, characterized in that: NLP technology text representation algorithms include: TFIDF word frequency statistics algorithm.

3. A device for automatically finding and optimizing the optimal threshold of text similarity, characterized in that: include: one or more processors; A storage device for storing one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the method for automatically finding and optimizing the optimal threshold of text similarity according to any one of claims 1 to 2.