Method for enhancing AI large model generation by using structured context-assisted retrieval
By integrating node embedding and structuring the user query text, combined with AI big model, the problem that existing question-and-answer systems are difficult to deeply explore text semantics, achieving higher answer accuracy.
Patent Information
- Application Number
- CN202411948901.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-27
- Publication Date
- 2025-05-02
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
When handling user queries, existing question-and-answer systems rely mostly on simple keyword matching or surface semantic analysis, making it difficult to deeply explore text semantic information, resulting in low accuracy of answers.
By integrating the query text input by the user, a target query structure is constructed, and matching text blocks are obtained from the preset relationship library obtained by structured processing, and combined with the AI big model, the target answer is determined.
Deeply digging into text semantics and accurately positioning related text blocks, significantly improving the accuracy of the answers generated by the Q&A system.
Smart Images

Figure CN119917616A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of information processing technology, and in particular to a method for enhancing AI large model generation by utilizing structured context-assisted retrieval. Background Art
[0002] With the development of information technology, users have increasingly higher requirements for the accuracy of question-answering systems. However, when processing user queries, question-answering methods in related technologies mostly rely on simple keyword matching or surface semantic analysis to locate relevant text blocks, lacking the mining of deep semantic information of the text. On the one hand, natural language itself is highly complex and ambiguous, and phenomena such as polysemy and semantic ambiguity are common, which makes it difficult to accurately understand the user's true intentions based solely on surface features. In this case, the question-answering system in related technologies cannot deeply understand the complex needs behind the user's query, which may result in the retrieved text block not being the most relevant to the user's query, resulting in the low accuracy of the generated answer. Summary of the invention
[0003] The present application provides a method for enhancing AI large model generation using structured context-assisted retrieval, which can improve the accuracy of generated answers.
[0004] In a first aspect, an embodiment of the present application provides a method for enhancing AI large model generation by using structured context-assisted retrieval, the method comprising:
[0005] Perform node embedding and integration on the query text input by the user to obtain the target query structure;
[0006] Acquire a first target text block that matches the target query structure from a first preset relationship library, the preset relationship library is obtained by performing structured processing on a preset document, the preset document includes multiple text blocks, the preset relationship library includes entity relationships corresponding to the multiple text blocks, and the structured processing includes structured information extraction and node embedding integration processing;
[0007] Acquire a second target text block matching the target query structure from a second preset relationship library, wherein the second preset relationship library includes a plurality of text blocks and respective corresponding vector relationships;
[0008] Performing text processing on the first target text block and the second target text block to obtain a target text block;
[0009] According to the target text block and the query text, a target answer corresponding to the query text is determined.
[0010] In a second aspect, the present application provides a device for enhancing AI large model generation by using structured context-assisted retrieval, the device comprising:
[0011] An integration module is used to perform node embedding integration on the query text input by the user to obtain a target query structure;
[0012] A first acquisition module is used to acquire a first target text block matching the target query structure from a first preset relationship library, wherein the preset relationship library is obtained by performing structured processing on a preset document, wherein the preset document includes a plurality of text blocks, the preset relationship library includes entity relationships corresponding to the plurality of text blocks, and the structured processing includes structured information extraction and node embedding integration processing;
[0013] A second acquisition module is used to acquire a second target text block matching the target query structure from a second preset relationship library, wherein the second preset relationship library includes the plurality of text blocks and their corresponding vector relationships;
[0014] A processing module, configured to perform text processing on the first target text block and the second target text block to obtain a target text block;
[0015] A determination module is used to determine a target answer corresponding to the query text based on the target text block and the query text through an AI big model.
[0016] In a third aspect, an embodiment of the present application provides an electronic device, the electronic device comprising: a processor and a memory storing computer program instructions;
[0017] When the processor executes the computer program instructions, it implements the method of enhancing AI big model generation by using structured context-assisted retrieval as in any one of the embodiments of the first aspect.
[0018] In a fourth aspect, an embodiment of the present application provides a computer storage medium having computer program instructions stored thereon. When the computer program instructions are executed by a processor, a method for enhancing AI large model generation by using structured context-assisted retrieval as in any one of the embodiments in the first aspect is implemented.
[0019] In a fifth aspect, an embodiment of the present application provides a computer program product. When the instructions in the computer program product are executed by a processor of an electronic device, the electronic device executes a method for enhancing AI large model generation by using structured context-assisted retrieval as in any one of the embodiments of the first aspect above.
[0020] In a method for enhancing AI big model generation by using structured context-assisted retrieval provided in an embodiment of the present application, the query text input by the user is first node-embedded and integrated to obtain the target query structure. This step fully considers the semantic structure of the query text, is no longer limited to simple keywords or surface semantics, and lays the foundation for subsequent precise matching. Then, the first target text block and the second target text block matching the target query structure are obtained from the first preset relationship library (including text block entity relationships) and the second preset relationship library (including text block vector relationships) obtained based on structured processing. Through multi-dimensional and deep relationship library retrieval, the text information related to the user query can be more comprehensively mined, effectively avoiding the limitations brought by relying on a single method to retrieve the text block. Then, the two obtained target text blocks are subjected to text processing to obtain the target text block, and the relevant text content is further optimized and screened. Finally, the target answer is determined according to the target text block and the query text through the AI big model. The whole process deeply mines the text semantics and accurately locates the relevant text blocks, so that the final generated answer is more in line with the complex needs of the user, thereby greatly improving the accuracy of the answer generated by the question-answering system. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] In order to more clearly illustrate the technical solution of the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0022] Figure 1 This is one of the flowcharts of the method for enhancing AI large model generation by using structured context-assisted retrieval provided in an embodiment of the present application;
[0023] Figure 2 This is the second flow chart of the method for enhancing AI large model generation by using structured context-assisted retrieval provided in the embodiment of the present application;
[0024] Figure 3 It is a structural schematic diagram of a device for enhancing AI large model generation by using structured context-assisted retrieval provided in an embodiment of the present application;
[0025] Figure 4 It is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0026] In order to more clearly understand the above-mentioned objectives, features and advantages of the present disclosure, the scheme of the present disclosure will be further described below. It should be noted that the embodiments of the present disclosure and the features in the embodiments can be combined with each other without conflict.
[0027] In the following description, many specific details are set forth to facilitate a full understanding of the present disclosure, but the present disclosure may also be implemented in other ways different from those described herein; it is obvious that the embodiments in the specification are only part of the embodiments of the present disclosure, rather than all of the embodiments.
[0028] It should be noted that, in this article, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the term "comprising" or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprising a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0029] In today's era of rapid development of information technology, the importance of question-answering systems has become increasingly prominent, and users have increasingly stringent requirements for their accuracy. In the process of using large language models for retrieval enhancement generation to build question-answering systems, a key factor determines the accuracy of the final result, that is, the precise positioning of text blocks. However, related technologies have obvious limitations in this regard. In most cases, they simply rely on the surface similarity between user queries and text blocks to try to locate relevant text. Natural language itself is extremely complex and full of ambiguity. The widespread existence of polysemy and semantic ambiguity makes it difficult for this surface matching method to deeply explore the deep semantic information of text blocks. Even if seemingly relevant text blocks are found in this way, due to the lack of precise grasp of semantics, it is easy to have deviations in understanding, which in turn leads to the generated answers being unable to meet user needs.
[0030] In order to solve the problems existing in the related technology, an embodiment of the present application provides a method for enhancing the generation of AI large models by using structured context-assisted retrieval.
[0031] The present application embodiment provides a method for enhancing the generation of an AI large model by using structured context-assisted retrieval. The following first introduces the method for enhancing the generation of an AI large model by using structured context-assisted retrieval provided by the present application embodiment. Figure 1 As shown, the method specifically comprises the following steps:
[0032] S100, performing node embedding integration on the query text input by the user to obtain a target query structure.
[0033] Optionally, the query text is a question statement input by the user, which is the starting point of the entire question-answering process. For example, the user may enter a natural language sentence such as "Which company produces the highest conversion efficiency of power transformers?" as the query text. The content of the query text can cover various fields and topics, and has the characteristics of natural language, such as ambiguity and polysemy. It is the expression of the user's demand for seeking answers from the system, and the system needs to process and analyze it to understand the user's intention and provide an accurate answer.
[0034] Optionally, the target query structure is formed after node embedding and integration, and is a composite data form used to accurately express the user's query intention and facilitate system processing and retrieval.
[0035] Optionally, in a feasible implementation of the present application, the target query structure may include two parts: a target semantic association graph and a target feature vector.
[0036] Specifically, we can first build a graph structure based on the semantic understanding of the query text. For example, for the query "How to quickly improve English speaking skills?", "English speaking skills" is determined as the core node, "improve" can be regarded as an action relationship node, connected to the core node, and "quickly" is used as an attribute node to modify the action of "improve", together forming a preliminary semantic association graph. This graph reflects the key semantic elements in the query text and their mutual relationships through the connection relationship between nodes, providing a basic framework for subsequent further processing, so that the system can grasp the general structure of the query from a semantic level.
[0037] Then, various semantic features are extracted from the query text. At the vocabulary level, the semantic connotation, part of speech, and common usage in the field of each word are analyzed; for phrases and sentence structures, the semantic logic contained in their grammatical structures is identified, such as the relationship between the subject and the action and object in the subject-predicate-object structure. For example, in "How to quickly improve English speaking skills?", the action semantics represented by the verb "improve" is identified, "English speaking skills" is the object of the action, and "quickly" is used as a manner adverbial to modify the degree of "improve".
[0038] Subsequently, the extracted semantic features are encoded and converted into a form that can be processed by a computer. Vector encoding can be used to assign specific vector representations to different semantic features. For example, corresponding vector spaces are set for common verbs (such as "improve") and nouns (such as "English speaking ability"), and the vector values are determined according to their positions and relationships in the semantic space. At the same time, corresponding encoding methods are also set to represent the relationships between different semantic features (such as modification relationships, action-object relationships, etc.), and they are integrated into the overall encoding system.
[0039] Subsequently, the encoded semantic features are integrated and optimized into a unified representation. Through machine learning algorithms or deep learning models (such as neural networks), the internal connections and combination rules between different semantic features are learned. For example, the neural network learns a large number of semantic feature combination patterns similar to the query text, adjusts the internal weight parameters, and fuses the extracted and encoded features to finally generate a target representation that can comprehensively reflect the semantics and structure of the query text. This process aims to integrate the scattered semantic features into an organic whole to obtain a target semantic association graph, making it more suitable for matching and retrieving with the knowledge base or documents in subsequent steps. In this target semantic association graph, the connection relationship between nodes is clearer and richer, which not only reflects the basic semantic logic, but also incorporates more semantic information obtained through feature extraction and encoding. For example, when processing complex queries, the hierarchical structure and logical constraint relationship between different semantic elements can be clearly displayed, so that the system can more accurately locate relevant information when matching with the knowledge base, thereby improving the accuracy and efficiency of retrieval.
[0040] The target feature vector is a mathematical vector representation of the query text after feature extraction, encoding and integration. It quantifies the semantic features in the query text in the form of a vector, and reflects the key features of the query text in the vector space. This vector complements the target semantic association graph. The target semantic association graph presents the query from the perspective of semantic logical structure, while the target feature vector provides support from the perspective of mathematical feature quantification. The two together constitute the target query structure, enabling the system to use technical means such as vector calculation and graph matching to quickly find the content that best matches the user's query in the knowledge base or document, thereby providing a strong basis for determining the accurate answer.
[0041] S200, obtaining a first target text block matching the target query structure from a first preset relationship library, wherein the preset relationship library is obtained by performing structured processing on a preset document, wherein the preset document includes multiple text blocks, and the preset relationship library includes entity relationships corresponding to each of the multiple text blocks, and the structured processing includes structured information extraction and node embedding integration processing.
[0042] Optionally, the preset document is a collection of pre-prepared text materials containing rich information, which can be in the form of electronic documents, text records in databases, web page texts, etc. It covers various knowledge and information related to the fields involved in the question-answering system. For example, if it is a question-answering system in the medical field, the preset document may contain medical textbooks, clinical research reports, disease diagnosis and treatment guidelines, etc.; if it is a question-answering system in the field of science and technology, the preset document may include technical manuals, scientific research papers, product manuals, etc. The preset document is the knowledge source of the question-answering system, providing basic data for answering user queries. Its scale and quality directly affect the system's answering ability and accuracy.
[0043] A text block is a smaller text unit formed by dividing a preset document according to certain rules. The segmentation method can be determined based on the structural characteristics of the document (such as paragraphs, chapters), semantic integrity (such as a complete concept explanation, event description), or specific technical requirements (such as a fixed character length). For example, in a technical document, each paragraph can be regarded as a text block, or several related paragraphs can be divided into a text block based on the content theme. The division of text blocks is intended to break down large documents into parts that are easy to process and manage, so that the system can more efficiently search and match information related to user queries. Each text block retains certain semantic information and is the basic unit for subsequent construction of a relationship library and retrieval of answers.
[0044] Entity relationships refer to the various connections between entities involved in a text block. Entities can be specific things (such as product names, people, places, etc.), abstract concepts (such as theories, methods, phenomena, etc.) or events, etc. These entities are related to each other through semantic relationships. For example, in medical documents, there may be a "treatment" relationship between "drugs" and "diseases", and a "manifestation" relationship between "patients" and "symptoms"; in scientific and technological documents, there is a "possessing" relationship between "equipment" and "functions", and a "applicable to" relationship between "algorithms" and "application scenarios", etc. The identification and extraction of entity relationships is a key step in building structured knowledge. It helps the system understand the semantic logic within the text block, so as to more accurately perform matching and retrieval operations in the relationship library, and provide more targeted information to answer user queries.
[0045] Optionally, the first preset relationship library is a knowledge base constructed by structuring the preset document, and its core content is the entity relationship corresponding to each of the multiple text blocks. During the construction process, the preset document is firstly subjected to structured information extraction, the entities and their relationships in the text blocks are identified, and then this information is sorted and stored to form a relationship library. This relationship library organizes data in a way that is convenient for query and matching. For example, a graph database can be used, with entities as nodes and entity relationships as edges to construct a knowledge graph structure. When the system receives a user query and generates a target query structure, it can quickly search for text blocks that match the entity relationships in the target query structure in the first preset relationship library, providing strong support for obtaining accurate answers. There can be many ways to construct and store the first preset relationship library. The above is just a common example. Other similar structured data storage and management methods can also be used according to specific needs and technical selections.
[0046] Optionally, the first target text block is a text block that matches the target query structure and is retrieved from the first preset relationship library. After the system integrates the query text input by the user through node embedding to obtain the target query structure, it will search for the text block that best matches it in terms of entity relationship in the first preset relationship library. These text blocks are considered to be highly relevant to the user query because the entity relationships they contain are consistent with the semantic logic expected by the query. For example, if the user query is about a specific function of a certain product, the text blocks in the first preset relationship library that describe the relationship between the product and the relevant functions may be determined as the first target text block. The first target text block is an important object for further processing and analysis by the system. They will be processed with the second target text block obtained from the second preset relationship library for subsequent text processing to ultimately determine the target answer that can answer the user query. The matching process for obtaining the first target text block can be based on a variety of algorithms and technologies, such as similarity calculation based on a vector space model, a graph matching algorithm, etc. The specific implementation method depends on the structure of the first preset relationship library and the design requirements of the system, and can be optimized and improved according to actual conditions.
[0047] Optionally, in a feasible implementation of the present application, first, a first preset relationship library is constructed based on the structured processing of a preset document. The preset document is divided into multiple text blocks, and the entities in each text block and the relationships between them are identified through structured information extraction technology. These entity relationships constitute the core content of the relationship library. At the same time, a one-to-one correspondence between entities and text blocks is established so that the text blocks containing specific entities can be quickly located later.
[0048] After the node embedding and integration of the user input query text is completed to obtain the target query structure, matching retrieval is started in the first preset relationship library. Key entity and relationship information are extracted from the target query structure, and this information is used to search in the graph information library. For example, if the target query structure contains entity "A" and entity "B" and a certain relationship "R" between them, the system will search in the graph to see if there is a path connecting "A" and "B" with a relationship of "R". At the same time, based on the found entities, a collection of text blocks that may contain relevant information is quickly located.
[0049] During the search process, a variety of algorithms and techniques can be used to improve the accuracy and efficiency of matching. For example, the similarity between the target query structure and the path in the graph can be calculated based on the vector space model, or the graph matching algorithm can be used to find the most similar entity relationship structure. For multiple potential matching text blocks found, they can also be sorted according to the similarity score, and the text block with the higher score can be selected as the first target text block.
[0050] S300, acquiring a second target text block matching the target query structure from a second preset relationship library, wherein the second preset relationship library includes the plurality of text blocks and their corresponding vector relationships.
[0051] Optionally, the second preset relationship library is also constructed based on the processing of the preset document, aiming to provide the system with another dimension of text block retrieval basis. It complements the first preset relationship library and serves the goal of accurately obtaining text blocks related to the user query from the preset document. Before constructing the second preset relationship library, the preset document has undergone a series of preprocessing steps, such as being divided into multiple text blocks, which become the basic elements for constructing the relationship library.
[0052] The core content of the second preset relationship library is to store multiple text blocks and their corresponding vector relationships. The vector relationship here is a mathematical representation relationship established by converting the text block into a vector form. Specifically, each text block is mapped to a vector space, in which the dimension and value of the vector reflect certain characteristics of the text block, such as vocabulary distribution, semantic information, etc. Through a specific vector representation method (such as a word vector model, a text vector model, etc.), the text block is converted into a vector, so that the similarity, distance and other relationships between the text blocks can be calculated in the vector space. These vector relationships provide a quantitative comparison basis for subsequent text block retrieval based on the target query structure, so that the system can quickly locate text blocks that are similar to the target query structure to some extent through vector calculation. The storage structure of the second preset relationship library can adopt a vector database or other data structure suitable for storing vector data and supporting efficient retrieval to ensure that the vector relationship can be quickly accessed and compared when processing user queries, thereby improving the response speed of the system.
[0053] The second target text block is a text block retrieved from the second preset relationship library and matching the target query structure.
[0054] Optionally, in a feasible implementation of the present application, after the target query structure is obtained, the search operation based on the second preset relationship library is started. Then, a corresponding similarity calculation algorithm, such as a cosine similarity algorithm or a Euclidean distance calculation method, is used to calculate the similarity values between the target query structure and each text block vector in the second preset relationship library one by one. Through such calculation, a quantitative result of the similarity degree of each text block vector relative to the target query structure vector can be obtained.
[0055] Then, according to the set matching rules and thresholds, the text blocks whose similarity values meet the requirements are screened out, and these text blocks are identified as the second target text blocks that match the target query structure. For example, if the text blocks whose cosine similarity is greater than a certain threshold (such as 0.8) are set as matching text blocks, then the text blocks whose similarity reaches or exceeds this value will be selected.
[0056] S400: Perform text processing on the first target text block and the second target text block to obtain a target text block.
[0057] Optionally, in a feasible implementation of the present application, after obtaining the first target text block from the first preset relationship library and the second target text block from the second preset relationship library, the text processing stage is entered. First, the formats of these text blocks need to be unified and standardized. Since different text blocks may differ in source and pre-processing methods, it is necessary to ensure that they are under the same format standards in subsequent operations, such as unifying the encoding format, removing unnecessary special characters, etc., so that the text content is in a regular and easy-to-process state.
[0058] Next, the first target text block and the second target text block will be merged to form a relatively complete text collection, making full use of the text resources retrieved from different dimensions to ensure that relevant information is not missed. In the merging process, duplicate content is identified and removed to avoid affecting the subsequent analysis efficiency and accuracy of the answer due to excessive duplicate information. Appropriate algorithms or rules are used to determine which sentences are completely repeated and only one copy is retained.
[0059] Then, semantic analysis and refinement will be carried out on the merged and deduplicated text sets, using natural language processing techniques, such as part-of-speech tagging, syntactic analysis, and semantic role labeling, to deeply explore the key semantic information, logical relationships, and core ideas in the text, sort out the parts that are most relevant to the user's query text, further focus on useful content, remove redundant expressions that are not related to answering user questions, and make the text more refined and relevant.
[0060] Afterwards, you can also perform certain sorting operations on the text based on specific needs and application scenarios. For example, you can rearrange it according to factors such as the relevance to the target query structure and the importance of the text, and put the most valuable text content that is most likely to help generate accurate answers at the front for easy reference later.
[0061] Through the above series of text processing operations, an optimized and integrated target text block is finally obtained, which contains more targeted information that better fits the user's query needs.
[0062] S500, determining a target answer corresponding to the query text according to the target text block and the query text through the AI big model.
[0063] Optionally, in a feasible implementation of the present application, first, a comprehensive semantic analysis is performed on the target text block and the query text. With the help of the semantic understanding model in natural language processing technology, the semantic information in the target text block is deeply analyzed, including multiple levels such as lexical semantics, sentence semantics, and paragraph semantics, while accurately grasping the semantic needs of the query text. For example, identify keywords and key phrases in the text and the semantic associations between them, and determine the core elements such as themes, objects, actions involved in the text. In this way, the points of convergence and difference between the target text block and the query text at the semantic level are clarified, and a semantic foundation is built for the generation of answers.
[0064] Next, based on the results of semantic analysis, extract key information in the target text block that is highly relevant to the query text. Specifically, it involves operations such as information screening, summarization, and integration. For example, select factual statements, data, and opinions that directly answer the query question from a large number of text contents, organize them in a certain logical order, remove redundant and irrelevant information, and form a concise and targeted information collection. If the query text is about the technical parameters of a product, then extract the accurate parameter data and related technical instructions of the product from the target text block and organize them reasonably.
[0065] Then, use language generation models or algorithms to construct answers. Choose appropriate expressions and language styles based on the extracted key information and the context and requirements of the query text. When generating answers, ensure the completeness, accuracy, and fluency of the answers. For example, if it is a more formal technical question and answer, the answer should use professional terms and standardized language structure; if it is a general daily question and answer, easy-to-understand language can be used. At the same time, pay attention to the logic of the answer so that it can clearly respond to the questions in the query text and avoid ambiguous or unclear expressions.
[0066] Specifically, the processed target text block and query text are organized and arranged in an appropriate manner to form the input data form of the AI big model. For example, the query text can be placed at the beginning to clearly present the user's core question, and then the content of the target text block can be listed in sequence to provide corresponding contextual information so that the AI big model knows the scope of relevant knowledge that can be referenced.
[0067] Subsequently, the organized data is input into the AI big model. The big model conducts in-depth analysis of the input content based on the language patterns, semantic understanding, and knowledge reasoning capabilities learned in pre-training. Within the big model, through a complex neural network architecture, using technologies such as attention mechanisms, it focuses on the target text block that is most relevant to the query text, mines the key semantic associations and logical clues, and then performs reasoning and generates answers based on this information.
[0068] In the process of answer generation, some external knowledge or rules can also be referenced to further optimize the answer. For example, standard specifications and industry practices in a specific field can make the answer more in line with actual application scenarios and professional requirements. In addition, the generated answer will be evaluated and verified for quality. Check whether the answer fully answers the query question, whether there are any wrong information or contradictions, whether it conforms to language expression habits, etc. If problems are found, make adjustments and corrections in a timely manner until a high-quality target answer that meets user needs is generated. Through this series of rigorous and systematic steps, the target answer corresponding to the query text is finally determined, providing users with accurate and useful information feedback.
[0069] In a method for enhancing AI big model generation by using structured context-assisted retrieval provided in an embodiment of the present application, the query text input by the user is first node-embedded and integrated to obtain the target query structure. This step fully considers the semantic structure of the query text, is no longer limited to simple keywords or surface semantics, and lays the foundation for subsequent precise matching. Then, the first target text block and the second target text block matching the target query structure are obtained from the first preset relationship library (including text block entity relationships) and the second preset relationship library (including text block vector relationships) obtained based on structured processing. Through multi-dimensional and deep relationship library retrieval, the text information related to the user query can be more comprehensively mined, effectively avoiding the limitations brought by relying on a single method to retrieve the text block. Then, the two obtained target text blocks are subjected to text processing to obtain the target text block, and the relevant text content is further optimized and screened. Finally, the target answer is determined according to the target text block and the query text through the AI big model. The whole process deeply mines the text semantics and accurately locates the relevant text blocks, so that the final generated answer is more in line with the complex needs of the user, thereby greatly improving the accuracy of the answer generated by the question-answering system.
[0070] In one embodiment, the target query structure includes a target query graph and a target query vector;
[0071] The node embedding and integration of the query text input by the user to obtain the target query structure includes:
[0072] According to the query text, construct an initial query graph, wherein the initial query graph includes an anchor node, an answer node, and a relationship between the anchor node and the answer node;
[0073] Performing position embedding, role embedding and type embedding on the initial query graph to obtain an initial embedding vector of the initial query graph;
[0074] Embedding and integrating the initial embedding vector to obtain a target embedding vector;
[0075] Determining the target query graph according to the target embedding vector;
[0076] The query text is vectorized to obtain the target query vector.
[0077] In one embodiment, embedding and integrating the initial embedding vector to obtain a target embedding vector includes:
[0078] The initial embedding vector is weighted and biased based on a preset activation function to obtain the target embedding vector.
[0079] Optionally, the target query graph is a graphical structure constructed based on the semantics of the query text, which includes anchor nodes, answer nodes, and the relationship between them. Its connotation is continuously enriched through subsequent operations such as position embedding, role embedding, and type embedding, which can clearly present the logical relationship of the query content and the association between key elements, thereby helping the system to more accurately locate information related to user needs in the knowledge base. For example, in the query "Which company produces power transformers?", "power transformers" as an anchor node is the core object around which the entire query revolves, and "company" as an answer node is the information expected to be obtained. The "production" relationship between them constitutes the basic logic of the query graph. The graph structure that is subsequently processed and improved is the target query graph, which provides an intuitive structural basis for understanding and retrieving query-related content.
[0080] The target query vector is a mathematical representation of the query text after vectorization. It is a quantitative representation of the query text features from a numerical perspective. It maps the semantics, vocabulary and other information in the text into the vector space. Through calculations between vectors (such as similarity calculations, etc.), it can measure the similarity of different texts in semantic features. It cooperates with the target query graph to assist the system in finding the part that best matches the user query in the massive knowledge base text, thereby preparing for generating accurate answers.
[0081] Optionally, in a specific implementation of the present application, the initial query graph is first constructed based on the query text input by the user. This requires an in-depth analysis of the semantics of the query text, from which the core concepts are identified as anchor nodes. For example, in the query text "Which smartphone has good camera effects and long battery life?", "smartphone" is the anchor node, which is the subject around which the entire query revolves. The answer node is the element corresponding to the information that the user expects to obtain. In the above example, the specific "model" (i.e., the specific smartphone model) that meets the conditions of good camera effects and long battery life is the answer node. The anchor node and the answer node are connected through relationships that reflect attribute requirements such as "good camera effects" and "long battery life", thereby constructing the initial query graph structure, and preliminarily presenting the semantic logic in the text in a graphical manner, building a basic framework for subsequent embedding processing.
[0082] Subsequently, the initial query graph is embedded by position, role and type to obtain the initial embedding vector.
[0083] Position embedding: It uses a predefined lookup table to operate. This lookup table corresponds the canonical position of each node in the query graph to an embedding vector in a high-dimensional space. For example, in a relatively simple query graph, the position index of the anchor node is set to 0. If there are nodes representing relationships in the middle, the indexes are assigned in order. The answer node is assigned the corresponding index (such as 2) at the last position, and then the corresponding embedding vector is obtained from the lookup table based on this index to capture the relative order relationship between the nodes. For example, in the example of "Which company produces power transformers?", the position 0 of "power transformers" corresponds to the corresponding position embedding vector P0, and the position 2 of "company" corresponds to the position embedding vector P2. In this way, the system can know the order of nodes in the entire query logic, which is of great significance for the subsequent understanding of query semantics and retrieval of relevant information.
[0084] Role embedding: unique embedding vectors are assigned to nodes of different roles (such as anchor nodes, answer nodes, etc.). Taking "Which company produces power transformers?" as an example, "power transformers" as an anchor node has a dedicated role embedding vector Ranchor, which reflects the role characteristics of this node as the starting point and core focus of the query; "company" as an answer node, its role embedding vector Ranswer highlights its role as the target role that the query ultimately expects to obtain information. These embedding vectors of different roles are stored in specific places, and through the association with nodes, they help the model clearly distinguish the functional roles assumed by the nodes in the query process, facilitating targeted analysis and processing.
[0085] Type embedding: Based on the overall structural type of the query graph, the corresponding structural context information is captured through the query type table. Different queries often have different structural characteristics. For example, the query graph structures for querying product attributes and querying event causal relationships are different. With the help of the query type table, the position and role combination of each node are encoded, and then these encoded information is mapped to the embedding space through linear transformation, thereby giving the entire query graph a unified structural context representation. For example, for a specific query, analyze what type of structure it belongs to, and then determine the corresponding type embedding vector (such as the type embedding vector Tproduction corresponding to "production relationship" in the previous example), so that the system can distinguish different types of query structures based on this, and adopt appropriate strategies in subsequent matching retrieval and other operations.
[0086] Through the above three embedding methods, the corresponding embedding vector is determined for each node in the initial query graph, and they are combined to form the initial embedding vector. These vectors contain various information such as the node's position, role, and type, enriching the description of the query graph from different angles and providing basic data for further integration and processing.
[0087] Subsequently, the initial embedding vector is embedded and integrated to obtain the target embedding vector. Specifically, a multilayer perceptron (MLP) is used to process and connect different embedding vectors. For each node in the query graph, its position embedding, role embedding, and type embedding vectors are extracted and input into the MLP. The MLP has a complex structure inside, containing multiple neurons and different hidden layers (for example, assuming that the MLP has two hidden layers), and it can learn the complex interactions between these embedding vectors. Specifically, during the calculation process, after the weight matrix W (different hidden layers have corresponding weight matrices, such as W1, W2, etc.), the bias b (each layer also has a corresponding bias, such as b1, b2, etc.) and the activation function σ, the calculation is performed step by step according to a specific calculation process. For example, the intermediate result h1 is obtained by the calculation h1=σ(W1[P0,Ranchor,Tproduction]+b1), and then further processed by h2=σ(W2h1+b2), and finally the integrated embedding vector qv′ is obtained, that is, the target embedding vector. This vector integrates information such as position, role and type. Compared with the initial embedding vector, it can more comprehensively and accurately reflect the semantics and structure of the query graph, and provide a strong basis for determining the target query graph.
[0088] Subsequently, based on the obtained target embedding vector, the initial query graph is optimized and improved to determine the final target query graph. The rich information contained in the target embedding vector will be integrated into the nodes of the query graph and the relationships between them, making the target query graph more accurate in structure and semantic expression. The connections and logical relationships between nodes can better reflect the true intention of the user's query, such as more clearly showing the hierarchical relationships and constraints between the elements in complex queries, which facilitates subsequent matching and comparison with the information in the knowledge base, and improves the accuracy and efficiency of retrieval.
[0089] Subsequently, a special text vectorization technology is used to convert the vocabulary, semantics and other information in the query text into a vector form. The entire query text can be vectorized by using a word vector model (such as Word2Vec, GloVe, etc.) combined with a certain text representation method (such as weighted summation and averaging of word vectors in the text). In this way, the query text is mapped to the vector space to obtain the target query vector. This vector can reflect the characteristics of the query text from a quantitative perspective, and can cooperate with the target query graph. It plays an important role in the subsequent vector-based calculation to find the knowledge base text content that best matches the user query. For example, by calculating the similarity between the target query vector and the text block vector in the knowledge base, relevant information can be screened to help generate accurate answers.
[0090] In these optional embodiments, position embedding, role embedding, and type embedding can enrich the information dimension of the initial query graph, making it more accurately reflect the semantic structure of the text. Integrating the initial embedding vector to obtain the target embedding vector can effectively integrate multivariate information and improve data quality and representativeness. Determining the target query graph helps to focus on key information and relationship networks. Vectorizing the query text to obtain the target query vector facilitates efficient computer processing and calculation, thereby providing a solid foundation for subsequent retrieval, analysis, and other tasks based on the target query structure, and improving the accuracy and efficiency of the system's understanding and processing of the query text.
[0091] In one embodiment, the first preset relationship library includes a graph information library and an entity-text block relationship library, wherein the graph information library includes a plurality of entities corresponding to the preset document and the association relationship between the plurality of entities; the entity-text block relationship library includes a one-to-one correspondence between the plurality of entities and the plurality of text blocks;
[0092] The acquiring a first target text block matching the target query structure from a first preset relationship library includes:
[0093] Acquire entity matching results that match the target query graph from the graph information library;
[0094] Acquire the first target text block that matches the entity matching result from the entity-text block relationship library;
[0095] The acquiring a second target text block matching the target query structure from a second preset relationship library includes:
[0096] A second target text block matching the target query vector is obtained from the second preset relationship library.
[0097] Optionally, the graph information library is a knowledge storage structure built based on preset documents, which focuses on the structured presentation of knowledge in the documents. It covers many entities in the preset documents, which are key elements in the fields involved in the documents. For example, in scientific documents, they can be various technical names, product models, etc., and in the cultural field, they can be writers, works, genres and other concepts. At the same time, the relationship between these entities is also recorded. For example, in the field of science and technology, "software" and "operating system" have a "run on" relationship. This relationship connects the corresponding entity nodes with edges, forming a form similar to a knowledge graph as a whole, which is convenient for complex semantic queries and reasoning, and can clearly show the internal logical connection between domain knowledge.
[0098] The entity and text block relationship library focuses on establishing the mapping relationship between entities and text blocks, clarifying which text blocks each entity appears in, and vice versa, that is, each text block contains a clear record of which entities. For example, in a preset document consisting of an academic paper, each chapter is used as a text block. For the entity "quantum entanglement", the relationship library will indicate that it appears in those chapters (text blocks) that explain related theories and experiments. This helps to quickly locate the text block range that may contain the required information based on the entity.
[0099] Optionally, in a specific implementation of the present application, when obtaining the first target text block that matches the target query structure from the first preset relationship library, first obtain the entity matching result that matches the target query graph from the graph information library. The target query graph is obtained after integrating the initial query graph with position embedding, role embedding, and type embedding. It has presented the semantics and structure of the query text in a more accurate and rich form through nodes and relationships. The system will analyze the entities contained in this target query graph and the intricate relationships between them, and use them as a reference to perform matching searches in the knowledge graph of the graph information library. With the help of graph matching algorithms or semantic similarity calculations, the nodes and edges in the graph are traversed to search for those parts that are highly consistent with the entities and relationships in the target query graph, thereby obtaining corresponding entity matching results.
[0100] Then, with the obtained entity matching results, the first target text block that matches it is further obtained from the entity and text block relationship library. Since the relationship library clearly records the correspondence between entities and text blocks, the text blocks containing these entities can be quickly locked based on the entities involved in the entity matching results. These precisely located text blocks become the first target text blocks. They are judged to be closely related to the user's query from the dimension based on entity relationships, providing important basic information for subsequent answer generation and other links.
[0101] And obtaining the second target text block that matches the target query structure from the second preset relationship library is to compare the target query vector with each text block vector stored in the second preset relationship library using a suitable similarity calculation method (such as cosine similarity, etc.), calculate the similarity value between them, and then screen out the text blocks that meet the requirements according to a preset similarity threshold, and determine them as the second target text blocks, so as to mine the content related to the user query from the vector relationship level, and work together with the first target text block to help produce accurate answers.
[0102] In these optional embodiments, the first target text block is obtained from the first preset relationship library, and the entity matching results are first found based on the target query graph through the graph information library, and then the text block is accurately located using the entity and text block relationship library, which can efficiently screen out relevant content from the perspective of entity relationships. The second target text block is obtained from the second preset relationship library based on the target query vector, and related texts can be mined from the vector relationship dimension. The two complement each other, and multi-dimensional retrieval not only makes full use of different relationship characteristics, but also expands the scope of effective information acquisition, which helps to find text related to user queries more comprehensively and accurately, and lays a solid foundation for the subsequent generation of high-quality answers.
[0103] In one embodiment, before performing node embedding and integration on the query text input by the user to obtain the target query structure, the method further includes:
[0104] Segmenting the preset document to obtain the multiple text blocks;
[0105] Extracting structured information from the multiple text blocks to obtain an initial knowledge graph, wherein the initial knowledge graph includes multiple nodes and association relationships between the multiple nodes, and the multiple nodes are used to represent entities of the multiple text blocks;
[0106] Performing position embedding, role embedding and type embedding on a plurality of nodes in the initial knowledge graph to obtain the graph information library;
[0107] Determine the entity-text block relationship library according to the corresponding relationship between each text block and each entity;
[0108] Constructing the first preset relationship library according to the graph information library and the entity and text block relationship library;
[0109] Performing vectorization processing on the multiple text blocks respectively to obtain a text block vector corresponding to each text block;
[0110] The second preset relationship library is determined according to the text block vector corresponding to each text block.
[0111] Optionally, in a specific implementation of the present application, first, the preset document is segmented to obtain multiple text blocks. This needs to be operated according to certain rules, such as dividing the content around the same topic and logically coherent into a text block according to the paragraph division and chapter separation in the document, or according to the semantic integrity. Taking the technical text manual of the power electronics industry as an example, the parts introducing different equipment and different technical principles may be divided into independent text blocks, so that subsequent processing is more targeted and easier to manage.
[0112] Then, we extract structured information to obtain the initial knowledge graph. We use tools such as big models to identify and extract entities in text blocks. The following is an example of a technical text manual for the power electronics industry.
[0113] When dealing with technical text manuals in the power electronics industry, they present many complex characteristics due to their strong professionalism and technicality. The manuals cover a wide range of complex and sophisticated professional terminology elements. These terms are numerous and have extremely intricate correlations and connections with each other. Overall, the original text materials present typical unstructured characteristics. In other words, the information exists in the form of free text without a unified format and organizational structure, which poses a great challenge to the effective use of information.
[0114] In order to overcome this problem and fully explore the valuable information in it, the first thing to do is to extract structured text information from these unstructured text corpora. This extraction process mainly includes two key aspects: identifying and extracting entities in the text, and determining the entity relationships between the extracted entities.
[0115] In the text of power electronics, we need to focus on nouns with specific meanings and functions as entities for extraction. These entities are of various types. For example, component names are a common type of entity. When specific electronic components such as resistors, capacitors, and transistors appear in the text, they need to be accurately identified; technical parameters are also important entity components, such as voltage values, current strength, power size and other specific values and corresponding parameter names, such as "220V", "5A", "100W", etc., which reflect the performance indicators of equipment or components; and equipment models should not be ignored. Model identifiers such as "ALCO RS-3" that represent specific equipment are key elements to distinguish different equipment individuals.
[0116] In addition, entities may also include many types such as equipment name, type, organization name, time, event, etc. For example, when mentioning the manufacturer name of a power electronic device (organization name entity), or recording the specific time of a power system upgrade (time entity), or describing an important power experiment event (event entity), etc., the corresponding nouns must also be extracted as entities. In actual operation, this task is completed with the help of the powerful language understanding ability of the big model. With its long text input capability and accurate understanding of the text intent, the big model can conduct in-depth analysis of the text content, and accurately identify and extract these different types of entities from the text according to established rules and requirements.
[0117] After extracting various entities, we need to further clarify the entity relationships between them. These relationships constitute the skeleton of the knowledge system of the power electronics industry and are very rich in types.
[0118] Among them, subordinate relationships are more common. For example, a specific electronic component belongs to a specific circuit system, or a certain equipment model belongs to a certain brand series. For example, a specific model of transformer belongs to a series of products under a large power equipment manufacturer. This kind of ownership is the embodiment of subordinate relationships.
[0119] Parallel relationships also appear from time to time. For example, when introducing components of different types but with similar functions, like capacitors made of different materials but all used to achieve filtering functions, they are in a parallel position at the functional application level, and there is a parallel relationship between them.
[0120] Functional associations are even more critical. For example, there is a functional association between a controller and the motor it controls, which is to adjust the operation of the motor through control signals; or there is a functional association between the power supply device and the multiple electrical devices it supplies power to ensure their normal operation. These are the actual manifestations of functional associations. Of course, the relationship between entities also covers many types such as cause and effect, similarity, and comparison. For example, because a circuit component fails (cause), the entire power system operates abnormally (result), which reflects the cause and effect relationship; there is a similarity relationship between two power equipment of different brands but similar performance; and there is a contrast relationship between two power conversion technologies with different principles, etc. In order to extract these entity relationships more efficiently and accurately, specific prompt words can be constructed with the help of large models to guide their work. The prompt words are as follows:
[0121] Given a piece of text, extract relation triples in the form of [Subject, Relation, Object] from it.
[0122] Here are some examples:
[0123] Example 1:
[0124] Text: The 17068.8mm long ALCO RS-3 uses a diesel-electric transmission.
[0125] Triple: [['ALCO RS-3', 'powerType', 'diesel-electric drive'], ['ALCO RS-3', 'length',
[0126] '17068.8 (mm)']]...
[0127] Now extract the triplets from the following text: {text block}
[0128] Based on such prompt words, the big model can identify the relationship triples [Subject, Relation, Object] containing key entities, entity attributes and the relationship between them from the original unstructured text. For example, for the text content such as "17068.8 mm long ALCO RS-3 uses diesel-electric transmission", the big model will accurately extract the relationship triples such as [['ALCO RS-3', 'powerType', 'diesel-electric transmission'], ['ALCO RS-3', 'length', '17068.8 (mm)']].
[0129] These relationship triplets carry structured information and can then be stored in a specially designed structured graph library, such as the neo4j database, in an orderly and easy-to-query manner. Taking the triples just extracted as an example, we can clearly get the corresponding entity information and entity association information, such as the node name is "ALCO RS-3" and "diesel-electric transmission", and we know that the node relationship is "ALCO RS-3" and the "powerType" is "diesel-electric transmission".
[0130] Through the above complete processing method, all the relationship triplets in the text are extracted using a large model, and they are stored in a structured form in a structured graph library. The structured graph constructed in this way greatly changes the organization and storage form of information, making subsequent information retrieval and analysis more efficient and convenient. Whether it is deep mining, exploring the deeper laws and connections hidden behind a lot of knowledge, or conducting intelligent reasoning, deriving unknown conclusions based on existing knowledge, or providing a reliable basis for decision support, there is a solid data foundation. Through this process, the effective transformation from original unstructured text to structured knowledge is successfully achieved, providing proprietary data support for subsequent structured search and other applications. Numerous relationship triplets jointly construct the initial knowledge graph, in which the key entities in each triple become nodes in the graph, and the relationship between them clarifies the connection between nodes, which is fully prepared for the subsequent construction of the graph information library and other operations.
[0131] Then, position embedding, role embedding and type embedding are performed on multiple nodes in the initial knowledge graph to build a graph information base.
[0132] When building a graph information database, position embedding is a key operation. Its focus is to use standardized position information to accurately present the relative order between nodes in the initial knowledge graph, so as to help the model better grasp the position relationship of the nodes in the entire graph structure, and lay the foundation for the subsequent comprehensive understanding and application of graph information.
[0133] The specific implementation method is to use a predefined lookup table, which contains all possible node position indexes, and for each index, it is mapped to a specific embedding vector in the high-dimensional space.
[0134] Taking the construction of graph information base of power electronics industry related knowledge as an example, in the initial knowledge graph, each node represents different entities, such as nodes corresponding to various components, equipment, technical parameters and other entities. For these nodes, their position index is determined according to certain rules. Assuming that we have a node representing the component "transistor" in the graph, a node reflecting the technical association relationship of "amplification function", and a node representing the device "certain model circuit motherboard", etc., according to their layout order in the entire knowledge system structure, for example, the "transistor" node is in a relative starting introduction and basic association position in the knowledge logic presented by the graph, and its position index is assigned to 0; the "amplification function" node is in an intermediate association position at the level of functional association with "transistor", and its position index is assigned to 1; the "certain model circuit motherboard" node is in a position where it is finally associated after relying on the previous related components and functional associations, so its position index is set to 2.
[0135] Through the lookup table, the specific high-dimensional space embedding vector corresponding to the position index 0 becomes the position embedding vector of the "transistor" node, which clearly shows from the perspective of the vector space that the node is in the earlier and more basic position information in the entire graph structure; similarly, position indexes 1 and 2 also correspond to specific embedding vectors, which are respectively assigned to the "amplification function" relationship node and the "certain model circuit motherboard" device node.
[0136] In this way, even if there are some nodes in the graph that seem similar and easy to confuse in terms of functional attributes, the model can accurately distinguish the order and relative position relationship of these nodes in the graph by virtue of their unique position embedding vectors. This is a crucial basic support for subsequent operations such as information retrieval, deep knowledge mining, and logical reasoning based on the graph information library. It allows the model to more accurately search, match, and deeply analyze relevant information according to the established position order and association logic of the nodes in the graph, and fully tap the knowledge value contained in the graph.
[0137] In the process of building a graph information database, role embedding aims to assign unique embedding vectors to nodes with different role positioning in the initial knowledge graph, so as to help the model clearly and accurately identify the functional role of each node in the entire graph knowledge construction and information transmission process, thereby optimizing the processing flow of graph information and improving the accuracy and effectiveness of graph application.
[0138] In the initial knowledge graph covered by the graph information library, nodes have diverse role classifications. For example, there are core basic nodes, which are often the most fundamental and basic elements in the entire knowledge system. For example, the nodes corresponding to the basic components (such as resistors, capacitors, etc.) in the field of power electronics can usually be classified as such roles. They are the cornerstones for building more complex knowledge associations. There are also associated intermediary nodes, whose main function is to build a bridge between different basic nodes or other important nodes. For example, the nodes corresponding to the circuit connection relationship and signal transmission relationship belong to this role, which is responsible for transmitting information and connecting knowledge logic. In addition, there are key convergence nodes, which are often at the key convergence point of the knowledge context. Many related knowledge clues and associations ultimately point to them. For example, nodes representing a complete power system, core technology system, etc. play such a role and are the key to integrating and presenting important knowledge blocks.
[0139] For each role type, a matching embedding vector is set in advance and stored in a dedicated lookup table for easy on-demand retrieval when building the graph information library.
[0140] Taking the core basic node representing "resistance" as an example, its corresponding role embedding vector will focus on reflecting its role characteristics as a basic building element and a knowledge starting point; for nodes that embody the associated intermediary role of "current signal transmission", its role embedding vector will highlight its functional characteristics in connecting different circuit elements and transmitting related electrical information; for the key aggregation node representing "a complex power control system", its role embedding vector will highlight its unique role characteristics in aggregating many related components, relationships and other information to form a complete knowledge block.
[0141] By assigning corresponding role embedding vectors to different role nodes, when the model processes the information in the graph information library, once the role embedding vector of a node is obtained, it can quickly understand the role played by the node in the entire graph knowledge logic. Based on the characteristics and functions of different roles, the information carried by the node can be used more reasonably and efficiently for subsequent analysis, reasoning, knowledge expansion and other operations, thereby comprehensively improving the performance of the graph information library in knowledge management and application.
[0142] Type embedding plays an indispensable role in building a graph information database. It mainly focuses on assigning an embedding vector that matches each node in the graph based on the structural type characteristics of the initial knowledge graph itself, so as to accurately capture the differences between different local structures or different subject knowledge sections in the graph, and then create a unified contextual representation for the entire graph information database, so that the model can correctly understand the overall architecture of the graph from a macro perspective, and perform effective knowledge reasoning and information retrieval based on this.
[0143] In the knowledge scope covered by the graph information database, due to the rich and diverse knowledge content, different knowledge blocks or local structures often have their own unique type characteristics. For example, in the knowledge graph of the power electronics industry, the knowledge structure about circuit principles may present a structural type based on circuit elements, with current flow and signal transmission as logical clues; and the knowledge block involving power equipment manufacturing technology, its structural type may be constructed based on elements such as equipment production process, process links, and quality control points. Although they all belong to the large knowledge field of the power electronics industry, their structural types are completely different.
[0144] In order to effectively reflect this structural difference, type embedding is performed with the help of a special query type table. This query type table will comprehensively consider the specific position of each node in the graph and the role it plays in the entire graph knowledge system, and record, organize and mark the combination of these positions and roles in the query type table according to a set of rigorous and detailed coding rules that are pre-set.
[0145] For example, for a node in the circuit principle knowledge structure that represents "power supply" and plays the role of basic power supply starting point and is located at the logical starting position of this knowledge block, its unique position and role combination will be recorded in the query type table according to the corresponding coding rules; similarly, for a node in the power equipment manufacturing process knowledge block that represents "a key assembly process" and plays the role of connecting the previous and subsequent process links and is located in the middle of the process, its position and role combination information will also be accurately recorded according to the corresponding rules.
[0146] Then, through linear transformation, the information in this detailed coded query type table is mapped to the embedding space to achieve type embedding. The specific calculation process can be expressed by the mathematical expression gG=Wg·flatten(Count(G)), where W_g is a pre-set linear transformation matrix, Count(G) represents the query type table, and the flatten function is used to flatten the query type table into a vector. Through such a linear transformation operation, the node position and role combination information originally presented in a tabular form is successfully converted into a vector representation in the embedding space, which is what we call the type embedding vector.
[0147] Through such type embedding operations, knowledge blocks of different structural types or nodes in local graph structures all have type embedding vectors that can accurately reflect their structural differences, so that the entire graph information base can obtain a unified and comprehensive contextual representation. In this way, when the model faces the graph information base to perform various tasks, it can quickly and accurately distinguish the characteristics of different knowledge blocks or local structures based on these type embedding vectors, and then adopt strategies that match them to parse, mine and integrate information in the graph, laying a solid foundation for more efficient and accurate retrieval of target node information in the graph information base, conducting deep knowledge reasoning, and realizing comprehensive knowledge application. Finally, a structured graph information base with complete functions, rich information, and multi-dimensional key information such as location, role, and type is successfully constructed, providing strong knowledge support for subsequent application scenarios such as accurate matching with user query needs.
[0148] Subsequently, the entity and text block relationship library is determined based on the correspondence between each text block and each entity, that is, recording in which text blocks each entity appears. The storage format can be {entity 1: text block id}, so that the relevant text block can be quickly located based on the entity during subsequent retrieval.
[0149] Then, the first preset relationship library is constructed based on the graph information library and the entity and text block relationship library, and the two are integrated together so that they can serve the subsequent information retrieval and matching work from the perspective of entity relationships.
[0150] Finally, multiple text blocks are vectorized separately, and a suitable vectorization method is used to convert the text blocks into high-dimensional vector representations, such as 512-dimensional, 1024-dimensional, and other vectors. According to the vector corresponding to each text block, a second preset relationship library is determined. This relationship library can realize the retrieval of text blocks based on vector relationships, and cooperate with the retrieval based on the first preset relationship library to provide a guarantee for accurately obtaining text blocks related to user queries, thereby laying a good data foundation for the entire question-and-answer process and improving the efficiency of information utilization and the accuracy of answer generation.
[0151] In these optional embodiments, segmentation of preset documents facilitates subsequent precise processing, and structured information extraction can convert knowledge into a graph form, making knowledge associations clearer. Node embedding allows the graph information library to incorporate multi-dimensional information, which is conducive to accurate retrieval. Determining the entity and text block relationship library facilitates finding text blocks based on entities. Constructing two preset relationship libraries to assist query matching from different angles. After the text block is vectorized, the second preset relationship library is determined, and related texts can be mined based on vector relationships. Multiple links cooperate to lay a solid foundation for efficient and accurate response to queries.
[0152] In one embodiment, the performing text processing on the first target text block and the second target text block to obtain the target text block includes:
[0153] Integrate the context information of the first target text block and the second target text block to obtain an integrated text block;
[0154] The integrated text is reordered to obtain the target text block.
[0155] Alternatively, if Figure 2 As shown, in a complete embodiment of the present application, when a user enters a query request, entities are first extracted from the query text (i.e., the target query graph in the target query structure), and then entity matching results are found from the graph information library based on these entities, and then the text block corresponding to the entity matching result is found by relying on the entity and text block relationship library, which is the structured text block (i.e., the first target text block). At the same time, the user's query text is also vectorized, and similar text blocks are matched from the text block vector library (i.e., the second preset relationship library) by calculating vector similarity, that is, vector similar text blocks (i.e., the second target text block).
[0156] Afterwards, the obtained structured text blocks and vector-similar text blocks are integrated to fuse their context information together to form integrated text blocks. In this process, repeated content is also identified and removed to avoid information redundancy. Next, the reordering model is used to reorder the integrated text blocks according to certain rules and standards, and the optimal text block after sorting is selected as the target text block.
[0157] Finally, the target text block, the user's query text, and the corresponding prompt words (such as: "You are a document retrieval expert. Please answer the following <question> based on the retrieved context. Refer to the original text in the context to give a professional and reasonable answer that is consistent with the identity of an electric power expert, and do not include words such as 'according to the context'.") are input into the large model. The large model will analyze and process these input contents, and then generate and output a final answer that meets the requirements (i.e., the target answer), thereby completing the entire question-and-answer process. By combining information of different dimensions of text blocks in multiple steps, the retrieval accuracy is improved, helping to accurately answer user questions.
[0158] Optionally, in an embodiment of the present application, by fusing structural context user queries (i.e., generating a target query structure by integrating position embedding, role embedding, and type embedding), the model can more accurately capture the logical relationship and semantic information between nodes when processing complex queries. The intention behind the user query can be understood more deeply, and it can be more accurately matched with the deep semantic information in the text block. Even in the face of complex or ambiguous queries, the text block that best meets the user's needs can be derived through the relationships and paths in the graph. Therefore, applying structured information storage to the retrieval process can significantly improve the accuracy and relevance of the target answer obtained, thereby bringing users a more high-quality and personalized content generation experience.
[0159] Figure 3 A structural schematic diagram of an apparatus for enhancing AI large model generation using structured context-assisted retrieval provided in another embodiment of the present application is shown. For ease of explanation, only the parts related to the embodiment of the present application are shown.
[0160] Reference Figure 3 , the device for enhancing AI big model generation by using structured context assisted retrieval may include:
[0161] An integration module 301 is used to perform node embedding integration on the query text input by the user to obtain a target query structure;
[0162] A first acquisition module 302 is used to acquire a first target text block matching the target query structure from a first preset relationship library, wherein the preset relationship library is obtained by performing structured processing on a preset document, wherein the preset document includes a plurality of text blocks, and the preset relationship library includes entity relationships corresponding to the plurality of text blocks, wherein the structured processing includes structured information extraction and node embedding integration processing;
[0163] A second acquisition module 303 is used to acquire a second target text block matching the target query structure from a second preset relationship library, wherein the second preset relationship library includes the plurality of text blocks and their corresponding vector relationships;
[0164] A processing module 304 is used to perform text processing on the first target text block and the second target text block to obtain a target text block;
[0165] The determination module 305 is used to determine the target answer corresponding to the query text according to the target text block and the query text through the AI big model.
[0166] In one embodiment, the target query structure includes a target query graph and a target query vector; the integration module 301 may include:
[0167] A construction submodule, configured to construct an initial query graph according to the query text, wherein the initial query graph includes an anchor node, an answer node, and a relationship between the anchor node and the answer node;
[0168] An embedding submodule, used for performing position embedding, role embedding and type embedding on the initial query graph to obtain an initial embedding vector of the initial query graph;
[0169] A first integration submodule is used to embed and integrate the initial embedding vector to obtain a target embedding vector;
[0170] A first determination submodule, configured to determine the target query graph according to the target embedding vector;
[0171] The first processing submodule is used to perform vectorization processing on the query text to obtain the target query vector.
[0172] In one embodiment, the first integration submodule may include:
[0173] The first processing unit is used to perform weight processing and bias processing on the initial embedding vector based on a preset activation function to obtain the target embedding vector.
[0174] In one embodiment, the first preset relationship library includes a graph information library and an entity-text block relationship library, wherein the graph information library includes a plurality of entities corresponding to the preset document and the association relationship between the plurality of entities; the entity-text block relationship library includes a one-to-one correspondence between the plurality of entities and the plurality of text blocks;
[0175] The first acquisition module 302 may include:
[0176] A first acquisition submodule is used to acquire entity matching results matching the target query graph from the graph information library;
[0177] The second acquisition submodule is used to acquire the first target text block that matches the entity matching result from the entity and text block relationship library.
[0178] In one embodiment, the second acquisition module 303 may include:
[0179] The third acquisition submodule is used to acquire a second target text block matching the target query vector from the second preset relationship library.
[0180] In one embodiment, the question-answering device may further include:
[0181] A segmentation module, used for segmenting the preset document to obtain the multiple text blocks;
[0182] An extraction module, configured to extract structured information from the plurality of text blocks to obtain an initial knowledge graph, wherein the initial knowledge graph includes a plurality of nodes and association relationships between the plurality of nodes, wherein the plurality of nodes are used to represent entities of the plurality of text blocks;
[0183] An embedding module, used for performing position embedding, role embedding and type embedding on a plurality of nodes in the initial knowledge graph to obtain the graph information library;
[0184] A second determination module is used to determine the entity and text block relationship library according to the corresponding relationship between each text block and each entity;
[0185] A construction module, used to construct the first preset relationship library according to the graph information library and the entity and text block relationship library;
[0186] A second processing module is used to perform vectorization processing on the multiple text blocks respectively to obtain a text block vector corresponding to each text block;
[0187] The third determination module is used to determine the second preset relationship library according to the text block vector corresponding to each text block.
[0188] In one embodiment, the processing module 304 may include:
[0189] A second integration submodule, configured to integrate the context information of the first target text block and the second target text block to obtain an integrated text block;
[0190] The reordering submodule is used to reorder the integrated text to obtain the target text block.
[0191] It should be noted that the information interaction, execution process, etc. between the above-mentioned devices / units are based on the same concept as the method embodiment of the present application, and are devices corresponding to the above-mentioned methods. All implementation methods in the above-mentioned method embodiment are applicable to the embodiments of the device. Its specific functions and technical effects brought about can be found in the method embodiment part, and will not be repeated here.
[0192] 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.
[0193] Figure 4 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application is shown.
[0194] The device may include a processor 401 and a memory 402 storing program instructions.
[0195] When the processor 401 executes the program, the steps in any of the above method embodiments are implemented.
[0196] Exemplarily, the program may be divided into one or more modules / units, one or more modules / units are stored in the memory 402, and executed by the processor 401 to complete the present application. One or more modules / units may be a series of program instruction segments capable of completing a specific function, and the instruction segments are used to describe the execution process of the program in the device.
[0197] Specifically, the processor 401 may include a central processing unit (CPU), or an application specific integrated circuit (ASIC), or may be configured to implement one or more integrated circuits of the embodiments of the present application.
[0198] Memory 402 may include a large capacity memory for data or instructions. By way of example and not limitation, memory 402 may include a hard disk drive (HDD), a floppy disk drive, a flash memory, an optical disk, a magneto-optical disk, a magnetic tape, or a universal serial bus (USB) drive or a combination of two or more of these. In appropriate cases, memory 402 may include a removable or non-removable (or fixed) medium. In appropriate cases, memory 402 may be inside or outside of an integrated gateway disaster recovery device. In a specific embodiment, memory 402 is a non-volatile solid-state memory.
[0199] The memory may include read-only memory (ROM), random access memory (RAM), magnetic disk storage media devices, optical storage media devices, flash memory devices, electrical, optical or other physical / tangible memory storage devices. Thus, typically, the memory includes one or more tangible (non-transitory) readable storage media (e.g., memory devices) encoded with software including computer executable instructions, and when the software is executed (e.g., by one or more processors), it is operable to perform the operations described with reference to the method according to an aspect of the present disclosure.
[0200] The processor 401 implements any one of the methods in the above embodiments by reading and executing program instructions stored in the memory 402 .
[0201] In one example, the electronic device may further include a communication interface 403 and a bus 410. The processor 401, the memory 402, and the communication interface 403 are connected via the bus 410 and communicate with each other.
[0202] The communication interface 403 is mainly used to implement communication between various modules, devices, units and / or equipment in the embodiments of the present application.
[0203] Bus 410 includes hardware, software or both, and the parts of online data flow billing equipment are coupled to each other. For example, but not limitation, bus may include accelerated graphics port (AGP) or other graphics bus, enhanced industrial standard architecture (EISA) bus, front-side bus (FSB), hypertransport (HT) interconnection, industrial standard architecture (ISA) bus, infinite bandwidth interconnection, low pin count (LPC) bus, memory bus, micro channel architecture (MCA) bus, peripheral component interconnection (PCI) bus, PCI-Express (PCI-X) bus, serial advanced technology attachment (SATA) bus, video electronics standard association local (VLB) bus or other suitable bus or two or more of these combinations. In appropriate cases, bus 410 may include one or more buses. Although the present application embodiment describes and shows a specific bus, the present application considers any suitable bus or interconnection.
[0204] In addition, in combination with the method in the above embodiment, the embodiment of the present application can provide a storage medium for implementation. The storage medium stores program instructions; when the program instructions are executed by a processor, any one of the methods in the above embodiment is implemented.
[0205] An embodiment of the present application further provides a chip, which includes a processor and a communication interface, wherein the communication interface and the processor are coupled, and the processor is used to run programs or instructions to implement the various processes of the above-mentioned method embodiment, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0206] It should be understood that the chip mentioned in the embodiments of the present application can also be called a system-level chip, a system chip, a chip system or a system-on-chip chip, etc.
[0207] An embodiment of the present application provides a computer program product, which is stored in a storage medium. The program product is executed by at least one processor to implement the various processes of the above-mentioned method embodiment and can achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0208] It should be clear that the present application is not limited to the specific configuration and processing described above and shown in the figures. For the sake of simplicity, a detailed description of the known method is omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of the present application is not limited to the specific steps described and shown, and those skilled in the art can make various changes, modifications and additions, or change the order between the steps after understanding the spirit of the present application.
[0209] The functional modules shown in the above block diagram can be implemented as hardware, software, firmware or their combination. When implemented in hardware, it can be, for example, an electronic circuit, an application specific integrated circuit (ASIC), suitable firmware, a plug-in, a function card, etc. When implemented in software, the elements of the present application are programs or code segments that are used to perform the required tasks. Programs or code segments can be stored in machine-readable media, or transmitted on a transmission medium or a communication link by a data signal carried in a carrier wave. "Machine-readable media" can include any medium that can store or transmit information. Examples of machine-readable media include electronic circuits, semiconductor memory devices, ROM, flash memory, erasable ROM (EROM), floppy disks, CD-ROMs, optical disks, hard disks, optical fiber media, radio frequency (RF) links, etc. Code segments can be downloaded via computer grids such as the Internet, intranets, etc.
[0210] It should also be noted that the exemplary embodiments mentioned in this application describe some methods or systems based on a series of steps or devices. However, this application is not limited to the order of the above steps, that is, the steps can be performed in the order mentioned in the embodiment, or in a different order from the embodiment, or several steps can be performed simultaneously.
[0211] Aspects of the present disclosure are described above with reference to the flowchart and / or block diagram of the method, device (system) and program product according to the embodiment of the present disclosure. It should be understood that each box in the flowchart and / or block diagram and the combination of each box in the flowchart and / or block diagram can be implemented by computer program instructions. These program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer or other programmable data processing device to produce a machine so that these instructions executed by the processor of the computer or other programmable data processing device enable the implementation of the function / action specified in one or more boxes of the flowchart and / or block diagram. Such a processor can be, but is not limited to, a general-purpose processor, a special-purpose processor, a special application processor or a field programmable logic circuit. It can also be understood that each box in the block diagram and / or flowchart and the combination of boxes in the block diagram and / or flowchart can also be implemented by dedicated hardware that performs a specified function or action, or can be implemented by a combination of dedicated hardware and computer instructions.
[0212] The above are only specific implementation methods of the present application. Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working processes of the systems, modules and units described above can refer to the corresponding processes in the aforementioned method embodiments, and will not be repeated here. It should be understood that the protection scope of the present application is not limited to this. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed in this application, and these modifications or replacements should be included in the protection scope of this application.
Claims
1. A method for enhancing AI large model generation using structured context-assisted retrieval, characterized in that: The method comprises: Perform node embedding and integration on the query text input by the user to obtain the target query structure; Acquire a first target text block that matches the target query structure from a first preset relationship library, wherein the preset relationship library is obtained by performing structured processing on a preset document, wherein the preset document includes a plurality of text blocks, the preset relationship library includes entity relationships corresponding to the plurality of text blocks, and the structured processing includes structured information extraction and node embedding integration processing; Acquire a second target text block matching the target query structure from a second preset relationship library, wherein the second preset relationship library includes the plurality of text blocks and their corresponding vector relationships; Performing text processing on the first target text block and the second target text block to obtain a target text block; Through the AI big model, the target answer corresponding to the query text is determined according to the target text block and the query text.
2. The method for enhancing AI large model generation by using structured context-assisted retrieval according to claim 1 is characterized in that: The target query structure includes a target query graph and a target query vector; The node embedding and integration of the query text input by the user to obtain the target query structure includes: According to the query text, construct an initial query graph, wherein the initial query graph includes an anchor node, an answer node, and a relationship between the anchor node and the answer node; Performing position embedding, role embedding and type embedding on the initial query graph to obtain an initial embedding vector of the initial query graph; Embedding and integrating the initial embedding vector to obtain a target embedding vector; Determining the target query graph according to the target embedding vector; The query text is vectorized to obtain the target query vector.
3. The method for enhancing AI large model generation by using structured context-assisted retrieval according to claim 2 is characterized in that: The embedding and integrating the initial embedding vector to obtain a target embedding vector includes: The initial embedding vector is weighted and biased based on a preset activation function to obtain the target embedding vector.
4. The method for enhancing AI large model generation by using structured context-assisted retrieval according to claim 2 is characterized in that: The first preset relationship library includes a graph information library and an entity-text block relationship library, wherein the graph information library includes a plurality of entities corresponding to the preset document and the association relationship between the plurality of entities; the entity-text block relationship library includes a one-to-one correspondence between the plurality of entities and the plurality of text blocks; The acquiring a first target text block matching the target query structure from a first preset relationship library includes: Acquire entity matching results that match the target query graph from the graph information library; Acquire the first target text block that matches the entity matching result from the entity-text block relationship library; The acquiring a second target text block matching the target query structure from a second preset relationship library includes: A second target text block matching the target query vector is obtained from the second preset relationship library.
5. The method for enhancing AI large model generation by using structured context-assisted retrieval according to claim 4 is characterized in that: Before performing node embedding and integration on the query text input by the user to obtain the target query structure, the method further includes: Segmenting the preset document to obtain the multiple text blocks; Extracting structured information from the multiple text blocks to obtain an initial knowledge graph, wherein the initial knowledge graph includes multiple nodes and association relationships between the multiple nodes, and the multiple nodes are used to represent entities of the multiple text blocks; Performing position embedding, role embedding and type embedding on a plurality of nodes in the initial knowledge graph to obtain the graph information library; Determine the entity-text block relationship library according to the corresponding relationship between each text block and each entity; Constructing the first preset relationship library according to the graph information library and the entity and text block relationship library; Performing vectorization processing on the multiple text blocks respectively to obtain a text block vector corresponding to each text block; The second preset relationship library is determined according to the text block vector corresponding to each text block.
6. The method for enhancing AI large model generation by using structured context-assisted retrieval according to claim 1, characterized in that: The performing text processing on the first target text block and the second target text block to obtain a target text block includes: Integrate the context information of the first target text block and the second target text block to obtain an integrated text block; The integrated text is reordered to obtain the target text block.
7. A device for enhancing AI large model generation using structured context-assisted retrieval, characterized in that: The device comprises: An integration module is used to perform node embedding integration on the query text input by the user to obtain a target query structure; A first acquisition module is used to acquire a first target text block matching the target query structure from a first preset relationship library, wherein the preset relationship library is obtained by performing structured processing on a preset document, wherein the preset document includes a plurality of text blocks, the preset relationship library includes entity relationships corresponding to the plurality of text blocks, and the structured processing includes structured information extraction and node embedding integration processing; A second acquisition module is used to acquire a second target text block matching the target query structure from a second preset relationship library, wherein the second preset relationship library includes the plurality of text blocks and their corresponding vector relationships; A processing module, configured to perform text processing on the first target text block and the second target text block to obtain a target text block; The determination module is used to determine a target answer corresponding to the query text according to the target text block and the query text.
8. An electronic device, characterized in that: The device comprises: a processor and a memory storing computer program instructions; When the processor executes the computer program instructions, it implements the method for enhancing AI large model generation using structured context-assisted retrieval as described in any one of claims 1-6.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer program instructions, which, when executed by a processor, implement the method for enhancing AI large model generation using structured context-assisted retrieval as described in any one of claims 1 to 6.
10. A computer program product, characterized in that When the instructions in the computer program product are executed by a processor of an electronic device, the electronic device executes the method for enhancing AI large model generation using structured context-assisted retrieval as described in any one of claims 1 to 6.
Citation Information
Cited By
Retrieval enhancement generation question and answer determination method and device, equipment and storage medium
CN120196735A