Question answering interaction method and apparatus based on large language model data vectorization query
By semantic recognition and vectorization of user input data, and intelligent Q&A combined with large language models, the problem of Q&A system quickly retrieving accurate answers in massive data is solved, and the query quality and accuracy of Q&A system are improved.
Patent Information
- Application Number
- PCT/CN2024/094243
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-12-25
- Filing Date
- 2024-05-20
- Publication Date
- 2025-07-03
AI Technical Summary
The efficiency and quality of existing question-and-answer systems to quickly retrieve accurate answers in massive data is difficult to improve, especially in intelligent question-and-answer systems, semantic understanding and data retrieval are insufficient.
By semantic recognition of user input data, determine the problem category, and convert it into input vectors, use the target vector database to perform vector query, generate query results, and logical analysis combined with large language models to provide intelligent question and answers.
The quality and accuracy of human-computer intelligent dialogue and question query have been improved, the query quality and accuracy of the question and answer system have been improved by at least 50%, and the accuracy of smart question and answer responses has been improved by at least 30%.
Smart Images

Figure CN2024094243_03072025_PF_FP_ABST
Abstract
Description
Question-answering interaction method and device based on vectorized query of large language model data Technical Field
[0001] The present application relates to the field of computer information processing, and more specifically, to a question-answering interaction method, device, electronic device, and computer-readable medium based on vectorized query of large language model data. Background Art
[0002] Intelligent Question Answering (IQA) is a core subfield of Natural Language Processing (NLP) that aims to design and develop systems that can parse, understand, and answer natural language questions posed by users. The goal of these systems is not just to return relevant text, but to provide accurate, concise, and direct answers.
[0003] One of the core components of intelligent question-answering systems is semantic understanding, which means that the system needs to deeply understand the user's intention and the meaning behind the question. To answer questions, intelligent question-answering systems typically need to access large knowledge bases or databases containing a wealth of facts, data, and information.
[0004] Knowledge-based question-answering systems are systems designed to answer questions based on facts and data. They rely on predefined knowledge bases that typically contain a large amount of facts, relationships, and other structured information. Retrieval-based question-answering systems refer to systems that retrieve and return the most relevant answers from a large pre-existing document or FAQ set based on the semantic information of the user's question. Unlike knowledge-based question-answering systems, retrieval-based systems do not rely on structured data, but rather on large amounts of text data. In the past decade, with breakthroughs in deep learning technology, question-answering systems have made a qualitative leap. Neural networks, especially recurrent neural networks (RNNs) and Transformer architectures, enable models to handle complex semantic structures and long-distance dependencies. However, existing question-answering systems all rely heavily on large amounts of data retrieval. How to quickly retrieve accurate answers from massive amounts of data has always been a key research topic.
[0005] The above information disclosed in this Background section is only for enhancement of understanding of the background of the application and therefore it may contain information that does not form the prior art that is already known to a person of ordinary skill in the art.
[0006] Summary of the Invention
[0007] In view of this, the present application provides a question-answering interaction method, device, electronic device and computer-readable medium based on vectorized query of large language model data, which can provide users with an intelligent question-answering method and improve the quality and accuracy of answers to human-computer intelligent dialogues and question queries.
[0008] Other features and advantages of the present application will become apparent from the following detailed description, or may be learned in part by practice of the present application.
[0009] According to one aspect of the present application, a question-answering interaction method based on vectorized query of large language model data is proposed, the method comprising: performing semantic recognition on user input data to determine the question category corresponding to the input data; determining a target vector database based on the question category; wherein the target vector database is used to store data of different categories after vectorization and multi-dimensional labeling; converting the input data into input vectors; performing vector query in the target vector database using the input vectors, and splicing them into query results; generating prompt questions based on the input data and the query results; inputting the prompt questions into a large language model to obtain logical analysis results; and when the logical analysis results are positive, performing question-answering interaction based on the logical analysis results.
[0010] Optionally, it also includes: vectorizing and organizing the knowledge data in the knowledge database, setting multidimensional labels and storing them in the knowledge vector database; vectorizing and organizing the question and answer data in the question and answer data, setting multidimensional labels and storing them in the question and answer vector database.
[0011] Optionally, the knowledge data in the knowledge database is vectorized, multi-dimensionally labeled, and stored in the knowledge vector database, including: removing symbols of the knowledge data in the knowledge base to generate multiple knowledge sentences; splicing the multiple knowledge sentences to generate multiple knowledge phrases that do not exceed a length threshold; converting the multiple knowledge phrases into multiple knowledge phrase vectors; and setting multi-dimensional labels for the knowledge phrase vectors respectively and storing them in the knowledge vector database.
[0012] Optionally, multi-dimensional labels are set for the knowledge phrase vectors and stored in the knowledge vector database, including: taking the text, source, and type of the knowledge data corresponding to the knowledge phrase vector as one of the multi-dimensional labels; taking the index value of the knowledge phrase vector in its corresponding knowledge data as one of the multi-dimensional labels; assigning an identifier to the knowledge phrase vector and taking it as one of the multi-dimensional labels; storing the knowledge phrase vector and its corresponding multi-dimensional label in the knowledge vector database.
[0013] Optionally, the question and answer data in the question and answer data are vectorized, multi-dimensional labels are set and stored in a question and answer vector database, including: combining the questions and answers in the question and answer data into question-answer blocks in a one-to-one correspondence; splitting the question data and answer data in the question-answer blocks; converting the question data into question vectors; converting the answer data into multiple answer phrase vectors; setting multi-dimensional labels for the question vectors and their corresponding answer phrase vectors respectively and storing them in the question and answer vector database.
[0014] Optionally, converting the answer data into multiple answer phrase vectors includes: removing symbols from the answer data to generate multiple answer sentences; concatenating the multiple answer sentences to generate multiple answer phrases that do not exceed a length threshold; and converting the multiple answer phrases into multiple answer phrase vectors.
[0015] Optionally, multi-dimensional labels are set for the question vector and the corresponding answer phrase vector respectively and stored in the question-answer vector database, including: taking the text, source, and type of the question vector and the corresponding answer phrase vector as one of the multi-dimensional labels; taking the index value of the answer phrase vector in the corresponding answer data as one of the multi-dimensional labels; assigning an identifier to the answer phrase vector and taking it as one of the multi-dimensional labels; and storing the question vector and the corresponding answer phrase vector and the multi-dimensional labels in the question-answer vector database.
[0016] Optionally, when the target vector database is a knowledge vector database, the input vector is used to perform a vector query in the target vector database and splice the query results, including: using the input vector to perform a vector query in the knowledge vector database to generate a predetermined number of knowledge phrase vectors as return results; extracting the multidimensional label of the first knowledge phrase vector in the return result; extracting an identifier and an index value from the multidimensional label; extracting contextual knowledge phrases in the knowledge vector database based on the identifier and the index value; and splicing the contextual knowledge phrases to generate a query result.
[0017] Optionally, when the target vector database is a question-answer vector database, the input vector is used to perform a vector query in the target vector database and splice the query results, including: using the input vector to perform a vector query in the question-answer vector database to generate a predetermined number of answer phrase vectors as return results; extracting the multidimensional label of the first answer phrase vector in the return result; extracting an identifier from the multidimensional label; extracting all answer phrases corresponding to the identifier in the question-answer vector database; and splicing all answer phrases corresponding to the identifier to generate a query result.
[0018] Optionally, generating a prompt question using the input data and the query result includes: extracting a pre-generated yes / no judgment prompt question template; and filling the input data and the query result into predetermined positions in the prompt question template respectively to generate the prompt question.
[0019] According to one aspect of the present application, a question-answering interaction device based on vectorized query of large language model data is proposed, which includes: an input module for performing semantic recognition on the user's input data and determining the question category corresponding to the input data; a target module for determining a target vector database according to the question category; a vector module for converting the input data into an input vector; a query module for performing vector query in the target vector database using the input vector and splicing the result into a query; a question module for generating a prompt question based on the input data and the query result; a model module for inputting the prompt question into a large language model and obtaining a logical analysis result; and a reply module for performing a question-answering interaction based on the logical analysis result when the logical analysis result is a positive result.
[0020] According to one aspect of the present application, an electronic device is proposed, which includes: one or more processors; a storage device for storing one or more programs; when the one or more programs are executed by the one or more processors, the one or more processors implement the method as described above.
[0021] According to one aspect of the present application, a computer-readable medium is provided, on which a computer program is stored. When the program is executed by a processor, the method described above is implemented.
[0022] According to the question-answering interaction method, device, electronic device and computer-readable medium based on vectorized query of large language model data of the present application, semantic recognition is performed on the user's input data to determine the question category corresponding to the input data; a target vector database is determined according to the question category; the input data is converted into an input vector; a vector query is performed in the target vector database using the input vector, and the query results are spliced together; a prompt question is generated based on the input data and the query result; the prompt question is input into a large language model to obtain a logical analysis result; when the logical analysis result is a positive result, a question-answering interaction method is performed according to the logical analysis result, which can provide users with an intelligent question reply method and improve the quality and accuracy of answers to human-computer intelligent dialogues and question queries.
[0023] It should be understood that the foregoing general description and the following detailed description are merely illustrative and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] The above and other objects, features, and advantages of the present application will become more apparent by describing in detail exemplary embodiments thereof with reference to the accompanying drawings. The drawings described below are merely some embodiments of the present application, and it is apparent to those skilled in the art that other drawings can be derived from these drawings without inventive effort.
[0025] FIG1 is a flowchart showing a question-answering interaction method based on large language model data vectorized query according to an exemplary embodiment.
[0026] FIG2 is a flowchart showing a question-answering interaction method based on large language model data vectorized query according to another exemplary embodiment.
[0027] FIG3 is a flowchart showing a question-answering interaction method based on large language model data vectorized query according to another exemplary embodiment.
[0028] FIG4 is a flowchart showing a question-answering interaction method based on large language model data vectorized query according to another exemplary embodiment.
[0029] FIG5 is a flowchart showing a question-answering interaction method based on large language model data vectorized query according to another exemplary embodiment.
[0030] FIG6 is a block diagram showing a question-answering interaction apparatus based on vectorized query of large language model data according to an exemplary embodiment.
[0031] Fig. 7 is a block diagram of an electronic device according to an exemplary embodiment. DETAILED DESCRIPTION
[0032] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be embodied in many forms and should not be construed as limited to the embodiments set forth herein; rather, these embodiments are provided so that this disclosure will be thorough and complete and will fully convey the concepts of the example embodiments to those skilled in the art. Like reference numerals in the drawings represent like or similar parts, and thus repetitive description thereof will be omitted.
[0033] Figure 1 is a flowchart illustrating a question-answering interaction method based on large language model data vectorized query according to an exemplary embodiment. The question-answering interaction method 10 based on large language model data vectorized query includes at least steps S102 to S108.
[0034] As shown in FIG. 1 , in S102 , semantic recognition is performed on the user's input data to determine the question category corresponding to the input data.
[0035] The user's input voice data or text data can be obtained, and the voice data can be processed by voice recognition and other processing to convert it into text data. Furthermore, the text data can be semantically recognized to determine the question category corresponding to the user input data.
[0036] In this application, the question category may include knowledge base questions, which refer to databases designed to answer fact- and data-based questions. They rely on predefined knowledge bases that typically contain a large amount of facts, relationships, and other structured information.
[0037] In this application, question categories may also include question-and-answer questions, which refer to retrieving and returning the most relevant answers from a pre-existing large document or FAQ set based on the semantic information of the user's question. Unlike knowledge-based question-and-answer systems, retrieval-based systems do not rely on structured data, and question-and-answer knowledge bases are generated through system logs. A large number of users' daily question-and-answer questions and replies are stored in the system logs. Some of these reply data are obtained through database retrieval, and some are obtained by manual customer service or other channels.
[0038] In S104, a target vector database is determined according to the problem category;
[0039] In this application, the target vector database is used to store different types of data that have been vectorized and multi-dimensionally labeled. For example, knowledge data in a knowledge database can be vectorized, multi-dimensionally labeled, and stored in the knowledge vector database. Another example is that question-answer data in question-answer data can be vectorized, multi-dimensionally labeled, and stored in the question-answer vector database. Therefore, in this application, the target vector database can include at least a knowledge vector database and a question-answer vector database.
[0040] The specific technical content of generating a knowledge vector database and the specific content of generating a question-answer vector database are described in detail in the embodiments corresponding to Figures 2 and 4, respectively. It is understood that in this application, other types of databases can also be set up for retrieval based on question categories, and the processing can be performed according to the steps of Figures 2 or 4, and this application is not limited to them.
[0041] In S106, the input data is converted into an input vector. A Chinese embedding model can be generated in advance through historical data training in the system, and the input data is input into the Chinese embedding model to generate an input vector.
[0042] In this application, by training the historical user log data of this system platform to generate a Chinese embedding model, the data of this platform can be more accurately vectorized, thereby improving the accuracy and efficiency of subsequent question queries.
[0043] In S108, the input vector is used to perform a vector search in the target vector database and the search results are assembled. The input vector is compared with all vectors in the target vector database for similarity. When the similarity comparison result is greater than a threshold, the vector in the knowledge class is considered a hit vector.
[0044] Different data splicing methods are determined according to different target vector databases to generate query results. In this application, the data splicing method of the knowledge vector database will be described in detail in the embodiment corresponding to Figure 3, and the data splicing method of the question-answer vector database will be described in detail in the embodiment corresponding to Figure 5.
[0045] In S110 , prompt questions are generated based on the input data and the query results.
[0046] In one embodiment, a pre-generated yes / no judgment prompt question template may be extracted; the input data and the query result are respectively filled into predetermined positions in the prompt question template to generate the prompt question.
[0047] The yes / no judgment prompt question template may be, for example, a promp template, and the format of the judgment template may be "judge whether the following content is correct, and give a response result if it is correct."
[0048] Furthermore, judgment questions can be generated through judgment templates. In the question-answer pair described above, the judgment questions constructed can be, for example:
[0049] “Judge whether the following is true:
[0050] “Q: What is the power of XX product?
[0051] A: The product power is 2000W.
[0052] The response result is:"
[0053] In S112, the prompt question is input into the large language model to obtain a logical analysis result. The prompt question is input into the large language model, and the large language model responds according to the requirements of the judgment question. The response result is "yes" or "no", and can also be other similar answers, such as "correct" or "incorrect". Another example is "valid" or "invalid", etc.
[0054] In S114, when the logic analysis result is a positive result, intelligent question-answering interaction is performed according to the logic analysis result.
[0055] In this application, a positive judgment result can be "yes" or similar words such as "correct". When the logical analysis result is positive, display data is generated based on the output content of the large language model and pushed to the user end for question response.
[0056] In the example described above, the output result of the large language model may be "the power of XX product is 2000W", and the output result of the large language model may also be "the rated power of XX product is 2000W", etc. This application is not limited to this.
[0057] According to the question-answering interaction method based on vectorized query of large language model data of the present application, semantic recognition is performed on the user's input data to determine the question category corresponding to the input data; a target vector database is determined according to the question category; the input data is converted into an input vector; a vector query is performed in the target vector database using the input vector, and the query results are spliced together; a prompt question is generated based on the input data and the query result; the prompt question is input into a large language model to obtain a logical analysis result; when the logical analysis result is a positive result, a question-answering interaction method is performed according to the logical analysis result, which can provide users with an intelligent question reply method and improve the quality and accuracy of answers to human-computer intelligent dialogues and question queries.
[0058] This application's question-and-answer interaction method, based on vectorized querying of large language model data, optimizes the strategy of using a vector library to store data in the platform database. This includes adopting different text segmentation strategies based on different file content types, and then using different splicing strategies for queries based on different file types to improve query quality and accuracy. Based on the document splitting strategy and query strategy in this application, in actual applications, the quality and accuracy of the platform's query and answer database have been improved by at least 50%, and the accuracy of intelligent question and answer responses has been improved by at least 30%.
[0059] It should be clearly understood that this application describes how to form and use specific examples, but the principles of this application are not limited to any details of these examples. On the contrary, based on the teaching of the content disclosed in this application, these principles can be applied to many other embodiments.
[0060] Figure 2 is a flowchart illustrating a question-answering interactive method based on vectorized querying of large language model data, according to another exemplary embodiment. Process 20 shown in Figure 2 is a detailed description of "vectorizing and organizing knowledge data in a knowledge database, assigning multidimensional labels, and storing the data in the knowledge vector database."
[0061] As shown in Figure 2, in S202, symbols are removed from the knowledge data in the knowledge base to generate multiple knowledge phrases. The knowledge data corresponding to the original platform is extracted from the knowledge base. The original knowledge data is stored according to different knowledge categories, and the text corresponding to each data item varies in size. The text corresponding to each piece of knowledge data is extracted one by one, and the symbols are removed, resulting in multiple knowledge phrases without symbols.
[0062] For example, the original knowledge data is "In the history of database development, databases have gone through various stages of development, such as hierarchical databases, network databases, and relational databases, and database technology has developed rapidly in all aspects." After removing the symbols, the generated knowledge sentence is as follows:
[0063] "In the history of database development
[0064] Database has gone through hierarchical database
[0065] The development of various stages such as network database and relational database
[0066] Database technology is developing rapidly in all aspects"
[0067] In S204, the plurality of knowledge short sentences are spliced together to generate a plurality of knowledge phrases that do not exceed a length threshold. The knowledge short sentences above are spliced together to generate a plurality of knowledge phrases that do not exceed 100.
[0068] As mentioned above, the knowledge phrases generated by splicing can be:
[0069] "In the history of database development, databases have gone through various stages of development, such as hierarchical databases, network databases, and relational databases. Database technology has developed rapidly in all aspects."
[0070] In S206, the plurality of knowledge phrases are converted into a plurality of knowledge phrase vectors. A Chinese embedding model may be generated in advance through historical data training in the system, and the plurality of knowledge phrases are input into the Chinese embedding model to generate a plurality of knowledge phrase vectors.
[0071] In S208, multi-dimensional labels are assigned to the knowledge phrase vectors and stored in the knowledge vector database. The text, source, and type of the knowledge data corresponding to the knowledge phrase vector can be used as one of the multi-dimensional labels; the index value of the knowledge phrase vector in the corresponding knowledge data can also be used as one of the multi-dimensional labels; an identifier can also be assigned to the knowledge phrase vector and used as one of the multi-dimensional labels; the knowledge phrase vector and its corresponding multi-dimensional label are stored in the knowledge vector database.
[0072] More specifically, parameters such as the text, source, type (text - file, question - question and answer, withelist - whitelisted phrases for subsequent query strategies), index value (for subsequent query strategies), and unique identifier (used to identify the entire file) corresponding to the knowledge vector data can be stored in the vector library. The index value refers to the position of the knowledge vector in the entire knowledge data.
[0073] For example, if a piece of knowledge data is split into five knowledge phrases, a, b, c, d, and e, and these five knowledge phrases belong to the same piece of knowledge data, they will have the same unique identifier, for example, 11111. Furthermore, each knowledge phrase is assigned an index according to its order in the source document:
[0074] The index of a is 1;
[0075] The index of b is 2;
[0076] The index of c is 3;
[0077] The index of d is 4;
[0078] e has an index of 5".
[0079] In a specific embodiment, the knowledge sentence described above, "In the history of database development, databases have successively experienced various stages of development such as hierarchical databases, network databases, and relational databases. Database technology has developed rapidly in all aspects," corresponds to the text "database," the source is "knowledge database," the type is "text-file," the index value is "3," and the unique identifier is "66666." The above content can be combined with the knowledge sentence vector and stored in the knowledge vector database.
[0080] Figure 3 is a flowchart illustrating a question-answering interactive method based on vectorized querying of large language model data, according to another exemplary embodiment. Process 30 shown in Figure 3 is a detailed description of S108 in the process shown in Figure 1, "Using the input vector to perform a vector query in the target vector database and concatenate the result into a query," when the target vector database is a knowledge vector database.
[0081] As shown in FIG. 3 , in S302 , the input vector is used to perform a vector query in the knowledge vector database, and a predetermined number of knowledge phrase vectors are generated as return results.
[0082] More specifically, vector queries of the knowledge vector database can be performed through similarity comparison. Specifically, the input vector and multiple knowledge phrase vectors in the knowledge vector database can be compared for similarity, and a similarity threshold can be set. When the similarity comparison result is greater than the threshold, the current knowledge phrase vector is temporarily stored as hit data.
[0083] After the similarity comparison is completed, all hit data are arranged from high to low according to the similarity, and the hit knowledge phrase vectors are extracted from high to low according to the preset number as the return result of this query.
[0084] In S304, the multi-dimensional label of the first knowledge phrase vector in the returned result is extracted, and the multi-dimensional label of the knowledge phrase vector with the highest similarity is extracted.
[0085] In S306 , an identifier and an index value are extracted from the multi-dimensional tag.
[0086] In S308, the contextual knowledge phrases in the knowledge vector database are extracted according to the identifier and the index value. Adjacent knowledge phrase vector contents can be extracted from the knowledge vector database according to the index value and the unique identifier.
[0087] In S310 , the contextual knowledge phrases are concatenated to generate a query result.
[0088] In one embodiment, for example, the index value of the current knowledge phrase vector is 3, and its corresponding unique identifier is 3333333333333333. Then, the data in the vector library can be taken with a unique identifier of 3333333333333333, and 5 knowledge phrases with index values of 1, 2, 3, 4, and 5 can be spliced into the query result.
[0089] It is worth mentioning that the number of knowledge phrases extracted from the context can be set by the system. In the above example, the knowledge phrases with two index values above and two index values below are extracted and concatenated to generate the query result. It can also be set to extract the knowledge phrases with five index values above and one index value below, and concatenate to generate the query result. This application is not limited to this.
[0090] Figure 4 is a flowchart illustrating a question-answering interaction method based on vectorized querying of large language model data, according to another exemplary embodiment. Process 40 shown in Figure 4 is a detailed description of "vectorizing and organizing the question-answer data in the question-answer data, assigning multidimensional labels, and storing them in the question-answer vector database."
[0091] As shown in Figure 4, in S402, the questions and answers in the question-answer data are combined into question-answer blocks in a one-to-one correspondence. In the original question-answer database, questions and answers are stored separately, and a question may correspond to multiple answers, or one answer may correspond to multiple questions.
[0092] First, questions and answers are combined one by one to generate a question-answer block in which one question corresponds to one answer.
[0093] In S404, the question data and the answer data in the question-answer block are separated.
[0094] In S406, the question data is converted into question vectors. A Chinese embedding model can be generated in advance through historical data training in the system, and the question data is input into the Chinese embedding model to generate multiple question vectors.
[0095] In S408, the answer data is converted into multiple answer phrase vectors. Symbols are removed from the answer data to generate multiple answer phrases. These multiple answer phrases are concatenated to generate multiple answer phrases that do not exceed a length threshold. These multiple answer phrases are then converted into multiple answer phrase vectors. This generation of answer phrase vectors can be combined with the method for generating knowledge phrase vectors in the knowledge vector database described above. This application will not elaborate further here.
[0096] In S410, multi-dimensional labels are assigned to the question vector and its corresponding answer phrase vector, and the labels are stored in the question-answer vector database. The text, source, and type of the question vector and its corresponding answer phrase vector are used as one of the multi-dimensional labels; the index value of the answer phrase vector in its corresponding answer data is used as one of the multi-dimensional labels; an identifier is assigned to the answer phrase vector and used as one of the multi-dimensional labels; and the question vector, its corresponding answer phrase vector, and the multi-dimensional labels are stored in the question-answer vector database.
[0097] In one embodiment, the text, vector value, source, type (text-file, question-question and answer, withelist-whitelist words for subsequent different query strategies), index value (for subsequent query strategies) and unique identifier (used to represent the identifier of the entire file) of the question vector and its corresponding answer phrase vector can be stored in the question and answer vector database.
[0098] Figure 5 is a flowchart illustrating a question-answering interactive method based on vectorized querying of large language model data, according to another exemplary embodiment. Process 50 shown in Figure 5 is a detailed description of S108 in the process shown in Figure 1, "performing a vector query in the target vector database using the input vector and concatenating the result into a query," when the target vector database is a question-answer vector database.
[0099] As shown in FIG. 5 , in S502 , the input vector is used to perform a vector query in the question-answer vector database, and a predetermined number of answer phrase vectors are generated as return results.
[0100] More specifically, vector queries of the question-answer vector database can be performed through similarity comparison. Specifically, the input vector and multiple answer phrase vectors in the question-answer vector database can be compared for similarity, and a similarity threshold can be set. When the similarity comparison result is greater than the threshold, the current answer phrase vector is temporarily stored as hit data.
[0101] After the similarity comparison is completed, all hit data are arranged from high to low according to the similarity, and the hit answer phrase vectors are extracted from high to low according to the preset number as the return result of this query.
[0102] In S504, the multi-dimensional label of the top answer phrase vector in the returned result is extracted, and the multi-dimensional label of the answer phrase vector with the highest similarity is extracted.
[0103] In S506, an identifier is extracted from the multi-dimensional tag.
[0104] In S508, all answer phrases corresponding to the identifier are extracted from the question-answer vector database. Adjacent vector contents can be retrieved from the vector database based on the unique identifier. For example, if the unique identifier of the current answer phrase vector is 3333333333333333, all answer phrases with the unique identifier 3333333333333333 are extracted from the vector database.
[0105] In S510, all answer phrases corresponding to the identifier are concatenated to generate a query result. All answer phrases uniquely identified as 3333333333333333 in the vector library data can be concatenated into a complete question and answer content. When concatenating to generate the answer content, the concatenation can be performed in the order of the index values of all answer phrases identified as 3333333333333333.
[0106] Those skilled in the art will appreciate that all or part of the steps implementing the above embodiments can be implemented as a computer program executed by a CPU. When executed by the CPU, the computer program performs the functions defined in the above method provided herein. The program can be stored in a computer-readable storage medium, such as a read-only memory, a magnetic disk, or an optical disk.
[0107] Furthermore, it should be noted that the aforementioned figures are merely illustrative of the processes included in the methods according to exemplary embodiments of the present application and are not intended to be limiting. It is readily understood that the processes illustrated in the aforementioned figures do not indicate or limit the temporal order of these processes. Furthermore, it is readily understood that these processes may be executed synchronously or asynchronously, for example, in multiple modules.
[0108] The following are device embodiments of the present application, which can be used to implement the method embodiments of the present application. For details not disclosed in the device embodiments of the present application, please refer to the method embodiments of the present application.
[0109] Figure 6 is a block diagram of a question-and-answer interactive device based on vectorized querying of large language model data, according to an exemplary embodiment. As shown in Figure 6 , the question-and-answer interactive device 60 based on vectorized querying of large language model data includes: an input module 602, a target module 604, a vector module 606, a query module 608, a question module 610, a model module 612, a response module 614, and a database module 616.
[0110] The input module 602 is used to perform semantic recognition on the user's input data and determine the question category corresponding to the input data;
[0111] The target module 604 is used to determine the target vector database according to the problem category;
[0112] The vector module 606 is used to convert the input data into an input vector;
[0113] The query module 608 is used to use the input vector to perform vector query in the target vector database and splice it into a query result;
[0114] When the target vector database is a knowledge vector database, the query module 608 is used to use the input vector to perform a vector query in the knowledge vector database, generate a predetermined number of knowledge phrase vectors as return results; extract the multidimensional label of the first knowledge phrase vector in the return result; extract the identifier and index value from the multidimensional label; extract the contextual knowledge phrases in the knowledge vector database based on the identifier and the index value; and splice the contextual knowledge phrases to generate a query result.
[0115] When the target vector database is a question-answer vector database, the query module 608 is used to use the input vector to perform a vector query in the question-answer vector database to generate a predetermined number of answer phrase vectors as return results; extract the multidimensional label of the first answer phrase vector in the return result; extract an identifier from the multidimensional label; extract all answer phrases corresponding to the identifier in the question-answer vector database; and splice all answer phrases corresponding to the identifier to generate a query result.
[0116] The question module 610 is used to generate prompt questions based on the input data and the query results;
[0117] The model module 612 is used to input the prompt question into the large language model to obtain a logical analysis result;
[0118] The reply module 614 is configured to perform a question-and-answer interaction based on the logic analysis result when the logic analysis result is a positive result.
[0119] The database module 616 is used to vectorize and organize the knowledge data in the knowledge database, set multi-dimensional labels and store them in the knowledge vector database; the database module 616 is also used to vectorize and organize the question and answer data in the question and answer data, set multi-dimensional labels and store them in the question and answer vector database.
[0120] According to the question-answering interaction device based on vectorized query of large language model data of the present application, semantic recognition is performed on the user's input data to determine the question category corresponding to the input data; a target vector database is determined according to the question category; the input data is converted into an input vector; a vector query is performed in the target vector database using the input vector, and the query results are spliced together; a prompt question is generated based on the input data and the query result; the prompt question is input into a large language model to obtain a logical analysis result; when the logical analysis result is a positive result, a question-answering interaction method is performed according to the logical analysis result, which can provide users with an intelligent question reply method and improve the quality and accuracy of answers to human-computer intelligent dialogues and question queries.
[0121] As shown in FIG7 , an embodiment of the present application provides an electronic device, including a processor 710 , a communication interface 720 , a memory 730 , and a communication bus 740 , wherein the processor 710 , the communication interface 720 , and the memory 730 communicate with each other via the communication bus 740 ;
[0122] Memory 730, for storing computer programs;
[0123] The processor 710 is configured to implement the question-answering interaction method based on large language model data vectorized query of any of the above embodiments when executing the program stored in the memory 730.
[0124] The communication interface 720 is used for communication between the electronic device and other devices.
[0125] The memory 730 may include a random access memory 730 (RAM) or a non-volatile memory 730, such as at least one disk storage 730. Alternatively, the memory 730 may be at least one storage device located away from the processor 710.
[0126] An embodiment of the present application provides a computer-readable storage medium storing one or more programs, and the one or more programs can be executed by one or more processors to implement the question-answering interaction method based on vectorized query of large language model data of any of the above embodiments. For example, semantic recognition can be performed on the user's input data to determine the question category corresponding to the input data; a target vector database can be determined based on the question category; the input data can be converted into an input vector; a vector query can be performed in the target vector database using the input vector, and the query results can be spliced together; a prompt question can be generated based on the input data and the query results; the prompt question can be input into the large language model to obtain a logical analysis result; and when the logical analysis result is a positive result, a question-answering interaction can be performed based on the logical analysis result.
[0127] While the exemplary embodiments of the present application have been specifically illustrated and described above, it should be understood that the present application is not limited to the detailed structures, configurations, or implementations described herein; rather, the present application is intended to encompass various modifications and equivalent configurations within the spirit and scope of the appended claims.
Claims
1. A question-and-answer interaction method based on vectorized query of large language model data, characterized in that, It includes: Performing semantic recognition on the input data of the user to determine the problem category corresponding to the input data; Determining a target vector database according to the problem category; wherein, the target vector database is used to store data of different categories after vectorization and setting of multi-dimensional labels; Converting the input data into an input vector; Performing vector query in the target vector database by using the input vector and splicing into a query result; Generating a prompt question through the input data and the query result; Inputting the prompt question into a large language model to obtain a logical analysis result; When the logical analysis result is a positive result, performing question-and-answer interaction according to the logical analysis result.
2. The method according to claim 1, wherein It also includes: Performing vectorization on the knowledge data in the knowledge database, setting multi-dimensional labels and storing them in the knowledge vector database; Performing vectorization on the Q&A data in the Q&A database, setting multi-dimensional labels and storing them in the Q&A vector database.
3. The method according to claim 2, wherein Performing vectorization on the knowledge data in the knowledge database, setting multi-dimensional labels and storing them in the knowledge vector database, including: Removing the symbols of the knowledge data in the knowledge base to generate multiple knowledge short sentences; Splicing the multiple knowledge short sentences to generate multiple knowledge phrases not exceeding the length threshold; Converting the multiple knowledge phrases into multiple knowledge phrase vectors; Setting multi-dimensional labels for the knowledge phrase vectors respectively and storing them in the knowledge vector database.
4. The method according to claim 3, wherein Setting multi-dimensional labels for the knowledge phrase vectors respectively and storing them in the knowledge vector database, including: Taking the copywriting, source, and type of the knowledge data corresponding to the knowledge phrase vector as one of the multi-dimensional labels; Taking the index value of the knowledge phrase vector in its corresponding knowledge data as one of the multi-dimensional labels; Assigning an identifier to the knowledge phrase vector and taking it as one of the multi-dimensional labels; Storing the knowledge phrase vector and its corresponding multi-dimensional labels in the knowledge vector database. Performing vectorization on the Q&A data in the Q&A database, setting multi-dimensional labels and storing them in the Q&A vector database, including:
5. The method according to claim 2, wherein Combining the questions and answers in the Q&A data into question-answer blocks in one-to-one correspondence; Splitting out the question data and answer data in the question-answer block; Converting the question data into a question vector; Converting the answer data into multiple answer phrase vectors; Setting multi-dimensional labels for the question vector and its corresponding answer phrase vectors respectively and storing them in the Q&A vector database. Converting the answer data into multiple answer phrase vectors, including:
6. The method according to claim 5, wherein Removing the symbols of the answer data to generate multiple answer short sentences; Splicing the multiple answer short sentences to generate multiple answer phrases not exceeding the length threshold; Converting the multiple answer phrases into multiple answer phrase vectors. Setting multi-dimensional labels for the question vector and its corresponding answer phrase vectors respectively and storing them in the Q&A vector database, including:
7. The method according to claim 5, characterized in that, Taking the copywriting, source, and type of the question vector and its corresponding answer phrase vectors as one of the multi-dimensional labels; Taking the index value of the answer phrase vector in its corresponding answer data as one of the multi-dimensional labels; Assigning an identifier to the answer phrase vector and taking it as one of the multi-dimensional labels; Store the problem vector, its corresponding answer phrase vector, and multi-dimensional tags in the Q&A vector database.
8. The method according to claim 1, wherein When the target vector database is a knowledge vector database, perform a vector query in the target vector database using the input vector and concatenate the query results, including: Perform a vector query in the knowledge vector database using the input vector to generate a predetermined number of knowledge phrase vectors as the return result; Extract the multi-dimensional tags of the first knowledge phrase vector in the return result; Extract the identifier and index value from the multi-dimensional tags; Extract the context knowledge phrase in the knowledge vector database according to the identifier and the index value; Concatenate the context knowledge phrases to generate the query result.
9. The method according to claim 1, wherein When the target vector database is a Q&A vector database, perform a vector query in the target vector database using the input vector and concatenate the query results, including: Perform a vector query in the Q&A vector database using the input vector to generate a predetermined number of answer phrase vectors as the return result; Extract the multi-dimensional tags of the first answer phrase vector in the return result; Extract the identifier from the multi-dimensional tags; Extract all the answer phrases corresponding to the identifier in the Q&A vector database; Concatenate all the answer phrases corresponding to the identifier to generate the query result.
10. A question-answering interaction device based on vectorized query of large language model data, characterized in that, Include: An input module for performing semantic recognition on the input data of the user to determine the problem category corresponding to the input data; A target module for determining the target vector database according to the problem category, where the target vector database is used to store different categories of data after vectorization and setting multi-dimensional tags; A vector module for converting the input data into an input vector; A query module for performing a vector query in the target vector database using the input vector and concatenating the query results; A problem module for generating a prompt question through the input data and the query result; A model module for inputting the prompt question into a large language model to obtain a logical analysis result; A reply module for performing a Q&A interaction according to the logical analysis result when the logical analysis result is a positive result.
11. An electronic device, characterized in that, Include: One or more processors; A storage device for storing one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 9.
12. A computer-readable medium having a computer program stored thereon, characterized in that, The program, when executed by the processor, implements the method according to any one of claims 1 to 9.
Citation Information
Patent Citations
Material data retrieval method
CN114254132A
Dialogue generation method and device based on knowledge base, electronic equipment and storage medium
CN117093698A
Method and system for optimizing man-machine conversation based on LLM model
CN117271735A
Question and answer interaction method and device based on large language model data vectorization query
CN117951268A
Dialog system answering method based on sentence paraphrase recognition
US20230069935A1
Cited By
Nuclear power DCS knowledge base construction system and method
CN120429286A
Industrial production operation safety knowledge question-answering method and system based on large language model
CN120744062A
Bridge data library division and model scheduling method and device based on information grading protection
CN121211487A
Question and answer method and device, electronic equipment, storage medium and program product
CN121301524A
Industrial data query and management method
CN121388132A