Method and device for identifying intention of query statement

By using binary classification and low-rank processing technology in Bert model intent recognition, the query statement intent recognition process is optimized, solving the problems of high time-consuming and large computing power requirements for Bert model reasoning, and achieving online real-time deployment and performance improvement. .

CN118861201APending Publication Date: 2024-10-29BEIJING WODONG TIANJUN INFORMATION TECH CO LTD
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
CN202410873827.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-01
Publication Date
2024-10-29

AI Technical Summary

Technical Problem

Online reasoning for query statement intent recognition based on the Bert model is time-consuming and requires large computing power, making it difficult to deploy online and making subsequent model iterations impossible.

Method used

Adopting dynamic batch processing and low-rank processing technology based on binary classification, through feature extraction, prediction model judgment, low-rank operation and threshold filtering, the query statement intent recognition process is optimized, reducing the amount of calculation and data transmission time, and improving the system Throughput and inference performance.

Benefits of technology

It realizes query statement intent recognition for online real-time deployment, reduces the amount of calculation and data transmission time, meets the requirements of online real-time deployment, and improves system throughput and reasoning performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118861201A_ABST
    Figure CN118861201A_ABST
Patent Text Reader

Abstract

The invention discloses a query statement intention recognition method and device, and relates to the technical field of computers. A specific embodiment of the method comprises the following steps: in response to an intention recognition request, performing feature extraction on a query statement to obtain a query vector; inputting the query vector into a prediction model, and judging whether the query statement has a query object intention or not; under the condition that it is judged that the query statement has the object query intention, low-rank processing and operation are conducted according to the query vector and a preset object feature vector of each object, and a prediction score of each object is obtained; obtaining a selectable object set according to a set score threshold value and the prediction score of each object; and selecting a target object from the selectable object set according to a set screening rule to serve as an intention recognition result of the query statement. According to the embodiment, the system throughput is improved, and the reasoning performance is improved; the calculation amount is greatly reduced, and the calculation power is saved; the transmission data volume is greatly reduced, and the data transmission time consumption is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a method and device for identifying query sentence intent. Background Art

[0002] The query statement, as the pre-logic of search relevance, correctly predicts the intent of the query statement entered by the user, which is conducive to further improving the search relevance and enhancing the user experience. At present, in order to improve the semantic understanding and generalization performance of the model, and to facilitate the subsequent introduction of various external data to model user interest preferences, the pre-trained language model Bert model is usually used to identify the intent of user query statements, and the prediction accuracy of the model is improved by introducing pre-trained language knowledge.

[0003] However, the Bert model is a model based on the self-attention mechanism, and the model parameters are large. Therefore, online query intent recognition based on the Bert model is not only time-consuming, but also requires a lot of computing power, making it difficult to deploy online and unable to perform subsequent model iterations. Summary of the invention

[0004] In view of this, an embodiment of the present invention provides a method and device for query statement intent recognition, which can perform dynamic query object intent prediction based on binary classification, thereby improving system throughput and reasoning performance; by performing low-rank processing when calculating the prediction score of each object, the amount of calculation is greatly reduced and computing power is saved; by filtering objects according to a set threshold, the amount of data copied from the GPU video memory to the CPU memory is greatly reduced, the data transmission time is reduced, and the requirements of online real-time deployment are met.

[0005] To achieve the above-mentioned purpose, according to one aspect of an embodiment of the present invention, a method for query statement intent recognition is provided, comprising: in response to an intent recognition request, performing feature extraction on the query statement to obtain a query vector; inputting the query vector into a prediction model to determine whether the query statement has a query object intent; in the case where it is determined that the query statement has a query object intent, performing low-rank processing and calculation based on the query vector and a preset object feature vector of each object to obtain a prediction score for each object; obtaining a set of optional objects based on a set score threshold and the prediction score of each object; and selecting a target object from the set of optional objects according to a set screening rule as the intent recognition result of the query statement.

[0006] Optionally, feature extraction is performed on the query statement to obtain a query vector, including: performing word segmentation on the query statement and extracting features based on the word segmentation results; and feature fusion of the embedded vector corresponding to each extracted feature to obtain the query vector.

[0007] Optionally, the query vector is input into the prediction model to determine whether the query statement has the query object intention, including: inputting the query vector into the prediction model, performing self-attention mechanism operation and binary classification operation on the query vector through the prediction model to obtain whether the query statement has the query object intention.

[0008] Optionally, low-rank processing and calculation are performed according to the query vector and the preset object feature vector of each object to obtain a prediction score for each object, including: performing matrix operations according to the query vector and the preset object feature vector of each object respectively; splitting the matrix operation into multiple low-dimensional matrix operations for low-rank processing and calculation to obtain a first prediction score for each object; normalizing the first prediction score of each object to obtain a prediction score for each object.

[0009] Optionally, target objects are selected from the set of optional objects according to set filtering rules, including: sorting each optional object in the set of optional objects based on the predicted score of each object according to the set filtering rules; and selecting a specified number of optional objects with high predicted scores from the sorted optional objects as the selected target objects.

[0010] Optionally, after obtaining the optional object set according to the set score threshold and the predicted score of each object, it also includes: generating two sequences, one sequence storing the predicted scores of each optional object in the optional object set, and the other sequence storing the position index of each predicted score in the optional object set.

[0011] Optionally, before extracting features from the query statements to obtain the query vectors, the method further includes: packaging the query statements within a time period of a set length into a batch for parallel processing; when it is determined that the query statements have query object intent, before performing low-rank processing and calculations based on the query vector and a preset object feature vector for each object, the method further includes: packaging the query statements with query object intent into a batch for parallel processing.

[0012] According to another aspect of an embodiment of the present invention, a device for identifying the intent of a query statement is provided, comprising: a feature extraction module, for extracting features from a query statement in response to an intent identification request to obtain a query vector; an intent prediction module, for inputting the query vector into a prediction model to determine whether the query statement has a query object intent; an object prediction module, for, when it is determined that the query statement has a query object intent, performing low-rank processing and calculations based on the query vector and a preset object feature vector of each object to obtain a prediction score for each object; an object screening module, for obtaining a set of selectable objects based on a set score threshold and the prediction score of each object; and a result selection module, for selecting a target object from the set of selectable objects according to a set screening rule as a result of the intent identification of the query statement.

[0013] Optionally, the feature extraction module is further used to: perform word segmentation on the query statement and extract features based on the word segmentation results; and perform feature fusion on the embedded vector corresponding to each extracted feature to obtain a query vector.

[0014] Optionally, the intent prediction module is further used to: input the query vector into the prediction model, and perform self-attention mechanism operation and binary classification operation on the query vector through the prediction model to obtain whether the query statement has the query object intent.

[0015] Optionally, the object prediction module is also used to: perform matrix operations according to the query vector and the preset object feature vector of each object; split the matrix operation into multiple low-dimensional matrix operations to perform low-rank processing and operations to obtain a first prediction score for each object; normalize the first prediction score of each object to obtain a prediction score for each object.

[0016] Optionally, the result selection module is also used to: sort each optional object in the optional object set based on the predicted score of each object according to the set screening rules; and select a specified number of optional objects with high predicted scores from the sorted optional objects as the selected target objects.

[0017] Optionally, the device for identifying the intent of a query statement also includes an object information storage module, which is used to: after obtaining a set of optional objects based on a set score threshold and a predicted score for each object, generate two sequences, one sequence storing the predicted scores of each optional object in the set of optional objects, and the other sequence storing the position index of each predicted score in the set of optional objects.

[0018] Optionally, the device for identifying query statement intent also includes a packaging module, which is used to: package the query statements within a time period of a set length into a batch for parallel processing before performing feature extraction on the query statements to obtain a query vector; when it is determined that the query statements have query object intent, package the query statements with query object intent into a batch for parallel processing before performing low-rank processing and calculation based on the query vector and a preset object feature vector for each object.

[0019] According to another aspect of an embodiment of the present invention, an electronic device is provided, comprising: one or more processors; a storage device for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the method for query statement intent recognition provided by an embodiment of the present invention.

[0020] According to another aspect of an embodiment of the present invention, a computer-readable medium is provided, on which a computer program is stored. When the program is executed by a processor, the method for identifying query sentence intent provided by an embodiment of the present invention is implemented.

[0021] According to another aspect of an embodiment of the present invention, a computer program product is provided, including a computer program, and when the computer program is executed by a processor, the method for query sentence intent recognition provided by an embodiment of the present invention is implemented.

[0022] An embodiment of the above invention has the following advantages or beneficial effects: by responding to an intent recognition request, feature extraction is performed on a query statement to obtain a query vector; the query vector is input into a prediction model to determine whether the query statement has a query object intent; when it is determined that the query statement has a query object intent, low-rank processing and calculation are performed based on the query vector and the preset object feature vector of each object to obtain a prediction score for each object; a set of optional objects is obtained based on a set score threshold and the prediction score of each object; a target object is selected from the set of optional objects according to a set screening rule as a technical solution for the intent recognition result of the query statement, which can first determine whether the query statement has a query object intent, and then calculate the query statement with the query object intent to obtain a prediction score for each object, thereby realizing dynamic query object intent prediction based on binary classification, improving system throughput, and improving reasoning performance; by performing low-rank processing when calculating the prediction score of each object, the amount of calculation is greatly reduced and computing power is saved; by filtering objects according to a set threshold, the amount of data copied from the GPU video memory to the CPU memory is greatly reduced, the time consumption of data transmission is reduced, and the requirements of online real-time deployment are met.

[0023] The further effects of the above-mentioned non-conventional optional manner will be described below in conjunction with specific implementation examples. BRIEF DESCRIPTION OF THE DRAWINGS

[0024] The accompanying drawings are used to better understand the present invention and do not constitute an improper limitation of the present invention.

[0025] Figure 1 Schematic diagram of main steps of a method for identifying query intent according to an embodiment of the present invention;

[0026] Figure 2 It is a schematic diagram of an implementation flow of an embodiment of the present invention;

[0027] Figure 3 It is a schematic diagram of the implementation process of dynamic batching of intent recognition requests according to an embodiment of the present invention;

[0028] Figure 4 is a schematic diagram of main modules of a device for query sentence intent recognition according to an embodiment of the present invention;

[0029] Figure 5 is an exemplary system architecture diagram to which embodiments of the present invention may be applied;

[0030] Figure 6 It is a schematic diagram of the structure of a computer system of a terminal device or a server suitable for implementing an embodiment of the present invention. DETAILED DESCRIPTION

[0031] The following is a description of exemplary embodiments of the present invention in conjunction with the accompanying drawings, including various details of the embodiments of the present invention to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for clarity and conciseness, the description of well-known functions and structures is omitted in the following description.

[0032] It should be noted that the collection, collection, updating, analysis, processing, use, transmission, storage and other aspects of user personal information involved in the technical solution disclosed in the present invention are in compliance with the provisions of relevant laws and regulations, are used for legitimate purposes, and do not violate public order and good morals. Necessary measures are taken for user personal information to prevent illegal access to user personal information data and maintain the security of user personal information, network security and national security.

[0033] The pre-trained language model Bert is a Transformer model based on the self-attention mechanism. The model parameters are large and the online reasoning calculation is large. At present, the estimated number of search results for a single query statement is in the hundreds of thousands, and the peak online access volume is tens of thousands. Online reasoning is required to be completed within at least ten milliseconds. The complex model and special business scenarios pose great challenges to the deployment of the model, which are mainly reflected in the following two aspects:

[0034] 1) A single query has a large number of estimated results. Inference is done on a graphics processing unit (GPU). The inference results need to be transferred from the GPU memory back to the CPU (Central Processing Unit) memory for subsequent business logic processing. This data transfer process takes more than 30ms, and the entire inference process takes nearly 40ms, far exceeding the online time requirement.

[0035] 2) The computing power requirement is large, the single-machine throughput is about 300, too many GPU resources are required, and online deployment is difficult.

[0036] In summary, online inference of search query estimation based on the Bert model is not only time-consuming, but also requires a lot of computing power. It is difficult to deploy online and cannot perform subsequent model iterations.

[0037] In order to meet the system requirements with high time consumption requirements, reduce GPU resource requirements, and complete the real-time deployment of the Bert model in the search query estimation scenario, the present invention adopts a variety of reasoning optimization strategies to form an effective solution. The technologies used mainly include dynamic batch processing based on binary classification, filtering processing of prediction results in GPU, and low-rank processing of Bert output layer. The relevant optimization strategies are mainly implemented on the GPU through CUDA operators. Among them, CUDA (Compute Unified Device Architecture) operators refer to parallel computing operations implemented using CUDA technology.

[0038] Figure 1 Schematic diagram of the main steps of the method for identifying query intent according to an embodiment of the present invention. Figure 1 As shown, the method for query sentence intention recognition according to an embodiment of the present invention mainly includes the following steps S101 to S105.

[0039] Step S101: In response to an intent recognition request, extract features from a query statement to obtain a query vector, wherein the intent recognition request is triggered by, for example, a user sending a query statement.

[0040] According to one embodiment of the present invention, feature extraction is performed on a query statement to obtain a query vector, which may specifically include: performing word segmentation on the query statement and extracting features based on the word segmentation results; and performing feature fusion on the embedding vector corresponding to each extracted feature to obtain a query vector. After the user's intent recognition request is sent to the server, the query statement query will first be segmented, and the corresponding feature information will be calculated (for example, including: the numerical encoding token id of the sub-unit after word segmentation, the segment that distinguishes whether it is two sentences, the position number position of the sub-unit after word segmentation in the original sentence, etc.). Then, the embedding vectors of these corresponding feature information are searched, and finally the embedding vectors of these feature information are summed up for feature fusion to obtain the query vector as the input of the prediction model.

[0041] Step S102: Input the query vector into the prediction model to determine whether the query sentence has the query object intention. The prediction model is, for example, trained based on various query sentences and corresponding intention recognition results in the historical period, which is a pre-trained language model.

[0042] According to one embodiment of the present invention, the query vector is input into the prediction model to determine whether the query statement has the query object intention, which may specifically include: inputting the query vector into the prediction model, performing self-attention mechanism operation and binary classification operation on the query vector through the prediction model to obtain whether the query statement has the query object intention. The prediction model performs multiple rounds of encoder calculation on the input query vector and outputs the result. The output result is firstly subjected to binary classification calculation to determine whether the corresponding query statement query has the query object intention, that is, to determine whether the query statement has the user's preference for the object, where the object can be, for example, a brand, a product, etc. For queries without the query object intention, no subsequent calculation is required to further determine the user's preferred object. For queries with the query object intention, further calculation of the user's preferred object will be performed. In this process, it is also necessary to record the mark of the query object intention of each query, so as to facilitate the corresponding intention prediction results to be returned one by one later. By performing dynamic query object intention prediction based on binary classification, the system throughput is improved and the reasoning performance is improved.

[0043] Step S103: When it is determined that the query statement has the query object intention, low-rank processing and calculation are performed based on the query vector and the preset object feature vector of each object to obtain the prediction score of each object. When it is determined that the query statement has the query object intention, the query with the query object intention needs to perform the calculation of the preferred query object classification prediction. In order to reduce the amount of calculation, this part of the calculation uses low-rank processing, that is, the output layer result of the prediction model is first reduced in dimension and then increased in dimension, which greatly reduces the amount of calculation while maintaining the same effect.

[0044] According to an embodiment of the present invention, low-rank processing and operation are performed according to the query vector and the preset object feature vector of each object to obtain the prediction score of each object, which may specifically include: performing matrix operations according to the query vector and the preset object feature vector of each object respectively; splitting the matrix operation into multiple low-dimensional matrix operations to perform low-rank processing and operation to obtain the first prediction score of each object; normalizing the first prediction score of each object to obtain the prediction score of each object. By splitting the high-dimensional matrix operation into multiple low-dimensional matrix operations for low-rank processing and matrix operation, the amount of calculation can be greatly reduced; by normalizing the first prediction score of each object, the prediction scores can be more conveniently sorted and compared.

[0045] In one embodiment, after the calculation results of the multi-layer encoder of the prediction model are determined to have brand intent through binary classification, the brand ID needs to be predicted. There is a relatively computationally intensive matrix operation of 768*30w dimensions. After offline effect evaluation, low-rank processing can be performed. Specifically, the high-dimensional 768*30w matrix operation can be split into two operations of 768*128 dimensions and 128*30w dimensions. This can reduce the dimension of the matrix while retaining its main features and structure. After the split, the amount of calculation can be reduced to 1 / 6 of the original, saving computing power.

[0046] Step S104: Obtain a set of selectable objects based on a set score threshold and the predicted score of each object. The score threshold is determined by offline statistics, and the minimum score of the intended object corresponding to each query is calculated by a statistical tool. By filtering the predicted score of each object according to the set score threshold, a set of selectable objects is obtained. In this way, the order of magnitude of the estimated results of the final reasoning completed in the GPU is greatly reduced, and the time consumption of transferring the estimated results from the GPU video memory back to the CPU memory is greatly reduced.

[0047] Normally, there will be many intent recognition results corresponding to a query statement, close to hundreds of thousands, and the actual truly effective results are expected to be within 10. Therefore, the present invention can greatly estimate the transmission volume and transmission time of the results by screening the hundreds of thousands of results identified according to the set score threshold. In one embodiment, taking the identification of user preference intentions for brands according to query statements as an example, the result of the brand identification classification prediction calculation is the brand identification id index corresponding to the query and the estimated score of each brand identification. The estimated object results of a single query are close to 300,000. All results need to be inferred to determine the relevant brand id according to the estimated score. The actual truly effective results are expected to be within 10. A threshold of the estimated score is selected based on offline statistical analysis, and all brand estimation results are threshold filtered according to the estimated score. In this way, the order of magnitude of the estimated results that are finally completed in the GPU is greatly reduced, and the time consumption of transferring the results from the GPU video memory back to the CPU memory can be reduced to within milliseconds.

[0048] Step S105: Select a target object from the set of selectable objects according to the set screening rules as the intent recognition result of the query statement.

[0049] According to one embodiment of the present invention, selecting a target object from a set of optional objects according to a set screening rule may specifically include: sorting each optional object in the set of optional objects based on the predicted score of each object according to the set screening rule; selecting a specified number of optional objects with a high ranking of predicted scores from the sorted optional objects as the selected target objects. By sorting the optional objects according to the predicted score of each object, and then selecting the optional objects with a high ranking as the target objects, a target object that better meets the user's query intent can be selected, thereby improving the accuracy of the intent recognition result. In one embodiment of the present invention, after the estimated result is transferred back from the GPU to the CPU, it is necessary to query the brand id vocabulary according to the brand id index to obtain the corresponding brand id, and take Topk according to the estimated score sorting, perform subsequent business logic processing based on the intercepted estimated brand result, and finally return the brand id and the estimated score to the upstream system.

[0050] According to an embodiment of the present invention, after obtaining the selectable object set according to the set score threshold and the predicted score of each object, it also includes: generating two sequences, one sequence saves the predicted score of each selectable object in the selectable object set, and the other sequence saves the position index of each predicted score in the selectable object set. For each query statement, there are multiple corresponding selectable objects. In order to facilitate the management of these selectable objects, the present invention will generate two sequences for saving the predicted score of each selectable object in the selectable object set and its position index in the selectable object set, so as to accurately record the predicted score corresponding to each selectable object.

[0051] According to one embodiment of the present invention, before extracting features from query statements to obtain query vectors, it also includes: packaging query statements within a set length of time into a batch for parallel processing; when it is determined that the query statement has query object intent, before performing low-rank processing and calculation based on the query vector and the preset object feature vector of each object, it also includes: packaging query statements with query object intent into a batch for parallel processing. In order to improve the system throughput, multiple request queries within a certain time interval are packaged into a batch batch according to the request order and input into the prediction model for reasoning, and the requests of the batch are subjected to attention and other calculations in the encoding encoder module of the prediction model. After the multi-layer encoder operation is completed, the output result is subjected to binary classification determination calculation, the brand intent of each query in the batch is determined and marked, and no subsequent reasoning calculation is required for queries without brand intent, and the estimated result is empty. For queries with brand intent in the batch, they are repackaged into a new batch, the brand ID and its estimated score are calculated, and finally the prediction results are returned in the order of the queries in the original first batch.

[0052] In an embodiment of the present invention, the CUDA programming framework can be used to organize the estimated results according to grids and thread blocks. When the estimated results are filtered in the GPU, the correspondence between the estimated results and the threads is as follows: grid corresponds to the estimated results of the batch, and block corresponds to the estimated results of a single query. The size of the block can be selected according to the performance test. For example, if the block size is set to 1024, the amount of data processed by each thread in the block is approximately 300,000 / 1024, and the last thread processes the remaining data. After filtering, the estimated result sequence of a single query will generate two sequences, one of which saves the estimated score that meets the threshold, and the other saves the position index of the estimated score in the original sequence. It is necessary to query the brand word list according to the position index to obtain the brand id.

[0053] Figure 2 FIG. 1 is a schematic diagram of an implementation flow of an embodiment of the present invention. Figure 2 As shown, in one embodiment of the present invention, the sight line process of performing intent recognition on a query statement is as follows:

[0054] 1) After the user's search query request reaches the online model service, the query is segmented and feature information is extracted, and then the feature information is fused as the input of the prediction model;

[0055] 2) The prediction model performs multiple encoder (including self-attention calculation and feedforward neural network) calculations on the input query vector and outputs the results. The output results are first classified into two categories to distinguish the brand intents and determine whether the corresponding query has brand intent. If there is no brand intent, the query does not need to be further calculated; if there is brand intent, the brand ID classification prediction calculation is performed;

[0056] 3) Queries with brand intent need to calculate brand ID classification predictions. In order to reduce the amount of calculation, this part of the calculation uses low-rank processing, that is, the output layer results of BERT are first reduced in dimension and then increased in dimension. With the same effect, the amount of calculation is reduced to 1 / 6 of the original. After that, the brand ID prediction results can be filtered according to the score threshold obtained by offline statistics;

[0057] 4) After the estimated results are transmitted back from the GPU to the CPU, business logic processing such as sorting and filtering of the estimated results is performed, and finally the brand ID and estimated score are returned to the upstream system.

[0058] Figure 3 FIG. 1 is a schematic diagram of the implementation process of dynamic batching of intent recognition requests according to an embodiment of the present invention. Figure 3As shown, in one embodiment of the present invention, in order to improve the system throughput, multiple request queries within a certain time interval (for example, there are 4 queries in the figure) are packaged into a batch in the order of request and input into the prediction model for reasoning. The requests of the batch are subjected to attention and other operations in the encoding module of the prediction model. After the multi-layer encoding operation is completed, the output results are subjected to a binary classification calculation to determine the brand intent of each query in the batch and mark it. For queries without brand intent, no subsequent reasoning calculation is required, and the estimated result is empty; for queries with brand intent, they are repackaged into a batch and brand id classification prediction is performed. Finally, the prediction results are returned in the order of the queries in the original batch.

[0059] Figure 4 Schematic diagram of the main modules of the apparatus for query sentence intent recognition according to an embodiment of the present invention. Figure 4 As shown, in an embodiment of the present invention, the device 400 for query statement intent recognition mainly includes a feature extraction module 401, an intent prediction module 402, an object prediction module 403, an object screening module 404 and a result selection module 405.

[0060] A feature extraction module 401 is used to extract features from a query statement to obtain a query vector in response to an intent recognition request;

[0061] The intent prediction module 402 is used to input the query vector into the prediction model to determine whether the query sentence has the query object intent;

[0062] The object prediction module 403 is used to perform low-rank processing and calculation based on the query vector and the preset object feature vector of each object to obtain a prediction score for each object when it is determined that the query sentence has a query object intention;

[0063] An object screening module 404 is used to obtain a selectable object set according to a set score threshold and a predicted score of each object;

[0064] The result selection module 405 is used to select a target object from the set of selectable objects according to a set screening rule as the intention recognition result of the query statement.

[0065] According to an embodiment of the present invention, the feature extraction module 401 may also be used to: perform word segmentation processing on the query statement and perform feature extraction based on the word segmentation result; and perform feature fusion on the embedded vector corresponding to each extracted feature to obtain a query vector.

[0066] According to another embodiment of the present invention, the intent prediction module 402 can also be used to: input the query vector into the prediction model, perform self-attention mechanism operation and binary classification operation on the query vector through the prediction model to obtain whether the query statement has the query object intent.

[0067] According to another embodiment of the present invention, the object prediction module 403 can also be used to: perform matrix operations according to the query vector and the preset object feature vector of each object; split the matrix operation into multiple low-dimensional matrix operations to perform low-rank processing and operations to obtain a first prediction score for each object; normalize the first prediction score of each object to obtain a prediction score for each object.

[0068] According to another embodiment of the present invention, the result selection module 405 can also be used to: sort each optional object in the optional object set based on the predicted score of each object according to the set screening rules; and select a specified number of optional objects with high predicted scores from the sorted optional objects as the selected target objects.

[0069] According to another embodiment of the present invention, the apparatus 400 for query statement intent recognition further includes an object information storage module (not shown in the figure), which is used to: after obtaining a set of optional objects based on a set score threshold and a predicted score for each object, generate two sequences, one sequence storing the predicted scores of each optional object in the set of optional objects, and the other sequence storing the position index of each predicted score in the set of optional objects.

[0070] According to another embodiment of the present invention, the device 400 for identifying query statement intent also includes a packaging module (not shown in the figure), which is used to: before performing feature extraction on the query statement to obtain a query vector, package the query statements within a time period of a set length into a batch for parallel processing; when it is determined that the query statement has a query object intent, before performing low-rank processing and calculation based on the query vector and a preset object feature vector for each object, package the query statements with the query object intent into a batch for parallel processing.

[0071] According to the technical solution of the embodiment of the present invention, by responding to the intent recognition request, feature extraction is performed on the query statement to obtain a query vector; the query vector is input into the prediction model to determine whether the query statement has the query object intent; when it is determined that the query statement has the query object intent, low-rank processing and operation are performed according to the query vector and the preset object feature vector of each object to obtain the prediction score of each object; a set of optional objects is obtained according to the set score threshold and the prediction score of each object; the target object is selected from the optional object set according to the set screening rule, and the technical solution as the intent recognition result of the query statement can first determine whether the query statement has the query object intent, and then operate on the query statement with the query object intent to obtain the prediction score of each object, thereby realizing dynamic query object intent prediction based on binary classification, improving system throughput, and improving reasoning performance; by performing low-rank processing when calculating the prediction score of each object, the amount of calculation is greatly reduced and computing power is saved; by filtering objects according to the set threshold, the amount of data copied from the GPU video memory to the CPU memory is greatly reduced, the time consumption of data transmission is reduced, and the requirements of online real-time deployment are met.

[0072] Figure 5 An exemplary system architecture 500 is shown to which the method for query sentence intent recognition or the apparatus for query sentence intent recognition according to the embodiments of the present invention may be applied.

[0073] like Figure 5 As shown, system architecture 500 may include terminal devices 501, 502, 503, a network 504 and a server 505. Network 504 is used to provide a medium for communication links between terminal devices 501, 502, 503 and server 505. Network 504 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.

[0074] Users can use terminal devices 501, 502, 503 to interact with server 505 through network 504 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 501, 502, 503, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc. (only as examples).

[0075] The terminal devices 501 , 502 , and 503 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, desktop computers, and the like.

[0076] Server 505 can be a server that provides various services, such as a backend management server (only an example) that provides support for shopping websites browsed by users using terminal devices 501, 502, and 503. The backend management server can respond to the received intent recognition request and other data, extract features from the query statement to obtain a query vector; input the query vector into the prediction model to determine whether the query statement has the query object intent; when it is determined that the query statement has the query object intent, perform low-rank processing and calculation based on the query vector and the preset object feature vector of each object to obtain the prediction score of each object; obtain a selectable object set based on the set score threshold and the prediction score of each object; select the target object from the selectable object set according to the set screening rules as the intent recognition result of the query statement, and process it, and feed back the processing result (such as the intent recognition result - only an example) to the terminal device.

[0077] It should be noted that the method for query statement intent recognition provided in the embodiment of the present invention is generally executed by the server 505 , and accordingly, the device for query statement intent recognition is generally set in the server 505 .

[0078] It should be understood that Figure 5 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.

[0079] Reference below Figure 6 , which shows a schematic diagram of the structure of a computer system 600 of a terminal device or a server suitable for implementing an embodiment of the present invention. Figure 6 The terminal device or server shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.

[0080] like Figure 6 As shown, the computer system 600 includes a central processing unit (CPU) 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage part 608 into a random access memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the system 600 are also stored. The CPU 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.

[0081] The following components are connected to the I / O interface 605: an input section 606 including a keyboard, a mouse, etc.; an output section 607 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 608 including a hard disk, etc.; and a communication section 609 including a network interface card such as a LAN card, a modem, etc. The communication section 609 performs communication processing via a network such as the Internet. A drive 610 is also connected to the I / O interface 605 as needed. A removable medium 611, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 610 as needed, so that a computer program read therefrom is installed into the storage section 608 as needed.

[0082] In particular, according to the embodiments disclosed in the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present invention include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 609, and / or installed from the removable medium 611. When the computer program is executed by the central processing unit (CPU) 601, the above-mentioned functions defined in the system of the present invention are executed.

[0083] It should be noted that the computer-readable medium shown in the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.

[0084] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0085] The units or modules involved in the embodiments of the present invention may be implemented in software or in hardware. The units or modules described may also be provided in a processor. For example, they may be described as: a processor including a feature extraction module, an intent prediction module, an object prediction module, an object screening module, and a result selection module. Among them, the names of these units or modules do not constitute a limitation on the units or modules themselves in certain circumstances. For example, the feature extraction module may also be described as "a module for extracting features from a query statement to obtain a query vector in response to an intent recognition request."

[0086] As another aspect, the present invention also provides a computer-readable medium, which may be included in the device described in the above embodiment; or it may exist independently and not be assembled into the device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by a device, the device includes: in response to an intent recognition request, extracting features from a query statement to obtain a query vector; inputting the query vector into a prediction model to determine whether the query statement has a query object intent; in the case where it is determined that the query statement has a query object intent, performing low-rank processing and calculation based on the query vector and the preset object feature vector of each object to obtain a prediction score for each object; obtaining a selectable object set based on a set score threshold and the prediction score of each object; selecting a target object from the selectable object set according to a set screening rule as the intent recognition result of the query statement.

[0087] According to the technical solution of the embodiment of the present invention, by responding to the intent recognition request, feature extraction is performed on the query statement to obtain a query vector; the query vector is input into the prediction model to determine whether the query statement has the query object intent; when it is determined that the query statement has the query object intent, low-rank processing and operation are performed according to the query vector and the preset object feature vector of each object to obtain the prediction score of each object; a set of optional objects is obtained according to the set score threshold and the prediction score of each object; the target object is selected from the optional object set according to the set screening rule, and the technical solution as the intent recognition result of the query statement can first determine whether the query statement has the query object intent, and then operate on the query statement with the query object intent to obtain the prediction score of each object, thereby realizing dynamic query object intent prediction based on binary classification, improving system throughput, and improving reasoning performance; by performing low-rank processing when calculating the prediction score of each object, the amount of calculation is greatly reduced and computing power is saved; by filtering objects according to the set threshold, the amount of data copied from the GPU video memory to the CPU memory is greatly reduced, the time consumption of data transmission is reduced, and the requirements of online real-time deployment are met.

[0088] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A method for identifying query intent, characterized in that: include: In response to the intent recognition request, feature extraction is performed on the query sentence to obtain a query vector; Inputting the query vector into a prediction model to determine whether the query statement has a query object intention; When it is determined that the query statement has a query object intention, low-rank processing and calculation are performed according to the query vector and a preset object feature vector of each object to obtain a prediction score for each object; A selectable object set is obtained according to a set score threshold and a predicted score of each object; A target object is selected from the set of optional objects according to the set screening rules as the intent recognition result of the query statement.

2. The method according to claim 1, characterized in that Feature extraction is performed on the query statement to obtain the query vector, including: Perform word segmentation on the query statement and extract features based on the word segmentation results; The embedding vector corresponding to each extracted feature is fused to obtain the query vector.

3. The method according to claim 1, characterized in that Inputting the query vector into a prediction model to determine whether the query statement has a query object intention includes: The query vector is input into the prediction model, and the prediction model is used to perform a self-attention mechanism operation and a binary classification operation on the query vector to determine whether the query statement has a query object intention.

4. The method according to claim 1, characterized in that: Performing low-rank processing and calculation according to the query vector and the preset object feature vector of each object to obtain a prediction score of each object, including: Perform matrix operations respectively according to the query vector and the preset object feature vector of each object; Splitting the matrix operation into multiple low-dimensional matrix operations to perform low-rank processing and operations to obtain a first prediction score for each object; The first prediction score of each object is normalized to obtain the prediction score of each object.

5. The method according to claim 1, characterized in that Selecting a target object from the set of selectable objects according to a set screening rule includes: According to the set screening rules, each optional object in the optional object set is sorted based on the predicted score of each object; A specified number of optional objects with high predicted scores are selected from the sorted optional objects as target objects.

6. The method according to claim 1, characterized in that After obtaining the selectable object set according to the set score threshold and the predicted score of each object, it also includes: Two sequences are generated, one sequence stores the prediction scores of each optional object in the optional object set, and the other sequence stores the position index of each prediction score in the optional object set.

7. The method according to claim 1, characterized in that Before extracting features from the query statements to obtain the query vector, the method further includes: packaging the query statements within a time period of a set length into a batch for parallel processing; When it is determined that the query statement has the query object intention, before low-rank processing and calculation are performed according to the query vector and the preset object feature vector of each object, the method further includes: packaging the query statements with the query object intention into a batch for parallel processing.

8. A device for identifying query intent, characterized in that: include: A feature extraction module, configured to extract features from a query statement to obtain a query vector in response to an intent recognition request; An intention prediction module, used to input the query vector into a prediction model to determine whether the query statement has a query object intention; An object prediction module, configured to, when it is determined that the query statement has a query object intention, perform low-rank processing and calculation based on the query vector and a preset object feature vector of each object to obtain a prediction score for each object; An object screening module is used to obtain a selectable object set according to a set score threshold and a predicted score of each object; The result selection module is used to select a target object from the optional object set according to a set screening rule as the intention recognition result of the query statement.

9. An electronic device, 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 according to any one of claims 1 to 7.

10. A computer readable medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.

11. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.

Citation Information

Patent Citations

  • Method and apparatus for identifying query intent based on hybrid strategy

    CN109063221A

  • Identification model-based intention identification method, identification equipment and medium

    CN109815492A

  • User intention processing method and device, computer equipment and storage medium

    CN113157892A

  • Object recognition method and device, equipment, storage medium and product

    CN115271813A

  • Small sample intention recognition method based on data enhancement

    CN115964486A