CN120045750A - Retrieval enhancement generation method and system based on large language model - Google Patents

Retrieval enhancement generation method and system based on large language model Download PDF

Info

Publication number
CN120045750A
CN120045750A CN202411937157.7A CN202411937157A CN120045750A CN 120045750 A CN120045750 A CN 120045750A CN 202411937157 A CN202411937157 A CN 202411937157A CN 120045750 A CN120045750 A CN 120045750A
Authority
CN
China
Prior art keywords
query
language model
query instruction
information
retrieval
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202411937157.7A
Other languages
Chinese (zh)
Inventor
陈舟
白玉琪
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tsinghua University
Original Assignee
Tsinghua University
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tsinghua University filed Critical Tsinghua University
Priority to CN202411937157.7A priority Critical patent/CN120045750A/en
Publication of CN120045750A publication Critical patent/CN120045750A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/903Querying
    • G06F16/9032Query formulation
    • G06F16/90332Natural language query formulation or dialogue systems
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/903Querying
    • G06F16/90335Query processing
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/903Querying
    • G06F16/9035Filtering based on additional data, e.g. user or group profiles
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/903Querying
    • G06F16/9038Presentation of query results
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/906Clustering; Classification
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/953Querying, e.g. by the use of web search engines
    • G06F16/9535Search customisation based on user profiles and personalisation
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/953Querying, e.g. by the use of web search engines
    • G06F16/9538Presentation of query results
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/30Semantic analysis
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Computational Linguistics (AREA)
  • Artificial Intelligence (AREA)
  • Mathematical Physics (AREA)
  • General Health & Medical Sciences (AREA)
  • Health & Medical Sciences (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

本发明提供一种基于大语言模型的检索增强生成方法和系统,该方法包括:获取用户的输入查询信息;基于大语言模型分别对输入查询信息进行重写和关键信息提取,得到第一查询指令和第二查询指令;根据输入查询信息,基于大语言模型识别用户意图并进行意图分类,得到意图分类结果;根据第一查询指令和第二查询指令,通过预设多源知识库进行多路混合检索,得到初始检索结果;根据意图分类结果对初始检索结果进行结果重排和筛选,得到增强提示词;将输入查询信息和增强提示词输入大语言模型,得到检索增强生成结果。本发明能够精准识别用户查询的需求和意图,在开放域中高精度检索相关信息,提高了信息检索的即时性、准确性、专业性和回复质量。

The present invention provides a retrieval enhancement generation method and system based on a large language model, the method comprising: obtaining user input query information; rewriting the input query information and extracting key information based on the large language model to obtain a first query instruction and a second query instruction; identifying the user's intention based on the large language model and classifying the intention according to the input query information to obtain an intention classification result; performing multi-way mixed retrieval through a preset multi-source knowledge base according to the first query instruction and the second query instruction to obtain an initial retrieval result; rearranging and screening the initial retrieval result according to the intention classification result to obtain an enhanced prompt word; inputting the input query information and the enhanced prompt word into the large language model to obtain a retrieval enhancement generation result. The present invention can accurately identify the needs and intentions of user queries, retrieve relevant information with high precision in an open domain, and improve the immediacy, accuracy, professionalism and reply quality of information retrieval.

Description

Retrieval enhancement generation method and system based on large language model
Technical Field
The invention relates to the technical field of natural language processing, in particular to a retrieval enhancement generation method and system based on a large language model.
Background
In the present day of explosive growth of digital information, it is particularly critical to construct efficient information retrieval systems that must be able to quickly and accurately screen out the required information from the vast data. However, conventional retrieval systems often rely on a single knowledge source, such as an internet search engine or a specialized database, which greatly limits their efficiency and accuracy in handling diverse and cross-domain queries. In addition, most of these systems are based on keyword matching, and it is difficult to understand the complex query intention of the user in depth, so that the search result often deviates from the actual requirement of the user.
In order to improve the accuracy of retrieval, in recent years, language models based on deep learning, such as GPT and BERT, have been developed. The models use semantic understanding technology to significantly improve the accuracy of retrieval. Nevertheless, these single model-dependent solutions still face challenges in integrating multi-source data and adapting to domain-specific knowledge, and retrieval results in the open domain tend to contain a lot of noise, which limits the efficiency of the knowledge service.
Therefore, how to accurately identify the query requirement and intention of the user, and to realize high-precision information retrieval in the open domain, and to improve the instantaneity, accuracy and profession of the information retrieval system reply, becomes the technical problem to be solved currently.
Disclosure of Invention
In view of the above problems, the present invention provides a method and a system for generating a search enhancement based on a large language model, which uses a multi-source knowledge base to rewrite input query information of a user, extract key information of the input query information of the user, identify the intention of the user and classify the query information, then performs multi-path mixed search, rearranges search results, and finally generates a reply. The invention can accurately identify the requirement and intention of user inquiry, search related information in an open domain with high precision, improve the instantaneity, accuracy and professionality of the information acquired by the information search system, and improve the recovery quality of the system.
The invention provides a large language model-based search enhancement generation method, which comprises the steps of obtaining input query information of a user, respectively carrying out rewriting and key information extraction on the input query information based on a large language model to obtain a first query instruction and a second query instruction, wherein the first query instruction is an instruction comprising rewritten query information, the second query instruction is an instruction comprising key information, identifying user intention and carrying out intention classification based on the large language model according to the input query information to obtain an intention classification result, carrying out multiplex mixed search through a preset multi-source knowledge base according to the first query instruction and the second query instruction to obtain an initial search result, wherein the multi-source knowledge base comprises an Internet knowledge base, a wikipedia knowledge base and an academic literature knowledge base, carrying out result rearrangement and screening on the initial search result according to the intention classification result to obtain an enhancement prompt word, and inputting the input query information and the enhancement prompt word into the large language model to obtain an enhancement generation result output by the large language model.
The method for generating the retrieval enhancement based on the large language model comprises the steps of carrying out natural language processing on input query information to identify grammar structures and semantic contents in queries, generating a plurality of rewritten versions by using the large language model according to the identified grammar structures and the semantic contents, evaluating semantic similarity and information retention of each rewritten version, selecting the rewritten version with the highest semantic similarity and information retention to integrate into the first query instruction, extracting query key information from the input query information by using the large language model to generate the second query instruction according to the query information, and the query key information comprises entities and concepts.
According to the large language model-based search enhancement generation method, user intention is identified and intention classification is carried out on the basis of the large language model according to the input query information to obtain intention classification results, the large language model is used for carrying out deep semantic analysis on the input query information to understand the requirement and the query purpose of a user to obtain a deep semantic analysis result, and the deep semantic analysis result is matched with a preset intention category to obtain the intention classification result.
The method for generating the retrieval enhancement based on the large language model comprises the steps of carrying out multi-path mixed retrieval according to a first query instruction and a second query instruction through a preset multi-source knowledge base to obtain an initial retrieval result, carrying out text segmentation on the preset multi-source knowledge base to obtain a plurality of text fragments, converting the plurality of text fragments into vector representations based on a preset vector model to obtain a plurality of text fragment vectors, respectively converting the first query instruction and the second query instruction into vector representations based on the preset vector model to obtain a first query instruction vector and a second query instruction vector, carrying out multi-path mixed retrieval according to the plurality of text fragment vectors, the first query instruction vector and the second query instruction vector, and evaluating similarity and relativity to obtain the initial retrieval result.
The method for generating the retrieval enhancement based on the large language model comprises the steps of carrying out multi-path mixed retrieval according to a plurality of text segment vectors, a first query instruction vector and a second query instruction vector, evaluating similarity and correlation to obtain an initial retrieval result, calculating cosine distances of the first query instruction vector and all the text segment vectors to obtain a first cosine distance, wherein the first cosine distance is used for evaluating similarity and correlation between the first query instruction vector and all the text segment vectors in multi-path mixed retrieval, calculating cosine vectors of the second query instruction vector and all the text segment vectors to obtain a second cosine distance, and the second cosine distance is used for evaluating similarity and correlation between the second query instruction vector and all the text segment vectors in multi-path mixed retrieval, adding the first cosine distance and the second cosine distance to obtain a third cosine distance, and obtaining the initial retrieval result according to the third cosine distance.
The method for generating the retrieval enhancement based on the large language model comprises the steps of rearranging and screening the initial retrieval result according to the intention classification result to obtain an enhancement prompt word, adjusting parameters of the initial retrieval result according to the intention classification result to obtain an adjusted retrieval result, rearranging the retrieval result according to the parameters of the adjusted retrieval result, and screening the results ranked in a preset number as the enhancement prompt word.
The invention further provides a retrieval enhancement generation system based on the large language model, which comprises an acquisition module, a query instruction module, an enhancement prompt module, an intention classification module and a retrieval module, wherein the acquisition module is used for acquiring input query information of a user, the query instruction module is used for respectively carrying out rewriting and key information extraction on the input query information based on the large language model to obtain a first query instruction and a second query instruction, the first query instruction is an instruction comprising the rewritten query information, the second query instruction is an instruction comprising the key information, the intention classification module is used for identifying user intention and carrying out intention classification based on the large language model according to the input query information to obtain an intention classification result, the retrieval module is used for carrying out multiplex mixed retrieval through a preset multi-source knowledge base to obtain an initial retrieval result, the multi-source knowledge base comprises an Internet knowledge base, a wikipedia knowledge base and an academic literature knowledge base, the enhancement prompt module is used for carrying out result rearrangement and screening on the initial retrieval result according to the intention classification result to obtain an enhancement prompt, and the result generation module is used for inputting the input query information and the enhancement prompt word into the large language model to obtain the enhancement result.
The invention also provides electronic equipment, which comprises a memory, a processor and a computer program stored on the memory and running on the processor, wherein the processor realizes the retrieval enhancement generation method based on the large language model when executing the computer program.
The present invention also provides a non-transitory computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements a large language model-based retrieval enhancement generation method as described in any of the above.
The present invention also provides a computer program product comprising a computer program which, when executed by a processor, implements a large language model based retrieval enhancement generation method as described in any of the above.
The invention provides a retrieval enhancement generation method and a retrieval enhancement generation system based on a large language model, wherein the method comprises the steps of obtaining input query information of a user; the method comprises the steps of respectively carrying out rewriting and key information extraction on input query information based on a large language model to obtain a first query instruction and a second query instruction, identifying user intention based on the large language model and carrying out intention classification according to the input query information to obtain an intention classification result, carrying out multi-path mixed search through a preset multi-source knowledge base according to the first query instruction and the second query instruction to obtain an initial search result, carrying out result rearrangement and screening on the initial search result according to the intention classification result to obtain an enhanced prompt word, and inputting the input query information and the enhanced prompt word into the large language model to obtain a search enhanced generation result. The invention can accurately identify the requirement and intention of the user query, and search the related information in the open domain with high precision, thereby improving the instantaneity, accuracy, specialty and replying quality of information search.
Drawings
In order to more clearly illustrate the invention or the technical solutions of the prior art, the following description will briefly explain the drawings used in the embodiments or the description of the prior art, and it is obvious that the drawings in the following description are some embodiments of the invention, and other drawings can be obtained according to the drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flow diagram of a method for generating search enhancement based on a large language model.
FIG. 2 is a schematic diagram of a large language model-based search enhancement generation system.
Fig. 3 is a schematic structural diagram of an electronic device provided by the present invention.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the present invention more apparent, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings, and it is apparent that the described embodiments are some embodiments of the present invention, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
Referring to fig. 1, fig. 1 is a flow chart of a method for generating a search enhancement based on a large language model according to the present invention.
The invention provides a retrieval enhancement generation method based on a large language model, which comprises the following steps:
And 101, acquiring input query information of a user.
102, Rewriting input query information and extracting key information based on a large language model to obtain a first query instruction and a second query instruction, wherein the first query instruction is an instruction comprising rewritten query information, and the second query instruction is an instruction comprising key information.
As a preferred embodiment, the method comprises the steps of respectively carrying out rewriting and key information extraction on input query information based on a large language model to obtain a first query instruction and a second query instruction, carrying out natural language processing on the input query information to identify grammar structures and semantic contents in queries, generating a plurality of rewritten versions by using the large language model according to the identified grammar structures and semantic contents, evaluating semantic similarity and information retention of each rewritten version, selecting the rewritten version with the highest semantic similarity and information retention to integrate into the first query instruction, extracting query key information from the input query information by using the large language model to generate the second query instruction according to the query information, and wherein the query key information comprises entities and concepts.
In this embodiment, the large language model first receives and analyzes the input query information of the user in the spoken language form, and identifies the grammar structure and semantic content in the query through deep learning and natural language processing capabilities. And extracting key information according to the identified grammar structure and semantic content. The large language model automatically modifies the query according to the key information to obtain a plurality of rewritten versions. These rewritten versions are intended to express the same query intent from different perspectives to increase the coverage of the search. The cosine similarity can then be used to calculate the semantic similarity for each rewritten version. Meanwhile, the information retention may be evaluated by comparing the degree of matching of the rewritten version with keywords and concepts in the original query. In order to generate a query instruction with clearer structure, accurate expression and no ambiguity, a rewritten version with highest semantic similarity and information retention is selected and integrated into a first query instruction. This transformation not only enhances the clarity of the query, but also optimizes the relevance and efficiency of the subsequent retrieval process. In this way, it is ensured that accurate requirements are extracted from the user's informal expression, providing a solid basis for the hybrid search process.
And deep analyzing the input query information of the user by utilizing the large language model to extract the contained direct and implicit query key information so as to generate a second query instruction. This process involves identifying important entities in the query text, such as person names, places, events, and proper nouns. Through its high-level semantic understanding capability, large language models can capture not only obvious keywords, but also insights into what is implied, which may not be directly expressed, but is critical to query intent. The generated second query instruction therefore includes all key entities and concepts, which provides accurate guidance for subsequent hybrid retrieval and data processing, ensuring relevance and comprehensiveness of the retrieval results.
And 103, identifying the user intention based on the large language model and carrying out intention classification according to the input query information to obtain an intention classification result.
As a preferred embodiment, the method comprises the steps of identifying user intention based on a large language model according to input query information and carrying out intention classification to obtain an intention classification result, wherein the method comprises the steps of carrying out deep semantic analysis on the input query information by using the large language model to understand the requirement and the query purpose of a user to obtain a deep semantic analysis result, and matching the deep semantic analysis result with a preset intention category to obtain the intention classification result.
In this embodiment, the input query information is subjected to deep semantic analysis using a large language model. This analysis process involves parsing the natural language text entered by the user to identify the user's actual needs and query purposes. The process of deep semantic analysis may include text preprocessing, feature extraction, and semantic understanding. Then, the large language model matches the deep semantic analysis result (understood information) with a preset intention category, classifies the query into one of three preset categories, namely an Internet category, a wikipedia category or an academic literature category, and obtains an intention classification result. This classification is based on the characteristics of the query content and the type of information that the user may seek. For example, queries for current events may be categorized as Internet classes, queries for historical or definitional content may be categorized as Wikipedia classes, and queries with academic or research depth may be categorized as academic literature classes. The step not only quickens the searching process, but also ensures the accuracy and the relativity of the searching result, and effectively matches the searching requirement of the user with the most suitable data source.
And 104, carrying out multi-path mixed search through a preset multi-source knowledge base according to the first query instruction and the second query instruction to obtain an initial search result, wherein the multi-source knowledge base comprises an Internet knowledge base, a wikipedia knowledge base and an academic literature knowledge base.
A preferred embodiment of the method comprises the steps of carrying out multi-channel mixed search through a preset multi-source knowledge base according to a first query instruction and a second query instruction to obtain an initial search result, carrying out text segmentation on the preset multi-source knowledge base to obtain a plurality of text fragments, converting the plurality of text fragments into vector representations based on a preset vector model to obtain a plurality of text fragment vectors, respectively converting the first query instruction and the second query instruction into vector representations based on the preset vector model to obtain a first query instruction vector and a second query instruction vector, and carrying out multi-channel mixed search according to the plurality of text fragment vectors, the first query instruction vector and the second query instruction vector to evaluate similarity and relativity to obtain the initial search result.
As a preferred embodiment, the method comprises the steps of carrying out multi-path mixed search according to a plurality of text segment vectors, a first query instruction vector and a second query instruction vector, evaluating similarity and correlation to obtain an initial search result, wherein the method comprises the steps of calculating cosine distances between the first query instruction vector and all the text segment vectors to obtain a first cosine distance, wherein the first cosine distance is used for evaluating similarity and correlation between the first query instruction vector and all the text segment vectors in multi-path mixed search, calculating cosine vectors between the second query instruction vector and all the text segment vectors to obtain a second cosine distance, wherein the second cosine distance is used for evaluating similarity and correlation between the second query instruction vector and all the text segment vectors in multi-path mixed search, adding the first cosine distance and the second cosine distance to obtain a third cosine distance, and obtaining the initial search result according to the third cosine distance.
In this embodiment, the multi-source knowledge base includes an internet knowledge base, a wikipedia knowledge base, and an academic literature knowledge base.
The internet knowledge base refers to a knowledge base that interfaces with APIs (Application Programming Interface, application programming interfaces) that must be applied to a search engine. An open interface, which must be provided by a search engine, is used to query data on the internet in real time. This deployment allows access to the most extensive sources of information, including up-to-date web page content and dynamic data. Through API calls, the user's query may be sent directly to the must search engine and search results received, which are then used for subsequent processing and analysis.
The wikipedia knowledge base refers to a local knowledge base obtained by crawling all entries of the wikipedia. There is a periodically running crawler program that is responsible for downloading new and updated entry content from the wikipedia website and storing it on a local server. The advantage of this approach is that it allows access to a wide range of information for the wikipedia without requiring a real-time internet connection, while also reducing the request burden on the wikipedia server. The presence of the local knowledge base ensures a fast response and high reliability of the retrieval operation.
The academic literature knowledge base refers to the academic literature knowledge base, and the academic literature knowledge base refers to the knowledge base with Semantic Scholar APIs as interfaces. Semantic Scholar is a widely used academic paper search engine that provides access to a large number of academic documents. Through the API, the database of Semantic Scholar can be queried directly to obtain detailed information about the academic paper, including the paper abstract, citation information and download links. The deployment mode can utilize the latest academic research results to support the deep analysis and understanding of scientific problems.
Setting the maximum character number as 1024, and text segmentation is carried out on the contents in the Internet knowledge base, the wikipedia knowledge base and the academic literature knowledge base to obtain a plurality of text fragments. This process ensures that each text segment is of a size that is easily managed and handled, helping to improve the efficiency and effectiveness of subsequent processing. And then converting text fragments of the Internet knowledge base, the wikipedia knowledge base and the academic literature knowledge base into vector representations based on a preset vector model (such as a word embedding or BERT model) to obtain a plurality of text fragment vectors, so that each text fragment can have mathematical expression in a vector space, and mathematical comparison and calculation are facilitated. And converting the first query instruction into a vector representation based on a preset vector model to obtain a first query instruction vector. The same vector model is used to ensure that the query instruction and the text fragment are within the same vector space, thereby enabling feasibility and accuracy of subsequent comparison operations. And calculating cosine distances between the first query instruction vector and all text segment vectors to obtain a first cosine distance. The cosine distance is used to measure the similarity between the vectors, which is used here to determine the degree of relevance of each text segment to the query instruction. And converting the second query instruction into a vector representation based on the vector model to obtain a second query instruction vector. The second query instruction is also converted to a vector representation, ensuring that this query instruction can effectively be compared for similarity to the text segment. And calculating cosine distances between the second query instruction vector and all text segment vectors to obtain a second cosine distance, and evaluating similarity and relevance. The first cosine distance and the second cosine distance are added to obtain a comprehensive cosine distance measure (third cosine distance), which considers the relevance evaluation of two different dimension query instructions on the same text segment. By taking the inverse of the third cosine distance as the score (initial search result) of the data fragment. Such scoring methods result in a higher score for text segments that are less distant (i.e., more relevant) and thus are preferentially selected for use.
The first cosine distance and the second cosine distance are added, specifically, the sum of the weight of the first cosine distance and the weight of the second cosine distance is 1, the general values are 0.7 and 0.3 respectively, and the specific values need to be determined through specific experiments.
And 105, carrying out result rearrangement and screening on the initial search result according to the intention classification result to obtain the enhanced prompt word.
As a preferred embodiment, the method comprises the steps of rearranging and screening the initial search results according to the intention classification results to obtain enhanced prompt words, wherein the method comprises the steps of adjusting parameters of the initial search results according to the intention classification results to obtain adjusted search results, rearranging the search results according to the parameters of the adjusted search results, and screening the results ranked in a preset number as the enhanced prompt words.
In this embodiment, first, parameters of an initial search result are adjusted according to an intention classification result, and an adjusted search result is obtained. In particular, if a certain data segment belongs to a knowledge base (internet class, wikipedia class, or academic literature class) to which the identified query class corresponds, the score of that data segment will be doubled. This score adjustment is to prioritize data sources that are more relevant to the user's query intent. And then, reordering the search results according to the parameters of the adjusted search results, and screening the results ranked in a preset number as enhancement prompt words. Specifically, all the adjusted scores are reordered, and the top N data segments with the highest scores are selected as enhancement prompt words. The default value of N is set to 5, but this parameter can be adjusted according to the needs of the experiment or practical application. This step ensures high relevance and accuracy of the search results, thereby better satisfying the information needs of the user.
And 106, inputting the input query information and the enhancement prompt words into a large language model to obtain a retrieval enhancement generation result output by the large language model.
In this embodiment, the input query information of the user and N pieces (enhanced cue words) are assembled into the input cue words. The input prompt word is designed to be simple and unambiguous, contains all key information, and ensures that a large language model can be effectively guided to understand and respond to the query requirement of a user. Then, the input prompt word is input into the large language model. The large language model uses the information to carry out deep semantic processing and generates an exhaustive answer aiming at the user inquiry or provides the output of related information to obtain the retrieval enhancement generation result. The process fully utilizes the high-quality data fragments obtained by the mixed retrieval so as to achieve optimal answer quality and user satisfaction.
The large language model is an open source large language model, and the large language model (Large Language Model, LLM) is also called a large language model, is an artificial intelligence model, and aims to understand and generate human language or natural language. Large language models are trained on large amounts of text data and can perform a wide range of tasks including performing conversations, questions and answers, text classification, text summarization, translation, emotion analysis, and the like. Large language models are characterized by a large scale, containing billions of parameters, which help them learn complex patterns in language data. Large language models are typically based on deep learning architectures, such as translators, which facilitate their execution of various natural language processing tasks.
The large-scale language model can also be a model of ChatGLM-6B, chatGPT series, stableVicuna, paLM, galactica series or LLaMA series which are arbitrarily opened, and the model can be determined according to specific situations. Code in the open source large language model is open source, data set is open source and has authorized permissions.
The invention uses a large language model to rewrite the input query information of the user, extracts the key information of the input query information of the user, identifies the intention of the user and classifies the user, then carries out multi-path mixed search and search result rearrangement, and finally generates a reply. The invention can accurately identify the requirement and intention of user inquiry, search related information in an open domain with high precision, improve the instantaneity, accuracy and professionality of the information acquired by the information search system, and improve the recovery quality of the system.
The large language model-based search enhancement generation system provided by the invention is described below, and the large language model-based search enhancement generation system described below and the large language model-based search enhancement generation method described above can be referred to correspondingly with each other.
Referring to fig. 2, fig. 2 is a schematic structural diagram of a search enhancement generation system based on a large language model according to the present invention.
The invention further provides a retrieval enhancement generation system based on the large language model, which comprises an acquisition module 201 for acquiring input query information of a user, a query instruction module 202 for respectively rewriting and extracting key information of the input query information based on the large language model to obtain a first query instruction and a second query instruction, wherein the first query instruction is an instruction comprising the rewritten query information, the second query instruction is an instruction comprising the key information, an intention classification module 203 for identifying user intention and carrying out intention classification based on the large language model according to the input query information to obtain an intention classification result, a retrieval module 204 for carrying out multiplex mixed retrieval through a preset multi-source knowledge base according to the first query instruction and the second query instruction to obtain an initial retrieval result, the multi-source knowledge base comprises an Internet knowledge base, a wikipedia knowledge base and an academic literature knowledge base, an enhancement prompt module 205 for carrying out result rearrangement and screening on the initial retrieval result according to the intention classification result to obtain an enhancement prompt, and a result generation module 206 for inputting the input query information and the enhancement prompt into the large language model to obtain the retrieval enhancement generation result output by the large language model.
The large language model-based retrieval enhancement generation system comprises an acquisition module, a query instruction module, an intention classification module, a retrieval module, an enhancement prompt module and a result generation module. The functions of the modules are tightly connected, and the modules are cooperatively used through a plurality of specially designed modules, so that the aim of searching related information in an open domain with high precision is achieved, and the instantaneity, the accuracy and the specialty of the reply generated by the information retrieval system are improved.
Fig. 3 illustrates a schematic structure of an electronic device, which may include a processor 301, a communication interface (Communications Interface) 302, a memory 303, and a communication bus 304, as shown in fig. 3, where the processor 301, the communication interface 302, and the memory 303 perform communication with each other through the communication bus 304. The processor 301 may call a logic instruction in the memory 303 to execute a search enhancement generation method based on a large language model, where the method includes obtaining input query information of a user, respectively rewriting and extracting key information based on the large language model to obtain a first query instruction and a second query instruction, where the first query instruction is an instruction including rewritten query information, and the second query instruction is an instruction including key information, identifying user intention and performing intention classification based on the large language model according to the input query information to obtain an intention classification result, performing multiplex mixed search through a preset multi-source knowledge base according to the first query instruction and the second query instruction to obtain an initial search result, where the multi-source knowledge base includes an internet knowledge base, a wikipedia knowledge base, and an academic literature knowledge base, performing result rearrangement and screening on the initial search result according to the intention classification result to obtain an enhancement prompt word, and inputting the input query information and the enhancement prompt word into the large language model to obtain a search enhancement generation result output by the large language model.
Further, the logic instructions in the memory 303 may be implemented in the form of software functional units and stored in a computer readable storage medium when sold or used as a stand alone product. Based on this understanding, the technical solution of the present invention may be embodied essentially or in a part contributing to the prior art or in a part of the technical solution, in the form of a software product stored in a storage medium, comprising several instructions for causing a computer device (which may be a personal computer, a server, a network device, etc.) to perform all or part of the steps of the method according to the embodiments of the present invention. The storage medium includes a U disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a magnetic disk, an optical disk, or other various media capable of storing program codes.
On the other hand, the invention also provides a computer program product, which comprises a computer program, wherein the computer program can be stored on a non-transitory computer readable storage medium, when the computer program is executed by a processor, the computer can execute the retrieval enhancement generation method based on the large language model, which is provided by the methods, and comprises the steps of acquiring input query information of a user, respectively carrying out rewriting and keyword extraction on the input query information based on the large language model to obtain a first query instruction and a second query instruction, wherein the first query instruction is an instruction comprising rewritten query information, and the second query instruction is an instruction comprising keyword, identifying user intention and carrying out intention classification based on the large language model according to the input query information to obtain an intention classification result, carrying out multiplex mixed retrieval according to the first query instruction and the second query instruction to obtain an initial retrieval result, wherein the multi-source knowledge base comprises an Internet knowledge base, a wiki knowledge base and a academic literature knowledge base, carrying out result rearrangement and screening on the initial retrieval result according to the intention classification result to obtain an enhancement prompt word, and outputting the enhanced query result and the large language model to obtain the input language model.
In yet another aspect, the present invention further provides a non-transitory computer readable storage medium, on which a computer program is stored, the computer program being implemented when executed by a processor to perform a method for generating a search enhancement based on a large language model provided by the above methods, the method comprising obtaining input query information of a user, rewriting and extracting key information from the input query information based on the large language model to obtain a first query instruction and a second query instruction, respectively, the first query instruction being an instruction including the rewritten query information, the second query instruction being an instruction including the key information, identifying a user intent based on the large language model and performing intent classification based on the input query information to obtain an intent classification result, performing a multiplex search based on the first query instruction and the second query instruction to obtain an initial search result, the multi-source knowledge base including an internet knowledge base, a wikipedia knowledge base, and a academic literature knowledge base, rearranging and screening the initial search result based on the intent classification result to obtain an enhancement prompt word, inputting the input query information and the enhancement prompt word into the large language model to obtain an enhanced generated search result output by the large language model.
The apparatus embodiments described above are merely illustrative, wherein the elements illustrated as separate elements may or may not be physically separate, and the elements shown as elements may or may not be physical elements, may be located in one place, or may be distributed over a plurality of network elements. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment. Those of ordinary skill in the art will understand and implement the present invention without undue burden.
From the above description of the embodiments, it will be apparent to those skilled in the art that the embodiments may be implemented by means of software plus necessary general hardware platforms, or of course may be implemented by means of hardware. Based on this understanding, the foregoing technical solution may be embodied essentially or in a part contributing to the prior art in the form of a software product, which may be stored in a computer readable storage medium, such as ROM/RAM, a magnetic disk, an optical disk, etc., including several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the method described in the respective embodiments or some parts of the embodiments.
It should be noted that the above-mentioned embodiments are merely for illustrating the technical solution of the present invention, and not for limiting the same, and although the present invention has been described in detail with reference to the above-mentioned embodiments, it should be understood by those skilled in the art that the technical solution described in the above-mentioned embodiments may be modified or some technical features may be equivalently replaced, and these modifications or substitutions do not make the essence of the corresponding technical solution deviate from the spirit and scope of the technical solution of the embodiments of the present invention.

Claims (10)

1. A large language model-based search enhancement generation method, comprising:
Acquiring input query information of a user;
The input query information is rewritten and key information is extracted based on a large language model, so that a first query instruction and a second query instruction are obtained, wherein the first query instruction is an instruction comprising rewritten query information, and the second query instruction is an instruction comprising key information;
Identifying user intention and carrying out intention classification based on the large language model according to the input query information to obtain an intention classification result;
according to the first query instruction and the second query instruction, carrying out multi-path mixed search through a preset multi-source knowledge base to obtain an initial search result, wherein the multi-source knowledge base comprises an Internet knowledge base, a wikipedia knowledge base and an academic literature knowledge base;
According to the intention classification result, carrying out result rearrangement and screening on the initial search result to obtain an enhanced prompt word;
and inputting the input query information and the enhancement prompt word into the large language model to obtain a retrieval enhancement generation result output by the large language model.
2. The method for generating the retrieval enhancement based on the large language model according to claim 1, wherein the method for generating the retrieval enhancement based on the large language model comprises the steps of respectively rewriting the input query information and extracting key information to obtain a first query instruction and a second query instruction, and comprises the following steps:
Performing natural language processing on the input query information to identify grammar structures and semantic content in the query;
Generating a plurality of rewritten versions using the large language model according to the identified grammar structure and the semantic content;
evaluating the semantic similarity and information retention of each rewritten version, and selecting the rewritten version with the highest semantic similarity and information retention to integrate into the first query instruction;
And extracting query key information from the input query information by using the large language model to generate the second query instruction according to the query information, wherein the query key information comprises entities and concepts.
3. The method for generating a large language model based search enhancement according to claim 1, wherein the identifying the user intention based on the large language model and performing intention classification based on the input query information to obtain an intention classification result comprises:
Performing deep semantic analysis on the input query information by using the large language model to understand the requirements and the query purposes of users and obtain a deep semantic analysis result;
and matching the deep semantic analysis result with a preset intention category to obtain the intention category result.
4. The method for generating the retrieval enhancement based on the large language model according to claim 1, wherein the performing the multi-path hybrid retrieval according to the first query instruction and the second query instruction through a preset multi-source knowledge base to obtain an initial retrieval result comprises:
text segmentation is carried out on the preset multi-source knowledge base, and a plurality of text fragments are obtained;
Converting the text fragments into vector representations based on a preset vector model to obtain a plurality of text fragment vectors;
Respectively converting the first query instruction and the second query instruction into vector representations based on the preset vector model to obtain a first query instruction vector and a second query instruction vector;
And carrying out multipath mixed search according to the text segment vectors, the first query instruction vector and the second query instruction vector, and evaluating similarity and relativity to obtain the initial search result.
5. The method for generating a large language model based search enhancement as claimed in claim 4, wherein said performing a multi-path mixed search based on a plurality of said text segment vectors, said first query instruction vector and said second query instruction vector, evaluating similarity and relevance, and obtaining said initial search result comprises:
the cosine distances between the first query instruction vector and all the text segment vectors are calculated to obtain a first cosine distance, wherein the first cosine distance is used for evaluating the similarity and the correlation between the first query instruction vector and all the text segment vectors in multi-path mixed retrieval;
the cosine vectors of the second query instruction vector and all the text segment vectors are calculated to obtain a second cosine distance, wherein the second cosine distance is used for evaluating the similarity and the correlation between the second query instruction vector and all the text segment vectors in multi-path mixed retrieval;
adding the first cosine distance and the second cosine distance to obtain a third cosine distance;
and obtaining the initial search result according to the third cosine distance.
6. The large language model based search enhancement generation method according to any one of claims 1 to 5, wherein the performing result rearrangement and screening on the initial search result according to the intention classification result to obtain an enhancement prompt includes:
Adjusting parameters of the initial search result according to the intention classification result to obtain an adjusted search result;
And reordering the search results according to the adjusted parameters of the search results, and screening the results ranked in a preset number as the enhancement prompt.
7. A large language model based search enhancement generation system, comprising:
the acquisition module is used for acquiring input query information of a user;
The query instruction module is used for respectively rewriting the input query information and extracting key information based on a large language model to obtain a first query instruction and a second query instruction, wherein the first query instruction is an instruction comprising rewritten query information, and the second query instruction is an instruction comprising key information;
the intention classification module is used for identifying user intention and classifying the intention based on the large language model according to the input query information to obtain an intention classification result;
the retrieval module is used for carrying out multi-path mixed retrieval through a preset multi-source knowledge base according to the first query instruction and the second query instruction to obtain an initial retrieval result, wherein the multi-source knowledge base comprises an Internet knowledge base, a wiki encyclopedia knowledge base and an academic literature knowledge base;
the enhancement prompt module is used for carrying out result rearrangement and screening on the initial search result according to the intention classification result to obtain an enhancement prompt word;
and the result generation module is used for inputting the input query information and the enhancement prompt word into the large language model to obtain a retrieval enhancement generation result output by the large language model.
8. An electronic device comprising a memory, a processor and a computer program stored on the memory and running on the processor, wherein the processor implements the large language model based retrieval enhancement generation method of any one of claims 1 to 6 when the computer program is executed by the processor.
9. A non-transitory computer-readable storage medium having stored thereon a computer program, wherein the computer program when executed by a processor implements the large language model-based retrieval enhancement generation method of any of claims 1 to 6.
10.A computer program product comprising a computer program which, when executed by a processor, implements a large language model based retrieval enhancement generation method as claimed in any one of claims 1 to 6.
CN202411937157.7A 2024-12-26 2024-12-26 Retrieval enhancement generation method and system based on large language model Pending CN120045750A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202411937157.7A CN120045750A (en) 2024-12-26 2024-12-26 Retrieval enhancement generation method and system based on large language model

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202411937157.7A CN120045750A (en) 2024-12-26 2024-12-26 Retrieval enhancement generation method and system based on large language model

Publications (1)

Publication Number Publication Date
CN120045750A true CN120045750A (en) 2025-05-27

Family

ID=95750537

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202411937157.7A Pending CN120045750A (en) 2024-12-26 2024-12-26 Retrieval enhancement generation method and system based on large language model

Country Status (1)

Country Link
CN (1) CN120045750A (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN120508607A (en) * 2025-07-21 2025-08-19 国网江苏省电力有限公司南通供电分公司 Text retrieval optimization method and system for electric power scientific research information
CN120832368A (en) * 2025-07-02 2025-10-24 内蒙古电力勘测设计院有限责任公司 A distributed knowledge base query method, device and equipment for intelligent semantic matching
CN121030013A (en) * 2025-10-31 2025-11-28 天津宏达瑞信科技有限公司 Large-scale intelligent agent application system and method integrating data and knowledge from the heating industry
CN121146095A (en) * 2025-11-18 2025-12-16 船舶信息研究中心(中国船舶集团有限公司第七一四研究所) Multi-turn question answering: large-scale model multi-way retrieval question answering parameter and data source tuning methods
CN121501971A (en) * 2025-11-14 2026-02-10 社小智(北京)科技有限公司 Intelligent decision support method, equipment and media for work orders generated based on retrieval enhancement

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111339239A (en) * 2019-06-13 2020-06-26 海通证券股份有限公司 Knowledge retrieval method and device, storage medium and server
KR20240157591A (en) * 2024-10-15 2024-11-01 (주)비타소프트 Vector database retrieval method for hierarchically structured documents and an llm-based knowledge retrieval system utilizing the same
CN118939763A (en) * 2024-07-11 2024-11-12 招商银行股份有限公司 Information retrieval method, device, storage medium and computer program product
CN118981522A (en) * 2024-07-26 2024-11-19 睿宇时空科技(重庆)股份有限公司 Database AI question answering system and method based on large language model and retrieval enhancement
CN119005340A (en) * 2024-08-01 2024-11-22 上海之爱智能科技有限公司 Knowledge reasoning method, system, device and medium integrating multiple sources and modes
CN119179787A (en) * 2024-08-09 2024-12-24 国网湖北省电力有限公司电力科学研究院 Expert information retrieval prompt engineering self-generation method and device with enhanced knowledge graph

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111339239A (en) * 2019-06-13 2020-06-26 海通证券股份有限公司 Knowledge retrieval method and device, storage medium and server
CN118939763A (en) * 2024-07-11 2024-11-12 招商银行股份有限公司 Information retrieval method, device, storage medium and computer program product
CN118981522A (en) * 2024-07-26 2024-11-19 睿宇时空科技(重庆)股份有限公司 Database AI question answering system and method based on large language model and retrieval enhancement
CN119005340A (en) * 2024-08-01 2024-11-22 上海之爱智能科技有限公司 Knowledge reasoning method, system, device and medium integrating multiple sources and modes
CN119179787A (en) * 2024-08-09 2024-12-24 国网湖北省电力有限公司电力科学研究院 Expert information retrieval prompt engineering self-generation method and device with enhanced knowledge graph
KR20240157591A (en) * 2024-10-15 2024-11-01 (주)비타소프트 Vector database retrieval method for hierarchically structured documents and an llm-based knowledge retrieval system utilizing the same

Non-Patent Citations (4)

* Cited by examiner, † Cited by third party
Title
ZHOU, C等: "On Effective Radiative Forcing of Partial Internally and Externally Mixed Aerosols and Their Effects on Global Climate", JOURNAL OF GEOPHYSICAL RESEARCH-ATMOSPHERES, vol. 123, no. 01, 31 January 2018 (2018-01-31) *
王志华;赵伟;: "基于本体的语义网检索模型及关键技术研究", 计算机工程与设计, vol. 32, no. 01, 31 December 2011 (2011-12-31) *
白玉琪等: "面向在线空间信息的自动化搜索", 计算机工程与应用, no. 25, 31 December 2003 (2003-12-31) *
车万翔等: "大模型时代的自然语言处理:挑战、机遇与发展", 中国科学:信息科学, vol. 53, no. 09, 31 December 2023 (2023-12-31) *

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN120832368A (en) * 2025-07-02 2025-10-24 内蒙古电力勘测设计院有限责任公司 A distributed knowledge base query method, device and equipment for intelligent semantic matching
CN120508607A (en) * 2025-07-21 2025-08-19 国网江苏省电力有限公司南通供电分公司 Text retrieval optimization method and system for electric power scientific research information
CN121030013A (en) * 2025-10-31 2025-11-28 天津宏达瑞信科技有限公司 Large-scale intelligent agent application system and method integrating data and knowledge from the heating industry
CN121501971A (en) * 2025-11-14 2026-02-10 社小智(北京)科技有限公司 Intelligent decision support method, equipment and media for work orders generated based on retrieval enhancement
CN121146095A (en) * 2025-11-18 2025-12-16 船舶信息研究中心(中国船舶集团有限公司第七一四研究所) Multi-turn question answering: large-scale model multi-way retrieval question answering parameter and data source tuning methods
CN121146095B (en) * 2025-11-18 2026-03-24 船舶信息研究中心(中国船舶集团有限公司第七一四研究所) Multi-turn question answering: large-scale model multi-way retrieval question answering parameter and data source tuning methods

Similar Documents

Publication Publication Date Title
CN112214593B (en) Question and answer processing method, device, electronic device and storage medium
US10503828B2 (en) System and method for answering natural language question
KR101661198B1 (en) Method and system for searching by using natural language query
US11699034B2 (en) Hybrid artificial intelligence system for semi-automatic patent infringement analysis
CN111353310A (en) Named entity identification method and device based on artificial intelligence and electronic equipment
CN109460459B (en) Log learning-based dialogue system automatic optimization method
CN112800170A (en) Question matching method and device and question reply method and device
CN107491547A (en) Searching method and device based on artificial intelligence
CN106815252A (en) A kind of searching method and equipment
CN114372454B (en) Text information extraction method, model training method, device and storage medium
CN115827819A (en) An intelligent question answering processing method, device, electronic equipment and storage medium
CN114153946A (en) Intelligent retrieval method, device, equipment and storage medium
CN113157887A (en) Knowledge question-answering intention identification method and device and computer equipment
CN120316235A (en) Conversational enterprise knowledge question-answering method, device, storage medium and electronic device
CN119581049A (en) An intelligent medical question-answering system based on pre-trained language model
Sathyendra et al. Helping users understand privacy notices with automated query answering functionality: An exploratory study
CN112949293A (en) Similar text generation method, similar text generation device and intelligent equipment
CN110851560B (en) Information retrieval method, device and equipment
CN113590768B (en) Training method and device for text relevance model, question answering method and device
CN119621944A (en) Data retrieval method, device, electronic device and medium
CN119829700A (en) Language processing model training method and device and problem processing method and device
CN119474340A (en) Information retrieval method, device, storage medium and equipment
Kia et al. Open-Domain question classification and completion in conversational information search
CN113157892A (en) User intention processing method and device, computer equipment and storage medium
JP2022092849A (en) Retrieval apparatus, retrieval method and program

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination