Question and answer method and device based on size model fusion and retrieval enhancement generation

By constructing a knowledge graph and integrating multiple retrieval methods, the retrieval strategy was optimized, solving the problems of information loss and high cost in the RAG system when processing HTML files, and achieving efficient and accurate retrieval and generation.

CN120849564BActive Publication Date: 2026-07-21ASIAINFO TECH CHINA INC
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
ASIAINFO TECH CHINA INC
Filing Date
2025-07-18
Publication Date
2026-07-21

AI Technical Summary

Technical Problem

Existing RAG systems lose contextual information when processing HTML files, resulting in low retrieval efficiency and accuracy, as well as high computational costs, leading to low relevance and efficiency in generating retrieval information.

Method used

By constructing a knowledge graph, integrating graph retrieval technology and vector retrieval algorithms, distilling small models from large models, optimizing the weights of retrieval methods, and combining multiple retrieval methods, we can achieve accurate matching and efficient location of data blocks.

Benefits of technology

It improves the relevance and accuracy of retrieved information, reduces computational resource consumption, improves the running efficiency of small models, and saves costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120849564B_ABST
    Figure CN120849564B_ABST
Patent Text Reader

Abstract

The embodiment of the application provides a question and answer method and device based on size model fusion and retrieval enhancement generation, and relates to the field of artificial intelligence; the method comprises the following steps: determining a community theme summary corresponding to an original document; acquiring a question input by a user, determining a community theme summary related to the question, and determining a preset data block related to the question as a first data block based on the community theme summary; inputting the question and the first data block into a hybrid retrieval model to obtain a second data block; acquiring context information of the second data block, determining a preset data block related to the second data block based on the context information, merging the second data block and the preset data block related to the second data block to obtain a third data block; inputting the question and the third data block into a small model to obtain a fourth data block; and inputting the fourth data block and the question into a preset model to obtain an answer corresponding to the question. The embodiment of the application improves the relevance and accuracy of retrieval information generated by an RAG system.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer artificial intelligence technology, and more specifically, to a question-answering method and apparatus based on size model fusion and retrieval enhancement generation. Background Technology

[0002] Retrieval Augmented Generation (RAG) is an artificial intelligence approach that combines retrieval techniques with generative models. It improves the accuracy, timeliness, and interpretability of responses by retrieving relevant information from external knowledge bases and inputting it into the generative model. In enterprise scenarios, RAG is often used to process private information such as internal documents, product knowledge bases, and historical data, helping users quickly obtain answers in their specialized fields.

[0003] Existing RAG systems, when processing HTML files, simply convert them to plain text before inputting them into the model, destroying the original HTML format and causing the loss of important contextual information. Furthermore, RAG systems employ a single retrieval technique, resulting in low efficiency and accuracy in complex scenarios. Moreover, RAG systems directly rely on large models to calculate the relevance scores of HTML documents, consuming significant computational power for each score, leading to high costs and low efficiency. Summary of the Invention

[0004] This application provides a question-answering method and apparatus based on size model fusion and retrieval enhancement to solve the technical problems of low relevance and accuracy of retrieval information generated by existing RAG systems, as well as low efficiency in generating retrieval information.

[0005] According to a first aspect of the embodiments of this application, a question-answering method based on size model fusion and retrieval enhancement is provided, the method comprising: Determine the community topic summary corresponding to the original document. The community topic summary is related to at least one preset data block. Each preset data block includes text data belonging to the same title in the original document. Obtain the user's input question, determine the community topic summary related to the question; and based on the community topic summary, determine at least one preset data block related to the question as the first data block; The question and the first data block are input into a hybrid retrieval model to obtain a first score for each preset data block in the first data block. The preset data block with the highest first score is selected as the second data block. The context information of the second data block is obtained, and preset data blocks related to the second data block are determined based on the context information. The second data block is merged with the preset data blocks related to the second data block to obtain a third data block. The question and the third data block are input into a small model to obtain a fourth data block. The small model is obtained by training the large model. The fourth data block and the question are input into a preset model to obtain the answer to the question.

[0006] As an optional implementation, determining the community topic summary corresponding to the original document includes: Retrieve the text data and hierarchical relationships from the original document; the hierarchical relationships are used to indicate the relationships between different headings in the original document. Based on the text data, determine the summary information of the original document; The summary information is vectorized to obtain the first entity included in the summary information and the relationship between the first entity; Based on the first entity and the relationship between the first entity, the first entity is divided into at least one community, and a community topic summary for each community is determined; Based on the community topic summary of each community, the community topic summary corresponding to the original document is determined.

[0007] As an optional implementation, determining the community topic summary for each community includes: Determine the name of the original document associated with each first entity; The names of the first entity and the original document are used as nodes of the knowledge graph, and the relationships between the first entities and the relationships between the first entity and the corresponding original document are used as edges of the knowledge graph. The node corresponding to each first entity is merged with the node corresponding to the adjacent first entity to obtain at least one community; Determine the first entities included in each community and the relationships between the first entities; based on the first entities included in each community and the relationships between the first entities, determine the community topic summary for each community.

[0008] As an optional implementation, merging the node corresponding to each first entity with the nodes corresponding to adjacent first entities to obtain at least one community includes: Each node corresponding to the first entity is treated as a community; The modularity of the knowledge graph is determined when the node moves to each of the adjacent communities; The community is merged with the adjacent community corresponding to the case of maximum modularity until a preset condition is met, resulting in at least one community.

[0009] As an optional implementation, the step of obtaining the user input question, determining a community topic summary related to the question, and based on the community topic summary, determining a preset data block related to the question as a first data block, includes: The user-input question is matched with the community topic summary corresponding to the original document to determine the community topic summary related to the question; and the community corresponding to the community topic summary related to the question is determined; the community includes at least one first entity; The problem is vectorized to obtain the second entity included in the problem; Identify a first entity in the community that matches the second entity as the third entity; and identify a first entity related to the third entity as the fourth entity. Based on the knowledge graph, the name of the first original document associated with the third entity is determined, and the name of the second original document associated with the fourth entity is determined; Based on the name of the first original document, a preset data block included in the first original document is determined as a first preset data block; and based on the name of the second original document, a preset data block included in the second original document is determined as a second preset data block. A preset data block related to the third entity in the first preset data block is determined as the third preset data block; and a preset data block related to the fourth entity in the second preset data block is determined as the fourth preset data block. Based on the third preset data block and the fourth preset data block, a first data block related to the problem is determined.

[0010] As an optional implementation, the hybrid retrieval model includes multiple retrieval methods; The step of inputting the question and the first data block into the hybrid retrieval model to obtain the first score of each preset data block in the first data block includes: Obtain the score of each preset data block in the first data block for each retrieval method, the score being used to indicate the relevance of the preset data block to the question; Based on the score of each preset data block in each retrieval method, determine the ranking of each preset data block in each retrieval method; Based on the ranking of each preset data block and the weight corresponding to each retrieval model, the first score of each preset data block is determined.

