Search

CN-122021868-A - Large model response method and device based on block diagram

CN122021868ACN 122021868 ACN122021868 ACN 122021868ACN-122021868-A

Abstract

The embodiment of the specification provides a block diagram-based large model response method and a block diagram-based large model response device. In the method, similarity matching is carried out on a user problem and a plurality of document blocks from a knowledge document, N first document blocks are obtained, and a target subgraph containing M first document blocks and connection relations thereof is extracted from a block diagram. The nodes represent Wen Dangkuai, and the connection relationships between the nodes include semantic relationships between document blocks and structural relationships between document blocks from within the knowledge document. And then, processing the target subgraph added with the user questions as nodes through a first graph neural network to obtain characterization vectors of M first document blocks, performing similarity matching on the user questions and the M first document blocks according to the characterization vectors to obtain K second document blocks, and inputting the user questions, texts of the K second document blocks and graph structure information of the target subgraph into a large model to obtain answers to the user questions. In the question and answer process, the privacy of the user needs to be protected from disclosure.

Inventors

  • CHEN SHAOKAI
  • ZHANG YICHI
  • GUO LINGBING
  • LIU ZHIZHEN
  • ZHANG WEN
  • CHEN HUAJUN

Assignees

  • 浙江大学
  • 支付宝(杭州)数字服务技术有限公司

Dates

Publication Date
20260512
Application Date
20251202

Claims (12)

  1. 1. A block diagram-based large model response method, comprising: performing similarity matching on the user problem and a plurality of document blocks to obtain N first document blocks, wherein the plurality of document blocks are obtained by partitioning texts of a plurality of knowledge documents; Extracting a target subgraph containing M first document blocks and connection relations among the first document blocks from a pre-constructed block diagram, wherein nodes in the block diagram represent Wen Dangkuai, and the connection relations among the nodes comprise semantic relations among document blocks and structural relations among the document blocks in a knowledge document, and M is not more than N; Processing a target subgraph added with the user problem as a node through a first graph neural network to obtain characterization vectors of the M first document blocks, wherein the characterization vectors aggregate information of neighbor nodes and connection relations between the neighbor nodes; According to the characterization vector, carrying out similarity matching on the user problem and the M first document blocks to obtain K second document blocks, wherein K is smaller than M; inputting the user question and the text of the K second document blocks into a large model, so that the large model combines the text of the K second document blocks to determine an answer to the user question.
  2. 2. The method of claim 1, the block map being constructed in the following manner: Constructing a structural relation edge between nodes corresponding to two document blocks according to the relative position between two adjacent document blocks in a knowledge document; For any two document blocks, when the two document blocks contain the same specific entity, constructing semantic relation edges between nodes corresponding to the two document blocks.
  3. 3. The method of claim 1, said step of extracting a target subgraph containing M of said first document blocks and connection relations between them from a pre-constructed block graph, comprising: Inquiring an initial subgraph containing the N first document blocks and the connection relations between the N first document blocks from the block diagram; And removing nodes corresponding to the isolated first document block in the initial subgraph to obtain the target subgraph.
  4. 4. The method of claim 1, the step of processing the target subgraph added with the user question as a node through a first graph neural network, comprising: Adding the user problem as a node into the target subgraph, constructing a semantic relation edge between a node corresponding to the user problem and a node in the target subgraph, and adding neighbor document blocks of the M first document blocks in the block diagram and connection relations thereof into the target subgraph to obtain an updated subgraph; And determining the characterization vectors of the M first file blocks based on the nodes in the updated subgraph and the connection relations among the nodes through the first graph neural network.
  5. 5. The method of claim 1, the step of entering text of the user question and the K second document pieces into a large model comprising: Inputting the text of the user question and the K second document blocks and the graph structure information of the target subgraph into the large model, so that the large model combines the K document blocks and the graph structure information to determine an answer to the user question.
  6. 6. The method of claim 5, wherein the large model comprises an embedded layer and a hidden layer, wherein the step of inputting the user question and text of the K second document blocks and the graph structure information of the target sub-graph into the large model comprises: Inputting the user questions and the texts of the K second document blocks into the embedded layer to obtain a plurality of first feature vectors; Extracting the graph structure information of the target subgraph through a structure extraction model to obtain a second feature vector; And inputting the first feature vectors and the second feature vectors into the hidden layer, and obtaining an answer to the user question through the hidden layer.
  7. 7. The method of claim 6, wherein the structure extraction model comprises a second graph neural network and a vector conversion network, and wherein the step of extracting graph structure information of the target subgraph by the structure extraction model comprises: extracting graph structure information of the target subgraph through the second graph neural network to obtain an initial feature vector; and converting the initial feature vector into a second feature vector of a vector space where the large model is located through the vector conversion network.
  8. 8. The method of claim 6, the step of entering text of the user question and the K second document pieces into the embedding layer comprising: Inputting a prompt template containing the text of the user question and the K second document blocks and a task instruction into the embedded layer, wherein the task instruction is used for indicating the graph structure information embodied according to the text of the K second document blocks and the second feature vector and determining the answer of the user question.
  9. 9. The method of claim 1, training the first graph neural network in the following manner: Acquiring a sample user problem and a sample block diagram, wherein the sample block diagram comprises a plurality of nodes representing sample text files and edges representing connection relations between sample file blocks; determining a plurality of first nodes matched with the sample user problem from the sample block diagram according to a set matching strategy, determining positive sample labels for the plurality of first nodes, and determining negative sample labels for other nodes in the sample block diagram; Processing a sample block diagram added with the sample user problem as a node through the first graph neural network to obtain a characterization vector of a sample text block in the sample block diagram, wherein a connecting edge is established between the node corresponding to the sample user problem and the plurality of first nodes; Calculating a similarity score between the sample user problem and each sample text block in the sample block diagram according to the characterization vector; Determining prediction loss according to the similarity score of each sample text block and the sample label of each sample text block; and updating the first graph neural network according to the prediction loss.
  10. 10. A block diagram based large model response device comprising: The primary retrieval module is configured to carry out similarity matching on the user problem and a plurality of document blocks to obtain N first document blocks, wherein the document blocks are obtained by partitioning texts of a plurality of knowledge documents; The sub-graph determining module is configured to extract a target sub-graph containing M first document blocks and connection relations among the first document blocks from a pre-constructed block graph, wherein nodes in the block graph represent Wen Dangkuai, and the connection relations among the nodes comprise semantic relations among document blocks and structural relations among the document blocks from a knowledge document; the characterization determining module is configured to process the target subgraph added with the user problem as a node through a first graph neural network to obtain characterization vectors of the M first file blocks, wherein the characterization vectors aggregate information of neighbor nodes and connection relations between the neighbor nodes; The rearrangement retrieval module is configured to perform similarity matching on the user problem and the M first document blocks to obtain K second document blocks, wherein K is smaller than M; and the answer determining module is configured to input the user questions and the texts of the K second document blocks into a large model, so that the large model determines answers to the user questions in combination with the texts of the K second document blocks.
  11. 11. A computer readable storage medium having stored thereon a computer program which, when executed in a computer, causes the computer to perform the method of any of claims 1-9.
  12. 12. A computing device comprising a memory having executable code stored therein and a processor, which when executing the executable code, implements the method of any of claims 1-9.

