Retrieval method and device based on large language model and multi-path recall and electronic equipment
By combining multi-path recall and prompt word engineering with a large language model, the shortcomings of existing retrieval technologies in terms of accuracy and semantic understanding are addressed, achieving efficient and accurate retrieval in the field of plastic and cosmetic surgery.
Patent Information
- Application Number
- CN202411137861.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-19
- Publication Date
- 2024-11-26
AI Technical Summary
Existing retrieval technologies such as TF-IDF and large language models have shortcomings in terms of accuracy and semantic understanding, resulting in inaccurate retrieval results and the potential spread of false information.
By combining the features of multiple search tools, and through synonym conversion, multi-path recall, and prompt word engineering of large language models, the search results are limited to a preset domain. Utilizing graph databases, vector databases, and keyword retrieval, accurate search results are provided.
It improves the accuracy and efficiency of retrieval, avoids the illusion problem of large language models in specific patterns, and enhances the ability to answer professional questions in the field of plastic and cosmetic surgery.
Smart Images

Figure CN119025758A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of information retrieval technology, and in particular relates to a retrieval method, device and electronic equipment based on a large language model and multi-way recall. Background Art
[0002] With the advancement of science and technology and the development of society, there are many different retrieval technologies, and different retrieval technologies have different characteristics. When users search for questions, if they cannot accurately select the retrieval tools, the accuracy of the retrieval may be reduced.
[0003] Existing technologies such as TF-IDF are mainly based on word segmentation of the documents to be retrieved, and count the frequency of different words in different documents, and return the retrieved documents through keyword matching. However, the TF-IDF algorithm simply lacks consideration of word order information and text distribution, which lacks the ability to understand the deep meaning of the text in a fine-grained manner. Large Language Model (LLM) generates natural language answers to questions raised by users in the form of dialogue. The basic idea of the multi-head attention mechanism of the large language model is to project the query, key, and value into multiple spaces, and then calculate the similarity between the query and all keys to assign attention weights, and finally weighted sum these weights to obtain the output vector. However, the large language model is overly dependent on specific patterns. When processing new data, the large language model will imitate the reasoning of the training corpus, resulting in inconsistent results with the actual situation, which will lead to a series of adverse consequences such as spreading false information.
[0004] Therefore, combining the characteristics of various search tools to accurately provide users with the search results they need has become an urgent problem that needs to be solved. Summary of the invention
[0005] The present application provides a retrieval method, device and electronic device based on a large language model and multi-way recall, which combines the characteristics of multiple retrieval tools to accurately provide the retrieval results required by users.
[0006] In a first aspect, an embodiment of the present application provides a retrieval method based on a large language model and multi-way recall, the method comprising: obtaining user search content; performing synonym conversion on the user search content to determine conversion data, the synonym conversion comprising removing stop words, replacing typos and identifying homophones; based on the conversion data, determining recall data through multi-way recall processing, the recall data comprising node recall data, text recall data and document recall data; based on the recall data and the conversion data, determining retrieval results through a large language model, the large language model comprising a prompt word project, the prompt word project being used to limit the retrieval results to a preset field.
[0007] In a possible implementation, the prompt word project includes a large language model role and a large language model responsibility; the large language model role is used to determine the large language model domain; the large language model responsibility is used to determine the source of the retrieval result based on the large language model domain and the recall data.
[0008] In a possible implementation, the retrieval results are determined based on the recall data and the conversion data through a large language model, including: determining summary information of each content in the recall data based on the recall data; identifying user retrieval intent based on the conversion data; determining a retrieval draft based on matching the summary information of each content with the user retrieval intent; and determining retrieval results by deleting fabricated content based on the retrieval draft.
[0009] In one possible implementation, the multi-path recall processing includes a first-path recall processing, a second-path recall processing, and a third-path recall processing; the first-path recall processing is used to determine the node recall data based on the conversion data through a graph database, and the graph database is constructed by structured data and semi-structured data; the second-path recall processing is used to determine the text recall data based on the conversion data through a vector database, and the vector database is constructed by text data; the third-path recall processing is used to determine the document recall data based on the conversion data through keyword retrieval, and the document recall data is constructed by document data.
[0010] In one possible implementation, constructing the graph database includes: determining the knowledge graph patterns and triples corresponding to the structured data and the semi-structured data based on the structured data and the semi-structured data; constructing a knowledge graph construction script based on the knowledge graph pattern and the triples through a preset computer language; and constructing the graph database based on the knowledge graph construction script.
[0011] In one possible implementation, constructing the vector database includes: performing block processing on the text data to determine the block text data; performing vectorization processing based on the block text data through a vectorization processing model to determine the vector data corresponding to the block text data; and determining a vector database based on the vector data.
[0012] In a possible implementation, the determining of text recall data based on the conversion data through a vector database includes: determining vector conversion data based on the conversion data through the vectorization processing model; and determining the text recall data through similarity matching in the vector database based on the vector conversion data.
[0013] In a second aspect, an embodiment of the present application provides a retrieval device based on a large language model and multi-way recall, the device comprising: an acquisition module for acquiring user search content; a conversion module for performing synonymous conversion on the user search content and determining conversion data, the synonymous conversion comprising removing stop words, replacing typos and identifying homophones; a processing module for determining recall data based on the conversion data through multi-way recall processing, the recall data comprising node recall data, text recall data and document recall data; a determination module for determining retrieval results based on the recall data and the conversion data through a large language model, the large language model comprising a prompt word project, the prompt word project being used to limit the retrieval results to a preset field.
[0014] In a third aspect, an embodiment of the present application provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the method described in the first aspect or any one of the implementation methods thereof is implemented.
[0015] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method described in the first aspect or any one of the implementation methods thereof is implemented.
[0016] In a fifth aspect, an embodiment of the present application provides a computer program product. When the computer program product runs on an electronic device, the electronic device executes the method described in the first aspect or any one of the implementation methods thereof.
[0017] The solution provided by the present application is as follows: obtaining user search content; performing synonymous conversion on the user search content to determine conversion data; determining recall data through multi-way recall processing based on the conversion data; determining the search results through a large language model based on the recall data and the conversion data, wherein the large language model includes a prompt word engineering, and the prompt word engineering is used to limit the search results to a preset field. Compared with the prior art that only uses one search method for searching, the present application determines the recall data through multi-way recall processing, combining the advantages of each search method, and then limits the field of the large language model through the prompt word engineering based on the recall data and the user search content, and limits the scope of the large language model's answer to the recall data, which can effectively avoid the hallucination problem of the general model. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0019] Figure 1 A flowchart of a retrieval method based on a large language model and multi-way recall provided in one embodiment of the present application;
[0020] Figure 2 A flowchart of another retrieval method based on a large language model and multi-way recall provided in an embodiment of the present application;
[0021] Figure 3 A structural block diagram of a retrieval device based on a large language model and multi-way recall provided in an embodiment of the present application;
[0022] Figure 4 A schematic diagram of the structure of an electronic device provided in one embodiment of the present application. DETAILED DESCRIPTION
[0023] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.
[0024] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, wholes, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or combinations thereof.
[0025] It should also be understood that the term “and / or” used in the specification and appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes these combinations.
[0026] As used in the specification and appended claims of this application, the term "if" can be interpreted as "when" or "uponce" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrase "if it is determined" or "if [described condition or event] is detected" can be interpreted as meaning "uponce it is determined" or "in response to determining" or "uponce [described condition or event] is detected" or "in response to detecting [described condition or event]", depending on the context.
[0027] In addition, in the description of the present application specification and the appended claims, the terms "first", "second", "third", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance.
[0028] References to "one embodiment" or "some embodiments" etc. described in the specification of this application mean that one or more embodiments of the present application include specific features, structures or characteristics described in conjunction with the embodiment. Therefore, the statements "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways.
[0029] Existing technologies such as TF-IDF and BM25 are mainly based on word segmentation of the documents to be retrieved, and counting the frequency of different words in different documents, and returning the retrieved documents through keyword matching. Among them, TF-IDF technology mainly considers the frequency of a word in a document (TF), and calculates the inverse of the frequency of the word in all documents (inverse document frequency, IDF). The final TF-IDF value is obtained by multiplying the frequency TF and IDF. This value reflects the frequency of a word in the target document and its proportion of the frequency of all other documents. When the TF-IDF value is large, it indicates that the word is unique in the current document and appears relatively less in other documents. It can be used as a keyword to recall the current document. BM25 technology is an improved algorithm based on TF-IDF. It introduces new parameters and adjusts the formula to improve the accuracy of information retrieval. Specifically, BM25 technology introduces document length and normalization factors and controls the upper limit of word frequency.
[0030] Topic modeling is a text mining method that identifies topics by analyzing a large collection of unlabeled natural text data. It is widely used in fields such as information retrieval and text classification.
[0031] Latent Dirichlet Allocation (LDA) is a typical representative of topic models. It mines latent topics from a document collection by assuming that each document is generated by a mixture of multiple topics and each topic is a probability distribution of words.
[0032] Keyword search algorithm is a common and crude search method. First, the algorithm will process the user's query content by word segmentation, etc. Then, the segmented results are matched accurately or fuzzily to the web pages containing these keywords in the database, and finally, the extracted websites are sorted and presented to the user. Users can customize search strategies. Users can combine multiple keywords together for search, such as medical artificial intelligence; users can also use "+" or "-" to add required content or filter out unnecessary content.
[0033] Knowledge graph is a semantic network that reveals the relationship between entities and depicts the physical objects in the real world and their relationships. Generally, triples are used to represent the relationship information between two entities and the attribute information between concepts and attributes. Knowledge graph involves a variety of natural language processing technologies, including entity extraction, relationship extraction, attribute extraction, and entity alignment.
[0034] LLM is a new type of retrieval method that generates natural language answers to questions raised by users in the form of dialogue. The underlying architecture of the general large model is based on the Transformer architecture. It uses the multi-head attention mechanism (Multi-Head Attention, MHA) to simultaneously focus on different parts of the input sequence, improving the computational efficiency of the model and capturing long-distance dependencies. The basic idea of the multi-head attention mechanism is to project the query, key, and value into multiple spaces, then calculate the similarity between the query and all keys to assign attention weights, and finally perform weighted summation based on these weights to obtain the output vector.
[0035] In summary, existing technologies all have some limitations in the retrieval process.
[0036] There are obvious shortcomings in content understanding. TF-IDF technology is simple and lacks consideration of word order information and text distribution, which lacks the ability to understand the deep meaning of the text in a fine-grained manner. Secondly, TF-IDF technology also lacks the ability to handle unregistered words. The LDA model is very sensitive to the number of topics and the initialization value of the topic distribution during training. At this stage, there is no feasible solution to determine the number of topics.
[0037] In terms of understanding user query content, existing technologies also have obvious technical shortcomings. Keyword search cannot solve the phenomenon of polysemy due to technical limitations. Knowledge graph retrieval also has shortcomings in information retrieval. As the scale of the knowledge base continues to expand, it is difficult to maintain and update the knowledge base, resulting in the inability to guarantee the timeliness of a lot of information; secondly, a large amount of redundant information will be generated during the knowledge storage process, affecting its query efficiency. General large language models are also slightly insufficient in information retrieval. The biggest problem with large model retrieval is the phenomenon of hallucination. The large model is overly dependent on specific patterns. In the process of processing new data, the large model will imitate the reasoning of the training corpus, resulting in the generation of results that are inconsistent with the actual situation. This will lead to a series of adverse consequences such as the spread of false information.
[0038] The above content belongs to vector space models and probability models, which can solve the problem of information retrieval to a certain extent and are widely used in search engines such as Elastic search. However, search products based on the above retrieval technology often do not have the ability to understand semantics. In view of the various questioning methods of users in different fields, it is necessary to build various domain-driven templates (Domain Specific Language, DSL) to parse the corresponding "queries", identify the query intent, and then carry out document search. In addition, word segmentation technology is an important prerequisite for keyword search. However, in the vertical medical field, due to the emergence of a large number of proper nouns, the efficiency of existing word segmentation technology is difficult to guarantee, and proper nouns need to be manually added to the word segmentation dictionary, which is time-consuming and laborious.
[0039] Therefore, the present application proposes a retrieval method, device and electronic device based on a large language model and multi-way recall, which combines the characteristics of multiple retrieval tools to accurately provide the retrieval results required by users.
[0040] Figure 1 The present invention is a flowchart of a retrieval method based on a large language model and multi-way recall, the method comprising:
[0041] S110, obtaining user search content.
[0042] Exemplarily, the method provided in the present application can be used for knowledge retrieval in the field of plastic surgery. The user inputs the search content according to his or her own needs, and the system automatically obtains the user's search content.
[0043] S120, performing synonym conversion on the user search content to determine conversion data, wherein the synonym conversion includes removing stop words, replacing wrong characters and identifying homophones.
[0044] For example, when a user inputs search content, the search content may not be accurate due to various reasons such as input habits or input methods, and the input content may contain noise such as typos, stop words or homophones. Therefore, after obtaining the user's search content, the user's search content is subjected to noise removal, that is, synonym conversion, including: removing stop words, replacing typos and identifying homophones, etc., to obtain conversion data, so that the content that the user wants to search can be determined more clearly.
[0045] S130, based on the converted data, determine the recalled data through multi-channel recall processing, the recalled data includes node recall data, text recall data and document recall data.
[0046] In one possible implementation, Figure 2 As shown, the conversion data is first converted into multiple lines through routing lines, and then multi-way recall processing is performed. The multi-way recall processing includes first-way recall processing, second-way recall processing and third-way recall processing; the first-way recall processing is used to determine node recall data based on the conversion data through a graph database, and the graph database is constructed through structured data and semi-structured data; the second-way recall processing is used to determine text recall data based on the conversion data through a vector database, and the vector database is constructed through text data; the third-way recall processing is used to determine document recall data based on the conversion data through keyword retrieval, and the document recall data is constructed through document data.
[0047] In one possible implementation, building a graph database includes: determining knowledge graph patterns and triples corresponding to structured data and semi-structured data based on structured data and semi-structured data; building a knowledge graph construction script based on the knowledge graph pattern and triples through a preset computer language; and building a graph database based on the knowledge graph construction script.
[0048] Exemplarily, before determining the node recall data, it is necessary to build a graph database. For structured and semi-structured data (such as case reports), the logical relationship data of this type of data is used to quickly define the ontology model of the knowledge graph, that is, the knowledge graph model. At the same time, data with a certain structure is converted into triples, that is, the basic units of the knowledge graph (subject, predicate and object), through automated tools (such as regular expressions). Then, based on the interface of the preset computer language (such as Python) and the graph database Neo4j, an automated knowledge graph construction script is constructed, and the content of the knowledge graph in the graph database is updated in batches through a T+1 scheduled task.
[0049] Furthermore, based on the large language model, the construction of Cypher query statements for the Neo4j graph database is completed. In order to improve the accuracy of Cypher query statements constructed by the large language model, this application constructs 100 common question-answer pairs in the field of plastic and aesthetic surgery (oriented to the knowledge graph), and manually provides relevant Cypher statements as supervised fine-tuning training data. The converted user search content will be retrieved through the Cypher statement builder and the graph database to retrieve the self-built knowledge graph in the field of plastic and aesthetic surgery to determine the node recall data. If the relevant node cannot be searched in the current knowledge graph, the search return for this path will be empty.
[0050] In one possible implementation, constructing a vector database includes: performing block processing on text data to determine the block text data; performing vector processing based on the block text data through a vector processing model to determine vector data corresponding to the block text data; and determining a vector database based on the vector data.
[0051] Exemplarily, for text data (such as plastic surgery guidelines and consensus), this application uses a large language model (text2vec-large-chinese) to complete the text-to-vector embedding process. First, the existing documents are divided into blocks to ensure that the length of the text segments meets the text length accepted by the large model. Subsequently, the block text is vectorized using a large language model (text2vec-large-chinese), and the results are stored in a vector database to determine the vector database. For the user's search content, based on the converted data, the same large language model is used for vectorization processing to keep the processing method consistent. Thereafter, the vectorized search statement is searched for semantically similar vectors in the vector database, and the top n (n can be 3) most similar text segments are returned as text recall data content.
[0052] Furthermore, for data in other modalities such as pictures and tables, this application adopts a unified embedding model to convert such data into vectors in the same semantic space. The specific formula is:
[0053]
[0054]
[0055] word token embedder
[0056] encoderφ:O→χ q
[0057] Where wi represents the i-th token, p_LM represents the large language model, w_(n+1:L) represents the answer, P(wn+1:L|wl:n) represents the conditional probability distribution of the answer given by the large language model given a question, xi represents the word embedding vector or the vector of the image (or other modality embedding), and O represents the encoder of each modality.
[0058] If the current vector database cannot find matching document data, the search result will be empty.
[0059] In a possible implementation, text recall data is determined based on the conversion data through a vector database, including: determining vector conversion data through a vectorized processing model based on the conversion data; and determining text recall data through similarity matching in a vector database based on the vector conversion data.
[0060] For example, for document data, BM25 inverted index technology is used to recall relevant documents using the keyword method. The BM25 algorithm calculates the similarity between the keywords in the search statement and the documents after the inverted index, and the calculation method is as follows:
[0061]
[0062] In the formula, Q represents the query statement, D represents the document, and q i represents the i-th word in the query Q, n represents the number of words in the query Q, f(q i , D) represents q i The word frequency in document D, IDF(q i ) represents word q i The inverse stable frequency, k1 and b are free parameters.
[0063] S140, based on the recall data and the conversion data, the search results are determined through a large language model, the large language model includes a prompt word project, and the prompt word project is used to limit the search results to a preset field.
[0064] In one possible implementation, the prompt word engineering includes a large language model role and a large language model responsibility; the large language model role is used to determine the large language model domain; the large language model responsibility is used to determine the source of the retrieval results based on the large language model domain and recall data.
[0065] Exemplarily, the method provided in the present application can be adapted to the field of plastic and cosmetic surgery, and therefore the role of the large language model can be defined as: a professional plastic and cosmetic surgery expertise base; the responsibilities of this field are based on the large language model domain and recall data, that is, the results of the answers are limited to the content of the plastic surgery encyclopedia, clinical practice guidelines, and expert consensus.
[0066] In one possible implementation, Figure 2 As shown, based on the recall data and the conversion data, the retrieval results are determined through a large language model, including: based on the recall data, determining the summary information of each content in the recall data; based on the conversion data, identifying the user's retrieval intention; based on the user's retrieval intention, matching the summary information of each content to determine the retrieval draft; based on the retrieval draft, deleting fabricated content to determine the retrieval results.
[0067] Exemplarily, because the results retrieved by the large speech model come from the recalled data, summary information of each content in the recalled data is determined according to the content of the recalled data, that is, the content of the recalled data is understood.
[0068] Furthermore, each content can be divided by a preset symbol, and a specific symbol can be used to divide each content by "#", for example: ###This is an introduction document of a medical beauty encyclopedia###.
[0069] Exemplarily, after understanding the content of the recall data, it is necessary to analyze the user's search content, understand the user's questions, and determine the user's intention. Since the conversion data is data processed based on the user's search content, this application can analyze the conversion data to determine the user's intention.
[0070] Furthermore, user questions can be segmented using preset symbols. The specific symbol can be “*” to segment user questions, for example: ***What is the Medical Beauty Encyclopedia***.
[0071] Furthermore, the summary information of each content is matched based on the user's search intent, relevant answers are found from the recalled data, and the preliminary search draft is refined.
[0072] Further, check the search draft to ensure that no fabricated or innovative elements are added to the search draft.
[0073] Furthermore, if the searched content is in other languages, it can be converted into unified Chinese or other terms to answer the questions.
[0074] Finally, in order to improve the ability of semantic understanding, this application can use the open source large language model ChatGLM4-7b as a dialogue tool to further search or understand user intentions.
[0075] The technical solution provided by this application is different from the traditional retrieval technology. It proposes a vectorized processing model based on a vector database, which can improve the intention recognition ability and context understanding ability of knowledge search, avoid the construction of complex domain-driven search templates, and improve the accuracy and efficiency of search. In view of the problem that the general large language model is prone to hallucinations and fallacies in the field of specialized medical treatment, this application limits the scope of the large model's answer to the recall data through the prompt word project, which can effectively avoid the hallucination problem of the general model. For structured and semi-structured texts (such as case reports), this application quickly constructs a domain knowledge graph as the source of the domain knowledge base, which can make full use of the logical relationships contained in the structured and semi-structured texts to improve the efficiency of knowledge utilization. Finally, using the multi-way recall method, the traditional keyword retrieval results (document recall data), vector database retrieval results (text recall data), and graph database retrieval results (node recall data) are provided to the pre-trained large language model as a recall knowledge base, so that the large language model can accurately and efficiently answer professional questions in the field of plastic surgery and medical beauty. This application combines the characteristics of multiple search tools to accurately provide the search results required by users.
[0076] Figure 3 This is a structural block diagram of a retrieval device based on a large language model and multi-way recall provided in an embodiment of the present application. For the sake of convenience, only the part related to the embodiment of the present application is shown. Figure 3 The retrieval device 300 based on a large language model and multi-way recall includes an acquisition module 301 , a conversion module 302 , a processing module 303 , and a determination module 304 .
[0077] In one implementation, the apparatus 300 may be used to implement the above Figure 1 For example, the acquisition module 301 is used to implement S110, the conversion module 302 is used to implement S120, the processing module 303 is used to implement S130, and the determination module 304 is used to implement S140.
[0078] The technical solution provided by this application is different from the traditional retrieval technology. It proposes a vectorized processing model based on a vector database, which can improve the intention recognition ability and context understanding ability of knowledge search, avoid the construction of complex domain-driven search templates, and improve the accuracy and efficiency of search. In view of the problem that the general large language model is prone to hallucinations and fallacies in the field of specialized medical treatment, this application limits the scope of the large model's answer to the recall data through the prompt word project, which can effectively avoid the hallucination problem of the general model. For structured and semi-structured texts (such as case reports), this application quickly constructs a domain knowledge graph as the source of the domain knowledge base, which can make full use of the logical relationships contained in the structured and semi-structured texts to improve the efficiency of knowledge utilization. Finally, using the multi-way recall method, the traditional keyword retrieval results (document recall data), vector database retrieval results (text recall data), and graph database retrieval results (node recall data) are provided to the pre-trained large language model as a recall knowledge base, so that the large language model can accurately and efficiently answer professional questions in the field of plastic surgery and medical beauty. This application combines the characteristics of multiple search tools to accurately provide the search results required by users.
[0079] Figure 4 This is a schematic diagram of the structure of an electronic device provided by an embodiment of the present application. Figure 4 As shown, the electronic device 4 of this embodiment includes: at least one processor 40 ( Figure 4 Only one is shown in the figure) a processor, a memory 41, and a computer program 42 stored in the memory 41 and executable on the at least one processor 40, wherein the processor 40 implements the steps in any of the above method embodiments when executing the computer program 42.
[0080] The electronic device 4 may be a computing device such as a desktop computer, a notebook, a PDA, or a cloud server. The electronic device may include, but is not limited to, a processor 40 and a memory 41. Those skilled in the art will appreciate that Figure 4 It is only an example of the electronic device 4 and does not constitute a limitation on the electronic device 4. It may include more or fewer components than shown in the figure, or a combination of certain components, or different components. For example, it may also include input and output devices, network access devices, etc.
[0081] The processor 40 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.
[0082] In some embodiments, the memory 41 may be an internal storage unit of the electronic device 4, such as a hard disk or memory of the electronic device 4. In other embodiments, the memory 41 may also be an external storage device of the electronic device 4, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the electronic device 4. Further, the memory 41 may also include both an internal storage unit of the electronic device 4 and an external storage device. The memory 41 is used to store an operating system, an application program, a boot loader (BootLoader), data, and other programs, such as the program code of the computer program, etc. The memory 41 may also be used to temporarily store data that has been output or is to be output.
[0083] The technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated in a processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.
[0084] An embodiment of the present application also provides an electronic device, which includes: at least one processor, a memory, and a computer program stored in the memory and executable on the at least one processor, wherein the processor implements the steps of any of the above-mentioned method embodiments when executing the computer program.
[0085] An embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in the above-mentioned method embodiments can be implemented.
[0086] An embodiment of the present application provides a computer program product. When the computer program product runs on a mobile terminal, the mobile terminal can implement the steps in the above-mentioned method embodiments when executing the computer program product.
[0087] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, which can be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may at least include: any entity or device that can carry the computer program code to the camera / electronic device, a recording medium, a computer memory, a read-only memory (ROM), a random access memory (RAM), an electric carrier signal, a telecommunication signal, and a software distribution medium. For example, a USB flash drive, a mobile hard disk, a disk or an optical disk.
[0088] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0089] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0090] In the embodiments provided in the present application, it should be understood that the disclosed devices / electronic devices and methods can be implemented in other ways. For example, the device / electronic device embodiments described above are merely schematic. For example, the division of the modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0091] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0092] The embodiments described above are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, a person skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.
Claims
1. A retrieval method based on a large language model and multi-way recall, characterized in that: The method comprises: Get user search content; Performing synonym conversion on the user search content to determine conversion data, wherein the synonym conversion includes removing stop words, replacing wrong characters and identifying homophones; Based on the converted data, through multi-channel recall processing, recall data is determined, wherein the recall data includes node recall data, text recall data and document recall data; Based on the recalled data and the converted data, a search result is determined through a large language model, wherein the large language model includes a prompt word project, and the prompt word project is used to limit the search result to a preset field.
2. The method according to claim 1, characterized in that The prompt word project includes a large language model role and a large language model responsibility; the large language model role is used to determine the large language model domain; the large language model responsibility is used to determine the source of the retrieval result based on the large language model domain and the recall data.
3. The method according to claim 2, characterized in that The step of determining the search result based on the recall data and the conversion data by using a large language model includes: Based on the recalled data, determining summary information of each content in the recalled data; Based on the conversion data, identifying the user's search intent; Determine a search draft based on the user's search intention matching the summary information of each content; Based on the preliminary search draft, fabricated content is deleted and the search results are determined.
4. The method according to claim 1, characterized in that: The multi-way recall processing includes a first-way recall processing, a second-way recall processing and a third-way recall processing; The first recall process is used to determine node recall data based on the conversion data through a graph database, wherein the graph database is constructed through structured data and semi-structured data; The second recall process is used to determine text recall data based on the converted data through a vector database, wherein the vector database is constructed through text data; The third recall process is used to determine document recall data based on the conversion data through keyword retrieval, and the document recall data is constructed through document data.
5. The method according to claim 4, characterized in that Constructing the graph database includes: Based on the structured data and the semi-structured data, determine the knowledge graph patterns and triples corresponding to the structured data and the semi-structured data; Based on the knowledge graph pattern and the triples, construct a knowledge graph construction script by using a preset computer language; Based on the knowledge graph construction script, the graph database is constructed.
6. The method according to claim 4, characterized in that Constructing the vector database includes: Processing the text data in blocks to determine the block text data; Based on the block text data, vectorization processing is performed through a vectorization processing model to determine vector data corresponding to the block text data; Based on the vector data, the vector database is determined.
7. The method according to claim 6, characterized in that Determining text recall data based on the conversion data through a vector database includes: Based on the conversion data, determine vector conversion data through the vectorization processing model; The text recall data is determined based on the vector conversion data through similarity matching in the vector database.
8. A retrieval device based on a large language model and multi-way recall, characterized in that: The device comprises: The acquisition module is used to obtain the user's search content; A conversion module, used for performing synonym conversion on the user search content and determining conversion data, wherein the synonym conversion includes removing stop words, replacing wrong characters and identifying homophones; A processing module, configured to determine the recalled data through multi-channel recall processing based on the converted data, wherein the recalled data includes node recalled data, text recalled data and document recalled data; A determination module is used to determine the search results based on the recall data and the conversion data through a large language model, wherein the large language model includes a prompt word project, and the prompt word project is used to limit the search results to a preset field.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the method according to any one of claims 1 to 7 is implemented.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.
Citation Information
Cited By
Information retrieval method and device based on multi-path recall, medium and equipment
CN119577117A
Intelligent question answering system and method based on combination of large language model and NL2SQL
CN119760071A
An intelligent question and answer system and method based on a large language model combined with NL2SQL
CN119760071B
Information retrieval system and method based on multi-path recall, terminal, medium and product
CN120407870A
Large screen content recall method and device, storage medium and program product
CN120849535A