[0011] As an optional implementation, the weight corresponding to each retrieval method is determined in the following way: The problem is input into a pre-trained weight generation model to obtain the weights corresponding to each retrieval method.

[0012] As an optional implementation, the step of inputting the problem and the third data block into the small model to obtain the fourth data block includes: Obtain a second score for each preset data block in the third data block, the second score being determined using the small model, and the second score being used to indicate the relevance of the problem to the preset data block; The second number of preset data blocks with the highest second score in the third data block are used as the fourth data block.

[0013] As an optional implementation, the small model is obtained by training a large model, including: The preset question and the preset data block are input into the large model to obtain a third score and first text information; the third score is used to indicate the relevance between the preset question and the data block; the first text information is used to indicate the reason for determining the third score. Using the preset question and the preset data block as training samples, and the third score and the first text information as training labels, the small model to be trained is trained until the preset stopping condition is met, thus obtaining the small model.

[0014] According to a second aspect of the embodiments of this application, a question-answering apparatus based on size model fusion and retrieval enhancement is provided, the apparatus comprising: The first processing module is used to determine the community topic summary corresponding to the original document. The community topic summary is related to at least one preset data block. Each preset data block includes text data belonging to the same title in the original document. The second processing module is used to acquire the question input by the user, determine the community topic summary related to the question, and determine at least one preset data block related to the question based on the community topic summary, as the first data block; The third processing module is used to input the question and the first data block into a hybrid retrieval model, obtain a first score for each preset data block in the first data block, and take the preset data block with the highest first score as the second data block; obtain the context information of the second data block, determine the preset data blocks related to the second data block based on the context information, merge the second data block with the preset data blocks related to the second data block to obtain a third data block; input the question and the third data block into a small model to obtain a fourth data block; wherein, the small model is obtained by training the large model; The fourth processing module is used to input the fourth data block and the question into a preset model to obtain the answer corresponding to the question.

[0015] According to a third aspect of the present application, an electronic device is provided, comprising: a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement the method described in any of the first aspects.

[0016] According to a fourth aspect of the embodiments of this application, a computer-readable storage medium is provided having a computer program stored thereon that, when executed by a processor, implements the method as described in any of the first aspects.

[0017] The beneficial effects of the technical solutions provided in this application are: This application provides a question-answering method and apparatus based on large-scale model fusion and retrieval enhancement. By extracting summary information from original documents and constructing a knowledge graph, this method integrates graph retrieval technology and vector retrieval algorithms to achieve accurate matching of user query needs and quickly locate data blocks in the original documents related to the user's question. It combines multiple retrieval methods using the RRF algorithm and optimizes the weights of different retrieval methods, allowing the retrieval strategy to dynamically evolve with the characteristics of the enterprise's private domain knowledge. Furthermore, this application utilizes a large model to distill a small model, using the scores output by the large model and the logic behind the scoring reasons to train the small model. This enables the small model to better simulate the decision-making process of the large model, significantly reducing the number of model parameters while maintaining comparable performance. This improves the operating efficiency of the small model and saves significant computational resources, effectively solving the technical problems of low relevance and accuracy of retrieval information generated by existing RAG systems, as well as low efficiency in generating retrieval information. Attached Figure Description

[0018] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments of this application will be briefly introduced below.

[0019] Figure 1A schematic diagram of the structure of a question-answering method based on size model fusion and retrieval enhancement provided in this application embodiment; Figure 2 A flowchart illustrating a question-answering method based on size model fusion and retrieval enhancement provided for embodiments of this application; Figure 3 This is a schematic diagram of the structure of a knowledge graph provided in an embodiment of this application; Figure 4 A flowchart illustrating the training process of a weight generation model provided in this application embodiment; Figure 5 A schematic diagram of the structure of a question-answering device based on size model fusion and retrieval enhancement provided in this application embodiment; Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation

[0020] The embodiments of this application are described below with reference to the accompanying drawings. It should be understood that the embodiments described below with reference to the accompanying drawings are exemplary descriptions for explaining the technical solutions of the embodiments of this application, and do not constitute a limitation on the technical solutions of the embodiments of this application.

[0021] Those skilled in the art will understand that, unless otherwise stated, the singular forms “a,” “an,” and “the” used herein may also include the plural forms. It should be further understood that the terms “comprising” and “including” as used in embodiments of this application mean that the corresponding feature can be implemented as the presented feature, information, data, step, operation, element, and / or component, but do not exclude implementation as other features, information, data, step, operation, element, component, and / or combinations thereof supported by the art. It should be understood that when we say that an element is “connected” or “coupled” to another element, the one element can be directly connected or coupled to the other element, or it can mean that the one element and the other element establish a connection relationship through an intermediate element. Furthermore, “connected” or “coupled” as used herein can include wireless connection or wireless coupling. The term “and / or” as used herein indicates at least one of the items defined by the term; for example, “A and / or B” can be implemented as “A,” or as “B,” or as “A and B.”

[0022] In the embodiments of this application, the terms "module" or "unit" refer to a computer program or part of a computer program that has a predetermined function and works with other related parts to achieve a predetermined goal, and can be implemented wholly or partially using software, hardware (such as processing circuitry or memory), or a combination thereof. Similarly, a processor (or multiple processors or memory) can be used to implement one or more modules or units. Furthermore, each module or unit can be part of an overall module or unit that includes the functionality of that module or unit.

[0023] To make the objectives, technical solutions, and advantages of this application clearer, the embodiments of this application will be described in further detail below with reference to the accompanying drawings.

[0024] Retrieval Augmented Generation (RAG) is an artificial intelligence approach that combines retrieval techniques with generative models. It improves the accuracy, timeliness, and interpretability of responses by retrieving relevant information from external knowledge bases and inputting it into the generative model. In enterprise scenarios, RAG is often used to process private information such as internal documents, product knowledge bases, and historical data, helping users quickly obtain answers in their specialized fields.

[0025] Existing RAG systems, when processing HTML files, simply convert them to plain text before inputting them into the model, destroying the original HTML format and causing the loss of important contextual information. Furthermore, RAG systems employ a single retrieval technique, resulting in low efficiency and accuracy in complex scenarios. Moreover, RAG systems directly rely on large models to calculate the relevance scores of HTML documents, consuming significant computational power for each score, leading to high costs and low efficiency.

[0026] The question-answering method and apparatus based on size model fusion and retrieval enhancement provided in this application aim to solve the above-mentioned technical problems in the prior art.

[0027] The technical solutions of this application and their effects are described below through several exemplary embodiments. It should be noted that the following embodiments can be referenced, borrowed from, or combined with each other. Identical terms, similar features, and similar implementation steps in different embodiments will not be repeated.

[0028] Figure 1 A schematic diagram illustrating the structure of a question-answering method based on size model fusion and retrieval enhancement provided in this application embodiment; as shown below. Figure 1 As shown in the diagram, the structure includes four modules: S1 HTML knowledge processing and storage module, S2 HTML file retrieval module, S3 HTML file compression module, and S4 LLMs generation module.

[0029] In this embodiment, the S1 HTML knowledge processing and storage module is used to preprocess HTML files in the HTML file library to obtain summary information of the HTML files and preset data blocks in the HTML files; and to vectorize the summary information to extract entities and relationships between entities; and to construct a knowledge graph based on the entities and relationships between entities, and to divide the entities into at least one community according to the knowledge graph, generating community summary information for each community; wherein each community topic summary is related to at least one preset data block. The preset data blocks and the generated community summary information are stored in a knowledge base.

[0030] In this embodiment of the application, the S2 HTML file retrieval module receives a user question and determines a community topic summary related to the user question; based on the community topic summary, it determines at least one preset data block related to the user question as the first data block.

[0031] In this embodiment of the application, the S3 HTML file compression module performs coarse-grained compression on the first data block to obtain the second data block; obtains the context information of the second data block, determines the preset data block related to the second data block based on the context information, merges the second data block with the preset data block related to the second data block to obtain the third data block; and performs fine-grained compression on the third data block to obtain the fourth data block.

[0032] In this embodiment of the application, the S4 LLMs generation module integrates the fourth data block and the user question and inputs them into the Large Language Models (LLMs) to obtain the answer output by the Large Language Model; for example, the Large Language Model can be Qwen2.5; where Qwen2.5 is the Tongyi Qianwen series of open source large models developed by Alibaba Cloud.

[0033] Figure 2 A flowchart illustrating a question-answering method based on size model fusion and retrieval enhancement provided in this application embodiment is shown below. Figure 2 As shown, the method includes: S201. Determine the community topic summary corresponding to the original document. The community topic summary is related to at least one preset data block. Each preset data block includes text data belonging to the same title in the original document.

[0034] In this embodiment, the file library includes at least one original document, which includes, but is not limited to, HTML files, Word documents, and PDF documents. Each original document includes at least one title, and each title includes corresponding text data. Text data belonging to the same title is treated as a preset data block, that is, each original document includes at least one preset data block.

[0035] S202. Obtain the question input by the user, determine the community topic summary related to the question, and based on the community topic summary, determine at least one preset data block related to the question as the first data block.

[0036] In this embodiment of the application, the user-input question is matched with the similarity of various community topic summaries to determine the community topic summaries related to the question; after determining the community topic summaries, the preset data blocks related to the community topic summaries are used as the first data blocks.

[0037] S203. Input the question and the first data block into the hybrid retrieval model to obtain the first score of each preset data block in the first data block. Take the first number of preset data blocks with the highest first score as the second data block. Obtain the context information of the second data block. Based on the context information, determine the preset data blocks related to the second data block. Merge the second data block with the preset data blocks related to the second data block to obtain the third data block. Input the question and the third data block into the small model to obtain the fourth data block. The small model is obtained by training the large model.

[0038] In this embodiment of the application, the hybrid retrieval model includes a combination of multiple retrieval methods (models). By inputting the first data block and the question into the hybrid retrieval model, the score of each preset data block in each retrieval method can be obtained, and the ranking of each preset data block in each retrieval method can be determined. Based on the ranking of each preset data block in each retrieval method and the weight of each retrieval method, the first score of each preset data block is determined, and the first number of preset data blocks with the highest first scores are used to obtain the second data block.

[0039] In this embodiment of the application, the original document corresponding to the second data block is determined, and based on the hierarchical relationship between the various headings in the original document, a preset data block related to the second data block in the original document is determined. The second data block and the data blocks related to the second data block are merged to obtain the third data block.

[0040] In this embodiment, a large language model is used to perform in-depth analysis on user questions and preset data blocks, generating authoritative labeled data containing relevance scores and reasons for the scores, which serves as training samples. Knowledge distillation techniques are used to train a smaller model, enabling it to maintain performance similar to the larger model while significantly reducing the number of parameters and lowering computational resource consumption.

[0041] S204. Input the fourth data block and the question into the preset model to obtain the answer to the question.

[0042] In this embodiment of the application, the fourth data block and the user question are integrated and input into a large language model (LLMs) to obtain the answer output by the large language model; wherein the large language model can be a large language model such as Qwen2.5 or DeepSeek.

[0043] In this embodiment, the retrieval strategy is dynamically evolved with the characteristics of the enterprise's private domain knowledge by combining the RRF algorithm with multiple retrieval methods. At the same time, the small model is distilled from the large model, which enables the small model to better simulate the decision-making process of the large model, thereby improving the running efficiency of the small model and saving a lot of computing resources.

[0044] Based on the above embodiments, as an optional embodiment, determining the community topic summary corresponding to the original document includes: Retrieves the text data and hierarchical relationships from the original document; the hierarchical relationships are used to indicate the relationships between different headings in the original document. Based on text data, determine the summary information of the original document; The summary information is vectorized to obtain the first entity included in the summary information and the relationships between the first entities; Based on the first entity and the relationships between the first entities, the first entity is divided into at least one community, and a community topic summary is determined for each community; Based on the community topic summary for each community, determine the community topic summary corresponding to the original document.

[0045] In this embodiment of the application, for the original document, the text data in the original document, including the title, body paragraphs, etc., are extracted by the corresponding parsing technology.

[0046] Optionally, for an enterprise's HTML file library, filtering rules can be defined to filter out noisy content in the text data. For example, regular expressions can be used to match and remove noisy content, which includes, but is not limited to, comments, extra spaces, line breaks, CSS style code, and JavaScript scripts.

[0047] It should be noted that if the original document includes images, the Clip model and OCR model can be used to convert the images into text data. When obtaining the text data in the original document, it is also necessary to obtain the hierarchical relationship of the original document. The hierarchical relationship is a visual representation of the document structure, which clearly indicates the subordinate and parallel relationships between different headings.

[0048] In this embodiment of the application, when parsing HTML files, not only is a traditional DOM tree constructed, but the semantic relationships between tags are also recorded, such as the row and column structure of a table, the hierarchical relationship between the title and the body content, etc.

[0049] For example, for an HTML file containing a table, the parser will perform the following when building the DOM tree nodes: node, Nodes and Each node records its role and position within the table structure. For example: A node records the number of rows and columns it contains. The node records the row number it belongs to. The node records its row and column numbers, as well as its relationship to the table header. This establishes the correspondence between the tables. In this way, the system can clearly understand the organizational structure of the tabular data during subsequent processing.

[0050] In this embodiment of the application, based on the extracted text data, an extractive summarization algorithm (such as Text Rank) is used to extract the sentences included in the text data, and key sentences are extracted according to the importance and relevance of the sentences to form the summary information of the original document; or, a large language model is used to determine the summary information of the original document.

[0051] In this embodiment, after obtaining the summary information, it is necessary to vectorize the summary information to obtain the first entities included in the summary information and the relationships between the first entities. In this embodiment, the first entity is the core element with practical significance in the summary information. It may be a specific person's name, place name, or organization name, or it may be an abstract concept, event, or theory, such as "artificial intelligence" and "climate change." After determining the first entity, it is also necessary to further analyze the relationships between the first entities. These relationships may be causal relationships (such as "heavy rain caused flooding"), subordinate relationships (such as "machine learning belongs to artificial intelligence"), parallel relationships (such as "apples and bananas are both fruits"), and interactive relationships (such as "company A and company B reached a cooperation agreement"). Through vector operations and semantic analysis after vectorization, these connections hidden behind the text can be accurately identified. In this embodiment of the application, after determining the first entity and the relationships between entities, the first entity is then divided into at least one community, and a community topic summary is determined for each community. Here, "community" refers to a set of closely related first entities. The core basis for the division is the strength of the relationships between the first entities, that is: entities with direct and frequent relationships will be grouped into the same community, while entities with weak or no relationships will be assigned to different communities.

[0052] In this embodiment of the application, after each community is formed, a community theme summary needs to be determined for it. The community theme summary needs to accurately summarize the core themes of all entities in the community and the inherent relationships between them. Since there is a correspondence between the first entity in the community theme summary and the original document, the community theme summary corresponding to the original document can be determined based on the correspondence between the first entity and the original document.

[0053] In this embodiment of the application, by extracting the text data and hierarchical relationships (such as the subordinate and parallel relationships between headings) of the original document, the logical framework of the document (such as the hierarchical nesting of chapters and subtopics) can be completely preserved, avoiding semantic fragmentation caused by structural loss in subsequent processing.

[0054] Based on the above embodiments, as an optional embodiment, a community topic summary for each community is determined, including: Determine the name of the original document associated with each first entity; The names of the first entity and the original document are used as nodes of the knowledge graph, and the relationships between the first entities and the relationships between the first entities and their corresponding original documents are used as edges of the knowledge graph. The node corresponding to each first entity is merged with the node corresponding to the adjacent first entity to obtain at least one community; Determine the first entities included in each community and the relationships between them; based on the first entities included in each community and the relationships between them, determine the community topic summary for each community.

[0055] like Figure 3 As shown, the original document includes document 1, document 2, and document 3; document 1 includes two first entities, entity 1 and entity 2; document 2 includes two first entities, entity 3 and entity 4; and document 3 includes two first entities, entity 5 and entity 6. The relationship between the documents and entities is an containment relationship (i.e., ...). Figure 3 The "includes" between Chinese documents and entities, and the relationships between entities (i.e.) Figure 3 The "relation" between entities in Chinese includes, but is not limited to, referencing, dependency, and causal relationships. It should be noted that... Figure 3 Document 1, Document 2, and Document 3 can be either the name of the original document or the index value of the original document.

[0056] In this embodiment, after determining the knowledge graph, the node corresponding to each first entity is merged with the nodes corresponding to its adjacent first entities to form at least one community. Here, "adjacent" is primarily based on the strength of the edge connections between nodes; it can be understood that if two first entity nodes have a direct and close relationship (such as multiple edges connecting them, or edges with high weights), they will be merged into the same community. This merging is not merely a simple physical aggregation, but a logical grouping based on semantic association, with the aim of bringing together entities with related topics.

[0057] In this embodiment of the application, for each community, the core theme of the community can be summarized based on the first entities included in the community and the relationships between the first entities. For example, for each community, the graph structure information of the community (i.e., the relationships between the first entities) is converted into structured text information, and the structured text information is input into a large language model to generate a community theme summary.

[0058] In this embodiment, a knowledge graph is constructed by extracting the summary information of the original file. Based on the knowledge graph, graph retrieval technology and vector retrieval algorithm are integrated to achieve accurate matching of user query needs and quickly locate the data block of the original file related to the user's question.

[0059] Based on the above embodiments, as an optional embodiment, the node corresponding to each first entity is merged with the node corresponding to the adjacent first entity to obtain at least one community, including: Each node corresponding to the first entity is treated as a community; The modularity of the knowledge graph is determined when nodes move to adjacent communities. The community is merged with the adjacent community corresponding to the maximum modularity until the preset conditions are met, resulting in at least one community.

[0060] In this embodiment, during the community partitioning process of the knowledge graph, firstly, an initial community structure needs to be established, that is, each node corresponding to the first entity is treated as a separate community. This means that in the initial state, all communities are independent of each other. Secondly, in the initial state, the modularity of the knowledge graph is calculated when nodes move to each adjacent community. Here, "modularity" is a key indicator for measuring the quality of community partitioning. Its core logic is that a high-quality community partitioning should satisfy "closely related nodes within a community and sparsely related nodes between communities," maximizing the modularity of the entire knowledge graph. By repeatedly merging adjacent communities until a preset condition is met, at least one community is obtained.

[0061] Optionally, in this embodiment of the application, the preset conditions include that merging any two adjacent communities in the knowledge graph cannot increase the modularity of the knowledge graph; or, the number of times adjacent communities are merged reaches a preset number.

[0062] Specifically, in this embodiment of the application, the modularity of the knowledge graph can be calculated using formula (1), as shown below:

[0063] Where Q represents the modularity of the knowledge graph; and C represents the number of communities in the knowledge graph. The community's identification number; For the community The sum of the weights of the internal edges, where the weights of the internal edges are community. The values ​​of all edges in the array are normalized to obtain the value, where the value represents the frequency of relationships between nodes. It is with the community The sum of the weights of all edges connected to the middle node is half.

[0064] To facilitate understanding of formula (1) and the calculation method of modularity after community merging by those skilled in the art, the following will use... Figure 3 Let's take an example to illustrate.

[0065] like Figure 3 As shown, in the initial state, each node is a community. The frequency of the reference relationship between entity 1 and entity 2 is 1; the frequency of the reference relationship between entity 1 and entity 3 is 1; the frequency of the reference relationship between entity 3 and entity 4 is 1; the frequency of the reference relationship between entity 4 and entity 5 is 1; and the frequency of the reference relationship between entity 5 and entity 6 is 1. Therefore, the weight of the edge between the above-mentioned entities with reference relationships is the frequency of the reference relationship divided by the sum of the frequencies of all entity reference relationships, that is: the weight of each edge is 1 / (1+1+1+1+1), which means the authority of each edge is 0.2. At this time, each community only includes external edges, not internal edges; therefore, the sum of the weights of the internal edges is equal to 0. The sum of the weights of the outer edges is 0.2; half the sum of the weights of all edges is 0.2 / 2, which means half the sum of the weights equals 0.1. According to formula (1), the modularity of each community is 0- The modularity of the entire knowledge graph is equal to the sum of the modularities of each community, i.e.: .

[0066] At this point, Entity 1 and Entity 2 are merged into Community 1, Entity 3 and Entity 4 are merged into Community 2, and Community 5 and Entity 6 are merged into Community 3. For Community 1, this community includes one internal edge (Entity 1 -> Entity 2) and one external edge (Entity 1 -> Entity 3). Therefore, the sum of the weights of the internal edge (Entity 1 -> Entity 2) is... The sum of the weights of the outer edges is 0.2; half the sum of the weights of all edges within community 1 equals (0.2 + 0.2) / 2, that is, half the sum of the weights equals 0.2; therefore, the modularity of community 1 is 0.2. Similarly, the modularity of Community 2 can be calculated to be 0.2- 0.11; and the modularity of Community 3 is 0.2- The modularity of the entire knowledge graph is equal to the sum of the modularities of each community, which is 0.16 + 0.11 + 0.16 = 0.43. Therefore, it can be seen that the modularity of the entire knowledge graph increases after nodes (communities) are merged.

[0067] It should be noted that in this embodiment of the application, after each community merger, it is necessary to re-identify the neighboring communities of the new community (i.e., other communities that have edge connections with any node in the new community), and recalculate the modularity when moving the new community to these neighboring communities, and select the scheme with the largest modularity to continue merging. In this embodiment of the application, by merging entities with close relationships, entities within the same community tend to revolve around the same core theme, thereby identifying the entities most relevant to the user's problem.

[0068] Based on the above embodiments, as an optional embodiment, the user-input question is obtained, and a community topic summary related to the question is determined; and based on the community topic summary, a preset data block related to the question is determined as the first data block, including: The user-input question is matched with the corresponding community topic summary of the original document to determine the community topic summary related to the question; and the community corresponding to the community topic summary related to the question is determined; the community includes at least one first entity; The problem is vectorized to obtain the second entity included in the problem; Identify the first entity in the community that matches the second entity as the third entity; and identify the first entity that is related to the third entity as the fourth entity. Based on the knowledge graph, the name of the first original document associated with the third entity and the name of the second original document associated with the fourth entity are determined. Based on the name of the first original document, a preset data block included in the first original document is determined as the first preset data block; and based on the name of the second original document, a preset data block included in the second original document is determined as the second preset data block. The preset data block related to the third entity in the first preset data block is determined as the third preset data block; and the preset data block related to the fourth entity in the second preset data block is determined as the fourth preset data block; Based on the third and fourth preset data blocks, the first data block relevant to the problem is determined.

[0069] In this embodiment, the user-input question is matched with the community topic summary corresponding to the original document to determine the community topic summary and corresponding community related to the question. The community topic summary is a condensation of the core content of each community, covering the core logic of the first entity and its relationships within the community. The matching process is not a simple keyword comparison, but uses semantic analysis technology to determine the degree of relevance between the topic involved in the question and each community topic summary. For example, if a user asks "Application strategies of big data in e-commerce marketing", the system will compare whether each community topic summary contains "big data", "e-commerce marketing" and "application strategies", and then lock in the community topic summary most relevant to the topic. After determining the relevant community topic summary, its corresponding community can be located, and this community must contain at least one first entity, which is the foundation supporting the community topic.

[0070] In this embodiment, after receiving the user's input question, the question is vectorized to extract the second entity contained within it. After obtaining the second entity, a first entity matching the second entity needs to be found from the identified relevant communities as the third entity, and further, first entities associated with the third entity are identified as the fourth entity. For example, a graph query can be used to determine the first entities related to the second entity in the relevant communities as the third entity; then, using multi-hop graph traversal, the relationships between the first entities are explored to determine the first entities associated with the third entity as the fourth entity.

[0071] In this embodiment, after determining the third and fourth entities, the names of the first and second original documents associated with the third entity and the second original document associated with the fourth entity are queried based on the knowledge graph. Next, based on the names of the first and second original documents, their index values ​​are determined, and the first and second original documents in the file library are located using these index values. Preset data blocks contained in each document are then extracted and designated as the first and second preset data blocks. After obtaining the first and second preset data blocks, preset data blocks directly related to the third and fourth entities are further filtered out and designated as the third and fourth preset data blocks, respectively. This filtering process eliminates text data irrelevant to the user's question from the preset data blocks, focusing on the core content. Finally, the third and fourth preset data blocks are integrated to form the first data block related to the user's question.

[0072] In this embodiment, by matching user questions with community topic summaries of the original documents, the relevant communities are directly identified, significantly narrowing the scope of subsequent data processing and effectively reducing time and computational costs. This also significantly reduces data retrieval redundancy, laying the foundation for quickly locating the first data block related to the user question.

[0073] Based on the above embodiments, as an optional embodiment, the hybrid retrieval model includes multiple retrieval methods; The question and the first data block are input into the hybrid retrieval model to obtain the first score for each preset data block in the first data block, including: Obtain the score of each preset data block in the first data block for each retrieval method. The score is used to indicate the relevance of the preset data block to the question. Based on the score of each preset data block in each retrieval method, determine the ranking of each preset data block in each retrieval method; Based on the ranking of each preset data block and the weight corresponding to each retrieval model, the first score of each preset data block is determined.

[0074] In this embodiment of the application, the hybrid retrieval model is a hybrid retrieval model obtained by combining multiple retrieval methods. For example, the first retrieval method is the BM25 retrieval method, the second retrieval method is a vector retrieval method based on the bge-large-zh-v1.5 vector model, and the third retrieval method is a vector retrieval method based on the multilingual-e5-large vector model.

[0075] In this embodiment, the first data block includes at least one preset data block. Each retrieval method scores the relevance of each preset data block to the question, obtaining a score for each preset data block in each retrieval method. Based on the score of each preset data block in each retrieval method, the ranking of each preset data block in each retrieval method is determined.

[0076] In this embodiment of the application, after obtaining the ranking of each preset data block, the RRF score of each preset data block is calculated using the weighted adjustable RRF (Reciprocal Rank Fusion) method, i.e., the first score. The calculation process can use formula (2), which is shown below:

[0077] Where N is the sequence number of the preset data block, that is, the Nth preset data block in the first data block; RRF(N) is the RRF score of the Nth preset data block, that is, the first score; is the index of the retrieval method; m is the number of retrieval methods; For the first The weights of different retrieval methods; This is a conditional parameter, typically with a value of 60; For the preset data block N in the first... Ranking among various retrieval methods.

[0078] In this embodiment of the application, the RRF score of each preset data block in the first data block can be calculated by formula (2). The RRF score is the comprehensive score of all retrieval methods in the hybrid retrieval model, which is used to evaluate the relevance between the preset data block and the user question.

[0079] Specifically, in this embodiment, after obtaining the first score of each preset data block, a first number of preset data blocks can be selected as the second data blocks in descending order. For example, if the first data block includes 10 preset data blocks and the first number is 5, then the 5 preset data blocks with the highest first scores are selected from the first data blocks as the second data blocks.

[0080] In this embodiment, the RRF score of each preset data block in the first data block is calculated by a hybrid retrieval model, which can more comprehensively and accurately evaluate the relevance of the preset data blocks to the user's question. Unlike simple weighted fusion, this embodiment utilizes the ranking of the preset data blocks in the retrieval method, which can better balance the advantages of different retrieval methods and retrieve the preset data blocks that are most relevant to the user's question.

[0081] Based on the above embodiments, as an optional embodiment, the weight corresponding to each retrieval method is determined in the following way: The question is input into a pre-trained weight generation model to obtain the weights corresponding to each retrieval method.

[0082] In this embodiment, the weight generation model can be a lightweight model such as BERT. The input of the model is the processed user question features, and the output is the weight of each retrieval method; that is, the weight generation model can automatically output the weight of each retrieval method based on the user's input question.

[0083] Optionally, in this embodiment of the application, the weight generation model needs to be trained before the user question is input into the weight generation model. For example: prepare multiple preset questions and multiple preset data blocks; for each preset question, determine the weight of each retrieval method in the interval [0,1]; input the preset questions into the hybrid retrieval model, determine the first score of each preset data block, the specific method can be referred to formula (2) and the description above, and will not be repeated here; based on the first score of each preset data block, determine N (N is a positive integer) preset data blocks with the highest scores, and use a large model or manual evaluation to score the satisfaction of the N preset data blocks with the highest scores.

[0084] Based on the original weights, the weights of each retrieval method are modified at preset weight intervals, so that the weights of each retrieval method traverse [0,1]. For each weight, the N preset data blocks with the highest scores are given satisfaction ratings. The weight of the retrieval method with the highest satisfaction rating is used as the training label. A preset question is input into the weight generation model to be trained, and the model outputs the weight of each retrieval method. This weight is compared with the weight in the training label. If the difference is greater than a threshold, the parameters of the weight generation model are modified, and the model is retrained until a preset condition is met. The preset condition can be either reaching a preset number of training iterations or the difference between the weight of the retrieval method output by the weight generation model and the training label being less than a threshold.

[0085] To help those skilled in the art better understand how the embodiments of this application implement the training of the weight generation model, the following is a detailed explanation. Figure 4 Please provide an explanation. For example... Figure 4 As shown, the hybrid retrieval model includes the BM25 model, vector model 1, and vector model 2. User questions and preset data blocks are input into the hybrid retrieval model. The BM25 model, vector model 1, and vector model 2 score each preset data block respectively, resulting in matching list 1 output by the BM25 model, matching list 2 output by the vector model 1, and matching list 3 output by the vector model 2. Each matching list includes the ranking of each preset data block. The ranking of each preset data block in the three matching lists and the weights output by the weight generation model are substituted into formula (2) to obtain the RRF score of each preset data block. The preset data blocks with the highest RRF scores are added to the hybrid matching list, and the satisfaction score of the preset data blocks in the hybrid matching list is given by the large language model or by a human. The weights of each retrieval model under the satisfaction score are used as training labels. User questions are input into the weight generation model to be trained, and the optimized weights of each retrieval model are output. Based on the difference between the optimized weights and the weights in the training labels, the parameters of the weight generation model are iteratively optimized until the preset conditions are met. This can be understood as the difference between the weights output by the weight generation model and the weights in the training labels being less than a threshold, or the number of iterations for optimization reaching a preset number.

[0086] In this embodiment, user questions and satisfaction ratings for the current retrieval are recorded as user feedback data, which can accumulate data for training the subsequent weight generation model. At the end of each period (e.g., a quarter), the newly collected user feedback data from that period is merged with historical data, and the weight generation model is retrained. As data accumulates, the model continuously optimizes its weight prediction capabilities, making the mixed retrieval results more in line with user needs, thereby improving retrieval efficiency and satisfaction.

[0087] Based on the above embodiments, as an optional embodiment, the problem and the third data block are input into the small model to obtain a fourth data block, including: Obtain a second score for each preset data block in the third data block. The second score is determined using a small model and is used to indicate the relevance of the problem to the preset data block. The second data block with the highest second score in the third data block is selected as the fourth data block.

[0088] In this embodiment of the application, a trained small model is used to score each preset data block in the third data block. This score reflects the small model's judgment on the relevance of the preset data block to the user's question.

[0089] For example, given a user question "Application cases of artificial intelligence in the field of education" and a pre-set data block "An online education platform uses artificial intelligence algorithms for intelligent homework grading", the small model may output a high relevance score, such as 0.8; while for another pre-set data block "Introduction to the course settings of the online education platform", the small model may output a low score, such as 0.3.

[0090] In this embodiment, the preset data blocks in the third data block are sorted in descending order according to the correlation score output by the small model, a second number of preset data blocks are selected, and the remaining preset data blocks are deleted, thereby achieving fine-grained compression of the third data block.

[0091] In this embodiment, the small model typically features lightweight and low latency, and is used to score and filter the third data block. It can quickly complete the processing task while maintaining a certain level of semantic understanding. Compared to relying on a large model for full data processing, this approach significantly reduces computational resource consumption and improves the real-time performance of the overall process.

[0092] Based on the above embodiments, as an optional embodiment, the small model is obtained by training the large model, including: The preset question and preset data block are input into the large model to obtain a third score and a first text information; the third score is used to indicate the correlation between the preset question and the data block; the first text information is used to indicate the reason for determining the third score. Using the preset question and preset data block as training samples, and the third score and first text information as training labels, the small model to be trained is trained until the preset stopping condition is met, thus obtaining the small model.

[0093] In this embodiment, the large model takes a user question and a pre-defined data block as input. For example, the user question is "Application strategies of big data in e-commerce marketing," and the pre-defined data block is "E-commerce platforms formulate personalized recommendation strategies by analyzing users' purchase history data." After complex internal calculations and reasoning, the large model outputs two parts: first, a relevance score, indicating the degree of relevance between the pre-defined data block and the user question; and second, a detailed explanation of this score, which may cover the analysis of keyword matching, semantic coherence, and topic relevance between the question and the pre-defined data block. For example, the large model gives a relevance score of 0.8 because "both the question and the pre-defined data block revolve around the e-commerce field, and 'big data analysis' and 'analyzing users' purchase history data' are highly semantically related, while 'application strategies' and 'formulating personalized recommendation strategies' are logically closely linked."

