Data query method, device, electronic device, medium and computer program product
By introducing the first large model based on real-time knowledge base and query method of vector database in the knowledge retrieval system, the problem of low data retrieval quality and accuracy in traditional systems is solved, and more efficient and accurate data query results are achieved.
Patent Information
- Application Number
- CN202411737823.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-27
- Publication Date
- 2025-04-01
AI Technical Summary
When traditional knowledge retrieval systems process large amounts of information data, the quality of data retrieval and the accuracy of query results are low, especially when extracting and utilizing the latest information, it seems unscrupulous.
By receiving the query instructions, the first large model based on real-time knowledge base training is used to process the query instructions, the initial query results are obtained, and the query instructions are vectorized, the vector database is queried to obtain the second query result, and the target query results are finally synthesized based on the two results.
It improves the accuracy and quality of data queries, and through multi-level processing and vectorization technology, it improves the accurate response ability to user query instructions.
Smart Images

Figure CN119739844A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of artificial intelligence, and in particular relates to a data query method, device, electronic device, medium and computer program product. Background Art
[0002] At present, the rapid evolution of the field of network security requires knowledge retrieval systems to be able to update and process a large amount of new information in real time. However, traditional knowledge retrieval systems have low data retrieval quality and query result accuracy when processing large amounts of information data, especially when extracting and utilizing the latest information. Summary of the invention
[0003] Embodiments of the present application provide a data query method, device, electronic device, medium, and computer program product.
[0004] The present application provides a data query method, the method comprising:
[0005] receiving a first query instruction;
[0006] Processing the first query instruction through a first large model to obtain one or more first query results corresponding to the first query instruction; the first large model is obtained based on real-time knowledge base training;
[0007] Vectorizing the two first query instructions to obtain a first vector; querying a vector database for one or more second query results corresponding to the first vector; the vector database is obtained by vectorizing the text data in the real-time knowledge base;
[0008] Based on the first query result and the second query result, a target query result corresponding to the first query instruction is obtained.
[0009] In some embodiments, obtaining a target query result corresponding to the first query instruction based on the first query result and the second query result includes: sorting each query result in the first query result and the second query result based on the similarity of each query result in the first query result and the second query result to the first query instruction; obtaining the target query result corresponding to the first query instruction based on the query result with the greatest similarity in the sorted results.
[0010] It can be seen that by sorting the similarities of multiple query results obtained by different query methods and taking the result with the greatest similarity as the target query result, the accuracy of data query can be improved.
[0011] In some embodiments, after obtaining the target query result corresponding to the first query instruction, the method further includes: obtaining a prompt word based on the target query result and a preset prompt word template; processing the prompt word through a preset second large model to obtain an output result corresponding to the first query instruction that meets a preset format.
[0012] It can be seen that by further processing the target query results through the second largest model and outputting the output results that meet the preset format, the processing power of the large model can be used to further improve the accuracy of the obtained target query results, which is conducive to improving the ability to answer query instructions.
[0013] In some embodiments, the vectorizing the two first query instructions includes: vectorizing the other first query instruction of the two first query instructions according to semantic information of one of the two first query instructions.
[0014] It can be seen that by first obtaining the semantic information of a first query instruction and then performing vectorization processing on another identical first query instruction based on the semantic information, the semantic information of the text can be fully understood during the vectorization processing, thereby improving the accuracy of the vectorization processing. When the method of this embodiment is implemented based on a large model, the semantic processing capability of the large model can be fully utilized, and the contextual relationship of the first query instruction can be fully understood through the large model, which is conducive to improving the accuracy of the vectorization processing results of the large model.
[0015] In some embodiments, the vector database is obtained by processing the text data in the real-time knowledge base using echo embedding technology; the vectorization processing of the two first query instructions includes: vectorization processing of the two first query instructions based on echo embedding technology.
[0016] It can be seen that the data in the real-time knowledge base is vectorized based on the echo embedding technology, and the first query instruction is vectorized based on the echo embedding technology, which can improve the accuracy of the vectorization processing of the data in the real-time knowledge base and the first query instruction. Further, the query result corresponding to the first query instruction is obtained through the vectorized vector data, which can improve the accuracy of the obtained query result.
[0017] In some embodiments, the first big model represents a vertical field big model for a vertical field; before the first query instruction is processed by the first big model, the method further includes: performing data processing on the data in the real-time database to obtain a processed database; the data processing includes one or more of data cleaning, data normalization, and data verification; based on the data in the processed database and the query instruction, the vertical field big model is trained to obtain a trained vertical field big model; the trained vertical field big model is used to generate query results based on the query instruction; the processing of the first query instruction by the first big model includes: processing the first query instruction by the trained vertical field big model.
[0018] The present application also provides a data query device, the device comprising:
[0019] A receiving module, used for receiving a first query instruction;
[0020] A processing module, used for processing the first query instruction through a first large model to obtain one or more first query results corresponding to the first query instruction; the first large model is obtained based on the training of the real-time knowledge base; vectorizing the two first query instructions to obtain a first vector; querying one or more second query results corresponding to the first vector in a vector database; the vector database is obtained by vectorizing the text data in the real-time knowledge base;
[0021] A query module is used to obtain a target query result corresponding to the first query instruction based on the first query result and the second query result.
[0022] An embodiment of the present application provides an electronic device, the electronic device comprising a processor and a memory for storing a computer program that can be run on the processor; wherein:
[0023] The processor is used to run the computer program to execute any one of the above data query methods.
[0024] An embodiment of the present application provides a computer storage medium on which a computer program is stored. When the computer program is executed by a processor, any of the above-mentioned data query methods is implemented.
[0025] An embodiment of the present application provides a computer program product, including a computer program, which implements any of the above-mentioned data query methods when executed by a processor.
[0026] The embodiments of the present application provide a data query method, device, electronic device, medium, and computer program product. By performing vectorization processing based on two first query instructions, the accuracy of vectorization processing can be improved, and the second query result obtained based on the processed vector also has a high accuracy rate; combined with one or more first query results processed by the first large model, a target query result with higher accuracy can be obtained. Therefore, the data query method provided by the embodiments of the present application can effectively improve the quality of data retrieval and the accuracy of query results. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] Figure 1 A flow chart of a data query method provided in an embodiment of the present application;
[0028] Figure 2 A flow chart of another data query method provided in an embodiment of the present application;
[0029] Figure 3 A schematic diagram of the structure of a data query device provided in an embodiment of the present application;
[0030] Figure 4 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0031] In the era of rapid development of artificial intelligence (AI), the storage and representation of knowledge increasingly rely on the mathematical construction of vectors. In particular, vector databases, as multidimensional carriers of information storage, provide AI models with the necessary "memory" function, which plays a vital role in interacting with humans. The rapid evolution of the current network security field requires knowledge retrieval systems to be able to update and process a large amount of new information in real time. Traditional knowledge retrieval systems are unable to cope with these challenges, especially in extracting and utilizing the latest information. In this context, retrieval-augmented generation (RAG) technology and large models in vertical fields can be used to respond to the latest query needs. Despite this, large models, such as the GPT (Generative Pre-trained Transformer) structure, as an excellent autoregressive language model framework, have not been able to fully realize their huge semantic understanding potential with their built-in embedding methods. Traditional embedding methods limit the performance of GPT models in the retrieval process.
[0032] Although RAG technology and large models in vertical fields have made some progress in processing emerging information, existing retrieval methods have failed to fully utilize the powerful semantic understanding capabilities based on the GPT structure. This limits the quality of retrieval and affects the accuracy of the final response. Traditional embedding methods fail to maximize the potential of the GPT model, resulting in suboptimal semantic understanding of text.
[0033] In response to the above problems, the embodiments of the present application propose an innovative vectorization processing technology. This vectorization processing technology effectively enhances the ability of the relevant processing model to grasp the semantics of the text by copying the input text and passing it to the relevant processing model. Specifically, through the method provided in the embodiments of the present application, when the GPT model is used to process repeated text segments, the context information generated when it first appears can be used to greatly improve the retrieval accuracy, reduce the false alarm rate, and achieve highly accurate and efficient response to user query instructions. By applying the method provided in the embodiments of the present application, the advancement of the GPT model in knowledge retrieval can be fully stimulated, and efficient and high-precision semantic search and information retrieval can be achieved.
[0034] The following is a further detailed description of the embodiments of the present application in conjunction with the accompanying drawings and examples. It should be understood that the embodiments provided herein are only used to explain the embodiments of the present application and are not intended to limit the embodiments of the present application. In addition, the embodiments provided below are partial embodiments for implementing the present application, rather than providing all embodiments for implementing the present application. In the absence of conflict, the technical solutions recorded in the embodiments of the present application can be implemented in any combination.
[0035] It should be noted that, in the embodiments of the present application, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a method or device including a series of elements includes not only the elements explicitly recorded, but also includes other elements not explicitly listed, or also includes elements inherent to the implementation of the method or device. In the absence of further restrictions, an element defined by the sentence "includes..." does not exclude the presence of other related elements (such as steps in the method or units in the device, such as a unit in the device may be a part of a circuit, a part of a processor, a part of a program or software, etc.) in the method or device including the element.
[0036] The data query method provided in the embodiment of the present application includes a series of steps, but the data query method provided in the embodiment of the present application is not limited to the recorded steps. Similarly, the data query device provided in the embodiment of the present application includes a series of modules, but the device provided in the embodiment of the present application is not limited to including the modules explicitly recorded, and may also include modules required to obtain relevant information or perform processing based on the information.
[0037] The present application embodiment provides a data query method, such as Figure 1 As shown, Figure 1 A flow chart of a data query method is shown. Figure 1 The data query methods shown include:
[0038] Step 101: Receive a first query instruction.
[0039] The first query instruction received here may be a query instruction input by a user based on an input device, such as a terminal device, a computer, an embedded device, a controller, etc. The first query instruction may also be a query instruction issued by a processing program, a model, etc.
[0040] Step 102: Process the first query instruction through the first large model to obtain one or more first query results corresponding to the first query instruction; the first large model is obtained based on real-time knowledge base training.
[0041] A real-time knowledge base refers to a database system that integrates a large amount of information, data, and knowledge, and can quickly respond to the update and query requirements of new data. In order to achieve an efficient data storage solution, the real-time database can be a non-relational database NoSQL (Not Only Structured Query Language) or a distributed database. The real-time knowledge base can implement data pipelines, for example, to achieve multiple links such as data collection, cleaning, conversion, storage, and analysis, so that data can be automatically processed and stored when new data arrives.
[0042] The data cleaning process can be run regularly on the real-time knowledge base to remove duplicate and invalid data, and automated tools can be used to identify and delete irrelevant tags in the real-time knowledge base to maintain high-quality data in the real-time knowledge base and obtain high-quality data in the real-time database.
[0043] The first large model can be a model trained based on high-quality data in a real-time database, so by inputting a first query instruction into the first large model, one or more first query results corresponding to the first query instruction can be obtained. Here, one or more query results are query results obtained by the first large model based on the data in the real-time database. Specifically, the first large model can obtain an internal knowledge base based on high-quality data in the real-time database during model training, and obtain one or more first query results corresponding to the first query instruction based on the internal knowledge base; or, after receiving the first query instruction, the first large model can also call the high-quality data in the real-time database and process to obtain one or more first query results.
[0044] Step 103: vectorize the two first query instructions to obtain a first vector; query one or more second query results corresponding to the first vector in a vector database; the vector database is obtained by vectorizing the text data in the real-time knowledge base.
[0045] In some embodiments, the text data in the real-time database can be vectorized to obtain a vector database corresponding to the real-time database. The vectorization processing methods here include but are not limited to word embedding methods, processing based on pre-trained language models, processing based on N-gram models, etc. It should be noted that in order to realize data query through the vector database, the query instruction needs to be vectorized, and it is necessary to ensure that the query instruction and the text data in the real-time database are vectorized based on the same vectorization processing method.
[0046] When data query is required based on vector database, in order to improve the accuracy of data query, it is necessary to accurately vectorize the text data. Vectorization is a technology that converts non-numeric data, such as text, images, etc., into numerical data. In natural language processing, text vectorization is the process of converting text data into numerical vector representation for calculation and analysis. Vectorization can capture the vocabulary, grammar, and semantic features in text data by converting text data into vector representation. These features have a certain distribution pattern in the vector space, so that semantically similar texts are close to each other in the vector space. Therefore, the accuracy of vectorization is closely related to the understanding of contextual semantics.
[0047] In order to improve the accuracy of vectorization processing, in an embodiment of the present application, the first query instruction is copied to obtain two first query instructions, and the two first query instructions are vectorized. For example, the first query instruction may be "qwerty", and the two first query instructions obtained by copying the first query instruction may be "qwertyqwerty". The two first query instructions "qwertyqwerty" may be vectorized. It can be seen that there are two identical text data in the two first query instructions "qwertyqwerty", so in the vectorization processing, the first text data "qwerty" may be identified first, "qwerty" may be semantically understood, and then the latter "qwerty" of the two first query instructions "qwertyqwerty" may be vectorized.
[0048] Alternatively, the two first query instructions may be in the form of "qwerty", "qwerty", and in this case, the first vectorization process may be performed on one "qwerty". Since the relative position and relationship between the vectors obtained after the process can reflect the context information in the text to a certain extent, before the second vectorization process is performed on the other "qwerty", the relative position and relationship between the vectors obtained after the first vectorization process may be analyzed and processed, and then the second vectorization process may be performed to improve the accuracy of the second vectorization process.
[0049] Based on the vectorization processing method given above, the text data in the real-time database can also be vectorized, that is, the text data that needs to be vectorized in the real-time database is copied to obtain two identical text data, and the two identical text data are vectorized to obtain a vector database. When the vector database contains a large amount of vector data, in order to improve the retrieval speed of large-scale vector data, it can also be searched based on the approximate nearest neighbor search algorithm to improve the vector data query speed and quickly return the vector data.
[0050] By querying the vector data in the vector database through the vectorized first query instruction, one or more second query results can be obtained.
[0051] Step 104: Based on the first query result and the second query result, obtain a target query result corresponding to the first query instruction.
[0052] After obtaining the query result in the vector database based on step 103, the corresponding query result in the vector database is one or more vectors. The vectors can be converted into text data by a processing method such as inverse mapping to obtain one or more second query results.
[0053] Among the one or more first query results and the one or more second query results, one query result is determined as a target query result corresponding to the first query instruction.
[0054] It can be seen that based on the method given in the above steps, based on the real-time knowledge base containing real-time data, the first query instruction is processed through the first large model, which can improve the accuracy of the first query result and the real-time performance of the first query result; based on the vectorization processing of the two first query instructions, the accuracy of the vectorization processing can be improved, and the accuracy of the second query result obtained through the vector query can be further improved. By determining the target query result from multiple first query results and second query results with higher accuracy, the accuracy of the obtained target query result can be further improved.
[0055] In practical applications, steps 101 to 104 can be implemented based on a processor, and the processor can be at least one of an application specific integrated circuit (ASIC), a digital signal processor (DSP), a digital signal processing device (DSPD), a programmable logic device (PLD), a field programmable gate array (FPGA), a central processing unit (CPU), a controller, a microcontroller, and a microprocessor.
[0056] In some embodiments, the above-mentioned obtaining the target query result corresponding to the first query instruction based on the first query result and the second query result includes: sorting each query result in the first query result and the second query result based on the similarity of each query result in the first query result and the second query result with the first query instruction; obtaining the target query result corresponding to the first query instruction based on the query result with the greatest similarity in the sorted results.
[0057] Based on step 102 and step 103 in the above embodiment, multiple query results consisting of one or more first query results and one or more second query results can be obtained. The multiple query results obtained can be sorted based on the similarity between each query result in the multiple query results and the first query instruction to obtain a sorted result. By determining the query result with the greatest similarity to the first query instruction in the sorted results, the query result with the greatest similarity is the target query result corresponding to the first query result.
[0058] In some embodiments, after obtaining the target query result corresponding to the first query instruction, the method further includes: obtaining a prompt word based on the target query result and a preset prompt word template; processing the prompt word through a preset second largest model to obtain an output result corresponding to the first query instruction that meets a preset format.
[0059] In order to obtain an output result in a preset format, after obtaining the target query result, the target query result can be further processed by the second largest model to obtain an output result that meets the preset format. Here, the second largest model can be a general large model, that is, the second largest model does not need to be specially trained.
[0060] Specifically, after obtaining the target query result, the prompt word for inputting the second largest model can be obtained based on the target query result and the preset prompt word template. For example, the prompt word template corresponding to the second largest model can be:
[0061] Please read the following text and generate a text summary in the following format:
[0062] Abstract title: {automatically generated or refined according to content}
[0063] Original text summary: {Briefly summarize the main content and key points of the original text}
[0064] Key Information:
[0065] -{Key Information Point 1}
[0066] -{Key Information Point 2}
[0067] -{Key Information Point 3}
[0068] (Add more key information points based on the original content)
[0069] Conclusion or revelation: {the conclusion, viewpoint or revelation extracted from the content of the original text}".
[0070] Correspondingly, assume that the target query result is "Original title: Application and Challenges of Artificial Intelligence in the Medical Field; With the rapid development of science and technology, artificial intelligence (AI) has penetrated into various industries, among which the medical field is one of the important fields of AI application. The application of AI in medicine includes but is not limited to disease diagnosis, drug development, patient management, etc. However, the application of AI in the medical field also faces many challenges, such as data privacy, algorithm bias, medical ethics, etc. This article will explore the current application status of AI in the medical field and the challenges it faces."
[0071] By combining the target query result with the prompt word template, an example of a preset format output of the target query result obtained by the second largest model may be:
[0072] “Abstract title: Overview of the applications and challenges of artificial intelligence in the medical field
[0073] Original article overview: This article discusses the current status of artificial intelligence applications in the medical field and the challenges it faces, including applications in disease diagnosis, drug development, patient management, as well as issues such as data privacy, algorithmic bias, and medical ethics.
[0074] Key Information:
[0075] The applications of artificial intelligence in the medical field include disease diagnosis, drug development, patient management, etc.
[0076] The main challenges facing AI in medical applications include data privacy, algorithmic bias, and medical ethics issues.
[0077] This article aims to explore the current status and challenges of AI in the medical field.
[0078] Conclusion or revelation: Artificial intelligence has broad application prospects in the medical field, but it also faces many challenges. In order to better apply AI technology, these problems need to be solved to ensure the safety and reliability of the technology. "
[0079] It can be seen that by processing the target query results through the large model, the output results that meet the preset format requirements can be obtained, so that the output results in a unified format can be obtained for different query instructions.
[0080] In some embodiments, the above-mentioned vectorization processing of the two first query instructions includes: performing vectorization processing on the other first query instruction of the two first query instructions according to semantic information of one of the two first query instructions.
[0081] Based on the method given in the above embodiment, in practical applications, the model can be used to implement vectorized processing, for example, two first query instructions are vectorized by the first processing model. The first processing model represents a model that can be vectorized. The first processing model can specifically be a One-Hot Model, an N-Gram model, a Doc2Vec model, etc. The first processing model can also be a large language model, such as a GPT (Generative Pre-trained Transformer) series model, such as GPT-2, GPT-3, etc.
[0082] For the GPT model, since the GPT model itself has strong processing capabilities in knowledge retrieval and semantic understanding, through the method provided in this embodiment, the semantic processing capability of the GPT model can be used to obtain accurate semantic information of a first query instruction, and further, the GPT model can perform vectorization processing on the other first query instruction of the two first query instructions based on the semantic information obtained by itself, which can enhance the GPT model's ability to grasp the semantics of the text and greatly improve the accuracy of the vectorization processing.
[0083] In some embodiments, the above-mentioned vector database is obtained by processing the text data in the real-time knowledge base with echo embedding technology; the above-mentioned vectorization processing of the two first query instructions includes: vectorization processing of the two first query instructions based on echo embedding technology.
[0084] In this embodiment, the echo embedding technology (echo embeddings) can be specifically used to vectorize the data in the real-time database and the first query instruction. The high-quality data in the real-time database can be vectorized by the echo embedding technology, and the first query instruction obtained can be vectorized based on the echo embedding technology, and one or more second query results can be obtained based on the vector query.
[0085] In this embodiment, the first query instruction can be copied to obtain two first query instructions, and the two first query instructions can be vectorized based on the echo embeddings technology. The first query instruction can also be directly processed based on the echo embeddings technology, and two first query instructions can be obtained through the echo embeddings technology, and the first vector corresponding to the first query instruction can be obtained based on the two first query instructions.
[0086] In some embodiments, the first query instruction and high-quality data in the real-time database can also be vectorized based on the above-mentioned first processing model, such as the GPT model, combined with the echo embeddings technology.
[0087] In the related art, the embedding method is usually used to convert words, phrases or other types of text data into vectors when vectorizing the first query instruction and the high-quality data in the real-time database through the first processing model combined with the echo embeddings technology, especially when the first processing model is a large model with excellent language processing capabilities such as the GPT model, the first processing model is vectorized using the echo embeddings technology, which can give full play to the language processing capabilities of the first processing model and obtain an accurate vector representation of the text data.
[0088] In some embodiments, the first large model represents a vertical field large model for a vertical field; before the first query instruction is processed by the first large model, the method further includes: performing data processing on the data in the real-time database to obtain a processed database; the data processing includes one or more of data cleaning, data normalization, and data verification; based on the data in the processed database and the query instruction, the vertical field large model is trained to obtain a trained vertical field large model; the trained vertical field large model is used to generate query results based on the query instruction; the processing of the first query instruction by the first large model includes: processing the first query instruction by the trained vertical field large model.
[0089] A vertical field refers to a field that focuses on a specific industry or service. A large model trained based on data from a specific industry or service can be used as a vertical field large model. A vertical field large model focuses more on the knowledge and skills in a specific field and has higher field professionalism and practicality.
[0090] In the process of model training for large vertical domain models based on real-time databases, data in the real-time databases are first processed, such as data cleaning, data normalization, and data verification. The data cleaning process can be run regularly to remove duplicate and invalid data in the real-time database, and use automated tools to identify and delete irrelevant tags in the real-time database. Data with high relevance to vertical domains can also be screened out in the real-time database to obtain a processed database.
[0091] After the vertical domain big model is trained by the processed data in the database and the query instruction, the first query instruction can be processed based on the trained vertical domain big model to obtain one or more query results. For example, based on the first query instruction, an effective prompt word can be constructed using a preset prompt word template or natural language generation technology to ensure that the prompt word can guide the trained vertical domain big model to generate relevant answers. The prompt word can be dynamically adjusted according to the retrieved content and the user's question, so that the trained vertical domain big model can output more accurate output results, that is, one or more first query results are obtained.
[0092] Based on the use of a large model for instruction query, the embodiment of the present application introduces a vector processing query method, especially echo embedding technology, so that in the process of generating vectors based on the first processing model, subsequent token information can be accessed, which not only improves the quality of text embedding, but also significantly improves the performance of the first processing model under zero sample and fine-tuning conditions. The embodiment of the present application does not rely on additional data or complex instructions, making the model used for vectorized processing more versatile and easy to deploy.
[0093] Based on the method given in the above embodiment, Figure 2 Another data query method is shown, including:
[0094] Input the query instruction 201 into the vertical domain big model 203 to obtain one or more first query results output by the vertical domain big model 203; perform vectorization processing on the query instruction 201 based on the echo embeddings technology to obtain the instruction vector 202 corresponding to the query instruction 201. Here, the query instruction 201 can specifically be the first query instruction in the above embodiment.
[0095] The data in the real-time knowledge base 204 is processed to remove duplicate and invalid data, and to identify and delete irrelevant labels to obtain high-quality data 205. The text data in the high-quality data 205 is vectorized by echo embeddings technology to obtain a vector database 206. The similarity calculation is performed based on the instruction vector 202 and the vector in the vector database 206 to obtain a recall answer 207 that meets the similarity threshold. Here, the recall answer 207 can be one or more second query results in the above embodiment, and the recall answer 207 can be text data obtained based on the vector in the vector database 206 whose similarity with the instruction vector 202 is greater than the similarity threshold. Among them, the vertical field large model 203 is also trained based on the high-quality data 205.
[0096] One or more first query results outputted by the vertical domain big model 203 and the recalled answer 207 are sorted by similarity with the query instruction 201 to obtain a refined ranking result 208 .
[0097] The query result with the highest similarity to the query instruction 201 in the refined sorting result 208 is used as the target query result, and the target query result is input into the prompt word template 209 to obtain the prompt word 210. The prompt word 210 is input into the large model 211 to obtain the final output result 212. Here, the large model 211 can be the second large model in the above embodiment.
[0098] Those skilled in the art will appreciate that, in the above method of specific implementation, the order in which the steps are written does not imply a strict execution order and does not constitute any limitation on the implementation process. The specific execution order of the steps should be determined by their functions and possible internal logic.
[0099] Based on the data query method proposed in the above embodiment, the present application embodiment also provides a data query device, such as Figure 3 As shown, the data query device includes:
[0100] The receiving module 301 is used to receive a first query instruction.
[0101] Processing module 302 is used to process the first query instruction through the first large model to obtain one or more first query results corresponding to the first query instruction; the first large model is obtained based on the real-time knowledge base training; the two first query instructions are vectorized to obtain the first vector; one or more second query results corresponding to the first vector are searched in the vector database; the vector database is obtained by vectorizing the text data in the real-time knowledge base.
[0102] The query module 303 is used to obtain a target query result corresponding to the first query instruction based on the first query result and the second query result.
[0103] In practical applications, the receiving module 301, the processing module 302, and the query module 303 can be implemented based on a processor and a communication device.
[0104] In some embodiments, the query module 303 is specifically used to sort each query result in the first query result and the second query result based on the similarity of each query result in the first query result and the second query result with the first query instruction; and obtain the target query result corresponding to the first query instruction based on the query result with the greatest similarity in the sorted results.
[0105] In some embodiments, after obtaining the target query result corresponding to the first query instruction, the query module 303 is also used to obtain a prompt word based on the target query result and a preset prompt word template; the prompt word is processed through a preset second largest model to obtain an output result corresponding to the first query instruction that meets a preset format.
[0106] In some embodiments, the processing module 302 is specifically configured to perform vectorization processing on the other first query instruction of the two first query instructions according to semantic information of the other first query instruction of the two first query instructions.
[0107] In some embodiments, the vector database is obtained by processing text data in the real-time knowledge base using echo embedding technology, and the processing module 302 is specifically used to perform vectorization processing on the two first query instructions based on the echo embedding technology.
[0108] In some embodiments, the first large model represents a vertical field large model for a vertical field. Before the first query instruction is processed by the first large model, the processing module 302 is also used to perform data processing on the data in the real-time database to obtain a processed database; data processing includes one or more of data cleaning, data normalization, and data verification; based on the data in the processed database and the query instruction, the vertical field big model is trained to obtain a trained vertical field big model; the trained vertical field big model is used to generate query results based on the query instruction; the processing module 302 is specifically used to process the first query instruction through the trained vertical field big model.
[0109] It should be noted that the description of the above device embodiment is similar to the description of the above method embodiment, and has similar beneficial effects as the same method embodiment. For technical details not disclosed in the device embodiment of the present application, please refer to the description of the method embodiment of the present application for understanding.
[0110] It should be noted that in the embodiments of the present application, if the above method is implemented in the form of a software function module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the embodiment of the present application is essentially 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, including a number of instructions to enable a computer device (which can be a terminal, a server, etc.) to execute all or part of the methods described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a U disk, a mobile hard disk, a read-only memory (ROM), a disk or an optical disk. In this way, the embodiments of the present application are not limited to any specific combination of hardware and software.
[0111] An embodiment of the present application also provides an electronic device. Figure 4 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application is shown in FIG. Figure 4 As shown, the electronic device 40 may include:
[0112] The memory 401 is used to store executable instructions.
[0113] The processor 402 is used to implement any of the above-mentioned data query methods when executing the executable instructions stored in the memory 401.
[0114] The processor 402 may be at least one of an ASIC, a DSP, a DSPD, a PLD, a FPGA, a CPU, a controller, a microcontroller, and a microprocessor.
[0115] The above-mentioned computer-readable storage medium or memory 401 can be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), a magnetic random access memory (FRAM), a flash memory (Flash Memory), a magnetic surface memory, an optical disk, or a compact disc read-only memory (CD-ROM) and other memories; it can also be various terminals including one or any combination of the above-mentioned memories, such as mobile phones, computers, tablet devices, personal digital assistants, etc.
[0116] An embodiment of the present application further provides a computer storage medium, on which computer executable instructions are stored, and the computer executable instructions are used to implement any one of the data query methods provided in the above embodiments.
[0117] Correspondingly, an embodiment of the present application further provides a computer program product, which includes computer executable instructions, and the computer executable instructions are used to implement any one of the data query methods provided in the above embodiments.
[0118] In some embodiments, the functions or modules included in the device provided in the embodiments of the present application can be used to execute the method described in the above method embodiments. The specific implementation can refer to the description of the above method embodiments. For the sake of brevity, it will not be repeated here.
[0119] The above description of various embodiments tends to emphasize the differences between the various embodiments. The same or similar aspects can be referenced to each other, and for the sake of brevity, they will not be repeated herein.
[0120] The methods disclosed in the various method embodiments provided in this application can be arbitrarily combined without conflict to obtain new method embodiments.
[0121] The features disclosed in the various product embodiments provided in this application can be arbitrarily combined without conflict to obtain new product embodiments.
[0122] The features disclosed in the various method or device embodiments provided in this application can be arbitrarily combined without conflict to obtain new method embodiments or device embodiments.
[0123] 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, a magnetic disk, or an optical disk), and includes a number of instructions for a terminal (which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to execute the methods described in each embodiment of the present application.
[0124] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.
Claims
1. A data query method, characterized in that: The method comprises: receiving a first query instruction; Processing the first query instruction through a first large model to obtain one or more first query results corresponding to the first query instruction; the first large model is obtained based on real-time knowledge base training; Vectorizing the two first query instructions to obtain a first vector; querying a vector database for one or more second query results corresponding to the first vector; the vector database is obtained by vectorizing the text data in the real-time knowledge base; Based on the first query result and the second query result, a target query result corresponding to the first query instruction is obtained.
2. The method according to claim 1, characterized in that The obtaining, based on the first query result and the second query result, a target query result corresponding to the first query instruction includes: sorting each of the first query result and the second query result based on the similarity between each of the first query result and the second query result and the first query instruction; Based on the query result with the greatest similarity in the sorted results, a target query result corresponding to the first query instruction is obtained.
3. The method according to claim 1 or 2, characterized in that: After obtaining the target query result corresponding to the first query instruction, the method further includes: Based on the target query result and a preset prompt word template, a prompt word is obtained; The prompt word is processed by a preset second largest model to obtain an output result that satisfies a preset format and corresponds to the first query instruction.
4. The method according to claim 1, characterized in that: The vectorizing the two first query instructions includes: According to the semantic information of one of the two first query instructions, vectorization processing is performed on the other of the two first query instructions.
5. The method according to claim 1, characterized in that The vector database is obtained by processing the text data in the real-time knowledge base with echo embedding technology; The vectorizing the two first query instructions includes: The two first query instructions are vectorized based on the echo embedding technology.
6. The method according to claim 1, characterized in that The first large model represents a vertical domain large model for a vertical domain; before processing the first query instruction by the first large model, the method further includes: Performing data processing on the data in the real-time database to obtain a processed database; the data processing includes one or more of data cleaning, data normalization, and data verification; Based on the data in the processed database and the query instruction, the vertical field big model is trained to obtain a trained vertical field big model; the trained vertical field big model is used to generate query results based on the query instruction; The processing of the first query instruction by using the first large model includes: The first query instruction is processed by the trained vertical field big model.
7. A data query device, characterized in that: The device comprises: A receiving module, used for receiving a first query instruction; A processing module, used for processing the first query instruction through a first large model to obtain one or more first query results corresponding to the first query instruction; the first large model is obtained based on the training of the real-time knowledge base; vectorizing the two first query instructions to obtain a first vector; querying one or more second query results corresponding to the first vector in a vector database; the vector database is obtained by vectorizing the text data in the real-time knowledge base; A query module is used to obtain a target query result corresponding to the first query instruction based on the first query result and the second query result.
8. An electronic device, characterized in that: The electronic device comprises a processor and a memory for storing a computer program that can be run on the processor; wherein, The processor is configured to run the computer program to perform the method according to any one of claims 1 to 6.
9. A computer storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.
10. A computer program product, comprising a computer program, characterized in that The computer program implements the method according to any one of claims 1 to 6 when executed by a processor.