Description

Large model response method and device based on block diagram Technical Field One or more embodiments of the present disclosure relate to the field of machine learning technologies, and in particular, to a block diagram-based large model response method and apparatus. Background The large model is collectively referred to as a large language model (Large Language Model, LLM). The large model is a natural language processing model based on the deep learning technology, and the parameter magnitude of the large model is usually billions to billions or even higher, so that the large model has strong language understanding and generating capability. The large model may be applied in a question and answer system, giving answers to user questions. The traditional large model has strong reasoning capability, but the knowledge of the traditional large model has timeliness limitation, and is easy to generate a 'illusion'. For this reason, search enhancement generation (RETRIEVAL-augmented Generation, RAG) techniques have been developed that enable the construction of more reliable answer production mechanisms by dynamically integrating external knowledge bases with large language models. In the process of processing data aiming at user problems, privacy protection needs to be carried out on user data. At present, an improved scheme is desired, which can improve the accuracy of response when a large model responds based on a knowledge base. Disclosure of Invention One or more embodiments of the present specification describe a block diagram-based large model response method and apparatus to improve accuracy of response when a large model responds based on a knowledge base. The specific technical scheme is as follows. In a first aspect, an embodiment provides a block diagram-based large model response method, including: performing similarity matching on the user problem and a plurality of document blocks to obtain N first document blocks, wherein the plurality of document blocks are obtained by partitioning texts of a plurality of knowledge documents; Extracting a target subgraph containing M first document blocks and connection relations among the first document blocks from a pre-constructed block diagram, wherein nodes in the block diagram represent Wen Dangkuai, and the connection relations among the nodes comprise semantic relations among document blocks and structural relations among the document blocks in a knowledge document, and M is not more than N; Processing a target subgraph added with the user problem as a node through a first graph neural network to obtain characterization vectors of the M first document blocks, wherein the characterization vectors aggregate information of neighbor nodes and connection relations between the neighbor nodes; According to the characterization vector, carrying out similarity matching on the user problem and the M first document blocks to obtain K second document blocks, wherein K is smaller than M; inputting the user question and the text of the K second document blocks into a large model, so that the large model combines the text of the K second document blocks to determine an answer to the user question. In one implementation, the block map is constructed in the following manner: Constructing a structural relation edge between nodes corresponding to two document blocks according to the relative position between two adjacent document blocks in a knowledge document; For any two document blocks, when the two document blocks contain the same specific entity, constructing semantic relation edges between nodes corresponding to the two document blocks. In one implementation, the step of extracting the target subgraph including M first document blocks and the connection relations between the first document blocks from the pre-constructed block diagram includes: Inquiring an initial subgraph containing the N first document blocks and the connection relations between the N first document blocks from the block diagram; And removing nodes corresponding to the isolated first document block in the initial subgraph to obtain the target subgraph. In one implementation, the step of processing, through the first graph neural network, the target subgraph to which the user problem is added as a node includes: Adding the user problem as a node into the target subgraph, constructing a semantic relation edge between a node corresponding to the user problem and a node in the target subgraph, and adding neighbor document blocks of the M first document blocks in the block diagram and connection relations thereof into the target subgraph to obtain an updated subgraph; And determining the characterization vectors of the M first file blocks based on the nodes in the updated subgraph and the connection relations among the nodes through the first graph neural network. In one implementation, the step of inputting the user questions and the text of the K second document blocks into a large model includes: