Information retrieval method, intelligent question answering method and risk prevention and control method

By training the retrieval and inference models with encoders of the same parameters in the retrieval system, the problem of model performance mismatch was solved, and the accuracy of the target query results was improved.

CN116701444BActive Publication Date: 2026-04-07ALIBABA (CHINA) CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-04-01
Publication Date
2026-04-07

Smart Images

  • Figure CN116701444B_ABST
    Figure CN116701444B_ABST
Patent Text Reader

Abstract

This specification provides an information retrieval method, an intelligent question answering method, and a risk prevention and control method. The information retrieval method includes: receiving query information; inputting the query information into a pre-trained retrieval model, encoding the query information using a first encoder to obtain query features corresponding to the query information, and determining corresponding reference knowledge documents from a pre-constructed knowledge document set based on the query features; inputting the query features and reference knowledge documents into a pre-trained inference model, encoding them using a second encoder, and decoding them to obtain the target query result corresponding to the query information. The parameters of the first encoder and the second encoder are identical. The identical parameters of the first encoder and the second encoder ensure that the pre-trained retrieval model and the inference model have consistent encoding performance. The performance matching of the two models guarantees that the retrieved reference knowledge documents can be accurately used to determine the target query result corresponding to the query information, thus improving the accuracy of the target query result.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments in this specification relate to the field of information retrieval technology, and in particular to an information retrieval method. Background Technology

[0002] With the development of computer technology, retrieval systems based on neural network models are being used to retrieve information and determine the target query results corresponding to the query information. This technology is being applied in more and more fields, such as intelligent question-answering robots, intelligent search, and risk prevention and control.

[0003] Currently, retrieval augmentation systems are a common implementation of retrieval systems. These systems typically consist of two modules: a retrieval model and an inference model. The query information is input into the retrieval model, which retrieves the corresponding reference knowledge documents. The inference model then uses the query information and the reference knowledge documents to deduce the target query result.

[0004] However, these two models were trained independently, resulting in a mismatch in their performance. This makes it difficult to guarantee that the reference knowledge documents retrieved by the retrieval model can be accurately used to determine the target query results corresponding to the query information, leading to insufficient accuracy of the target query results. Therefore, a highly accurate information retrieval method is urgently needed. Summary of the Invention

[0005] In view of the above, this specification provides an information retrieval method. One or more embodiments of this specification also relate to an intelligent question-answering method, a risk prevention and control method, a data processing method for information retrieval, an information retrieval device, an intelligent question-answering device, a risk prevention and control device, a data processing device for information retrieval, a computing device, a computer-readable storage medium, and a computer program, to address the technical deficiencies existing in the prior art.

[0006] This specification provides an information retrieval method, including:

[0007] Receive query information;

[0008] The query information is input into a pre-trained retrieval model, and the query features corresponding to the query information are obtained by encoding through the first encoder. Based on the query features, the corresponding reference knowledge documents are determined from the pre-built knowledge document set.

[0009] The query features and reference knowledge documents are input into a pre-trained inference model, encoded by a second encoder, and then decoded to obtain the target query result corresponding to the query information. The parameters of the first encoder and the second encoder are the same.

[0010] In one or more embodiments of this specification, query information is received; the query information is input into a pre-trained retrieval model, and the query features corresponding to the query information are obtained by encoding with a first encoder; based on the query features, the corresponding reference knowledge document is determined from a pre-constructed knowledge document set; the query features and the reference knowledge document are input into a pre-trained inference model, and the target query result corresponding to the query information is obtained by encoding with a second encoder and then decoding. The parameters of the first encoder and the second encoder are identical. The identical parameters of the first encoder and the second encoder ensure that the pre-trained retrieval model and the inference model have consistent encoding performance, and the performance of the two models is well-matched. This guarantees that the reference knowledge document retrieved by the retrieval model can be accurately used to determine the target query result corresponding to the query information, thereby improving the accuracy of the target query result. Attached Figure Description

[0011] Figure 1 This is a flowchart illustrating an information retrieval method provided in one embodiment of this specification;

[0012] Figure 2 This is a flowchart illustrating an intelligent question-answering method provided in one embodiment of this specification;

[0013] Figure 3 This is a flowchart illustrating a risk control method provided in one embodiment of this specification;

[0014] Figure 4 This is a flowchart illustrating a data processing method for information retrieval provided in one embodiment of this specification;

[0015] Figure 5 This is a flowchart illustrating an information retrieval method provided in one embodiment of this specification;

[0016] Figure 6 This is a pre-training schematic diagram of an information retrieval method provided in one embodiment of this specification;

[0017] Figure 7 This is a training diagram illustrating an information retrieval method provided in one embodiment of this specification;

[0018] Figure 8 This is a schematic diagram of the structure of an information retrieval device provided in one embodiment of this specification;

[0019] Figure 9 This is a schematic diagram of the structure of an intelligent question-answering device provided in one embodiment of this specification;

[0020] Figure 10 This is a schematic diagram of the structure of a risk control device provided in one embodiment of this specification;

[0021] Figure 11This is a schematic diagram of the structure of a data processing device for information retrieval provided in one embodiment of this specification;

[0022] Figure 12 This is a structural block diagram of a computing device provided in one embodiment of this specification. Detailed Implementation

[0023] Many specific details are set forth in the following description to provide a full understanding of this specification. However, this specification can be implemented in many other ways than those described herein, and those skilled in the art can make similar extensions without departing from the spirit of this specification. Therefore, this specification is not limited to the specific implementations disclosed below.

[0024] The terminology used in one or more embodiments of this specification is for the purpose of describing particular embodiments only and is not intended to be limiting of the one or more embodiments of this specification. The singular forms “a,” “described,” and “the” as used in one or more embodiments of this specification and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term “and / or” as used in one or more embodiments of this specification refers to and includes any or all possible combinations of one or more associated listed items.

[0025] It should be understood that although the terms first, second, etc., may be used to describe various information in one or more embodiments of this specification, such information should not be limited to these terms. These terms are only used to distinguish information of the same type from one another. For example, first may also be referred to as second without departing from the scope of one or more embodiments of this specification, and similarly, second may also be referred to as first. Depending on the context, the word "if" as used herein may be interpreted as "when," "when," or "in response to a determination."

[0026] Furthermore, it should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in one or more embodiments of this specification are all information and data authorized by the user or fully authorized by all parties. Moreover, the collection, use and processing of related data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and corresponding operation entry points are provided for users to choose to authorize or refuse.

[0027] First, the terms and concepts used in one or more embodiments of this specification will be explained.

[0028] Multi-modal: During model training, retrieval, and inference, it receives input from different modalities, such as text, images, speech, and video.

[0029] Retrival-based methods retrieve the most relevant knowledge documents by using feature similarity between modalities (e.g., text-to-text) or across modalities (e.g., image-to-text) or other indexed data, thereby enhancing the performance of downstream tasks. Retrival-based methods can also be used for data augmentation in large models and the training phase, improving pre-training results.

[0030] Open-Domain Question Answering (OpenVQA): Given a query message Q, the model uses open-domain knowledge documents (structured or unstructured) and either Mechanical Reading Cognition (MRC) or generative methods to determine the target query result corresponding to that query message.

[0031] Transformer model: A neural network model based on attention mechanism, which calculates and analyzes the features of data through attention.

[0032] BERT (Bidirectional Encoder Representation from Transformers) model: A neural network model with bidirectional attention encoding representation function.

[0033] ViT (Vision Transformer) model: A Transformer derivative model applied to visual image processing.

[0034] CNN (Convolutional Neural Networks) model: A multi-layer neural network model with forward propagation and backward propagation.

[0035] Pre-training: The neural network model is trained by randomly initializing it with a large amount of sample data, so that the pre-trained neural network model is adapted to the initial application requirements, but the model performance is low.

[0036] Pre-training: Based on the pre-trained neural network model, further target initialization training is performed to adapt the trained neural network model to the target application requirements, resulting in higher model performance.

[0037] Validation: Based on the pre-trained neural network model, further target initialization training is performed. Validation is decoupled from the sample knowledge document, making the neural network model obtained by validation more adaptable to the target application requirements and resulting in higher model performance.

[0038] Supervised training, also known as supervised learning, is a method in model training that uses a neural network model to infer corresponding prediction results based on sample data. Then, based on the labels of the sample data and the prediction results, a loss value is determined. According to the loss value, the parameters of the neural network model are adjusted to obtain the trained neural network model.

[0039] Currently, retrieval systems are effective for solving question-and-answer problems, with common applications including chatbots, intelligent search engines, and real-time risk control systems. Retrieval augmentation systems are a common implementation of retrieval systems. These systems typically consist of two modules: a retrieval model and an inference model. The retrieval model extracts the query representation of the query information and identifies corresponding reference knowledge documents in a knowledge document set. The inference model integrates the reference knowledge documents with the query information to obtain the target query results that meet the user's expectations.

[0040] To address the aforementioned issues, this specification provides an information retrieval method in its embodiments. This specification also relates to an intelligent question-answering method, a risk prevention and control method, an information retrieval data processing method, an information retrieval device, an intelligent question-answering device, a risk prevention and control device, an information retrieval data processing device, a computing device, a computer-readable storage medium, and a computer program, which will be described in detail in the following embodiments.

[0041] Figure 1 This specification shows a flowchart of an information retrieval method according to an embodiment, which specifically includes the following steps:

[0042] Step 102: Receive query information.

[0043] The embodiments in this specification apply to the client and / or server of applications, web pages, or mini-programs with information retrieval functions.

[0044] The application areas of the embodiments in this specification include, but are not limited to: intelligent question-answering robots, intelligent search, and risk prevention and control, such as online intelligent customer service, human-computer communication, product information search, and social media risk management.

[0045] The query information refers to data information used for querying, including at least one modality, such as text, image, voice, video, etc. The query information can be directly received from user input, for example, the user inputs query information on a front-end interactive interface and receives the query information from the front end; it can also be received from a database; or it can be received from relevant information input devices, such as receiving query information from image modalities captured by a video capture device. No further limitation is made here.

[0046] For example, the system receives the query information "When was the first human landing on the moon?" input by the user from the front-end interactive interface, where the query information is in text mode.

[0047] Receiving query information lays the information and data foundation for subsequently determining reference knowledge documents and target query results.

[0048] Step 104: Input the query information into the pre-trained retrieval model, encode the query features corresponding to the query information through the first encoder, and determine the corresponding reference knowledge document from the pre-built knowledge document set based on the query features.

[0049] The retrieval model is a neural network model with reference knowledge document retrieval capabilities. The retrieval model has a first encoder and an external knowledge document set. The first encoder is a feature encoder for data information. It obtains the data features corresponding to the data information by encoding features of data information in at least one modality. For example, the encoder of the BERT model, the encoder of the Transformer model, the encoder of the ViT model, and the encoder of the CNN model.

[0050] Query features are feature encoding vectors corresponding to query information. They are low-dimensional feature encoding vectors, which can be understood as mapping query information to a low-dimensional feature space. For example, if the query information is text-based, the query features are text features obtained by character encoding each character in the text.

[0051] A knowledge document set is a pre-built prior dataset that stores multiple reference knowledge documents. A reference knowledge document is a document used to guide reasoning, containing reference knowledge and including at least one modality, such as text, image, audio, or video. The knowledge document set can be obtained directly from a public database, constructed from historical knowledge documents retrieved from a historical database, constructed from publicly available knowledge documents retrieved from a public database, or a combination of the above methods; no limitation is made here.

[0052] Based on query features, corresponding reference knowledge documents are determined from a pre-built knowledge document set. Specifically, this is done by calculating the feature similarity between the query features and the reference knowledge documents in the pre-built knowledge document set. The feature similarity can be cosine similarity, distance similarity, L1 similarity, L2 similarity, or maximum similarity, and is not limited here. The knowledge document set pre-stores the document features of each reference knowledge document, and in the above determination process, the similarity is directly calculated with the query features to obtain the feature similarity.

[0053] For example, the query "When was the first human landing on the moon?" is input into a pre-trained retrieval model. The first encoder encodes the query feature Feature_QueryInfo corresponding to the query information. Based on the feature similarity between the query feature Feature_QueryInfo and 1000 reference knowledge documents in the pre-built knowledge document set, the corresponding reference knowledge document is determined: "The History of the Human Moon Landing": The first human landing on the moon was on July 20, 1969, when the American Apollo 11 successfully landed on the moon, and astronaut Neil Armstrong...

[0054] The query information is input into a pre-trained retrieval model, and the query features corresponding to the query information are obtained by encoding through the first encoder. Based on the query features, the corresponding reference knowledge documents are determined from the pre-built knowledge document set, which provides relevant guidance for the subsequent reasoning model to perform reasoning and improves the accuracy of information retrieval.

[0055] In one optional embodiment of this specification, the query information includes text query information and image query information, and the first encoder includes a first text encoder and a first image encoder;

[0056] Step 104 includes the following specific steps:

[0057] The text query information is input into a pre-trained retrieval model, and the text query features corresponding to the text query information are obtained by encoding the text query information through the first text encoder.

[0058] The image query information is input into a pre-trained retrieval model, and the image query features corresponding to the image query information are obtained by encoding the first image encoder.

[0059] By fusing text query features and image query features, multimodal query features are obtained.

[0060] Based on the multimodal query features, the corresponding reference knowledge documents are determined from the pre-built knowledge document set, where the reference knowledge documents include reference knowledge text and reference knowledge images.

[0061] Text query information refers to the text-based data used for querying, while image query information refers to the image-based data used for querying. Text and image query information correspond to each other; for example, a text query might be "What are the characteristics and habits of the Siberian tiger?", and an image query might be a photograph of a Siberian tiger. Text query features are the text feature encoding vectors corresponding to the text query information; these are low-dimensional text feature encoding vectors, which can be understood as mapping the text query information to a low-dimensional feature space. Image query features are the image feature encoding vectors corresponding to the image query information; these are low-dimensional image feature encoding vectors, which can be obtained by mapping the image query information to a low-dimensional feature space.

[0062] The first text encoder is a feature encoder for text data, such as the encoder of the BERT model or the encoder of the Transformer model. The first image encoder is a feature encoder for image data, such as the encoder of the ViT model or the encoder of the CNN model.

[0063] Multimodal query features include query features in both text and image modalities. Reference knowledge text refers to the text-modal data information in the reference knowledge document used to guide reasoning. Reference knowledge images refer to the image-modal data information in the reference knowledge document used to guide reasoning. Any reference knowledge document can include both reference knowledge text and reference knowledge images, or only one of them. The text query features and image query features are fused to obtain multimodal query features. This can be done by direct addition or by unifying the feature dimensions and then adding the feature vector elements. It should be noted that since the feature dimensions of text query features and image query features may not be the same, it is necessary to unify the feature dimensions of both, specifically through a feature mapping matrix with preset dimensions.

[0064] Based on multimodal query features, corresponding reference knowledge documents are determined from a pre-built knowledge document set. Specifically, the reference knowledge documents are determined based on the feature similarity between the multimodal query features and the reference knowledge documents in the pre-built knowledge document set. The feature similarity can be cosine similarity, distance similarity, L1 similarity, L2 similarity, or maximum similarity, and is not limited here. The knowledge document set pre-stores the multimodal features of each reference knowledge document. These multimodal features are determined by the text features of the reference knowledge text and the image features of the reference knowledge image. In the above determination process, similarity is directly calculated between these features and the multimodal query features to obtain the feature similarity.

[0065] It should be noted that the second encoder also includes a corresponding text encoder and an image encoder, and the reference knowledge text and reference knowledge image are encoded accordingly in step 106.

[0066] For example, the text query "What are the characteristics and habits of the Siberian tiger?" is input into a pre-trained retrieval model. The first text encoder encodes the text query to obtain the corresponding text query feature, Feature_QueryTxtInfo. Similarly, the image query (a photo of a Siberian tiger) is input into a pre-trained retrieval model. The first image encoder encodes the image query to obtain the corresponding image query feature, Feature_QueryImageInfo. The text query feature Feature_QueryTxtInfo and the image query feature Feature_QueryImageInfo are then fused to obtain the multimodal query feature Feature_QueryMMInfo. Based on the multimodal query feature Feature_QueryMMInfo, the corresponding reference knowledge document, "Encyclopedia of Felines," is determined from a pre-built knowledge document set. This reference knowledge document includes the reference knowledge text: "The Siberian tiger is a member of the Felidae family, genus Panthera. It is one of the subspecies of tiger…", and 20 photos of Siberian tigers.

[0067] In the embodiments of this specification, multimodal information retrieval is achieved through multimodal fusion features, thereby improving the accuracy and applicability of the retrieval.

[0068] In one optional embodiment of this specification, the construction of the knowledge document set includes the following specific steps:

[0069] Obtain third-party sample knowledge documents from public databases;

[0070] Obtain the fourth sample knowledge document from the historical database;

[0071] Based on the third and fourth sample knowledge documents, a reference knowledge document is determined.

[0072] The reference knowledge document is input into the pre-trained retrieval model, and the document features of the reference knowledge document are obtained by encoding through the first encoder;

[0073] Based on the document features of the reference knowledge documents, a knowledge document set of reference knowledge documents is constructed.

[0074] To ensure the accuracy of the reference knowledge features determined by the retrieval model, a large-scale knowledge document set needs to be pre-built to guarantee the comprehensiveness of the query information.

[0075] The knowledge document centrally stores multiple reference knowledge documents and their corresponding document features. These features are low-dimensional feature encoding vectors, such as token-level features. The third sample knowledge document is an open-source sample knowledge document. The fourth sample knowledge document contains historical query information. The number of third and fourth sample knowledge documents must be sufficiently large.

[0076] It should be noted that the knowledge document set can be dynamically updated, that is, the third and fourth sample knowledge documents are dynamically acquired, the updated reference knowledge documents are determined, and added to the knowledge document set.

[0077] Based on the third and fourth sample knowledge documents, reference knowledge documents are determined. This process can be used to filter, supplement, delete, or modify the third and fourth sample knowledge documents, ensuring the accuracy and validity of the obtained reference knowledge documents.

[0078] Based on the document features of the reference knowledge documents, a knowledge document set is constructed. Specifically, the document features of the reference knowledge documents are used as corresponding indexes to construct the knowledge document set. In the subsequent process of determining the corresponding reference knowledge documents from the knowledge document set, the corresponding reference knowledge documents are identified based on the feature similarity between the query features and each index.

[0079] Taking the application of this specification's embodiments in an intelligent question-answering robot as an example, a certain intelligent question-answering robot is a customer service question-answering robot for tourism projects. This intelligent question-answering robot includes a retrieval model and an inference model. In order to improve the accuracy and comprehensiveness of the reference knowledge documents retrieved by the intelligent question-answering robot's retrieval model, it is necessary to pre-construct a knowledge document set applied to the retrieval model of this intelligent question-answering robot. Specifically, this includes: obtaining third sample knowledge documents from public databases and obtaining fourth sample knowledge documents from historical databases. The third sample knowledge documents are public knowledge documents such as transportation ticket prices, attraction ticket prices, tourist attraction guides, and the distribution of food in destinations. The fourth sample documents are historical knowledge documents such as historical orders, historical order distribution, and historical order reviews of tourism projects. After filtering, adding, deleting, modifying, and querying the above-mentioned third sample knowledge documents and fourth sample knowledge documents, reference knowledge documents for tourism projects are obtained. The reference knowledge documents are input into the pre-trained retrieval model, and the document features of the reference knowledge documents are obtained by encoding through the first encoder. Based on the document features of the reference knowledge documents, a knowledge document set of reference knowledge documents for tourism projects is constructed. By using sample data from different sources, the number of knowledge documents was expanded, resulting in a more comprehensive knowledge document set. This improved the accuracy of retrieving reference knowledge documents for tourism projects and enhanced the pre-training, pre-training, and verification effects of the retrieval and reasoning models in the intelligent question-answering robot. Consequently, the accuracy and relevance of the answers provided by the intelligent question-answering robot were improved.

[0080] For example, 100,000 third-sample knowledge documents from a public database and 1,000 fourth-sample knowledge documents from a historical database are obtained. After filtering the third-sample and fourth-sample knowledge documents, addition, deletion, and modification are performed to determine 50,000 reference knowledge documents. The 50,000 reference knowledge documents are input into a pre-trained retrieval model, and the document features of the reference knowledge documents are obtained by encoding through a first encoder. The document features of the 50,000 reference knowledge documents are determined as the corresponding indexes of the reference knowledge documents, and a knowledge document set including 50,000 reference knowledge documents is constructed.

[0081] In the embodiments of this specification, the number of knowledge document sets is expanded by using sample data from different sources, resulting in a more comprehensive knowledge document set, which improves the accuracy of information retrieval and the effectiveness of model pre-training, pre-training, and verification.

[0082] In one optional embodiment of this specification, the pre-training of the retrieval model includes the following specific steps:

[0083] Obtain a third sample set, which includes pre-trained query information and pre-trained knowledge documents with corresponding relationships;

[0084] The pre-trained query information is input into the retrieval model, and the pre-trained query features corresponding to the pre-trained query information are obtained by encoding through the first encoding layer.

[0085] The pre-trained knowledge document is input into the retrieval model, and the pre-trained document features corresponding to the pre-trained knowledge document are obtained by encoding through the first encoding layer.

[0086] The pre-training loss value is determined based on the feature similarity between pre-trained query features and pre-trained document features;

[0087] Based on the pre-training loss value, adjust the parameters of the retrieval model to obtain the pre-trained retrieval model.

[0088] To ensure the accuracy of the constructed knowledge document set, and to improve the effectiveness and efficiency of subsequent model pre-training, the retrieval model needs to be pre-trained. This ensures that the retrieval model possesses a certain level of accurate encoding and retrieval performance.

[0089] The third sample set is a collection of sample data used for pre-training, including multiple pairs of corresponding pre-training query information and pre-training knowledge documents. It is a type of weakly supervised sample. Generally, the number of samples in the third sample set is much larger than that in the first and second sample sets. Pre-training query information is query information used for model pre-training; it is pre-training data. Pre-training query information can be manually constructed or obtained from a sample database, which can be a historical database or a public database. Pre-training knowledge documents are knowledge documents used for model pre-training; they are labeled data. Pre-training knowledge documents can be manually constructed or obtained from a sample database, which can be a historical database or a public database. There is a correspondence between pre-training query information and pre-training knowledge documents; a pair of corresponding pre-training query information and pre-training knowledge documents constitutes a sample pair.

[0090] Pre-trained query features are feature encoding vectors corresponding to pre-trained query information. They are low-dimensional feature encoding vectors, which can be understood as mapping pre-trained query information to a low-dimensional feature space. Pre-trained document features are feature encoding vectors corresponding to pre-trained knowledge documents. They are also low-dimensional feature encoding vectors, which can be understood as mapping pre-trained knowledge documents to a low-dimensional feature space.

[0091] Feature similarity can be cosine similarity, distance similarity, L1 similarity, L2 similarity, or maximum similarity, and is not limited here.

[0092] The number of pre-trained query features and pre-trained document features is large. The pre-training loss value is obtained by calculating the similarity of each feature. The calculation method can be normalization using the softmax function or by averaging. No limitation is made here.

[0093] Based on the pre-training loss value, the parameters of the retrieval model are adjusted to obtain a pre-trained retrieval model. Specifically, the parameters of the retrieval model are iteratively adjusted based on the pre-training loss value until a pre-set pre-training termination condition is met. The pre-set termination condition includes, but is not limited to, a pre-training loss value threshold, the number of iterations, and the completion of training for all sample pairs in the third sample set. The iterative adjustment of model parameters based on the pre-training loss value is performed using a gradient update method. Generally, since the third sample set is large, the sample pairs are divided into multiple batches for multi-batch pre-training.

[0094] For example, a third sample set is obtained, which includes 200,000 sample pairs. Each sample pair includes pre-trained query information and pre-trained knowledge documents with corresponding relationships. The pre-trained query information is input into the retrieval model, and the pre-trained query features corresponding to the pre-trained query information are obtained by encoding through the first encoding layer. The pre-trained knowledge documents are input into the retrieval model, and the pre-trained document features corresponding to the pre-trained knowledge documents are obtained by encoding through the first encoding layer. Based on the feature similarity between the pre-trained query features and the pre-trained document features, the pre-training loss value Loss5 is determined. According to the pre-training loss value Loss5, the parameters of the retrieval model are iteratively adjusted using the gradient update method. Under the condition that the preset 200,000 sample pairs have completed training, the pre-trained retrieval model is obtained.

[0095] In the embodiments described in this specification, the performance of the retrieval model is improved, ensuring the accuracy of the knowledge document set subsequently constructed, and improving the training effect and efficiency of subsequent pre-training of the model.

[0096] In one optional embodiment of this specification, obtaining the third sample set includes the following specific steps:

[0097] Obtain fifth sample query information and fifth sample knowledge documents from public databases;

[0098] Obtain sixth sample query information and sixth sample knowledge document from historical database;

[0099] Determine the pre-training query information and pre-training knowledge document, wherein the pre-training query information includes the fifth sample query information and the sixth sample query information, and the pre-training knowledge document includes the fifth sample knowledge document and the sixth sample knowledge document;

[0100] Determine the correspondence between pre-training query information and pre-training knowledge documents;

[0101] Based on the correspondence, a third sample set is constructed.

[0102] The fifth sample query information is open-source. The fifth sample knowledge document is also open-source. The sixth sample query information is historical query information. The sixth sample knowledge document is also historical knowledge document. It should be noted that the fifth sample query information and the fifth sample knowledge document may or may not be explicitly labeled as having a correspondence; this will be determined later. The same applies to the sixth sample query information and the sixth sample knowledge document.

[0103] Determining the correspondence between pre-training query information and pre-training knowledge documents can be done by using pre-annotated correspondences, manually, or by using relevant tools; no limitation is made here.

[0104] Based on the correspondence, a third sample set is constructed. Specifically, the pre-trained query information and pre-trained knowledge documents are grouped according to the correspondence to construct the third sample set.

[0105] Continuing with the above application example of the intelligent question-answering robot, this intelligent question-answering robot is a customer service question-answering robot for tourism projects. This intelligent question-answering robot includes a retrieval model and a reasoning model. In order to improve the accuracy and relevance of the answers given by the intelligent question-answering robot, it is necessary to pre-train the retrieval model and the reasoning model of the intelligent question-answering robot. The comprehensiveness of the third sample set used for pre-training determines the pre-training effect of the model. The construction of the third sample set is pre-built, specifically including: obtaining the fifth sample question and the fifth sample knowledge document from a public database, and obtaining the sixth sample question and the sixth sample knowledge document from a historical database. The fifth sample questions include publicly available questions such as "How much is the transportation fare in location A?" and "What are the local delicacies in location B?". The fifth sample knowledge documents include publicly available documents such as "National Transportation Fare Announcement" and "Location B, a Culinary Capital". The sixth sample questions include historical questions such as "What is the recommended route in location C?" and "What is the rating of location D?". The sixth sample knowledge documents include historical documents such as "Three-Day, Two-Night Travel Log for Location C" and "Summary Table of Tourism Ratings Across the Country". The pre-training questions and pre-training knowledge documents are determined, as are the correspondences between them: "How much is the transportation fare in location A?" - "National Transportation Fare Announcement"; "What are the local delicacies in location B?" - "Location B, a Culinary Capital"; "What is the recommended route in location C?" - "Three-Day, Two-Night Travel Log for Location C"; "What is the rating of location D?" - "Summary Table of Tourism Ratings Across the Country". Based on these correspondences, the third sample set is constructed. By constructing a third sample set of a larger magnitude using sample data from different sources, the pre-training effect of the retrieval and reasoning models in the intelligent question-answering robot for tourism projects was improved, thereby enhancing the accuracy and relevance of the intelligent question-answering robot's responses.

[0106] For example, 198,000 pairs of fifth sample query information and fifth sample knowledge documents are obtained from a public database, and 2,000 pairs of sixth sample query information and sixth sample knowledge documents are obtained from a historical database. Pre-training query information and pre-training knowledge documents are determined, wherein the pre-training query information includes fifth sample query information and sixth sample query information, and the pre-training knowledge documents include fifth sample knowledge documents and sixth sample knowledge documents. Relevant tools are used to determine the correspondence between the pre-training query information and pre-training knowledge documents. Based on the correspondence, the pre-training query information and pre-training knowledge documents are grouped to obtain 200,000 sample pairs, and a third sample set is constructed.

[0107] In the embodiments described in this specification, a third sample set of a larger order of magnitude is constructed using sample data from different sources, thereby improving the pre-training effect.

[0108] In one optional embodiment of this specification, the pre-training query information is at least one batch of pre-training query information, and the pre-training knowledge document is at least one batch of pre-training knowledge document.

[0109] The pre-training loss value is determined based on the feature similarity between pre-trained query features and pre-trained document features, including the following specific steps:

[0110] The feature similarity between the first batch of pre-trained query features and the second batch of pre-trained document features is calculated. The first batch of pre-trained query features are the pre-trained query features of any batch of pre-trained query information, and the second batch of pre-trained query features are the pre-trained document features of any batch of pre-trained knowledge documents.

[0111] The pre-training loss value is determined based on the feature similarity between pre-trained query features and pre-trained document features across batches.

[0112] The sample data in the third sample set is extremely large. Generally, due to computing power considerations, it needs to be processed in batches. Therefore, the pre-training query information is at least one batch of pre-training query information, and the pre-training knowledge document is at least one batch of pre-training knowledge document.

[0113] The feature similarity between the first batch of pre-trained query features and the second batch of pre-trained document features is calculated as follows: The maximum similarity between the first batch of pre-trained query features and the second batch of pre-trained document features is calculated. The formula for calculating the maximum similarity is shown in Formula 1.

[0114]

[0115] Among them, S q,d To achieve maximum similarity, q represents the pre-trained query information, d represents the pre-trained knowledge document, and M represents the maximum similarity. q M represents the total number of tokens in the pre-trained query information. d E represents the total number of tokens in the pre-trained knowledge documents. qi E is the feature encoding vector of the i-th toke in the pre-trained query features. dj Let be the feature encoding vector of the j-th token in the pre-trained document features.

[0116] The pre-training loss value is determined based on the feature similarity between pre-trained query features and pre-trained document features across batches. Specifically, the pre-training loss value is obtained by calculating the contrast distribution based on the feature similarity between pre-trained query features and pre-trained document features across batches. The formula for calculating the contrast distribution is shown in Formula 2.

[0117]

[0118] Where B is the number of batch samples in the pre-training batch, and τ is a temperature parameter used to avoid gradient explosion.

[0119] In the embodiments described in this specification, the pre-training loss value is calculated more accurately, thereby improving the pre-training effect of the retrieval model.

[0120] Step 106: Input the query features and reference knowledge documents into the pre-trained inference model, encode them through the second encoder, and decode them to obtain the target query result corresponding to the query information. The parameters of the first encoder and the second encoder are the same.

[0121] The inference model is a neural network model with data information reasoning capabilities. It has a second encoder and a decoder. Data reasoning, guided by prior knowledge, determines a highly relevant reasoning result based on the input data information. The reasoning result can be obtained from prior knowledge or generated. The second encoder is a feature encoder for the data information. It encodes the features of at least one modality of data information to obtain the corresponding data features, such as the encoder of the BERT model, the encoder of the Transformer model, or the encoder of the ViT model. It should be noted that, to ensure that the reference knowledge documents retrieved by the retrieval model can be adapted to the reasoning process of the inference model, the parameters of the first encoder and the second encoder are the same in this embodiment. The decoder is a feature decoder guided by prior features, which decodes the data information of at least one modality. The second encoder and decoder realize data information reasoning through encoding and decoding.

[0122] The target query result is the reasoning result corresponding to the query information. It is a type of data information, including at least one modality, such as text, image, voice, video, etc.

[0123] It should be noted that the pre-training process of the retrieval model and the inference model is a supervised training process. The sample data used for training includes: sample query information, sample knowledge documents, and sample query results.

[0124] The target query result corresponding to the query information is obtained by encoding and decoding using a second encoder. Specifically, the reference knowledge document is encoded using the second encoder to obtain corresponding document features. Based on the query features and document features, the target query result corresponding to the query information is decoded. Furthermore, the target query result corresponding to the query information is decoded based on the query features and document features, specifically by using document features as prior features to decode the query features and obtain the target query result corresponding to the query information. Even further, using document features as prior features to decode the query features and obtain the target query result corresponding to the query information is achieved through attention calculation: document features are defined as key vectors and value vectors, and query features are defined as query vectors. Attention is calculated on the query vector, key vector, and value vector to obtain attention features. The attention features are then decoded to obtain the target query result corresponding to the query information. The formula for attention calculation is shown in Formula 3.

[0125]

[0126] Where Attention is the attention feature, Q is the query vector, K is the key vector, V is the value vector, and d k A preset temperature coefficient is used to reduce the gradient.

[0127] Optionally, after obtaining the target query results, the target query results are rendered on the front end.

[0128] Continuing with the above application example of the intelligent question-answering robot, this robot is a customer service question-answering robot specifically for tourism projects. It includes a retrieval model and an inference model. The specific question-answering process for tourism projects is as follows: It receives the question to be answered, "Planning a trip to location E by car, what are some recommended attractions and restaurants?" The question is input into the retrieval model, where a first encoder encodes the question's features. Based on these features, it identifies relevant reference knowledge documents from a pre-built knowledge document set, including "Complete Guide to Traveling to Location E," "A Summary of Food in Location E," and "A Cultural Tour of Location E." The question features and reference knowledge documents are then input into the inference model, where a second encoder encodes and decodes the results to obtain the target answer: "Recommended attractions include: Attraction 1, Attraction 2, and Attraction 3; recommended restaurants include: Restaurant 1 and Restaurant 2." The parameters of the first and second encoders are identical. The pre-trained retrieval and inference models have consistent encoding performance, and the performance of the two models is well-matched. This ensures that the reference knowledge documents retrieved by the retrieval model can be accurately used to determine the target answer to the question, improving the accuracy of the answer and enhancing the user experience.

[0129] For example, the query feature Feature_QueryInfo and the reference knowledge document "History of the First Human Moon Landing" are input into a pre-trained inference model. The reference knowledge document is encoded using a second encoder to obtain the corresponding document feature Feature_Document. The document feature Feature_Document is used as the prior feature Prior to decode the query feature Feature_QueryInfo, resulting in the target query result "July 20, 1969" corresponding to the query information "When was the first human moon landing?". The target query result is then rendered on the front-end interactive interface.

[0130] In this embodiment, query information is received; the query information is input into a pre-trained retrieval model, and the query features corresponding to the query information are obtained by encoding with a first encoder. Based on the query features, the corresponding reference knowledge document is determined from a pre-constructed knowledge document set. The query features and the reference knowledge document are input into a pre-trained inference model, encoded with a second encoder, and decoded to obtain the target query result corresponding to the query information. The parameters of the first encoder and the second encoder are identical. The identical parameters of the first encoder and the second encoder ensure that the pre-trained retrieval model and the inference model have consistent encoding performance. The performance of the two models is well-matched, guaranteeing that the reference knowledge document retrieved by the retrieval model can be accurately used to determine the target query result corresponding to the query information, thus improving the accuracy of the target query result.

[0131] In one optional embodiment of this specification, the pre-training of the retrieval model and the inference model includes: adjusting the parameters of the retrieval model and the inference model respectively using a first loss value, wherein the first loss value is determined by a second loss value corresponding to the retrieval model and a third loss value corresponding to the inference model.

[0132] Currently, the pre-training of retrieval augmentation systems involves training the retrieval model and the inference model independently. However, this training method has the following problems: 1. The inference model cannot determine whether the reference knowledge documents retrieved by the retrieval model are suitable. Because in such a two-stage system, the retrieval model mechanically matches reference knowledge documents with high relevance to the query information for inference. If an incorrect reference knowledge document is retrieved, it will mislead the inference process of the inference model, resulting in inaccurate query results. 2. The retrieval model and the inference model are optimized based on their respective loss values; the retrieval model cannot be optimized based on the inference model.

[0133] The first loss value is the total loss used to adjust the retrieval model and the inference model during pre-training. The second loss value is the loss determined during pre-training based on the sample knowledge documents and the reference knowledge documents retrieved by the retrieval model, and is used to measure the retrieval performance of the retrieval model. The third loss value is the loss determined during pre-training based on the sample query results and the predicted query results inferred by the inference model, and is used to measure the inference performance of the inference model.

[0134] It should be noted that since the first encoder and the second encoder have the same parameters, the retrieval model and the inference model have the same encoding performance. Furthermore, the first loss value, determined by the second loss value and the third loss value, is used to adjust the parameters of the retrieval model and the inference model as a whole, thereby achieving synchronous optimization of the retrieval model and the inference model. The pre-training process is a joint training, rather than training the two models independently.

[0135] For details on how to pre-train the retrieval and inference models using the first loss value, please refer to the embodiments in the following instruction manual.

[0136] The pre-training of the retrieval and inference models includes adjusting the parameters of both models using a first loss value, determined by a second loss value for the retrieval model and a third loss value for the inference model. During the pre-training process, the first loss value is determined by the second and third loss values ​​for the retrieval and inference models, and the parameters are adjusted accordingly. This joint training of the retrieval and inference models further optimizes their performance, ensuring that the reference knowledge documents retrieved by the retrieval model can be accurately used to determine the target query results, thus improving the accuracy of the target query results.

[0137] In one optional embodiment of this specification, the pre-training of the retrieval model and the inference model includes the following specific steps:

[0138] Obtain the first sample set, which includes sample query information, sample knowledge documents and sample query results with corresponding relationships;

[0139] The sample query information is input into the retrieval model, and the sample query features corresponding to the sample query information are obtained by encoding through the first encoding layer. Based on the sample query features, the corresponding reference knowledge documents are determined from the pre-built knowledge document set.

[0140] The second loss value is calculated based on the reference knowledge document and the sample knowledge document;

[0141] When the second loss value reaches the preset second loss value threshold, the sample query features and reference knowledge documents are input into the inference model, encoded by the second encoder, and decoded to obtain the predicted query result corresponding to the sample query information;

[0142] The third loss value is calculated based on the predicted query results and the sample query results;

[0143] The first loss value is determined based on the second and third loss values;

[0144] Based on the first loss value, adjust the parameters of the retrieval model and the inference model to obtain the trained retrieval model and the inference model.

[0145] The first sample set is a collection of sample data used for pre-training, including multiple sets of corresponding sample query information, sample knowledge documents, and sample query results. It is a strongly supervised sample set. Sample query information is the query information used for pre-training; it is training data. Sample query information can be manually constructed or obtained from a sample database, which can be a historical database or a public database. Sample knowledge documents are knowledge documents used for pre-training; they are labeled data. Sample knowledge documents can be manually constructed or obtained from a sample database, which can be a historical database or a public database. Sample query results are query results used for pre-training; they are labeled data. Sample query results can be manually constructed or obtained from a sample database, which can be a historical database or a public database. There are correspondences between sample query information, sample knowledge documents, and sample query results. Sample query information, sample knowledge documents, and sample query results with corresponding relationships constitute a sample group.

[0146] The second loss value measures the low-dimensional correlation between the sample query information and the reference knowledge document. For example, if the query feature is a text feature, the feature similarity between the two is determined based on the text features of the reference knowledge document in the knowledge document set, thus obtaining the second loss value. The second loss value threshold is a pre-set judgment threshold. If the second loss value reaches the threshold, the reference knowledge document is determined to have a high correlation with the sample query information. Under strong supervision of the sample knowledge document, i.e., only when the second loss value reaches the second loss value threshold, is the reference knowledge document determined to be able to effectively guide inference and participate in pre-training. The third loss value measures the high-dimensional correlation between the sample query result and the predicted query result. For example, if the query feature is an image semantic feature, the feature similarity between the two is determined based on the image semantic features of the reference knowledge document in the knowledge document set, thus obtaining the third loss value. The first loss value is a loss value that combines low-dimensional and high-dimensional correlation.

[0147] The predicted query result is a data information derived from the inference model based on the sample query features and reference knowledge documents.

[0148] Based on the sample query features, corresponding reference knowledge documents are determined from a pre-built knowledge document set. Specifically, the reference knowledge documents are determined by calculating the feature similarity between the sample query features and the reference knowledge documents in the pre-built knowledge document set. The feature similarity can be cosine similarity, distance similarity, L1 similarity, L2 similarity, or maximum similarity, and is not limited here. The knowledge document set pre-stores the document features of each reference knowledge document, and in the above determination process, the similarity is directly calculated with the sample query features to obtain the feature similarity.

[0149] Based on the reference knowledge document and the sample knowledge document, a second loss value is calculated, specifically by calculating the feature similarity between the reference knowledge document and the sample knowledge document. Based on the predicted query result and the sample query result, a third loss value is calculated, specifically by calculating the feature similarity between the predicted query result and the sample query result. Based on the second and third loss values, a first loss value is determined, specifically by weighting the second and third loss values ​​to obtain the first loss value.

[0150] Based on the first loss value, the parameters of the retrieval model and the inference model are adjusted to obtain the trained retrieval model and the inference model. Specifically, based on the first loss value, the parameters of the retrieval model and the inference model are iteratively adjusted until a preset training termination condition is met, thus obtaining the trained retrieval model and the inference model. The training termination condition is a pre-set judgment condition for the end of training, including but not limited to: a first loss value threshold, the number of iterations, and all sample groups in the first sample set having completed training. The method for iteratively adjusting the model parameters based on the first loss value is to use the gradient update method.

[0151] For example, a first sample set is obtained, comprising 100 sample groups. Each sample group includes corresponding sample query information, sample knowledge documents, and sample query results. The sample query information is input into the retrieval model, and the sample query features corresponding to the sample query information are encoded through a first encoding layer. Based on the feature similarity between the sample query features and reference knowledge documents in a pre-built knowledge document set, the corresponding reference knowledge document is determined. Based on the feature similarity Sim2 between the reference knowledge document and the sample knowledge document, a second loss value Loss2 is calculated. When the second loss value Loss2 reaches a preset second loss value threshold Thresh... In the case of oldLoss2, the sample query features and reference knowledge documents are input into the inference model, encoded by the second encoder, and decoded to obtain the predicted query results corresponding to the sample query information. Based on the feature similarity Sim3 between the predicted query results and the sample query results, the third loss value Loss3 is calculated. The second loss value Loss2 and the third loss value Loss3 are weighted to obtain the first loss value Loss1. Based on the first loss value Loss1, the parameters of the retrieval model and the inference model are iteratively adjusted using the gradient update method. Under the condition of satisfying the preset number of iterations (72 times), the trained retrieval model and the inference model are obtained.

[0152] In the embodiments of this specification, the retrieval model and the inference model have consistent coding performance. Only when the second loss value determined by the sample knowledge document and the reference knowledge document determined by the retrieval model reaches the loss value threshold can the reference knowledge document be input into the inference model in combination with the sample query information. The first loss value is determined by the second loss value corresponding to the retrieval model and the third loss value corresponding to the inference model. The parameters of the retrieval model and the inference model are adjusted respectively, realizing the joint training of the retrieval model and the inference model. This makes the performance of the two models compatible and improves the accuracy of subsequent information retrieval. At the same time, the model training is carried out on cloud-side devices with higher computing power, which improves training efficiency and training effect.

[0153] In one optional embodiment of this specification, obtaining the first sample set includes the following specific steps:

[0154] Obtain first-sample query information, first-sample knowledge documents, and first-sample query results from public databases;

[0155] Retrieve second sample query information, second sample knowledge documents, and second sample query results from historical databases;

[0156] The sample query information, sample knowledge document, and sample query results are determined. The sample query information includes first sample query information and second sample query information. The sample knowledge document includes first sample knowledge document and second sample knowledge document. The sample query results include first sample query results and second sample query results.

[0157] Determine the correspondence between sample query information, sample knowledge documents, and sample query results;

[0158] Based on the correspondence, the first sample set is constructed.

[0159] Public databases are databases containing publicly available, open-source sample data. Historical databases are databases that store historical sample data. Examples include the historical databases of intelligent question-answering robot platforms, intelligent search platforms, and risk control platforms.

[0160] The first sample query information is open-source sample query information. The first sample knowledge document is open-source sample knowledge document. The first sample query result is open-source sample query result. The second sample query information is historical query information. The second sample knowledge document is historical knowledge document. The second sample query result is historical query result. It should be noted that the first sample query information, the first sample knowledge document, and the first sample query result can be directly labeled with a correspondence, or they can be left unlabeled, which will be determined later. The same applies to the second sample query information, the second sample knowledge document, and the second sample query result.

[0161] Determining the correspondence between sample query information, sample knowledge documents, and sample query results can be done by using pre-labeled correspondences, manually, or by using relevant tools; no limitation is made here.

[0162] Based on the correspondence, the first sample set is constructed. Specifically, the sample query information, sample knowledge documents, and sample query results are grouped according to the correspondence to construct the first sample set.

[0163] Continuing with the above application example of the intelligent question-answering robot, this intelligent question-answering robot is a customer service question-answering robot for tourism projects. This intelligent question-answering robot includes a retrieval model and a reasoning model. To improve the accuracy and relevance of the robot's answers, the retrieval model and reasoning model need to be pre-trained. The comprehensiveness of the first sample set used for pre-training determines the pre-training effect of the model. The construction of the first sample set includes: obtaining a first sample question, a first sample knowledge document, and a first sample answer from a public database; and obtaining a second sample question, a second sample knowledge document, and a second sample answer from a historical database. The first sample questions included publicly available questions such as "How much is the transportation fare in location A?" and "What are the local delicacies in location B?". The first sample knowledge documents included publicly available documents such as "National Transportation Fare Announcement" and "Location B, a Culinary Capital". The first sample answers included publicly available answers such as "The transportation fare in location A is 720 yuan" and "The local delicacies in location B are Food 3 and Food 4". The second sample questions included historical questions such as "What is the recommended route for location C?" and "What is the rating for location D?". The second sample knowledge documents included historical documents such as "A Three-Day, Two-Night Travel Log for Location C" and "A Summary Table of Tourism Ratings Across the Country". The second sample answers included "The recommended route for location C is Attraction 1 - Attraction 2 - Attraction 3 - Attraction 4" and "Location D...". Historical answers such as "The rating is 4.7" were used to identify sample questions, sample knowledge documents, and sample answers, and to determine the correspondence between them: "How much is the transportation fare in location A?" - "National Transportation Fare Announcement" - "The transportation fare in location A is 720 yuan"; "What are the special delicacies in location B?" - "Location B, a Food Capital" - "The special delicacies in location B are Food 3 and Food 4"; "What is the recommended route in location C?" - "Three-day, two-night travel log of location C" - "The recommended route in location C is Attraction 1 - Attraction 2 - Attraction 3 - Attraction 4"; "What is the rating of location D?" - "National Tourism Rating Summary Table" - "Location D's rating is 4.7". Based on these correspondences, a first sample set was constructed. By using sample data from different sources, a richer first sample set was constructed, improving the pre-training effect of the retrieval and reasoning models in the intelligent question-answering robot for tourism projects, thereby improving the accuracy and relevance of the intelligent question-answering robot's answers.

[0164] For example, 80 sets of first sample query information, first sample knowledge documents, and first sample query results from a public database are obtained, and 20 sets of second sample query information, second sample knowledge documents, and second sample query results from a historical database are obtained. The sample query information, sample knowledge documents, and sample query results are determined, wherein the sample query information includes first sample query information and second sample query information, the sample knowledge documents include first sample knowledge documents and second sample knowledge documents, and the sample query results include first sample query results and second sample query results. The correspondence between the sample query information, sample knowledge documents, and sample query results is manually determined. Based on the correspondence, the sample query information, sample knowledge documents, and sample query results are grouped to obtain 100 sample groups, thus constructing the first sample set.

[0165] In the embodiments described in this specification, a richer first sample set is constructed by using sample data from different sources, thereby improving the training effect of pre-training.

[0166] In one optional embodiment of this specification, the inference model includes a second encoder and a decoder;

[0167] The sample query features and reference knowledge documents are input into the inference model, encoded by a second encoder, and then decoded to obtain the predicted query results corresponding to the sample query information. The specific steps include the following:

[0168] The reference knowledge document is input into the second encoder, and the document features corresponding to the reference knowledge document are encoded.

[0169] The sample query features and document features are input into the decoder. Using the document features as prior features, the sample query features are decoded to obtain the predicted query results corresponding to the sample query information.

[0170] The decoder is a feature decoder guided by prior features. Based on prior knowledge, the decoder performs guided decoding to obtain data information of at least one modality. Prior features are features used to guide the decoding.

[0171] Using document features as prior features, the sample query features are decoded to obtain the predicted query results corresponding to the sample query information. Specifically, the document features are defined as key vectors and value vectors, and the sample query features are defined as query vectors. Attention is calculated on the query vector, key vector, and value vector to obtain attention features. The attention features are then decoded to obtain the predicted query results corresponding to the sample query information. The formula for attention calculation is shown in Formula 3.

[0172] For example, the reference knowledge document is input into the second encoder to encode the document features corresponding to the reference knowledge document. The document features are determined as key vectors and value vectors, and the sample query features are determined as query vectors. Attention is calculated on the query vector, key vector, and value vector to obtain attention features. The attention features are then decoded to obtain the predicted query results corresponding to the sample query information.

[0173] In the embodiments described in this specification, the accuracy of the predicted query results is improved, and the training effect and efficiency of the model are enhanced.

[0174] In one optional embodiment of this specification, after obtaining the trained retrieval model and inference model, the following specific steps are further included:

[0175] The verification query information is input into the retrieval model, and the verification query features corresponding to the verification query information are obtained by encoding through the first encoding layer. Based on the verification query features, the corresponding reference knowledge documents are determined from the pre-built knowledge document set.

[0176] The verification query features and reference knowledge documents are input into the inference model, encoded by the second encoder, and then decoded to obtain the inference query results corresponding to the verification query information.

[0177] Based on the inference query results and the verification query results, the verification loss value is calculated;

[0178] Based on the verification loss value, adjust the parameters of the retrieval model and the inference model to obtain the verified retrieval model and the inference model.

[0179] The pre-training of the retrieval and inference models is a strongly supervised training process. It involves strong supervision from sample knowledge documents; specifically, a reference knowledge document is only considered valid for guiding inference and participating in pre-training if the second loss value reaches a certain threshold. Validation, on the other hand, is a weakly supervised training method that allows the model to accurately decode and obtain inference query results even without guidance, thus improving model performance. Validation serves as a fine-tuning method for the model.

[0180] The second sample set is a collection of sample data used for validation, including multiple pairs of corresponding validation query information and validation query results. It is a type of weakly supervised sample. Validation query information is used for model validation; it is validation data and can be manually constructed or obtained from a sample database, which can be a historical database or a publicly available database. Validation query results are used for model validation; they are labeled data and can also be manually constructed or obtained from a sample database, which can be a historical database or a publicly available database. There is a correspondence between validation query information and validation query results; a pair of corresponding validation query information and validation query results constitutes a sample pair.

[0181] The reasoning query result is a data information obtained by reasoning based on the query features and reference knowledge documents.

[0182] The validation loss is a loss value used to measure the high-dimensional correlation between validation query results and inference query results.

[0183] Based on the verification query features, corresponding reference knowledge documents are determined from a pre-built knowledge document set. Specifically, the reference knowledge documents are determined by calculating the feature similarity between the verification query features and the reference knowledge documents in the pre-built knowledge document set. The feature similarity can be cosine similarity, distance similarity, L1 similarity, L2 similarity, or maximum similarity, and is not limited here. The knowledge document set pre-stores the document features of each reference knowledge document, and in the above determination process, the similarity is directly calculated with the verification query features to obtain the feature similarity.

[0184] The reference knowledge document is encoded using a second encoder to obtain corresponding document features. Based on the verification query features and document features, the inference query result corresponding to the verification query information is decoded. Furthermore, the inference query result corresponding to the verification query information is decoded using the verification query features and document features, specifically by using document features as prior features to decode the verification query features and obtain the inference query result corresponding to the verification query information. Further, the inference query result corresponding to the verification query information is obtained by using attention calculation: the document features are determined as key vectors and value vectors, and the verification query features are determined as query vectors. Attention is calculated on the query vector, key vector, and value vector to obtain attention features. The attention features are then decoded to obtain the inference query result corresponding to the verification query information. The formula for attention calculation is shown in Formula 3.

[0185] The verification loss value is calculated based on the inference query results and the verification query results. Specifically, the verification loss value is calculated based on the feature similarity between the inference query results and the verification query results.

[0186] Based on the validation loss value, the parameters of the retrieval model and the inference model are adjusted to obtain validated retrieval and inference models. Specifically, the parameters of the retrieval model and the inference model are iteratively adjusted based on the validation loss value. Under the condition that the preset training termination conditions are met, the validated retrieval model and the inference model are obtained. The training termination conditions are pre-set judgment conditions for the end of training, including but not limited to: a validation loss value threshold, the number of iterations, and all sample groups in the second sample set having completed training. The method for iteratively adjusting the model parameters based on the validation loss value is to use the gradient update method.

[0187] For example, a second sample set is obtained, comprising 120 sample groups. Each sample group includes corresponding verification query information and sample query results. The verification query information is input into the retrieval model, and the verification query features corresponding to the verification query information are obtained through encoding by the first encoding layer. Based on the feature similarity between the verification query features and reference knowledge documents in the pre-built knowledge document set, the corresponding reference knowledge document is determined. The verification query features and the reference knowledge document are input into the inference model, and the document features corresponding to the reference knowledge document are obtained through encoding by the second encoder. Using the document features as prior features, the verification query features are decoded to obtain the inference query results corresponding to the verification query information. Based on the feature similarity Sim between the inference query results and the verification query results, the verification loss value Loss4 is calculated. Based on the first loss value Loss4, the parameters of the retrieval model and the inference model are iteratively adjusted using the gradient update method. Under the condition of satisfying the preset number of iterations (108 times), the retrieval model and the inference model with complete verification are obtained.

[0188] In the embodiments described in this specification, the model performance is further improved based on pre-training, thereby further improving the accuracy of subsequent information retrieval.

[0189] In one optional embodiment of this specification, obtaining the second sample set includes the following specific steps:

[0190] Obtain third-sample query information and results from public databases;

[0191] Obtain the fourth sample query information and the fourth sample query results from the historical database;

[0192] Determine the verification query information and the verification query results, wherein the verification query information includes the third sample query information and the fourth sample query information, and the verification query results include the third sample query results and the fourth sample query results;

[0193] Determine the correspondence between the verification query information and the verification query results;

[0194] Based on the correspondence, a second sample set is constructed.

[0195] The third sample query information is open-source sample query information. The third sample query result is open-source sample query result. The fourth sample query information is historical query information. The fourth sample query result is historical query result. It should be noted that the third sample query information and the third sample query result can be directly labeled with a correspondence, or the correspondence can be left unlabeled, to be determined later. The same applies to the fourth sample query information and the fourth sample query result.

[0196] Determining the correspondence between the verification query information and the verification query results can be done by using pre-marked correspondences, manually, or by using relevant tools; no limitation is made here.

[0197] Based on the correspondence, a second sample set is constructed. Specifically, the verification query information and the verification query results are grouped according to the correspondence to construct the second sample set.

[0198] Continuing with the above application example of the intelligent question-answering robot, this intelligent question-answering robot is a customer service question-answering robot for tourism projects. This intelligent question-answering robot includes a retrieval model and an inference model. In order to improve the accuracy and relevance of the answers given by the intelligent question-answering robot, it is necessary to further validate the retrieval model and the inference model. The comprehensiveness of the second sample set used for validation determines the validation effect of the model. The construction of the second sample set is pre-built, specifically including: obtaining a third sample question and a third sample answer from a public database, and obtaining a fourth sample question and a fourth sample answer from a historical database. The third sample questions include open questions such as "How much is the transportation fare in location A?" and "What are the local delicacies in location B?". The third sample answers include open answers such as "The transportation fare in location A is 720 yuan" and "The local delicacies in location B are food 3 and food 4". The fourth sample questions include historical questions such as "What is the recommended route in location C?" and "What is the rating of location D?". The verification questions and answers are determined. The historical answers of the fourth sample, such as "The recommended route in location C is attraction 1-attraction 2-attraction 3-attraction 4" and "The rating of location D is 4.7", determine the correspondence between the verification questions and answers: "How much is the transportation fare in location A?" - "The transportation fare in location A is 720 yuan"; "What are the local delicacies in location B?" - "The local delicacies in location B are food 3 and food 4"; "What is the recommended route in location C?" - "The recommended route in location C is attraction 1-attraction 2-attraction 3-attraction 4"; "What is the rating of location D?" - "The rating of location D is 4.7". Based on the correspondence, the second sample set is constructed. By constructing a richer second sample set using sample data from different sources, the verification effect of the retrieval and reasoning models in the intelligent question-answering robot for tourism projects was improved, thereby enhancing the accuracy and relevance of the answers provided by the intelligent question-answering robot.

[0199] For example, 80 pairs of third sample query information and third sample query results from a public database are obtained, and 40 pairs of fourth sample query information and fourth sample query results from a historical database are obtained. Verification query information and verification query results are determined, wherein the verification query information includes the third sample query information and the fourth sample query information, and the verification query results include the third sample query results and the fourth sample query results. The correspondence between the verification query information and the verification query results is manually determined. Based on the correspondence, the verification query information and the verification query results are grouped to obtain 120 sample pairs, and a second sample set is constructed.

[0200] In the embodiments described in this specification, a richer second sample set is constructed by using sample data from different sources, thereby improving the verification effect.

[0201] Figure 2This specification shows a flowchart of an intelligent question-answering method according to an embodiment, which specifically includes the following steps:

[0202] Step 202: Receive problem information;

[0203] Step 204: Input the question information into the pre-trained retrieval model, encode the question features corresponding to the question information through the first encoder, and determine the corresponding reference knowledge document from the pre-built knowledge document set based on the question features;

[0204] Step 206: Input the problem features and reference knowledge documents into the pre-trained reasoning model, encode them through the second encoder, and decode them to obtain the target answer information corresponding to the problem information. The parameters of the first encoder and the second encoder are the same.

[0205] The embodiments in this specification apply to the client and / or server of applications, web pages, or mini-programs with intelligent question-and-answer functions.

[0206] Receiving problem information means receiving problem information entered by the user through the front-end interface.

[0207] The embodiments in this specification are... Figure 1 The embodiments in the specification are based on the same inventive concept. For the specific methods of steps 204 and 206, please refer to [link / reference needed]. Figure 1 Steps 104 and 106 in the embodiment will not be described again here.

[0208] In this embodiment, question information is received; the question information is input into a pre-trained retrieval model, and the question features corresponding to the question information are obtained by encoding with a first encoder. Based on the question features, the corresponding reference knowledge document is determined from a pre-constructed knowledge document set; the question features and the reference knowledge document are input into a pre-trained inference model, and the target answer information corresponding to the question information is obtained by encoding with a second encoder and then decoding. The parameters of the first encoder and the second encoder are identical. The identical parameters of the first encoder and the second encoder ensure that the pre-trained retrieval model and the inference model have consistent encoding performance. The performance of the two models is well-matched, guaranteeing that the reference knowledge document retrieved by the retrieval model can be accurately used to determine the target answer information corresponding to the question information, thus improving the accuracy of the target answer information.

[0209] Figure 3 This specification shows a flowchart of a risk control method according to an embodiment, which specifically includes the following steps:

[0210] Step 302: Receive query information indicating potential risks;

[0211] Step 304: Input the query information with risk into the pre-trained retrieval model, encode the query features corresponding to the query information with risk through the first encoder, and determine the corresponding risk knowledge document from the pre-built risk knowledge document set based on the query features;

[0212] Step 306: Input the query features and risk knowledge documents into the pre-trained inference model, encode them through the second encoder, and decode them to obtain the risk-free query results. The parameters of the first encoder and the second encoder are the same.

[0213] The embodiments in this specification apply to the client and / or server of applications, web pages, or mini-programs with risk control functions.

[0214] Receiving risky query information means receiving risky query information input by the user through the front-end interface. The risk knowledge document set can be a set of reference knowledge documents that can remove risks (as a positive example) or a set of reference knowledge documents that contain risks (as a negative example).

[0215] The embodiments in this specification are... Figure 1 The embodiments in the specification are based on the same inventive concept; for the specific methods of steps 304 and 306, please refer to [link / reference needed]. Figure 1 Steps 104 and 106 in the embodiment will not be described again here.

[0216] In this embodiment, a risky query is received; the risky query is input into a pre-trained retrieval model, and a first encoder encodes the query features corresponding to the risky query; based on the query features, a corresponding risk knowledge document is determined from a pre-constructed risk knowledge document set; the query features and the risk knowledge document are input into a pre-trained inference model, encoded by a second encoder, and decoded to obtain a risk-free query result. The parameters of the first and second encoders are identical. The identical parameters of the first and second encoders ensure that the pre-trained retrieval model and inference model have consistent encoding performance, and the performance of the two models is well-matched. This guarantees that the risk knowledge documents retrieved by the retrieval model can be accurately used to determine the risk-free query result, thus improving the accuracy of the risk-free query result.

[0217] Figure 4 This specification illustrates a flowchart of a data processing method for information retrieval according to an embodiment of the present invention. The method is applied to a cloud-side device and specifically includes the following steps:

[0218] Step 402: Obtain the first sample set, wherein the first sample set includes sample query information with corresponding relationships, sample knowledge documents, and sample query results;

[0219] Step 404: Input the sample query information into the retrieval model, encode the sample query features corresponding to the sample query information through the first encoding layer, and determine the corresponding reference knowledge document from the pre-built knowledge document set based on the sample query features;

[0220] Step 406: Calculate the second loss value based on the reference knowledge document and the sample knowledge document;

[0221] Step 408: When the second loss value reaches the preset second loss value threshold, the sample query features and reference knowledge documents are input into the inference model, encoded by the second encoder, and decoded to obtain the predicted query result corresponding to the sample query information;

[0222] Step 410: Calculate the third loss value based on the predicted query results and the sample query results;

[0223] Step 412: Determine the first loss value based on the second and third loss values;

[0224] Step 414: Adjust the parameters of the retrieval model and the inference model based on the first loss value to obtain the trained retrieval model and inference model;

[0225] Step 416: Send the parameters of the trained retrieval model and inference model to the edge device.

[0226] Cloud-side devices are network devices that provide model training capabilities; they are virtual devices. Edge devices are physical devices that host applications, web pages, or mini-programs with information retrieval functions. Edge devices and cloud-side devices connect via network channels for data transmission. Cloud-side devices have higher computing power than edge devices.

[0227] In the embodiments of this specification, steps 402 to 416 have been... Figure 1 Similar descriptions are given in the embodiments and will not be repeated here.

[0228] In this embodiment, the method is applied to a cloud-side device. A first sample set is acquired, comprising corresponding sample query information, sample knowledge documents, and sample query results. The sample query information is input into a retrieval model, encoded by a first encoding layer to obtain sample query features corresponding to the sample query information, and a corresponding reference knowledge document is determined from a pre-constructed knowledge document set based on the sample query features. A second loss value is calculated based on the reference knowledge document and the sample knowledge document. If the second loss value reaches a preset second loss value threshold, the sample query features and the reference knowledge document are input into an inference model, encoded by a second encoder, and decoded to obtain a predicted query result corresponding to the sample query information. A third loss value is calculated based on the predicted query result and the sample query result. A first loss value is determined based on the second and third loss values. The parameters of the retrieval model and the inference model are adjusted based on the first loss value to obtain a trained retrieval model and an inference model. The parameters of the trained retrieval model and the inference model are sent to the edge device. The first encoder and the second encoder have the same parameters, and the retrieval model and the inference model have consistent encoding performance. Only when the second loss value determined by the sample knowledge document and the reference knowledge document determined by the retrieval model reaches the loss value threshold can the reference knowledge document be input into the inference model in combination with the sample query information. The first loss value is determined by the second loss value corresponding to the retrieval model and the third loss value corresponding to the inference model. The parameters of the retrieval model and the inference model are adjusted respectively, realizing the joint training of the retrieval model and the inference model. This makes the performance of the two models compatible and improves the accuracy of subsequent information retrieval. At the same time, the model training is carried out on cloud-side devices with higher computing power, which improves training efficiency and training effect.

[0229] Figure 5 A flowchart illustrating an information retrieval method according to an embodiment of this specification is shown, such as... Figure 5 As shown:

[0230] The first sample set includes corresponding sample query information, sample knowledge documents, and sample query results. The sample query information and sample knowledge documents are multimodal data information, comprising both text and image modalities. The second sample set includes corresponding validation query information and validation query results. The validation query information is multimodal data information, comprising both text and image modalities. The third sample set includes corresponding pre-training query information and pre-training knowledge documents. The pre-training query information and pre-training knowledge documents are multimodal data information, comprising both text and image modalities.

[0231] First, a pre-trained retrieval model is obtained through pre-training of the retrieval model. This pre-trained model is then used for inference on a second sample set to construct the knowledge document set. Second, after initializing the retrieval model, the retrieval and inference models are pre-trained using the first sample set based on the knowledge document set. Finally, the retrieval and inference models are validated using a third sample set based on the knowledge document set.

[0232] Figure 6 This specification illustrates a pre-training diagram of an information retrieval method according to an embodiment, as shown below. Figure 6 As shown:

[0233] The process of calculating the pre-training loss value is as follows: For any batch (batch 1, batch 2, ... batch B) of pre-training query information and pre-training knowledge documents, the pre-training query information includes text query information and image query information, and the pre-training knowledge documents include reference knowledge text and reference knowledge images. The text query information and image query information are encoded to obtain query features, and the reference knowledge text and reference knowledge images are encoded to obtain document features, thus establishing the index. For the query features and document features of each batch, the maximum similarity is calculated, such as... Figure 1 As shown in Formulas 1 and 2 of the embodiment, the pre-training loss value is calculated.

[0234] Figure 7 The diagram illustrates a training schematic of an information retrieval method according to an embodiment of this specification, such as... Figure 7 As shown:

[0235] The pre-built knowledge document set includes multiple reference knowledge documents (e.g., reference knowledge document 1, reference knowledge document 2, and reference knowledge document 3). Each reference knowledge document includes a corresponding reference knowledge image and reference knowledge text (e.g., reference knowledge image 1 and reference knowledge text 1, reference knowledge image 2 and reference knowledge text 2, reference knowledge image 3 and reference knowledge text 3). Any reference knowledge document has corresponding document features (e.g., document features of reference knowledge document 1, document features of reference knowledge document 2, and document features of reference knowledge document 3).

[0236] During the pre-training process of the retrieval model and the inference model, the sample query information is input into the retrieval model. After the retrieval model obtains the query features through the first encoder, it determines the corresponding reference knowledge document from the pre-built knowledge document set. The query features and the reference knowledge document are input into the inference model. After being encoded by the second encoder and decoded by the decoder, the predicted query result is obtained.

[0237] Corresponding to the above method embodiments, this specification also provides embodiments of an information retrieval device. Figure 8 A schematic diagram of the structure of an information retrieval device according to one embodiment of this specification is shown. Figure 8 As shown, the device includes:

[0238] The first receiving module 802 is configured to receive query information;

[0239] The first retrieval module 804 is configured to input query information into a pre-trained retrieval model, encode the query information to obtain query features corresponding to the query information through a first encoder, and determine the corresponding reference knowledge document from a pre-built knowledge document set based on the query features.

[0240] The first inference module 806 is configured to input query features and reference knowledge documents into a pre-trained inference model, encode them through a second encoder, and decode them to obtain the target query result corresponding to the query information. The parameters of the first encoder and the second encoder are the same.

[0241] Optionally, the pre-training of the retrieval model and the inference model includes: adjusting the parameters of the retrieval model and the inference model respectively using a first loss value, wherein the first loss value is determined by a second loss value corresponding to the retrieval model and a third loss value corresponding to the inference model.

[0242] Optionally, the device further includes: a pre-training module configured to acquire a first sample set, wherein the first sample set includes corresponding sample query information, sample knowledge documents, and sample query results; input the sample query information into a retrieval model, encode the sample query information through a first encoding layer to obtain sample query features corresponding to the sample query information, and determine the corresponding reference knowledge document from a pre-constructed knowledge document set based on the sample query features; calculate a second loss value based on the reference knowledge document and the sample knowledge document; when the second loss value reaches a preset second loss value threshold, input the sample query features and the reference knowledge document into an inference model, encode them through a second encoder, and decode them to obtain the predicted query result corresponding to the sample query information; calculate a third loss value based on the predicted query result and the sample query result; determine a first loss value based on the second loss value and the third loss value; and adjust the parameters of the retrieval model and the inference model based on the first loss value to obtain the trained retrieval model and the inference model.

[0243] Optionally, the pre-training module is further configured to: acquire first sample query information, first sample knowledge document, and first sample query result from a public database; acquire second sample query information, second sample knowledge document, and second sample query result from a historical database; determine the sample query information, sample knowledge document, and sample query result, wherein the sample query information includes first sample query information and second sample query information, the sample knowledge document includes first sample knowledge document and second sample knowledge document, and the sample query result includes first sample query result and second sample query result; determine the correspondence between the sample query information, sample knowledge document, and sample query result; and construct a first sample set based on the correspondence.

[0244] Optionally, the inference model includes a second encoder and a decoder, and the pre-training module is further configured to: input the reference knowledge document into the second encoder to encode the document features corresponding to the reference knowledge document; input the sample query features and document features into the decoder, and decode the sample query features using the document features as prior features to obtain the predicted query results corresponding to the sample query information.

[0245] Optionally, the device further includes: a verification module configured to input verification query information into a retrieval model, encode the verification query information through a first encoding layer to obtain verification query features corresponding to the verification query information, and determine the corresponding reference knowledge document from a pre-constructed knowledge document set based on the verification query features; input the verification query features and the reference knowledge document into an inference model, encode them through a second encoder, and decode them to obtain the inference query result corresponding to the verification query information; calculate the verification loss value based on the inference query result and the verification query result; and adjust the parameters of the retrieval model and the inference model based on the verification loss value to obtain the verified retrieval model and the inference model.

[0246] Optionally, the verification module is further configured to: obtain third sample query information and third sample query results from a public database; obtain fourth sample query information and fourth sample query results from a historical database; determine verification query information and verification query results, wherein the verification query information includes third sample query information and fourth sample query information, and the verification query results include third sample query results and fourth sample query results; determine the correspondence between the verification query information and the verification query results; and construct a second sample set based on the correspondence.

[0247] Optionally, the device further includes: a construction module configured to acquire a third sample knowledge document from a public database; acquire a fourth sample knowledge document from a historical database; determine a reference knowledge document based on the third and fourth sample knowledge documents; input the reference knowledge document into a pre-trained retrieval model and encode the document features of the reference knowledge document through a first encoder; and construct a knowledge document set of the reference knowledge document based on the document features of the reference knowledge document.

[0248] Optionally, the device further includes: a pre-training module configured to acquire a third sample set, wherein the third sample set includes pre-trained query information and pre-trained knowledge documents with corresponding relationships; inputting the pre-trained query information into the retrieval model and encoding it through a first encoding layer to obtain pre-trained query features corresponding to the pre-trained query information; inputting the pre-trained knowledge documents into the retrieval model and encoding them through a first encoding layer to obtain pre-trained document features corresponding to the pre-trained knowledge documents; determining a pre-training loss value based on the feature similarity between the pre-trained query features and the pre-trained document features; and adjusting the parameters of the retrieval model according to the pre-training loss value to obtain a pre-trained retrieval model.

[0249] Optionally, the pre-training module is further configured to: acquire fifth sample query information and fifth sample knowledge document from a public database; acquire sixth sample query information and sixth sample knowledge document from a historical database; determine pre-training query information and pre-training knowledge document, wherein the pre-training query information includes fifth sample query information and sixth sample query information, and the pre-training knowledge document includes fifth sample knowledge document and sixth sample knowledge document; determine the correspondence between the pre-training query information and pre-training knowledge document; and construct a third sample set based on the correspondence.

[0250] Optionally, the pre-training query information is at least one batch of pre-training query information, and the pre-training knowledge documents are at least one batch of pre-training knowledge documents. The pre-training module is further configured to: calculate the feature similarity between the first batch of pre-training query features and the second batch of pre-training document features, wherein the first batch of pre-training query features are the pre-training query features of any batch of pre-training query information, and the second batch of pre-training query features are the pre-training document features of any batch of pre-training knowledge documents; and determine the pre-training loss value based on the feature similarity between the pre-training query features and pre-training document features of each batch.

[0251] Optionally, the query information includes text query information and image query information. The first encoder includes a first text encoder and a first image encoder. The first retrieval module 804 is further configured to: input the text query information into a pre-trained retrieval model and encode it through the first text encoder to obtain the text query features corresponding to the text query information; input the image query information into a pre-trained retrieval model and encode it through the first image encoder to obtain the image query features corresponding to the image query information; fuse the text query features and the image query features to obtain multimodal query features; and determine the corresponding reference knowledge document from a pre-constructed knowledge document set based on the multimodal query features, wherein the reference knowledge document includes reference knowledge text and reference knowledge image.

[0252] In the embodiments of this specification, the parameters of the first encoder and the second encoder are the same, and the pre-trained retrieval model and the inference model have consistent encoding performance. The performance of the two models is adapted to each other, ensuring that the reference knowledge documents retrieved by the retrieval model can be accurately used to determine the target query results corresponding to the query information, thereby improving the accuracy of the target query results.

[0253] The above is a schematic scheme of an information retrieval device according to this embodiment. It should be noted that the technical solution of this information retrieval device and the technical solution of the information retrieval method described above belong to the same concept. For details not described in detail in the technical solution of the information retrieval device, please refer to the description of the technical solution of the information retrieval method described above.

[0254] Corresponding to the above method embodiments, this specification also provides embodiments of intelligent question-answering devices. Figure 9 A schematic diagram of the structure of an intelligent question-answering device according to one embodiment of this specification is shown. Figure 9 As shown, the device includes:

[0255] The second receiving module 902 is configured to receive problem information;

[0256] The second retrieval module 904 is configured to input the question information into a pre-trained retrieval model, encode the question information to obtain the question features corresponding to the question information through the first encoder, and determine the corresponding reference knowledge document from a pre-built knowledge document set based on the question features.

[0257] The second reasoning module 906 is configured to input the problem features and reference knowledge documents into a pre-trained reasoning model, encode them through a second encoder, and decode them to obtain the target answer information corresponding to the problem information. The parameters of the first encoder and the second encoder are the same.

[0258] In the embodiments of this specification, the parameters of the first encoder and the second encoder are the same, and the pre-trained retrieval model and the inference model have consistent encoding performance. The performance of the two models is matched, which ensures that the reference knowledge documents retrieved by the retrieval model can be accurately used to determine the target answer information corresponding to the question information, thereby improving the accuracy of the target answer information.

[0259] The above is an illustrative scheme of an intelligent question-answering device according to this embodiment. It should be noted that the technical solution of this intelligent question-answering device and the technical solution of the intelligent question-answering method described above belong to the same concept. For details not described in detail in the technical solution of the intelligent question-answering device, please refer to the description of the technical solution of the intelligent question-answering method described above.

[0260] Corresponding to the above method embodiments, this specification also provides embodiments of risk control devices. Figure 10 A schematic diagram of a risk control device according to one embodiment of this specification is shown. Figure 10 As shown, the device includes:

[0261] The third receiving module 1002 is configured to receive query information that poses a risk;

[0262] The third retrieval module 1004 is configured to input the query information with risk into a pre-trained retrieval model, encode the query features corresponding to the query information with risk through the first encoder, and determine the corresponding risk knowledge document from the pre-built risk knowledge document set based on the query features.

[0263] The third inference module 1006 is configured to input query features and risk knowledge documents into a pre-trained inference model, encode them through a second encoder, and decode them to obtain a risk-free query result, wherein the parameters of the first encoder and the second encoder are the same.

[0264] In the embodiments of this specification, the parameters of the first encoder and the second encoder are the same, and the pre-trained retrieval model and the inference model have consistent encoding performance. The performance of the two models is matched, which ensures that the risk knowledge documents retrieved by the retrieval model can be accurately used to determine the risk-removing query results, thereby improving the accuracy of the risk-removing query results.

[0265] The above is a schematic scheme of a risk control device according to this embodiment. It should be noted that the technical solution of this risk control device and the technical solution of the risk control method described above belong to the same concept. For details not described in detail in the technical solution of the risk control device, please refer to the description of the technical solution of the risk control method described above.

[0266] Corresponding to the above method embodiments, this specification also provides embodiments of a data processing apparatus for information retrieval. Figure 11 A schematic diagram of the structure of a data processing apparatus for information retrieval provided in one embodiment of this specification is shown. Figure 11 As shown, this device is applied to cloud-side equipment, and the device includes:

[0267] The acquisition module 1102 is configured to acquire a first sample set, wherein the first sample set includes sample query information with corresponding relationships, sample knowledge documents and sample query results;

[0268] The fourth retrieval module 1104 is configured to input sample query information into the retrieval model, encode the sample query information through the first encoding layer to obtain the sample query features corresponding to the sample query information, and determine the corresponding reference knowledge document from the pre-built knowledge document set based on the sample query features.

[0269] The first calculation module 1106 is configured to calculate the second loss value based on the reference knowledge document and the sample knowledge document;

[0270] The fourth inference module 1108 is configured to input the sample query features and reference knowledge documents into the inference model when the second loss value reaches a preset second loss value threshold, encode them through the second encoder, and decode them to obtain the predicted query result corresponding to the sample query information.

[0271] The second calculation module 1110 is configured to calculate the third loss value based on the predicted query result and the sample query result.

[0272] The determination module 1112 is configured to determine the first loss value based on the second loss value and the third loss value;

[0273] Training module 1114 is configured to adjust the parameters of the retrieval model and the inference model based on the first loss value to obtain the trained retrieval model and the inference model.

[0274] The sending module 1116 is configured to send the parameters of the trained retrieval model and inference model to the edge device.

[0275] In the embodiments of this specification, the parameters of the first encoder and the second encoder are the same, and the retrieval model and the inference model have consistent encoding performance. Only when the second loss value determined by the sample knowledge document and the reference knowledge document determined by the retrieval model reaches the loss value threshold can the reference knowledge document be input into the inference model in combination with the sample query information. The first loss value is determined by the second loss value corresponding to the retrieval model and the third loss value corresponding to the inference model. The parameters of the retrieval model and the inference model are adjusted respectively, realizing the joint training of the retrieval model and the inference model. This makes the performance of the two models compatible and improves the accuracy of subsequent information retrieval. At the same time, the model training is carried out on cloud-side devices with higher computing power, which improves training efficiency and training effect.

[0276] The above is an illustrative scheme of an information retrieval data processing device according to this embodiment. It should be noted that the technical solution of this information retrieval data processing device and the technical solution of the information retrieval data processing method described above belong to the same concept. Details not described in detail in the technical solution of the information retrieval data processing device can be found in the description of the technical solution of the information retrieval data processing method described above.

[0277] Figure 12 A structural block diagram of a computing device according to one embodiment of this specification is shown. The components of the computing device 1200 include, but are not limited to, a memory 1210 and a processor 1220. The processor 1220 is connected to the memory 1210 via a bus 1230, and a database 1250 is used to store data.

[0278] The computing device 1200 also includes an access device 1240, which enables the computing device 1200 to communicate via one or more networks 1260. Examples of these networks include PSTN (Public Switched Telephone Network), LAN (Local Area Network), WAN (Wide Area Network), PAN (Personal Area Network), or combinations of communication networks such as the Internet. The access device 1240 may include one or more of any type of wired or wireless network interface (e.g., NIC (Network Interface Controller)), such as an IEEE 802.12 WLAN (Wireless Local Area Networks) wireless interface, a Wi-MAX (World Interoperability for Microwave Access) interface, an Ethernet interface, a USB (Universal Serial Bus) interface, a cellular network interface, a Bluetooth interface, an NFC (Near Field Communication) interface, and so on. In one embodiment of this specification, the above-described components of the computing device 1200 and Figure 12 Other components, not shown, can also be connected to each other, for example, via a bus. It should be understood that... Figure 12 The block diagram of the computing device shown is for illustrative purposes only and is not intended to limit the scope of this specification. Those skilled in the art can add or replace other components as needed.

[0279] The computing device 1200 can be any type of stationary or mobile computing device, including mobile computers or mobile computing devices (e.g., tablet computers, personal digital assistants, laptop computers, notebook computers, netbooks, etc.), mobile phones (e.g., smartphones), wearable computing devices (e.g., smartwatches, smart glasses, etc.) or other types of mobile devices, or stationary computing devices such as desktop computers or PCs (Personal Computers). The computing device 1200 can also be a mobile or stationary server.

[0280] The processor 1220 is configured to execute the following computer-executable instructions, which, when executed by the processor, implement the steps of the aforementioned information retrieval method, intelligent question answering method, risk prevention and control method, or information retrieval data processing method.

[0281] The above is an illustrative scheme of a computing device according to this embodiment. It should be noted that the technical solution of this computing device belongs to the same concept as the technical solutions of the information retrieval method, intelligent question answering method, risk prevention and control method, and information retrieval data processing method described above. For details not described in detail in the technical solution of the computing device, please refer to the descriptions of the technical solutions of the information retrieval method, intelligent question answering method, risk prevention and control method, or information retrieval data processing method described above.

[0282] An embodiment of this specification also provides a computer-readable storage medium storing computer-executable instructions that, when executed by a processor, implement the steps of the aforementioned information retrieval method, intelligent question-answering method, risk prevention and control method, or information retrieval data processing method.

[0283] The above is an illustrative scheme of a computer-readable storage medium according to this embodiment. It should be noted that the technical solution of this storage medium belongs to the same concept as the technical solutions of the aforementioned information retrieval method, intelligent question answering method, risk prevention and control method, and information retrieval data processing method. Details not described in detail in the technical solution of the storage medium can be found in the descriptions of the technical solutions of the aforementioned information retrieval method, intelligent question answering method, risk prevention and control method, or information retrieval data processing method.

[0284] An embodiment of this specification also provides a computer program, wherein when the computer program is executed in a computer, it causes the computer to perform the steps of the above-described information retrieval method, intelligent question answering method, risk prevention and control method, or information retrieval data processing method.

[0285] The above is an illustrative scheme of a computer program according to this embodiment. It should be noted that the technical solution of this computer program belongs to the same concept as the technical solutions of the information retrieval method, intelligent question answering method, risk prevention and control method, and information retrieval data processing method described above. For details not described in detail in the technical solution of the computer program, please refer to the descriptions of the technical solutions of the information retrieval method, intelligent question answering method, risk prevention and control method, or information retrieval data processing method described above.

[0286] The foregoing has described specific embodiments of this specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims may be performed in a different order than that shown in the embodiments and may still achieve the desired result. Furthermore, the processes depicted in the drawings do not necessarily require the specific or sequential order shown to achieve the desired result. In some embodiments, multitasking and parallel processing are possible or may be advantageous.

[0287] The computer instructions include computer program code, which may be in the form of source code, object code, executable file, or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording media, USB flash drive, portable hard drive, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc.

[0288] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that the embodiments in this specification are not limited to the described order of actions, because according to the embodiments in this specification, some steps can be performed in other orders or simultaneously. Furthermore, those skilled in the art should also understand that the embodiments described in this specification are all preferred embodiments, and the actions and modules involved are not necessarily essential to the embodiments in this specification.

[0289] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions in other embodiments.

[0290] The preferred embodiments disclosed above are merely illustrative of this specification. Optional embodiments do not exhaustively describe all details, nor do they limit the invention to the specific implementations described. Clearly, many modifications and variations can be made based on the embodiments described herein. These embodiments are selected and specifically described in this specification to better explain the principles and practical applications of the embodiments, thereby enabling those skilled in the art to better understand and utilize this specification. This specification is limited only by the claims and their full scope and equivalents.

Claims

1. An information retrieval method, comprising: Receive query information; The query information is input into a pre-trained retrieval model, and the query features corresponding to the query information are obtained by encoding through a first encoder. Based on the query features, the corresponding reference knowledge document is determined from a pre-built knowledge document set. The query features and the reference knowledge document are input into a pre-trained inference model, encoded by a second encoder, and decoded to obtain the target query result corresponding to the query information, wherein the parameters of the first encoder and the second encoder are the same; The pre-training of the retrieval model and the inference model includes: The parameters of the retrieval model and the inference model are adjusted using a first loss value, which is determined by a second loss value corresponding to the retrieval model and a third loss value corresponding to the inference model. When the second loss value reaches a preset second loss value threshold, the sample query features and the reference knowledge document are input into the inference model, encoded by a second encoder, and decoded to obtain the predicted query result corresponding to the sample query information. The predicted query result and the sample query result are used to calculate the result. The sample query information and the sample query result are derived from a first sample set, and the sample query features are encoded based on the sample query information.

2. The method according to claim 1, wherein the pre-training of the retrieval model and the inference model comprises: Obtain a first sample set, wherein the first sample set includes sample query information, sample knowledge documents and sample query results with corresponding relationships; The sample query information is input into the retrieval model, and the sample query features corresponding to the sample query information are obtained by encoding through the first encoding layer. Based on the sample query features, the corresponding reference knowledge document is determined from the pre-constructed knowledge document set. Based on the reference knowledge document and the sample knowledge document, the second loss value is calculated; When the second loss value reaches a preset second loss value threshold, the sample query features and the reference knowledge document are input into the inference model, encoded by the second encoder, and decoded to obtain the predicted query result corresponding to the sample query information; Based on the predicted query results and the sample query results, a third loss value is calculated; The first loss value is determined based on the second loss value and the third loss value; Based on the first loss value, the parameters of the retrieval model and the inference model are adjusted to obtain the trained retrieval model and inference model.

3. The method according to claim 2, wherein obtaining the first sample set comprises: Obtain first-sample query information, first-sample knowledge documents, and first-sample query results from public databases; Retrieve second sample query information, second sample knowledge documents, and second sample query results from historical databases; The sample query information, sample knowledge document, and sample query result are determined, wherein the sample query information includes the first sample query information and the second sample query information, the sample knowledge document includes the first sample knowledge document and the second sample knowledge document, and the sample query result includes the first sample query result and the second sample query result; Determine the correspondence between the sample query information, the sample knowledge document, and the sample query results; Based on the aforementioned correspondence, a first sample set is constructed.

4. The method according to claim 2, further comprising, after obtaining the trained retrieval model and inference model: Obtain a second sample set, wherein the second sample set includes verification query information and verification query results with object relationships; The verification query information is input into the retrieval model, and the verification query features corresponding to the verification query information are obtained by encoding through the first encoding layer. Based on the verification query features, the corresponding reference knowledge documents are determined from the pre-constructed knowledge document set. The verification query features and the reference knowledge document are input into the inference model, encoded by the second encoder, and then decoded to obtain the inference query result corresponding to the verification query information. Based on the inference query result and the verification query result, the verification loss value is calculated; Based on the verification loss value, the parameters of the retrieval model and the inference model are adjusted to obtain the verified retrieval model and inference model.

5. The method according to claim 4, wherein obtaining the second sample set comprises: Obtain third-sample query information and results from public databases; Obtain the fourth sample query information and the fourth sample query results from the historical database; Determine the verification query information and the verification query result, wherein the verification query information includes the third sample query information and the fourth sample query information, and the verification query result includes the third sample query result and the fourth sample query result; Determine the correspondence between the verification query information and the verification query result; Based on the aforementioned correspondence, a second sample set is constructed.

6. The method according to any one of claims 1-5, wherein the construction of the knowledge document set comprises: Obtain third-party sample knowledge documents from public databases; Obtain the fourth sample knowledge document from the historical database; Based on the third sample knowledge document and the fourth sample knowledge document, a reference knowledge document is determined; The reference knowledge document is input into a pre-trained retrieval model, and the document features of the reference knowledge document are obtained by encoding through the first encoder; Based on the document features of the reference knowledge document, a knowledge document set of the reference knowledge document is constructed.

7. The method according to claim 6, wherein the pre-training of the retrieval model comprises: Obtain a third sample set, wherein the third sample set includes pre-trained query information and pre-trained knowledge documents with corresponding relationships; The pre-trained query information is input into the retrieval model, and the pre-trained query features corresponding to the pre-trained query information are obtained by encoding through the first encoding layer. The pre-trained knowledge document is input into the retrieval model, and the pre-trained document features corresponding to the pre-trained knowledge document are obtained by encoding through the first encoding layer. The pre-training loss value is determined based on the feature similarity between the pre-trained query features and the pre-trained document features. Based on the pre-training loss value, the parameters of the retrieval model are adjusted to obtain the pre-trained retrieval model.

8. The method according to claim 7, wherein obtaining the third sample set comprises: Obtain fifth sample query information and fifth sample knowledge documents from public databases; Obtain sixth sample query information and sixth sample knowledge document from historical database; Determine pre-training query information and pre-training knowledge documents, wherein the pre-training query information includes the fifth sample query information and the sixth sample query information, and the pre-training knowledge documents include the fifth sample knowledge documents and the sixth sample knowledge documents; Determine the correspondence between the pre-training query information and the pre-training knowledge document; Based on the aforementioned correspondence, a third sample set is constructed.

9. The method according to claim 1, wherein the query information includes text query information and image query information, and the first encoder includes a first text encoder and a first image encoder; The step of inputting the query information into a pre-trained retrieval model, encoding the query features corresponding to the query information through a first encoder, and determining the corresponding reference knowledge document from a pre-built knowledge document set based on the query features includes: The text query information is input into a pre-trained retrieval model, and the text query features corresponding to the text query information are obtained by encoding the text query information through a first text encoder. The image query information is input into a pre-trained retrieval model, and the image query features corresponding to the image query information are obtained by encoding the image query information through a first image encoder. The text query features and the image query features are fused to obtain multimodal query features; Based on the multimodal query features, corresponding reference knowledge documents are determined from a pre-constructed knowledge document set, wherein the reference knowledge documents include reference knowledge text and reference knowledge images.

10. An intelligent question-answering method, comprising: Receive problem information; The problem information is input into a pre-trained retrieval model, and the problem features corresponding to the problem information are obtained by encoding through the first encoder. Based on the problem features, the corresponding reference knowledge documents are determined from a pre-built knowledge document set. The problem features and the reference knowledge document are input into a pre-trained reasoning model, encoded by a second encoder, and decoded to obtain the target answer information corresponding to the problem information, wherein the parameters of the first encoder and the second encoder are the same; The pre-training of the retrieval model and the inference model includes: The parameters of the retrieval model and the inference model are adjusted using a first loss value, which is determined by a second loss value corresponding to the retrieval model and a third loss value corresponding to the inference model. When the second loss value reaches a preset second loss value threshold, the sample query features and the reference knowledge document are input into the inference model, encoded by a second encoder, and decoded to obtain the predicted query result corresponding to the sample query information. The predicted query result and the sample query result are used to calculate the result. The sample query information and the sample query result are derived from a first sample set, and the sample query features are encoded based on the sample query information.

11. A risk prevention and control method, comprising: Receive queries that pose a risk; The query information indicating the existence of risk is input into a pre-trained retrieval model, and the query features corresponding to the query information are obtained by encoding through the first encoder. Based on the query features, the corresponding risk knowledge document is determined from a pre-constructed risk knowledge document set. The query features and the risk knowledge document are input into a pre-trained inference model, encoded by a second encoder, and decoded to obtain a risk-free query result, wherein the parameters of the first encoder and the second encoder are the same; The pre-training of the retrieval model and the inference model includes: The parameters of the retrieval model and the inference model are adjusted using a first loss value, which is determined by a second loss value corresponding to the retrieval model and a third loss value corresponding to the inference model. When the second loss value reaches a preset second loss value threshold, the sample query features and the risk knowledge document are input into the inference model, encoded by a second encoder, and decoded to obtain the predicted query result corresponding to the sample query information. The predicted query result and the sample query result are used to calculate the result. The sample query information and the sample query result are derived from a first sample set, and the sample query features are encoded based on the sample query information.

12. A data processing method for information retrieval, applied to cloud-side devices, comprising: Obtain a first sample set, wherein the first sample set includes sample query information, sample knowledge documents and sample query results with corresponding relationships; The sample query information is input into the retrieval model, and the sample query features corresponding to the sample query information are obtained by encoding through the first encoding layer. Based on the sample query features, the corresponding reference knowledge document is determined from the pre-constructed knowledge document set. Based on the reference knowledge document and the sample knowledge document, the second loss value is calculated; When the second loss value reaches a preset second loss value threshold, the sample query features and the reference knowledge document are input into the inference model, encoded by the second encoder, and decoded to obtain the predicted query result corresponding to the sample query information; Based on the predicted query results and the sample query results, a third loss value is calculated; The first loss value is determined based on the second loss value and the third loss value; Based on the first loss value, adjust the parameters of the retrieval model and the inference model to obtain the trained retrieval model and inference model; The parameters of the trained retrieval model and inference model are sent to the edge device.

13. A computing device, comprising: Memory and processor; The memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions. When the computer-executable instructions are executed by the processor, they implement the steps of the information retrieval method according to any one of claims 1 to 9, or the intelligent question-answering method according to claim 10, or the risk prevention and control method according to claim 11, or the data processing method for information retrieval according to claim 12.

14. A computer program product comprising computer instructions that, when executed by a processor, implement the steps of the information retrieval method of any one of claims 1 to 9, or the intelligent question-answering method of claim 10, or the risk prevention and control method of claim 11, or the data processing method of the information retrieval method of claim 12.

Citation Information

Patent Citations

  • Cross-modal image-text retrieval method

    CN114911914A