[0094] In this embodiment, the RAG system collects a large amount of data generated by a large model, including user questions, preset data blocks, relevance scores, and justifications. This generated data is then used to distill smaller models. During distillation, the training objective of the smaller model is to learn the relevance scores output by the large model while understanding the logic behind the reasons given for those scores. For example, during training, the smaller model should output relevance scores as close as possible to the scores given by the large model for the same set of user questions and preset data blocks, and gradually grasp the basis for the large model's relevance judgments. In this way, the smaller model can learn the knowledge of the large model, and because the smaller model has relatively fewer parameters, it can respond more quickly during inference, saving costs.

[0095] In this embodiment, a small model is distilled from a large model, so that the performance of the small model can be comparable to that of the large model while reducing the number of parameters; this improves the efficiency of model operation and reduces the computational cost, making it possible to achieve high-quality text processing in resource-constrained environments.

[0096] Figure 5 This is a schematic diagram of a question-answering device based on size model fusion and retrieval enhancement provided in an embodiment of this application. The device includes: a first processing module 5001, a second processing module 5002, a third processing module 5003, and a fourth processing module 5004. Wherein: The first processing module 5001 is used to determine the community topic summary corresponding to the original document. The community topic summary is related to at least one preset data block. Each preset data block includes text data belonging to the same title in the original document. The second processing module 5002 is used to obtain the question input by the user, determine the community topic summary related to the question, and determine at least one preset data block related to the question based on the community topic summary, as the first data block; The third processing module 5003 is used to input the question and the first data block into the hybrid retrieval model, obtain the first score of each preset data block in the first data block, and take the first number of preset data blocks with the highest first scores as the second data block; obtain the context information of the second data block, determine the preset data blocks related to the second data block based on the context information, merge the second data block with the preset data blocks related to the second data block to obtain the third data block; input the question and the third data block into the small model to obtain the fourth data block; wherein, the small model is obtained by training the large model; The fourth processing module 5004 is used to input the fourth data block and the question into the preset model to obtain the answer to the question.

[0097] The question-answering device based on size model fusion and retrieval enhancement provided in this application can execute the question-answering method based on size model fusion and retrieval enhancement provided in this application. The implementation principles are similar. The actions performed by each module in the question-answering device based on size model fusion and retrieval enhancement provided in each embodiment of this application correspond to the steps in the question-answering method based on size model fusion and retrieval enhancement provided in each embodiment of this application. For detailed functional descriptions of each module in the question-answering device based on size model fusion and retrieval enhancement, please refer to the descriptions in the corresponding methods shown above, which will not be repeated here.

[0098] This application provides a question-answering method and apparatus based on large-scale model fusion and retrieval enhancement. By extracting summary information from original documents and constructing a knowledge graph, this method integrates graph retrieval technology and vector retrieval algorithms to achieve accurate matching of user query needs and quickly locate data blocks in the original documents related to the user's question. It combines multiple retrieval methods using the RRF algorithm and optimizes the weights of different retrieval methods, allowing the retrieval strategy to dynamically evolve with the characteristics of the enterprise's private domain knowledge. Furthermore, this application utilizes a large model to distill a small model, using the scores output by the large model and the logic behind the scoring reasons to train the small model. This enables the small model to better simulate the decision-making process of the large model, significantly reducing the number of model parameters while maintaining comparable performance. This improves the operating efficiency of the small model and saves significant computational resources, effectively solving the technical problems of low relevance and accuracy of retrieval information generated by existing RAG systems, as well as low efficiency in generating retrieval information.

[0099] Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application, such as... Figure 6 As shown, the electronic device 4000 includes a processor 4001 and a memory 4003. The processor 4001 and the memory 4003 are connected, for example, via a bus 4002. Optionally, the electronic device 4000 may further include a transceiver 4004, which can be used for data interaction between the electronic device and other electronic devices, such as sending and / or receiving data. It should be noted that in practical applications, the transceiver 4004 is not limited to one type, and the structure of the electronic device 4000 does not constitute a limitation on the embodiments of this application.

[0100] Processor 4001 may be a CPU (Central Processing Unit), a general-purpose processor, a DSP (Digital Signal Processor), an ASIC (Application Specific Integrated Circuit), an FPGA (Field Programmable Gate Array), or other programmable logic devices, transistor logic devices, hardware components, or any combination thereof. It can implement or execute the various exemplary logic blocks, modules, and circuits described in conjunction with the disclosure of this application. Processor 4001 may also be a combination that implements computational functions, such as including one or more microprocessor combinations, a combination of a DSP and a microprocessor, etc.

[0101] Bus 4002 may include a pathway for transmitting information between the aforementioned components. Bus 4002 may be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus, etc. Bus 4002 can be divided into address bus, data bus, control bus, etc. For ease of representation, Figure 6 The bus is represented by a single thick line, but this does not mean that there is only one bus or one type of bus.

[0102] The memory 4003 may be ROM (Read Only Memory) or other types of static storage devices capable of storing static information and instructions, RAM (Random Access Memory) or other types of dynamic storage devices capable of storing information and instructions, or EEPROM (Electrically Erasable Programmable Read Only Memory), CD-ROM (Compact Disc-Read Only Memory) or other optical disc storage, optical disc storage (including compressed optical discs, laser discs, optical discs, digital universal optical discs, Blu-ray discs, etc.), magnetic disk storage media, other magnetic storage devices, or any other medium capable of carrying or storing computer programs and capable of being read by a computer, without limitation herein.

[0103] The memory 4003 stores computer programs that execute embodiments of this application, and its execution is controlled by the processor 4001. The processor 4001 executes the computer programs stored in the memory 4003 to implement the steps shown in the foregoing method embodiments.

[0104] The electronic device package may include, but is not limited to, mobile terminals such as mobile phones, laptops, digital radio receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), and in-vehicle terminals (such as in-vehicle navigation terminals), as well as fixed terminals such as digital TVs and desktop computers. Figure 6 The electronic device shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of this application.

[0105] This application provides a computer-readable storage medium storing a computer program. When executed by a processor, the computer program can implement the steps and corresponding content of the aforementioned method embodiments. Compared with the prior art, it can achieve the following: It should be noted that the computer-readable medium in the embodiments of this application can be a computer-readable signal medium, a computer-readable medium, or any combination of the two. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In the embodiments of this application, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In the embodiments of this application, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium can be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wires, optical fibers, RF (radio frequency), etc., or any suitable combination thereof.

[0106] This application also provides a computer program product, including a computer program that, when executed by a processor, can implement the steps and corresponding content of the aforementioned method embodiments. Compared with the prior art, it can achieve: The terms "first," "second," "third," "fourth," "1," "2," etc. (if present) in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in a sequence other than that shown in the figures or text.

[0107] It should be understood that although arrows indicate various operation steps in the flowcharts of this application's embodiments, the order in which these steps are implemented is not limited to the order indicated by the arrows. Unless explicitly stated herein, in some implementation scenarios of this application's embodiments, the implementation steps in each flowchart can be executed in other orders as required. Furthermore, some or all steps in each flowchart, based on the actual implementation scenario, may include multiple sub-steps or multiple stages. Some or all of these sub-steps or stages can be executed at the same time, and each sub-step or stage can also be executed at different times. In scenarios where execution times differ, the execution order of these sub-steps or stages can be flexibly configured according to requirements, and this application's embodiments do not limit this.

[0108] The above are only optional implementation methods for some implementation scenarios of this application. It should be noted that for those skilled in the art, other similar implementation methods based on the technical concept of this application, without departing from the technical concept of this application, also fall within the protection scope of the embodiments of this application.

Claims

1. A question-answering method based on size model fusion and retrieval enhancement, characterized in that, The method includes: Determine the community topic summary corresponding to the original document. The community topic summary is related to at least one preset data block. Each preset data block includes text data belonging to the same title in the original document. Obtain the user's input question, determine the community topic summary related to the question; and based on the community topic summary, determine at least one preset data block related to the question as the first data block; The question and the first data block are input into a hybrid retrieval model to obtain a first score for each preset data block in the first data block. The preset data block with the highest first score is selected as the second data block. The context information of the second data block is obtained, and preset data blocks related to the second data block are determined based on the context information. The second data block is merged with the preset data blocks related to the second data block to obtain a third data block. The question and the third data block are input into a small model to obtain a fourth data block. The small model is obtained by training the large model. The fourth data block and the question are input into a preset model to obtain the answer to the question.

2. The question-answering method based on size model fusion and retrieval enhancement as described in claim 1, characterized in that, Determining the community topic summary corresponding to the original document includes: Retrieve the text data and hierarchical relationships from the original document; the hierarchical relationships are used to indicate the relationships between different headings in the original document. Based on the text data, determine the summary information of the original document; The summary information is vectorized to obtain the first entity included in the summary information and the relationship between the first entity; Based on the first entity and the relationship between the first entity, the first entity is divided into at least one community, and a community topic summary for each community is determined; Based on the community topic summary of each community, the community topic summary corresponding to the original document is determined.

3. The question-answering method based on size model fusion and retrieval enhancement as described in claim 2, characterized in that, The process of determining a community topic summary for each community includes: Determine the name of the original document associated with each first entity; The names of the first entity and the original document are used as nodes of the knowledge graph, and the relationships between the first entities and the relationships between the first entity and the corresponding original document are used as edges of the knowledge graph. The node corresponding to each first entity is merged with the node corresponding to the adjacent first entity to obtain at least one community; Determine the first entities included in each community and the relationships between the first entities; based on the first entities included in each community and the relationships between the first entities, determine the community topic summary for each community.

4. The question-answering method based on size model fusion and retrieval enhancement as described in claim 3, characterized in that, The step of merging the node corresponding to each first entity with the nodes corresponding to adjacent first entities to obtain at least one community includes: Each node corresponding to the first entity is treated as a community; The modularity of the knowledge graph is determined when the node moves to each of the adjacent communities; The community is merged with the adjacent community corresponding to the case of maximum modularity until a preset condition is met, resulting in at least one community.

5. The question-answering method based on size model fusion and retrieval enhancement as described in claim 4, characterized in that, The process involves obtaining user input and determining a summary of community topics related to that question. Based on the community topic summary, a preset data block related to the question is determined as the first data block, including: The user-input question is matched with the community topic summary corresponding to the original document to determine the community topic summary related to the question; and the community corresponding to the community topic summary related to the question is determined; the community includes at least one first entity; The problem is vectorized to obtain the second entity included in the problem; Identify a first entity in the community that matches the second entity as the third entity; and identify a first entity related to the third entity as the fourth entity. Based on the knowledge graph, the name of the first original document associated with the third entity is determined, and the name of the second original document associated with the fourth entity is determined; Based on the name of the first original document, a preset data block included in the first original document is determined as a first preset data block; and based on the name of the second original document, a preset data block included in the second original document is determined as a second preset data block. A preset data block related to the third entity in the first preset data block is determined as the third preset data block; and a preset data block related to the fourth entity in the second preset data block is determined as the fourth preset data block. Based on the third preset data block and the fourth preset data block, a first data block related to the problem is determined.

6. The question-answering method based on size model fusion and retrieval enhancement according to claim 5, characterized in that, The hybrid retrieval model includes multiple retrieval methods; The step of inputting the question and the first data block into the hybrid retrieval model to obtain the first score of each preset data block in the first data block includes: Obtain the score of each preset data block in the first data block for each retrieval method, the score being used to indicate the relevance of the preset data block to the question; Based on the score of each preset data block in each retrieval method, determine the ranking of each preset data block in each retrieval method; Based on the ranking of each preset data block and the weight corresponding to each retrieval model, the first score of each preset data block is determined.

7. The question-answering method based on size model fusion and retrieval enhancement as described in claim 6, characterized in that, The weight corresponding to each retrieval method is determined in the following way: The problem is input into a pre-trained weight generation model to obtain the weights corresponding to each retrieval method.

8. The question-answering method based on size model fusion and retrieval enhancement according to any one of claims 1-7, characterized in that, The step of inputting the problem and the third data block into the small model to obtain the fourth data block includes: Obtain a second score for each preset data block in the third data block, the second score being determined using the small model, and the second score being used to indicate the relevance of the problem to the preset data block; The second number of preset data blocks with the highest second score in the third data block are used as the fourth data block.

9. The question-answering method based on size model fusion and retrieval enhancement as described in claim 8, characterized in that, The small model is obtained by training the large model and includes: The preset question and the preset data block are input into the large model to obtain a third score and first text information; the third score is used to indicate the relevance between the preset question and the data block; the first text information is used to indicate the reason for determining the third score. Using the preset question and the preset data block as training samples, and the third score and the first text information as training labels, the small model to be trained is trained until the preset stopping condition is met, thus obtaining the small model.

10. A question-answering device based on size model fusion and retrieval enhancement, characterized in that, The device includes: The first processing module is used to determine the community topic summary corresponding to the original document. The community topic summary is related to at least one preset data block. Each preset data block includes text data belonging to the same title in the original document. The second processing module is used to acquire the question input by the user, determine the community topic summary related to the question, and determine at least one preset data block related to the question based on the community topic summary, as the first data block; The third processing module is used to input the question and the first data block into a hybrid retrieval model, obtain a first score for each preset data block in the first data block, and take the preset data block with the highest first score as the second data block; obtain the context information of the second data block, determine the preset data blocks related to the second data block based on the context information, merge the second data block with the preset data blocks related to the second data block to obtain a third data block; input the question and the third data block into a small model to obtain a fourth data block; wherein, the small model is obtained by training the large model; The fourth processing module is used to input the fourth data block and the question into a preset model to obtain the answer corresponding to the question.

11. An electronic device comprising a memory, a processor, and a computer program stored in the memory, characterized in that, The processor executes the computer program to implement the method of any one of claims 1 to 9.

12. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the method of any one of claims 1 to 9.