Artificial intelligence-based query processing method and device, computer equipment and medium

Through the query processing method combining inverted index and vector index, and combining large language models to generate answers and evaluate joint scores, the problem of insufficient search accuracy in the existing technology is solved, and the accuracy and relevance of answers are improved.

CN119166763AActive Publication Date: 2024-12-20PING AN TECH (SHENZHEN) CO LTD

Patent Information

Application Number
CN202411124031.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-15
Publication Date
2024-12-20
Estimated Expiration
2044-08-15

AI Technical Summary

Technical Problem

The existing question-and-answer system based on large language models is difficult to ensure the retrieval accuracy under the complexity of the knowledge base content and the ambiguity or ambiguity of the query statement, which affects the accuracy and relevance of the answers.

Method used

A query processing method combining inverted index and vector index is adopted, through word segmentation processing and word embedding model coding, answer prompt words and correlation prompt words are constructed, answers are generated using large language models and joint scores are evaluated, and the optimal answer is selected.

Benefits of technology

It improves the accuracy and relevance of the answers of query information, ensures the accuracy and relevance of the answers, and solves the problem of insufficient retrieval accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119166763A_ABST
    Figure CN119166763A_ABST
Patent Text Reader

Abstract

The invention belongs to the field of artificial intelligence and the field of financial science and technology, and relates to an artificial intelligence-based query processing method and device, computer equipment and a storage medium, and the method comprises the following steps: based on a retrieval strategy, retrieving a first document list and a second document list corresponding to query information from a knowledge base; combining and sorting the first text list and the second document list to screen a specified document; establishing an answer prompt word based on the specified document and the query information, and processing the answer prompt word based on a large language model to obtain an answer; processing a correlation cue word constructed based on the specified document and the query information through a large language model to obtain a correlation score; constructing a combined information pair based on the answer, the specified document and the query information, and calculating a joint score of the combined information pair; and obtaining a target answer and a target document of the target combination information with the highest joint score in the combination information pair, and returning the target answer and the target document to the user. According to the method and the device, the answer accuracy and correlation of the query information are effectively improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of artificial intelligence development technology and the field of financial technology, and in particular to artificial intelligence-based query processing methods, devices, computer equipment and storage media. Background Art

[0002] With the rapid development of financial technology and artificial intelligence, financial enterprises have an increasing demand for efficient and accurate customer service. In order to improve user experience, reduce manual customer service costs, and quickly respond to customer inquiries, financial enterprises widely use question-answering systems based on large language models (such as ChatGPT). Such systems are usually combined with external knowledge bases to achieve intelligent answers to complex financial problems.

[0003] In the prior art, a common implementation method is to use the user's query as input and first search the external knowledge base to find the documents most relevant to the query content. This step aims to use the richness and professionalism of the knowledge base to provide basic materials for subsequent answer generation. However, using the retrieved document content and the user query together as a prompt (pr ompt) of a large language model (such as ChatGPT), although it can use the powerful reasoning ability of the large language model to generate answers, this method has retrieval accuracy problems in practical applications. Due to the complexity and diversity of the knowledge base content, as well as the fuzziness or ambiguity of the query statement, the retrieval process is often difficult to ensure that the documents that are completely relevant to the user query can be accurately matched every time. This may cause the retrieved documents to deviate from the actual needs of the user, thereby affecting the accuracy and relevance of subsequent answers. Summary of the invention

[0004] The purpose of the embodiments of the present application is to propose a query processing method, apparatus, computer equipment and storage medium based on artificial intelligence to solve the existing method of using a large language model to generate answers. Due to the complexity and diversity of the knowledge base content and the fuzziness or ambiguity of the query statement, the retrieval process is often difficult to ensure that the documents that are completely relevant to the user's query can be accurately matched every time. This may cause the retrieved documents to deviate from the actual needs of the user, thereby affecting the accuracy and relevance of the subsequent answers.

[0005] In order to solve the above technical problems, the embodiment of the present application provides a query processing method based on artificial intelligence, which adopts the following technical solution:

[0006] Acquire query information input by a user, and retrieve a first document list corresponding to the query information from a pre-built knowledge base based on a preset inverted index retrieval strategy;

[0007] Retrieving a second document list corresponding to the query information from the knowledge base based on a preset vector index retrieval strategy;

[0008] Merging and sorting the first text list and the second document list to filter out a preset number of designated documents;

[0009] Constructing answer prompt words based on the designated document and the query information, and processing the answer prompt words based on a preset large language model to obtain an answer corresponding to the designated document;

[0010] Constructing relevance prompt words based on the designated document and the query information, and processing the relevance prompt words based on the large language model to obtain a relevance score between the designated document and the query information;

[0011] constructing a corresponding combined information pair based on the answer, the designated document and the query information, and calculating a joint score of the combined information pair based on the relevance score;

[0012] Filter out a target combined information pair with the highest joint score from all the combined information pairs, and obtain a target answer and a target document in the target combined information pair;

[0013] The target answer and the target document are returned to the user.

[0014] Furthermore, the step of retrieving a first document list corresponding to the query information from a pre-built knowledge base based on a preset inverted index retrieval strategy specifically includes:

[0015] Performing word segmentation processing on the query information to obtain corresponding query word segments;

[0016] Performing inverted index query processing on the knowledge base based on the query participle to obtain a document relevance score between the query participle and each first document included in the knowledge base;

[0017] Sort all the first documents based on the document relevance scores to obtain a corresponding inverted index result list;

[0018] The inverted index result list is used as the first document list.

[0019] Furthermore, the step of retrieving a second document list corresponding to the query information from the knowledge base based on a preset vector index retrieval strategy specifically includes:

[0020] Encoding the query information based on a preset word embedding model to obtain a corresponding query vector;

[0021] Performing vector index query processing on the knowledge base based on the query vector to obtain a similarity score between the query vector and each second document included in the knowledge base;

[0022] Sort all documents based on the similarity scores to obtain a corresponding vector index result list;

[0023] The vector index result list is used as the second document list.

[0024] Furthermore, the step of merging and sorting the first text list and the second document list to filter out a preset number of designated documents specifically includes:

[0025] Merging the first document list and the second document list to obtain a corresponding designated document list;

[0026] Obtain a first weight corresponding to the inverted index, and obtain a second weight corresponding to the vector index;

[0027] Based on the first weight and the second weight, a preset calculation formula is called to calculate the relevance score and the similarity score corresponding to each third document included in the designated document list to obtain a comprehensive score of each third document;

[0028] Sorting the third documents in descending order according to their comprehensive scores to obtain a corresponding sorted list;

[0029] A preset number of fourth documents with the highest comprehensive scores are selected from the sorted list, and the fourth documents are used as the designated documents.

[0030] Furthermore, the step of constructing answer prompt words based on the designated document and the query information, and processing the answer prompt words based on a preset large language model to obtain an answer corresponding to the designated document specifically includes:

[0031] Get the preset answer prompt word template;

[0032] Input the designated document and the query information into the answer prompt word template to obtain the answer prompt word;

[0033] Calling the large language model;

[0034] The answer prompt word is input into the large language model, the answer prompt word is processed by the large language model, and the answer corresponding to the designated document output by the large language model is received.

[0035] Furthermore, the step of calculating the joint score of the combined information pair based on the correlation score specifically includes:

[0036] Obtaining a specific answer, a specific document, and query information contained in a specified combination information pair; wherein the specified combination information is any one of all the combination information pairs;

[0037] Obtaining a specified relevance score between the specific document and the query information;

[0038] Obtaining a specified output probability corresponding to the specific answer;

[0039] A specified joint score of the specified combination information pair is generated based on the specified relevance score and the specified output probability.

[0040] Furthermore, the step of generating a specified joint score of the specified combination information pair based on the specified correlation score and the specified output probability specifically includes:

[0041] Obtain the preset joint calculation algorithm;

[0042] Calculate the specified correlation score and the output probability based on the joint calculation algorithm to obtain a corresponding calculation result;

[0043] The calculation result is used as the designated joint score of the designated combination information pair.

[0044] In order to solve the above technical problems, the embodiment of the present application further provides a query processing device based on artificial intelligence, which adopts the following technical solution:

[0045] A first retrieval module is used to obtain query information input by a user, and retrieve a first document list corresponding to the query information from a pre-built knowledge base based on a preset inverted index retrieval strategy;

[0046] A second retrieval module, configured to retrieve a second document list corresponding to the query information from the knowledge base based on a preset vector index retrieval strategy;

[0047] A screening module, used for merging and sorting the first text list and the second document list to screen out a preset number of designated documents;

[0048] A first processing module, configured to construct an answer prompt word based on the designated document and the query information, and to process the answer prompt word based on a preset large language model to obtain an answer corresponding to the designated document;

[0049] A second processing module is used to construct a relevance prompt word based on the designated document and the query information, and to process the relevance prompt word based on the large language model to obtain a relevance score between the designated document and the query information;

[0050] a calculation module, configured to construct a corresponding combination information pair based on the answer, the designated document and the query information, and calculate a joint score of the combination information pair based on the relevance score;

[0051] An acquisition module, used for selecting a target combination information pair with the highest joint score from all the combination information pairs, and acquiring a target answer and a target document from the target combination information pair;

[0052] A return module is used to return the target answer and the target document to the user.

[0053] In order to solve the above technical problems, the embodiment of the present application further provides a computer device, which adopts the following technical solution:

[0054] Acquire query information input by a user, and retrieve a first document list corresponding to the query information from a pre-built knowledge base based on a preset inverted index retrieval strategy;

[0055] Retrieving a second document list corresponding to the query information from the knowledge base based on a preset vector index retrieval strategy;

[0056] Merging and sorting the first text list and the second document list to filter out a preset number of designated documents;

[0057] Constructing answer prompt words based on the designated document and the query information, and processing the answer prompt words based on a preset large language model to obtain an answer corresponding to the designated document;

[0058] Constructing relevance prompt words based on the designated document and the query information, and processing the relevance prompt words based on the large language model to obtain a relevance score between the designated document and the query information;

[0059] constructing a corresponding combined information pair based on the answer, the designated document and the query information, and calculating a joint score of the combined information pair based on the relevance score;

[0060] Filter out a target combined information pair with the highest joint score from all the combined information pairs, and obtain a target answer and a target document in the target combined information pair;

[0061] The target answer and the target document are returned to the user.

[0062] In order to solve the above technical problems, the embodiment of the present application further provides a computer-readable storage medium, which adopts the following technical solution:

[0063] Acquire query information input by a user, and retrieve a first document list corresponding to the query information from a pre-built knowledge base based on a preset inverted index retrieval strategy;

[0064] Retrieving a second document list corresponding to the query information from the knowledge base based on a preset vector index retrieval strategy;

[0065] Merging and sorting the first text list and the second document list to filter out a preset number of designated documents;

[0066] Constructing answer prompt words based on the designated document and the query information, and processing the answer prompt words based on a preset large language model to obtain an answer corresponding to the designated document;

[0067] Constructing relevance prompt words based on the designated document and the query information, and processing the relevance prompt words based on the large language model to obtain a relevance score between the designated document and the query information;

[0068] constructing a corresponding combined information pair based on the answer, the designated document and the query information, and calculating a joint score of the combined information pair based on the relevance score;

[0069] Filter out a target combined information pair with the highest joint score from all the combined information pairs, and obtain a target answer and a target document in the target combined information pair;

[0070] The target answer and the target document are returned to the user.

[0071] Compared with the prior art, the embodiments of the present application have the following beneficial effects:

[0072] The present application first obtains the query information input by the user, and retrieves a first document list corresponding to the query information from a pre-built knowledge base based on a preset inverted index retrieval strategy; and retrieves a second document list corresponding to the query information from the knowledge base based on a preset vector index retrieval strategy; then merges and sorts the first text list and the second document list to filter out a preset number of designated documents; then constructs answer prompt words based on the designated document and the query information, and processes the answer prompt words based on a preset large language model to obtain an answer corresponding to the designated document; subsequently, constructs relevance prompt words based on the designated document and the query information, and processes the relevance prompt words based on the large language model to obtain a relevance score between the designated document and the query information; further constructs a corresponding combined information pair based on the answer, the designated document and the query information, and calculates a joint score of the combined information pair based on the relevance score; finally, a target combined information pair with the highest joint score is filtered out from all the combined information pairs, and a target answer and a target document in the target combined information pair are obtained, and then the target answer and the target document are returned to the user. In the process of processing the query information input by the user, the present application combines the inverted index retrieval and vector index retrieval strategies to screen out a preset number of specified documents, and then generates an answer corresponding to the query information based on the use of answer prompt words, relevance prompt words and a large language model and evaluates the corresponding joint score. Therefore, according to the joint score, the best answer can be selected from multiple candidate answers and returned to the user, effectively improving the accuracy and relevance of the answer to the query information. BRIEF DESCRIPTION OF THE DRAWINGS

[0073] In order to more clearly illustrate the scheme in the present application, a brief introduction is given below to the drawings required for use in the description of the embodiments of the present application. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0074] Figure 1 is an exemplary system architecture diagram to which the present application may be applied;

[0075] Figure 2 A flowchart of an embodiment of an artificial intelligence-based query processing method according to the present application;

[0076] Figure 3 is a structural schematic diagram of an embodiment of an artificial intelligence-based query processing device according to the present application;

[0077] Figure 4 It is a structural diagram of an embodiment of a computer device according to the present application. DETAILED DESCRIPTION

[0078] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by technicians in the technical field of the present application; the terms used in the specification of the application herein are only for the purpose of describing specific embodiments and are not intended to limit the present application; the terms "including" and "having" and any variations thereof in the specification and claims of the present application and the above-mentioned drawings are intended to cover non-exclusive inclusions. The terms "first", "second", etc. in the specification and claims of the present application or the above-mentioned drawings are used to distinguish different objects, not to describe a specific order.

[0079] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.

[0080] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the accompanying drawings.

[0081] like Figure 1 As shown, the system architecture 100 may include terminal devices 101, 102, 103, a network 104 and a server 105. The network 104 is used to provide a medium for communication links between the terminal devices 101, 102, 103 and the server 105. The network 104 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.

[0082] Users can use terminal devices 101, 102, 103 to interact with server 105 through network 104 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 101, 102, 103, such as web browser applications, shopping applications, search applications, instant messaging tools, email clients, social platform software, etc.

[0083] The terminal devices 101, 102, and 103 can be various electronic devices with display screens and supporting web browsing, including but not limited to smart phones, tablet computers, e-book readers, MP3 players (Moving Picture Experts Group Audio Layer III), MP4 (Moving Picture Experts Group Audio Layer IV) players, laptop computers, desktop computers, and the like.

[0084] The server 105 may be a server that provides various services, such as a background server that provides support for web pages displayed on the terminal devices 101 , 102 , and 103 .

[0085] It should be noted that the artificial intelligence-based query processing method provided in the embodiment of the present application is generally executed by a server / terminal device, and accordingly, the artificial intelligence-based query processing device is generally arranged in the server / terminal device.

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

[0087] Continue to refer Figure 2 , showing a flow chart of an embodiment of an artificial intelligence-based query processing method according to the present application. According to different requirements, the order of the steps in the flow chart can be changed, and some steps can be omitted. The artificial intelligence-based query processing method provided in the embodiment of the present application can be applied to any scenario where query processing is required, and the artificial intelligence-based query processing method can be applied to products in these scenarios, for example, query processing in the financial insurance field. The artificial intelligence-based query processing method comprises the following steps:

[0088] Step S201: obtaining query information input by a user, and retrieving a first document list corresponding to the query information from a pre-built knowledge base based on a preset inverted index retrieval strategy.

[0089] In this embodiment, the query processing method based on artificial intelligence is executed on the electronic device (e.g. Figure 1The server / terminal device shown in the figure) can obtain the query information input by the user through a wired connection method or a wireless connection method. It should be pointed out that the above-mentioned wireless connection method may include but is not limited to 3G / 4G / 5G connection, Wi F i connection, Bluetooth connection, Wi MAX connection, Zigbee connection, UWB (Ultra Wi DeBand) connection, and other wireless connection methods currently known or to be developed in the future. The present application can be applied to the business scenario of the unified search function of a financial enterprise, or it can also be applied to the business scenario of question retrieval for related documents. The above-mentioned query information can be a question input by the user. The above-mentioned knowledge base is a pre-built plug-in knowledge base corresponding to the large language model, which is independent of the large language model, and the knowledge base stores a piece of data in units of one document. Among them, the specific implementation process of retrieving the first document list corresponding to the query information from the pre-built knowledge base based on the preset inverted index retrieval strategy will be further described in detail in the subsequent specific embodiments of the present application, and will not be elaborated on here.

[0090] Step S202: retrieve a second document list corresponding to the query information from the knowledge base based on a preset vector index retrieval strategy.

[0091] In this embodiment, the specific implementation process of retrieving the second document list corresponding to the query information from the knowledge base based on the preset vector index retrieval strategy will be further described in detail in subsequent specific embodiments of the present application and will not be elaborated on here.

[0092] Step S203: merge and sort the first text list and the second document list to filter out a preset number of designated documents.

[0093] In this embodiment, the specific implementation process of merging and sorting the first text list and the second document list to screen out a preset number of specified documents will be further described in detail in subsequent specific embodiments of the present application and will not be elaborated on here.

[0094] Step S204: construct answer prompt words based on the designated document and the query information, and process the answer prompt words based on a preset large language model to obtain an answer corresponding to the designated document.

[0095] In the present embodiment, the specific implementation process of constructing answer prompt words based on the designated document and the query information, and processing the answer prompt words based on a preset large language model to obtain an answer corresponding to the designated document will be described in further detail in subsequent specific embodiments of the present application and will not be elaborated on here.

[0096] Step S205 , constructing relevance prompt words based on the designated document and the query information, and processing the relevance prompt words based on the large language model to obtain a relevance score between the designated document and the query information.

[0097] In this embodiment, a relevance prompt word template can be pre-constructed according to the actual prompt word template construction requirements. Specifically, the template content of the relevance prompt word template includes: calculating the relevance between the question [q] and the document [d], with a score ranging from 1 to 9 points, and the higher the score, the higher the relevance. [d]: (document text). [q]: (query text). By inputting the specified document and the query information into the corresponding positions in the relevance prompt word template, that is, inputting the specified document into the [d] position in the above-mentioned relevance prompt word template, and inputting the query information into the [q] position in the relevance prompt word template, the relevance prompt word is obtained. Then, the large language model is called, and the relevance prompt word is input into the large language model, the relevance prompt word is processed by the large language model, and the relevance score between the specified document and the query information output by the large language model is received. Among them, the large language model may return a score in text form, or a text paragraph containing the score. The pre-written code can be called to parse this response, and the corresponding relevance score is extracted and stored. In addition, if the answer output by the large language model is [cannot answer], the relevance score is set to 0. And since the relevance score of the answer corresponding to [cannot answer] is 0, the product is still 0 after multiplication, which means that the current answer should be rejected and will not be adopted in the future.

[0098] Step S206: construct a corresponding combined information pair based on the answer, the designated document and the query information, and calculate a joint score of the combined information pair based on the relevance score.

[0099] In this embodiment, the specific implementation process of calculating the joint score of the combination information pair based on the correlation score will be further described in detail in subsequent specific embodiments of the present application, and will not be elaborated on here.

[0100] Step S207, screening out a target combined information pair with the highest joint score from all the combined information pairs, and obtaining a target answer and a target document from the target combined information pair.

[0101] In this embodiment, the joint scores of all the combined information pairs can be traversed, and the target combined information pair with the highest joint score can be screened out from all the combined information pairs according to the joint score, and then the target answer and target document in the target combined information pair can be obtained.

[0102] Step S208: returning the target answer and the target document to the user.

[0103] In this embodiment, the target answer is taken as the final answer corresponding to the query information input by the user, and the target answer and the target document are returned to the user.

[0104] The present application first obtains the query information input by the user, and retrieves a first document list corresponding to the query information from a pre-built knowledge base based on a preset inverted index retrieval strategy; and retrieves a second document list corresponding to the query information from the knowledge base based on a preset vector index retrieval strategy; then merges and sorts the first text list and the second document list to filter out a preset number of designated documents; then constructs answer prompt words based on the designated document and the query information, and processes the answer prompt words based on a preset large language model to obtain an answer corresponding to the designated document; subsequently, constructs relevance prompt words based on the designated document and the query information, and processes the relevance prompt words based on the large language model to obtain a relevance score between the designated document and the query information; further constructs a corresponding combined information pair based on the answer, the designated document and the query information, and calculates a joint score of the combined information pair based on the relevance score; finally, a target combined information pair with the highest joint score is filtered out from all the combined information pairs, and a target answer and a target document in the target combined information pair are obtained, and then the target answer and the target document are returned to the user. In the process of processing the query information input by the user, the present application combines the inverted index retrieval and vector index retrieval strategies to screen out a preset number of specified documents, and then generates an answer corresponding to the query information based on the use of answer prompt words, relevance prompt words and a large language model and evaluates the corresponding joint score. Therefore, according to the joint score, the best answer can be selected from multiple candidate answers and returned to the user, effectively improving the accuracy and relevance of the answer to the query information.

[0105] In some optional implementations, the retrieving a first document list corresponding to the query information from a pre-built knowledge base based on a preset inverted index retrieval strategy in step S201 includes the following steps:

[0106] The query information is segmented to obtain corresponding query segmentations.

[0107] In this embodiment, the above-mentioned word segmentation is a process of splitting the query information into independent words (or called terms), and at the same time storing the document IDs where each word appears. Specifically, word segmentation processing can be implemented through regular expressions, natural language processing libraries (such as NLTK, spaCy, etc.). Specifically, the process of constructing an inverted index for the knowledge base includes: 1. Initializing the data structure: Create a data structure (such as a hash table or a dictionary) to store the inverted index. This structure maps terms to a list of document IDs containing that term. Among them, read all the documents pre-stored in the knowledge base, and perform word segmentation processing on each document to split it into corresponding terms. In addition, stop words can be removed from the documents to improve the retrieval efficiency. Specifically, those common words that are not very helpful for understanding the document content, such as "de" (of), "shi" (is), etc., can be removed. And perform lemmatization processing on the words, specifically restore the words to their basic forms (stems or roots) to reduce the diversity of words, and then improve the accuracy of retrieval. 2. Traversing the word segmentation results: For each document, traverse its word segmentation results. For each term, check whether it is already in the inverted index. If it is not in the inverted index, add the term to the index and initialize its corresponding list of document IDs to a list containing the current document ID. If it is in the inverted index, add the current document ID to the list of document IDs corresponding to that term. 3. Storing the inverted index: Save the constructed inverted index to disk or memory for subsequent retrieval use.

[0108] Perform an inverted index query process on the knowledge base based on the query word segmentation to obtain the document relevance scores between the query word segmentation and each first document contained in the knowledge base.

[0109] In this embodiment, the process of the inverted index query process specifically includes: Traverse each term in the query word segmentation. Search for the list of document IDs corresponding to each term in the inverted index of the knowledge base. For each term, collect its corresponding document IDs and calculate the relevance scores of these documents to the query information. Specifically, TF-IDF can be used to evaluate the importance of a term in a document. If a document appears in the document ID lists of multiple terms, accumulate its relevance score.

[0110] Sort all the first documents based on the document relevance scores to obtain a corresponding inverted index result list.

[0111] In this embodiment, the process of generating the inverted index result list includes: Sort all the documents according to the accumulated relevance scores. Create a list containing tuples of (document ID, accumulated score) and sort them in descending order of score, thereby obtaining the above-mentioned inverted index result list.

[0112] Use the inverted index result list as the first document list.

[0113] The present application obtains the corresponding query participles by performing word segmentation processing on the query information; then performs inverted index query processing on the knowledge base based on the query participles to obtain the document relevance scores between the query participles and each first document contained in the knowledge base; then sorts all the first documents based on the document relevance scores to obtain the corresponding inverted index result list; and subsequently uses the inverted index result list as the first document list. The present application uses the query information to perform inverted index retrieval on the knowledge base based on an inverted index retrieval strategy, so as to quickly and accurately retrieve relevant documents corresponding to the query information in the knowledge base, and obtain a first document list based on keyword matching, thereby improving the intelligence of generating the first document list and ensuring the data accuracy of the obtained first document list.

[0114] In some optional implementations of this embodiment, step S202 includes the following steps:

[0115] The query information is encoded based on a preset word embedding model to obtain a corresponding query vector.

[0116] In this embodiment, there is no specific limitation on the selection of the above-mentioned word embedding model, which can be determined according to the actual business use requirements. For example, BERT, Word2Vec, GloVe and other models can be used. The above-mentioned query information can be input into the word embedding model to obtain the word vector corresponding to the query information, that is, the query vector after encoding the query information is obtained. Specifically, the process of constructing a vector index for the knowledge base includes: 1. Encoding terms: Encode each term in the document using the selected word embedding model. Specifically, the term is input into the model and its corresponding word vector is obtained. 2. Vectorized storage: Use efficient vector search libraries such as Faiss to store the encoded word vector. Faiss supports multiple index types, such as Flat Index, IVF (Inverted File Index with Quantization), etc., which can be selected according to your specific needs. For document-level vectors, a vector representing the entire document is obtained by aggregating all word vectors in the document (such as average, weighted average, TF-IDF weighted, etc.). These document vectors are then stored in the Faiss index to obtain the corresponding vector index for subsequent vector similarity calculation.

[0117] A vector index query process is performed on the knowledge base based on the query vector to obtain a similarity score between the query vector and each second document included in the knowledge base.

[0118] In this embodiment, the process of vector index query processing specifically includes: using a vector search library such as Faiss to compare the query vector with the document vectors stored in the index of the knowledge base, and calculating the similarity score between the query vector and each document vector based on the vector similarity (such as cosine similarity).

[0119] All documents are sorted based on the similarity scores to obtain a corresponding vector index result list.

[0120] In this embodiment, the process of generating the vector index result list includes: sorting the documents according to the similarity scores, and creating a list containing tuples of (document ID, similarity score) arranged in descending order of the scores, thereby obtaining the above vector index result list.

[0121] The vector index result list is used as the second document list.

[0122] The present application encodes the query information based on a preset word embedding model to obtain a corresponding query vector; then performs vector index query processing on the knowledge base based on the query vector to obtain a similarity score between the query vector and each second document contained in the knowledge base; then sorts all documents based on the similarity score to obtain a corresponding vector index result list; and subsequently uses the vector index result list as the second document list. The present application uses the query information to perform vector index retrieval on the knowledge base based on a vector index retrieval strategy, so as to quickly and accurately retrieve semantically similar documents corresponding to the query information in the knowledge base, and obtain a second document list based on vector similarity, thereby improving the intelligence of generating the second document list and ensuring the data accuracy of the obtained second document list.

[0123] In some optional implementations, step S203 includes the following steps:

[0124] The first document list and the second document list are merged to obtain a corresponding designated document list.

[0125] In this embodiment, the first document list and the second document list are merged into a unified list to obtain the above-mentioned designated document list. If a document appears in both the first document list and the second document list, all scores of the document are retained.

[0126] A first weight corresponding to the inverted index is obtained, and a second weight corresponding to the vector index is obtained.

[0127] In this embodiment, there is no specific limitation on the values ​​of the first weight and the second weight, which can be set according to actual business needs. Preferably, the weight of the inverted index is emphasized because after the query information is segmented, the words that are completely repeated with the words in the knowledge base are given the first priority, followed by the semantic similarity of the vector index, so the weight will be biased towards the inverted index retrieval algorithm. Exemplarily, the first weight corresponding to the inverted index can be set to 0.6, and the second weight corresponding to the vector index can be set to 0.4.

[0128] Based on the first weight and the second weight, a preset calculation formula is called to calculate the relevance score and the similarity score corresponding to each third document included in the designated document list to obtain a comprehensive score of each third document.

[0129] In this embodiment, the first weight corresponds to the relevance score of the document, and the second weight corresponds to the similarity score of the document. The calculation formula is specifically a weighted sum formula. The weighted sum calculation process of the relevance score and the similarity score corresponding to each third document included in the designated document list can be performed according to the first weight and the second weight using the weighted sum formula, thereby obtaining a comprehensive score of each third document.

[0130] The third documents are sorted in descending order according to the comprehensive scores to obtain a corresponding sorted list.

[0131] A preset number of fourth documents with the highest comprehensive scores are selected from the sorted list, and the fourth documents are used as the designated documents.

[0132] In this embodiment, the designated document can be obtained by selecting a preset number of documents with the highest comprehensive scores from the sorted list obtained after sorting. In addition, a list or set can be created, including the IDs of these designated documents, for subsequent processing.

[0133] The present application obtains the corresponding designated document list by merging the first document list and the second document list; then obtains the first weight corresponding to the inverted index, and obtains the second weight corresponding to the vector index; then based on the first weight and the second weight, calls the preset calculation formula to calculate the relevance score and similarity score corresponding to each third document contained in the designated document list to obtain the comprehensive score of each third document; subsequently, sorts each third document in descending order according to the comprehensive score to obtain the corresponding sorted list; finally, selects the preset number of fourth documents with the highest comprehensive score from the sorted list, and uses the fourth document as the designated document. The present application calculates the relevance score and similarity score corresponding to each third document contained in the designated document list based on the first weight corresponding to the inverted index and the second weight corresponding to the vector index, and obtains the comprehensive score of each third document by using the preset calculation formula, and then selects the preset number of fourth documents with the highest comprehensive score as the designated document, so as to quickly and accurately complete the merge sorting process of the first text list and the second document list, and ensures the accuracy of the designated document obtained.

[0134] In some optional implementations of this embodiment, step S204 includes the following steps:

[0135] Get the preset answer prompt word template.

[0136] In this embodiment, an answer prompt word template can be pre-built according to actual prompt word template construction requirements. Specifically, the template content of the answer prompt word template includes: answer question [q] from the content of document [d], and return [cannot answer] if it cannot be answered. [d]: (document text). [q]: (query text).

[0137] The designated document and the query information are input into the answer prompt word template to obtain the answer prompt word.

[0138] In this embodiment, the answer prompt word can be obtained by inputting the designated document and the query information into corresponding positions in the answer prompt word template, that is, inputting the designated document into the [d] position in the answer prompt word template, and inputting the query information into the [q] position in the answer prompt word template.

[0139] The large language model is called.

[0140] In this embodiment, the above-mentioned large language model may specifically adopt ChatGPT.

[0141] The answer prompt word is input into the large language model, the answer prompt word is processed by the large language model, and the answer corresponding to the designated document output by the large language model is received.

[0142] In this embodiment, the constructed answer prompt words are submitted to the large language model, and the answers generated by the large language model for the answer prompt words are collected, and the association relationship between the answer and the corresponding document and query information can be further saved.

[0143] The present application obtains a preset answer prompt word template; then inputs the designated document and the query information into the answer prompt word template to obtain the answer prompt word; then calls the large language model; subsequently inputs the answer prompt word into the large language model, processes the answer prompt word through the large language model, and receives the answer corresponding to the designated document output by the large language model. The present application can quickly and intelligently construct matching answer prompt words based on the designated document and the query information based on the use of the answer prompt word template, thereby improving the efficiency of constructing the answer prompt words. In addition, through the use of the large language model, it is possible to quickly and accurately generate an answer corresponding to the designated document, thereby ensuring the accuracy of the generated answer.

[0144] In some optional implementations of this embodiment, the calculating of the joint score of the combination information pair based on the correlation score in step S206 includes the following steps:

[0145] Get the specific answer, specific document and query information contained in the specified combination of information.

[0146] In this embodiment, the above-mentioned specified combination information is any one information pair among all the combination information pairs.

[0147] A specified relevance score between the specific document and the query information is obtained.

[0148] In this embodiment, the designated relevance score between the specific document and the query information can be found out by looking up the relevance score between the designated document and the query information obtained by processing the relevance prompt word from the large language model.

[0149] Get the specified output probability corresponding to the specific answer.

[0150] In this embodiment, the above-mentioned specified output probability refers to the confidence or probability corresponding to the specific answer returned by the large language model, which specifically refers to the probability value of the large language model outputting the specific answer given the current query information, the specific document and the corresponding answer prompt word.

[0151] A specified joint score of the specified combination information pair is generated based on the specified relevance score and the specified output probability.

[0152] In this embodiment, the specific implementation process of generating the specified joint score of the specified combination information pair based on the specified correlation score and the specified output probability will be further described in detail in subsequent specific embodiments of the present application and will not be elaborated on here.

[0153] The present application obtains the specific answer, specific document and query information contained in the specified combination information pair; then obtains the specified correlation score between the specific document and the query information; then obtains the specified output probability corresponding to the specific answer; and subsequently generates the specified joint score of the specified combination information pair based on the specified correlation score and the specified output probability. The present application processes the specified correlation score between the specific document and the query information in the obtained specified combination information pair, and the obtained specified output probability corresponding to the specific answer, so as to realize the rapid and accurate generation of the specified joint score of the specified combination information pair, thereby ensuring the accuracy of the obtained joint score.

[0154] In some optional implementations of this embodiment, generating a specified joint score of the specified combination information pair based on the specified correlation score and the specified output probability includes the following steps:

[0155] Get the preset joint calculation algorithm.

[0156] In this embodiment, the above-mentioned joint calculation algorithm specifically includes: Score = Pm(pr c)*r_s(pqg), where, for each (answer a, document d, query information q) combined information pair, Score is the joint score, Pm(prc) is the confidence or probability corresponding to the large language model returning the answer a, that is, the probability that the large language model generates the answer a, and r_s(pqg) is the correlation score between the query information a and the document d.

[0157] The designated correlation score and the output probability are calculated based on the joint calculation algorithm to obtain a corresponding calculation result.

[0158] In this embodiment, the specified correlation score and the output probability may be substituted into corresponding positions in the above-mentioned joint calculation algorithm for calculation, thereby obtaining a corresponding calculation result.

[0159] The calculation result is used as the designated joint score of the designated combination information pair.

[0160] The present application obtains a preset joint calculation algorithm; then, based on the joint calculation algorithm, the specified correlation score and the output probability are calculated and processed to obtain a corresponding calculation result; and the calculation result is subsequently used as the specified joint score of the specified combination information pair. The present application calculates and processes the specified correlation score and the specified output probability in the specified combination information pair based on the use of a joint calculation algorithm to screen and evaluate the relevance and credibility of the answers contained in the specified combination information, and can accurately generate a specified joint score for the specified combination information pair, effectively ensuring the accuracy of the obtained specified joint score.

[0161] It should be understood that the order of execution of the steps in the above embodiment does not necessarily mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of the present invention.

[0162] It should be emphasized that in order to further ensure the privacy and security of the above target answers, the above target answers can also be stored in a node of a blockchain.

[0163] The blockchain referred to in this application is a new application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, encryption algorithm, etc. Blockchain is essentially a decentralized database, a string of data blocks generated by cryptographic methods. Each data block contains a batch of network transaction information, which is used to verify the validity of its information (anti-counterfeiting) and generate the next block. Blockchain can include the underlying blockchain platform, platform product service layer, and application service layer.

[0164] The embodiments of the present application can acquire and process relevant data based on artificial intelligence technology. Artificial Intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results.

[0165] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through computer-readable instructions, and the computer-readable instructions can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, the aforementioned storage medium can be a non-volatile storage medium such as a disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM).

[0166] It should be understood that, although the steps in the flowchart of the accompanying drawings are displayed in sequence as indicated by the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least a part of the steps in the flowchart of the accompanying drawings may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be executed in turn or alternately with other steps or at least a part of the sub-steps or stages of other steps.

[0167] Further references Figure 3 , as a response to the above Figure 2 The present application provides an embodiment of a query processing device based on artificial intelligence, and the embodiment of the device is similar to Figure 2 Corresponding to the method embodiment shown, the device can be specifically applied to various electronic devices.

[0168] like Figure 3 As shown, the artificial intelligence-based query processing device 300 described in this embodiment includes: a first retrieval module 301, a second retrieval module 302, a screening module 303, a first processing module 304, a second processing module 305, a calculation module 306, an acquisition module 307 and a return module 308. Among them:

[0169] The first retrieval module 301 is used to obtain the query information input by the user, and retrieve a first document list corresponding to the query information from a pre-built knowledge base based on a preset inverted index retrieval strategy;

[0170] A second retrieval module 302, configured to retrieve a second document list corresponding to the query information from the knowledge base based on a preset vector index retrieval strategy;

[0171] A screening module 303 is used to merge and sort the first text list and the second document list to screen out a preset number of designated documents;

[0172] A first processing module 304 is used to construct an answer prompt word based on the designated document and the query information, and to process the answer prompt word based on a preset large language model to obtain an answer corresponding to the designated document;

[0173] The second processing module 305 is used to construct a relevance prompt word based on the designated document and the query information, and process the relevance prompt word based on the large language model to obtain a relevance score between the designated document and the query information;

[0174] A calculation module 306, configured to construct a corresponding combination information pair based on the answer, the designated document and the query information, and calculate a joint score of the combination information pair based on the relevance score;

[0175] An acquisition module 307 is used to select a target combination information pair with the highest joint score from all the combination information pairs, and acquire a target answer and a target document from the target combination information pair;

[0176] The return module 308 is used to return the target answer and the target document to the user.

[0177] In some optional implementations of this embodiment, the first search module 301 includes:

[0178] A word segmentation submodule, used to perform word segmentation processing on the query information to obtain corresponding query words;

[0179] A first query submodule, configured to perform inverted index query processing on the knowledge base based on the query participle, and obtain a document relevance score between the query participle and each first document contained in the knowledge base;

[0180] A first sorting submodule, used to sort all the first documents based on the document relevance scores to obtain a corresponding inverted index result list;

[0181] The first determining submodule is configured to use the inverted index result list as the first document list.

[0182] In some optional implementations of this embodiment, the second retrieval module 302 includes:

[0183] An encoding submodule, used for encoding the query information based on a preset word embedding model to obtain a corresponding query vector;

[0184] A second query submodule, configured to perform vector index query processing on the knowledge base based on the query vector to obtain a similarity score between the query vector and each second document included in the knowledge base;

[0185] A second sorting submodule is used to sort all documents based on the similarity scores to obtain a corresponding vector index result list;

[0186] The second determining submodule is configured to use the vector index result list as the second document list.

[0187] In some optional implementations of this embodiment, the screening module 303 includes:

[0188] A merging submodule, used for merging the first document list and the second document list to obtain a corresponding designated document list;

[0189] A first acquisition submodule, used to acquire a first weight corresponding to the inverted index, and to acquire a second weight corresponding to the vector index;

[0190] a calculation submodule, configured to calculate the relevance score and the similarity score corresponding to each third document included in the specified document list based on the first weight and the second weight, and obtain a comprehensive score of each third document;

[0191] A third sorting submodule is used to sort the third documents in descending order according to the comprehensive score to obtain a corresponding sorting list;

[0192] The screening submodule is used to screen out a preset number of fourth documents with the highest comprehensive scores from the sorted list, and use the fourth documents as the designated documents.

[0193] In some optional implementations of this embodiment, the first processing module 304 includes:

[0194] The second acquisition submodule is used to acquire a preset answer prompt word template;

[0195] An input submodule, used for inputting the specified document and the query information into the answer prompt word template to obtain the answer prompt word;

[0196] A calling submodule, used for calling the large language model;

[0197] The receiving submodule is used to input the answer prompt word into the large language model, process the answer prompt word through the large language model, and receive the answer corresponding to the specified document output by the large language model.

[0198] In some optional implementations of this embodiment, the calculation module 306 includes:

[0199] The third acquisition submodule is used to acquire the specific answer, specific document and query information contained in the specified combination information pair; wherein the specified combination information is any one of all the combination information pairs;

[0200] A fourth acquisition submodule, used to acquire a specified correlation score between the specific document and the query information;

[0201] A fifth acquisition submodule, used to acquire a specified output probability corresponding to the specific answer;

[0202] A generating submodule is used to generate a specified joint score of the specified combination information pair based on the specified correlation score and the specified output probability.

[0203] In some optional implementations of this embodiment, the generating submodule includes:

[0204] An acquisition unit, used for acquiring a preset joint calculation algorithm;

[0205] A calculation unit, configured to calculate the specified correlation score and the output probability based on the joint calculation algorithm to obtain a corresponding calculation result;

[0206] A determination unit is used to use the calculation result as a specified joint score of the specified combination information pair.

[0207] To solve the above technical problems, the present application also provides a computer device. Figure 4 , Figure 4 This is a basic structural block diagram of the computer device in this embodiment.

[0208] The computer device 4 includes a memory 41, a processor 42, and a network interface 43 that are interconnected through a system bus. It should be noted that the figure only shows a computer device 4 with components 41-43, but it should be understood that it is not required to implement all the components shown, and more or fewer components can be implemented instead. Among them, those skilled in the art can understand that the computer device here is a device that can automatically perform numerical calculations and / or information processing according to pre-set or stored instructions, and its hardware includes but is not limited to microprocessors, application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), digital processors (DSPs), embedded devices, etc.

[0209] The computer device may be a computing device such as a desktop computer, a notebook, a PDA, a cloud server, etc. The computer device may interact with a user through a keyboard, a mouse, a remote controller, a touch pad, or a voice control device.

[0210] The memory 41 includes at least one type of readable storage medium, and the readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (for example, SD or DX memory, etc.), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, disk, optical disk, etc. In some embodiments, the memory 41 can be an internal storage unit of the computer device 4, such as a hard disk or memory of the computer device 4. In other embodiments, the memory 41 can also be an external storage device of the computer device 4, such as a plug-in hard disk equipped on the computer device 4, a smart memory card (Smart Med ia Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. Of course, the memory 41 can also include both the internal storage unit of the computer device 4 and its external storage device. In this embodiment, the memory 41 is generally used to store the operating system and various application software installed on the computer device 4, such as computer-readable instructions of the query processing method based on artificial intelligence, etc. In addition, the memory 41 can also be used to temporarily store various types of data that have been output or are to be output.

[0211] The processor 42 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chips in some embodiments. The processor 42 is generally used to control the overall operation of the computer device 4. In this embodiment, the processor 42 is used to run the computer-readable instructions stored in the memory 41 or process data, such as running the computer-readable instructions of the artificial intelligence-based query processing method.

[0212] The network interface 43 may include a wireless network interface or a wired network interface. The network interface 43 is generally used to establish a communication connection between the computer device 4 and other electronic devices.

[0213] The present application also provides another implementation, namely, providing a computer-readable storage medium, wherein the computer-readable storage medium stores computer-readable instructions, and the computer-readable instructions can be executed by at least one processor to enable the at least one processor to perform the steps of the above-mentioned artificial intelligence-based query processing method.

[0214] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in each embodiment of the present application.

[0215] Obviously, the embodiments described above are only some embodiments of the present application, rather than all embodiments. The preferred embodiments of the present application are given in the accompanying drawings, but they do not limit the patent scope of the present application. The present application can be implemented in many different forms. On the contrary, the purpose of providing these embodiments is to make the understanding of the disclosure of the present application more thorough and comprehensive. Although the present application is described in detail with reference to the aforementioned embodiments, for those skilled in the art, it is still possible to modify the technical solutions recorded in the aforementioned specific implementation methods, or to perform equivalent replacement of some of the technical features therein. Any equivalent structure made using the contents of the specification and drawings of this application, directly or indirectly used in other related technical fields, is similarly within the scope of patent protection of this application.

Claims

1. A query processing method based on artificial intelligence, characterized in that: The steps include: Acquire query information input by a user, and retrieve a first document list corresponding to the query information from a pre-built knowledge base based on a preset inverted index retrieval strategy; Retrieving a second document list corresponding to the query information from the knowledge base based on a preset vector index retrieval strategy; Merging and sorting the first text list and the second document list to filter out a preset number of designated documents; Constructing answer prompt words based on the designated document and the query information, and processing the answer prompt words based on a preset large language model to obtain an answer corresponding to the designated document; Constructing relevance prompt words based on the designated document and the query information, and processing the relevance prompt words based on the large language model to obtain a relevance score between the designated document and the query information; constructing a corresponding combined information pair based on the answer, the designated document and the query information, and calculating a joint score of the combined information pair based on the relevance score; Filter out a target combined information pair with the highest joint score from all the combined information pairs, and obtain a target answer and a target document in the target combined information pair; The target answer and the target document are returned to the user.

2. The query processing method based on artificial intelligence according to claim 1, characterized in that: The step of retrieving a first document list corresponding to the query information from a pre-built knowledge base based on a preset inverted index retrieval strategy specifically includes: Performing word segmentation processing on the query information to obtain corresponding query word segments; Performing inverted index query processing on the knowledge base based on the query participle to obtain a document relevance score between the query participle and each first document included in the knowledge base; Sort all the first documents based on the document relevance scores to obtain a corresponding inverted index result list; The inverted index result list is used as the first document list.

3. The query processing method based on artificial intelligence according to claim 1, characterized in that: The step of retrieving a second document list corresponding to the query information from the knowledge base based on a preset vector index retrieval strategy specifically includes: Encoding the query information based on a preset word embedding model to obtain a corresponding query vector; Performing vector index query processing on the knowledge base based on the query vector to obtain a similarity score between the query vector and each second document included in the knowledge base; Sort all documents based on the similarity scores to obtain a corresponding vector index result list; The vector index result list is used as the second document list.

4. The query processing method based on artificial intelligence according to any one of claims 1 to 2, characterized in that: The step of merging and sorting the first text list and the second document list to filter out a preset number of designated documents specifically includes: Merging the first document list and the second document list to obtain a corresponding designated document list; Obtain a first weight corresponding to the inverted index, and obtain a second weight corresponding to the vector index; Based on the first weight and the second weight, a preset calculation formula is called to calculate the relevance score and the similarity score corresponding to each third document included in the designated document list to obtain a comprehensive score of each third document; Sorting the third documents in descending order according to their comprehensive scores to obtain a corresponding sorted list; A preset number of fourth documents with the highest comprehensive scores are selected from the sorted list, and the fourth documents are used as the designated documents.

5. The query processing method based on artificial intelligence according to claim 1, characterized in that: The step of constructing an answer prompt word based on the designated document and the query information, and processing the answer prompt word based on a preset large language model to obtain an answer corresponding to the designated document specifically includes: Get the preset answer prompt word template; Input the designated document and the query information into the answer prompt word template to obtain the answer prompt word; Calling the large language model; The answer prompt word is input into the large language model, the answer prompt word is processed by the large language model, and the answer corresponding to the designated document output by the large language model is received.

6. The query processing method based on artificial intelligence according to claim 1, characterized in that: The step of calculating the joint score of the combination information pair based on the correlation score specifically includes: Obtaining a specific answer, a specific document, and query information contained in a specified combination information pair; wherein the specified combination information is any one of all the combination information pairs; Obtaining a specified relevance score between the specific document and the query information; Obtaining a specified output probability corresponding to the specific answer; A specified joint score of the specified combination information pair is generated based on the specified relevance score and the specified output probability.

7. The query processing method based on artificial intelligence according to claim 6, characterized in that: The step of generating a specified joint score of the specified combination information pair based on the specified correlation score and the specified output probability specifically includes: Obtain the preset joint calculation algorithm; Calculate the specified correlation score and the output probability based on the joint calculation algorithm to obtain a corresponding calculation result; The calculation result is used as the designated joint score of the designated combination information pair.

8. A query processing device based on artificial intelligence, characterized in that: include: A first retrieval module is used to obtain query information input by a user, and retrieve a first document list corresponding to the query information from a pre-built knowledge base based on a preset inverted index retrieval strategy; A second retrieval module, configured to retrieve a second document list corresponding to the query information from the knowledge base based on a preset vector index retrieval strategy; A screening module, used for merging and sorting the first text list and the second document list to screen out a preset number of designated documents; A first processing module, configured to construct an answer prompt word based on the designated document and the query information, and to process the answer prompt word based on a preset large language model to obtain an answer corresponding to the designated document; A second processing module is used to construct a relevance prompt word based on the designated document and the query information, and to process the relevance prompt word based on the large language model to obtain a relevance score between the designated document and the query information; a calculation module, configured to construct a corresponding combination information pair based on the answer, the designated document and the query information, and calculate a joint score of the combination information pair based on the relevance score; An acquisition module, used for selecting a target combination information pair with the highest joint score from all the combination information pairs, and acquiring a target answer and a target document from the target combination information pair; A return module is used to return the target answer and the target document to the user.

9. A computer device comprising a memory and a processor, wherein the memory stores computer-readable instructions, and when the processor executes the computer-readable instructions, the steps of the artificial intelligence-based query processing method as described in any one of claims 1 to 7 are implemented.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-readable instructions, and when the computer-readable instructions are executed by the processor, the steps of the artificial intelligence-based query processing method according to any one of claims 1 to 7 are implemented.

Citation Information

Patent Citations

  • Information retrieval method and device, electronic equipment and storage medium

    CN118394916A

  • Knowledge management question-answering system construction method and device

    CN118446296A

  • Systems for controllable summarization of content

    US12008332B1

  • Method and apparatus for processing data in knowledge base, and computer device and storage medium

    WO2021164171A1

Cited By

  • Data processing method and device, nonvolatile storage medium and electronic equipment

    CN119441566A

  • Financial operation business question answering method based on large language model based on index algorithm

    CN119441566B