Method, apparatus, device and medium for extracting structured knowledge from a document

By using a large language model to automatically extract question-answer pairs and similar question pairs from documents, the high cost and low efficiency of manual data entry in bank knowledge base platforms have been solved. This enables the automated generation of structured knowledge around the clock, improving operational efficiency and customer experience.

CN117194632BActive Publication Date: 2026-05-29PING AN BANK CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
PING AN BANK CO LTD
Filing Date
2023-09-11
Publication Date
2026-05-29

AI Technical Summary

Technical Problem

The knowledge base platform of banks, which is aimed at C-end customers and internal users, requires manual input of knowledge, resulting in high labor costs and low efficiency.

Method used

The Large Language Model (GPT) is used to automatically extract question-answer pairs and question-similar question pairs from documents. By training the bank's self-developed large model bankgpt and combining Prompt Engineering and LORA fine-tuning techniques, structured knowledge can be automatically generated.

Benefits of technology

It reduced the cost of knowledge entry, improved the efficiency of knowledge operation and maintenance, enabled the automatic generation of structured knowledge around the clock, saved human resources, and improved the service effect for C-end customers.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117194632B_ABST
    Figure CN117194632B_ABST
Patent Text Reader

Abstract

The application discloses a method, device, equipment and medium for extracting structured knowledge from a document. The method comprises the following steps: extracting text content from document knowledge; inputting the text content into a first gpt large model to obtain a question-answer pair; inputting the text content or the question into a second gpt large model to obtain a question-similar question pair; and outputting the question-similar question-answer as structured knowledge. The application can automatically extract structured knowledge in the form of question-similar question-answer from document knowledge for C-end customers, thereby reducing knowledge input cost, improving knowledge operation efficiency, and solving the problems of high labor cost and slow efficiency of manual knowledge input by business operation personnel in the prior art.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of data processing, and more particularly to a method, apparatus, device, and medium for extracting structured knowledge from documents. Background Technology

[0002] Currently, the bank has built separate knowledge base platforms for individual customers and internal users (head office and branches). The knowledge base platform for individual customers primarily stores knowledge in question-and-answer pairs, while the knowledge base platform for internal users primarily stores knowledge in document format (HTML, Word, PDF, PPT, etc.). Both knowledge base platforms require manual input of knowledge by business operations personnel, resulting in high labor costs and slow efficiency. Summary of the Invention

[0003] Therefore, it is necessary to propose a method, apparatus, computer device, and readable storage medium for extracting structured knowledge from documents, which can automatically extract structured knowledge in the form of question-similar question-answer from document knowledge, in order to address the above problems.

[0004] Firstly, this application provides a method for extracting structured knowledge from documents, the method comprising:

[0005] Extract text content from document knowledge;

[0006] The text content is input into the first GPT large model to obtain question-answer pairs;

[0007] The text content or the question mark is input into the second GPT large model to obtain question mark-similar question pairs;

[0008] The question-similar question-answer format is used as the structured knowledge output.

[0009] In some embodiments, the method for extracting structured knowledge from a document further includes:

[0010] Instruction samples were constructed using a dataset of natural language tasks within the bank;

[0011] Different instruction samples and text are input into an open-source pre-trained model for training, resulting in the first GPT large model and the second GPT large model.

[0012] In some embodiments, the step of inputting different instruction samples and text into an open-source pre-trained model for training to obtain the first GPT large model and the second GPT large model respectively includes:

[0013] By inputting different instruction samples and text into the open-source pre-trained model, pre-labeled question-answer pairs and pre-labeled question-similar question pairs are obtained.

[0014] Determine whether the format and content of the pre-marked question-answer pair and the format and content of the pre-marked question-similar question pair conform to the standard;

[0015] If the format and content of the pre-labeled question-answer pair and the format and content of the pre-labeled question-similar question pair conform to the standard, then the training ends, and the first GPT large model and the second GPT large model are obtained.

[0016] In some embodiments, determining whether the format and content of the pre-marked question-answer pair and the format and content of the pre-marked question-similar question pair conform to the standard includes:

[0017] Obtain artificially constructed reference question-answer pairs and reference question-similar question pairs;

[0018] Based on whether the format and content of the pre-marked question-answer pair are consistent with or whether the differences are within the allowable range, determine whether the format and content of the pre-marked question-answer pair conform to the standard;

[0019] Based on whether the format and content of the pre-labeled question-similar question pair are consistent with or whether the differences are within the allowable range, it is determined whether the format and content of the pre-labeled question-similar question pair conform to the standard.

[0020] In some embodiments, whether the differences in format and content between the pre-marked question-answer pair and the referenced question-answer pair are within permissible limits includes:

[0021] Calculate the difference between the format of the pre-marked question-answer pair and the format of the referenced question-answer pair, and record it as the first difference value;

[0022] Calculate the difference between the content of the pre-question-answer pair and the content of the reference question-answer pair, and record it as the second difference value;

[0023] Obtain the weights of the first difference value and the second difference value; wherein the weight of the first difference value is less than the weight of the second difference value;

[0024] Calculate the total difference value based on the first difference value, the weight of the first difference value, the second difference value, and the weight of the second difference value;

[0025] Determine whether the total difference value is within the allowable range.

[0026] In some embodiments, whether the differences in format and content between the pre-reference question-similar question pair and the reference question-similar question pair are within permissible limits includes:

[0027] The difference between the format of the pre-labeled question-similar question pair and the format of the referenced question-similar question pair is calculated and denoted as the third difference value;

[0028] Calculate the difference between the content of the pre-labeled question-similar question pair and the content of the referenced question-similar question pair, and record it as the fourth difference value;

[0029] Obtain the weights of the third difference value and the fourth difference value; wherein the weight of the third difference value is less than the weight of the fourth difference value;

[0030] The total difference value is calculated based on the third difference value, the weight of the third difference value, the fourth difference value, and the weight of the fourth difference value;

[0031] Determine whether the total difference value is within the allowable range.

[0032] In some embodiments, extracting text content from document knowledge includes:

[0033] Get at least one of the following: HTML document, PDF document, and Word document;

[0034] The code extracts text content from HTML documents using Java's built-in HTMLEditorKit.ParserCallback; and / or extracts text content from PDF documents using the open-source spire.pdf.free package; and / or extracts text content from Word documents using the open-source poi package.

[0035] Secondly, this application also provides an apparatus for extracting structured knowledge from documents, the apparatus comprising:

[0036] The extraction module is used to extract text content from document knowledge;

[0037] The first input module is used to input the text content into the first GPT large model to obtain question-answer pairs;

[0038] The second input module is used to input the text content or the question into the second GPT large model to obtain question-similar question pairs;

[0039] The output module is used to output structured knowledge by taking the question, similar questions, and answers as the output.

[0040] Thirdly, embodiments of this application also provide a computer device, including a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor performs the steps of the method for extracting structured knowledge from a document as described in any of the first aspects.

[0041] Fourthly, embodiments of this application also provide a computer-readable storage medium storing a computer program, which, when executed by a processor, causes the processor to perform the steps of the method for extracting structured knowledge from a document as described in any of the first aspects.

[0042] The embodiments of this application have at least the following beneficial effects:

[0043] This application embodiment extracts text content from document knowledge; inputs the text content into a first GPT large model to obtain question-answer pairs; inputs the text content or questions into a second GPT large model to obtain question-similar question pairs; and outputs question-similar question-answer pairs as structured knowledge. This achieves automatic extraction of structured knowledge in the form of question-similar question-answer pairs from document knowledge for use by end-users, reducing knowledge input costs, improving knowledge operation and maintenance efficiency, and solving the problems of high labor costs and slow efficiency associated with manual knowledge input by business operation and maintenance personnel in existing technologies. Attached Figure Description

[0044] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0045] in:

[0046] Figure 1-1 This is a diagram illustrating the question, similar questions, and answers.

[0047] Figure 1 This is a flowchart illustrating a method for extracting structured knowledge from a document in one embodiment of this application.

[0048] Figure 2 This is a schematic diagram of the structured knowledge finally output in one embodiment of this application;

[0049] Figure 3 This is an internal structural diagram of a computer device in one embodiment of this application. Detailed Implementation

[0050] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of this application.

[0051] Currently, the bank has built corresponding knowledge base platforms for both individual customers and internal users (head office and branches). The knowledge base platform for individual customers mainly stores knowledge in the form of question-answer pairs; while the knowledge base platform for internal users mainly stores knowledge in the form of documents (HTML, Word, PDF, PPT, etc.).

[0052] Document knowledge (referring to knowledge stored in document form) primarily takes the forms of HTML, Word, TXT, and PDF. The knowledge structure that can be recognized and used by knowledge base platforms targeting end-users is: Question Mark - Similar Questions - Answer, such as... Figure 1-1 As shown, one standard question corresponds to multiple similar questions, and each standard question corresponds to one answer. The reason for having multiple similar questions is to enable the subsequent question-answering engine model on the user's end to have better generalization ability to user questions.

[0053] In the current knowledge maintenance process, both knowledge base platforms require business operations personnel to read and analyze the documents, then summarize the marked questions and answers within them, and simultaneously construct a list of similar questions for each marked question. This process is purely manual, resulting in high labor costs, low efficiency, and generally poor results (mainly in constructing the list of similar questions).

[0054] Based on the above problems, and considering cost reduction and efficiency improvement, this application proposes a method, apparatus, device, and medium for extracting structured knowledge from documents. The aim is to automatically extract structured knowledge in the form of question-similar question-answer from document knowledge. Experiments and optimizations were conducted using large model capabilities for use by C-end customers, reducing knowledge input costs and improving knowledge operation and maintenance efficiency.

[0055] The technical solutions shown in this application will now be described in detail through specific embodiments. It should be noted that the following embodiments may exist independently or in combination with each other; identical or similar content will not be repeated in different embodiments.

[0056] In a first aspect, embodiments of this application provide a method for extracting structured knowledge from documents. Figure 1 This is a flowchart illustrating a method for extracting structured knowledge from documents in one embodiment of this application. Please refer to... Figure 1 In some embodiments, the method for extracting structured knowledge from documents includes:

[0057] S110: Extract text content from document knowledge;

[0058] In some embodiments, the "structured" nature mentioned in this application refers to knowledge in relation to document knowledge, which has a fixed data structure. This fixed data structure can be stored in key-value format or in a traditional database table format. For example, structured knowledge in a bank consists of three parts: a tag question, similar questions, and answers, and these three parts have certain relationships (see reference). Figure 1-1 In terms of actual storage, if we design it in the form of a database table, we can design three tables: a question label table, a similar question table, and an answer table. The three tables can be linked through the question label ID to obtain a complete piece of knowledge.

[0059] In some embodiments, the document includes at least one of HTML documents, PDF documents, and Word documents. Text extraction mainly involves extracting text content from document knowledge. For example, in an HTML document, text extraction can remove the HTML tags and retain the text. This process can be viewed as data preprocessing, which is handled through engineering code. Text extraction is mainly implemented through the following code to extract plain text from HTML documents, PDF documents, and Word documents:

[0060] To extract plain text from an HTML document, this embodiment uses Java's built-in HTMLEditorKit.ParserCallback. Example code is shown below (partial):

[0061] FileReader in=new FileReader("input.html");

[0062] Html2Text parser=new Html2Text();

[0063] parser.parse(in);

[0064] in.close();

[0065] return parser.getText();

[0066] This application uses the open-source spire.pdf.free package to extract plain text from PDF documents. Example code is shown below (partial):

[0067]

[0068]

[0069] This application embodiment uses the open-source POI package to extract plain text from a Word document. There are many existing technologies for this purpose, and this application embodiment will not elaborate further.

[0070] S120: Input the text content into the first GPT large model to obtain the question-answer pair.

[0071] S130: Input the text content or question into the second GPT large model to obtain a list of similar questions corresponding to the question.

[0072] In some embodiments, both the first and second GPT large models are large models developed in-house by the bank, namely bankgpt, which belongs to the GPT (Generative Pre-trained Transformer) series of autoregressive models. The model specifications are generally 6.2 billion parameters, and three training objectives are set: mask-based natural language understanding task, unconditional long text generation task, and conditional text generation task.

[0073] In some embodiments, the first GPT large model and the second GPT large model are trained in the following manner:

[0074] Instruction samples were constructed using a dataset of natural language tasks within the bank;

[0075] Different instruction samples and text were input into an open-source pre-trained model for training, resulting in the first GPT large model and the second GPT large model.

[0076] Specifically, based on the weights of the open-source pre-trained model, instruction samples are constructed using datasets of more than 10 natural language tasks, such as knowledge bases, conversations, extraction tasks, and generation scenarios within the bank, to train the bank's internal GPT base, also known as the LLM (large language model) large model, which is the first GPT large model and the second GPT large model in the embodiments of this application.

[0077] During training, the input is generally divided into two parts. The first part is the instruction sample (prompt), which describes the task that the large model needs to complete. A professional and accurate task description often achieves twice the result with half the effort. The second part is the main text input (input), which is the text that needs to be processed. The prompt and input may be embedded in each other.

[0078] The following is an example of the input when training the first GPT large model according to an embodiment of this application:

[0079]

[0080]

[0081] As can be seen, the first GPT large model takes the instruction sample prompt1 and the main text as input, and outputs question-answer pairs. The intermediate process includes: the first GPT large model performs semantic analysis and entity recognition on the input instruction sample and main text, identifying entities and attribute information in the text. Based on the semantic analysis and entity recognition results, the first GPT large model can automatically generate relevant questions. Based on the generated questions, the first GPT large model can extract the corresponding answers from the text, forming question-answer pairs, and outputting them according to the format specified in the instruction sample.

[0082] Understandably, the instruction sample prompt describes the task that the large model needs to complete; therefore, the instruction sample of the second GPT large model differs from that of the first GPT large model. The instruction sample of the second GPT large model can be:

[0083] prompt2:

[0084] \n{input}\n###\nTask: You are the exam setter for a bank training program. Please rewrite the above text into multiple question-and-answer pairs, and output them according to the given format. \n###\nOutput:\nQuestions:\nSimilar Questions:

[0085] As can be seen, the input to the second GPT large model is the instruction sample prompt2 and the main text, and the output is a question-and-similar question pair. In some embodiments, the question obtained from the first GPT large model can also be used as the main text, and the instruction sample prompt2 and the main text can be input into the second GPT large model, with the output being a question-and-similar question pair. The intermediate process may include: the second GPT large model performs semantic analysis and entity recognition on the input instruction sample and main text (or question), identifying the entities and attribute information in the text. Based on the semantic analysis and entity recognition results, the first GPT large model can automatically generate relevant similar questions, forming question-and-similar question pairs, and output them according to the format specified in the instruction sample.

[0086] In other words, after extracting text content from document knowledge, the text content can be simultaneously input into both the first and second GPT large-scale models. The first and second GPT large-scale models process the text content according to different instruction samples, obtaining question-answer pairs and question-similar question pairs, respectively. Alternatively, after extracting text content from document knowledge, the text content can be input into the first GPT large-scale model. The first GPT large-scale model processes the text content according to the corresponding instruction samples, obtaining question-answer pairs; then, the obtained questions are input into the second GPT large-scale model. The second GPT large-scale model expands the questions with similar questions according to the corresponding instruction samples, obtaining a list of similar questions corresponding to the questions, thus obtaining question-similar question pairs.

[0087] This application's embodiments leverage the LLM large-scale model to empower question-answer pair extraction, primarily employing two major technical supports: Prompt Engineering and LORA fine-tuning. Prompt Engineering is a fundamental and rapidly deployable task. It refers to how to generate prompt templates for the current task. The most basic method for constructing prompts is manual creation, designing suitable text templates for the specific task. The model is also sensitive to prompts; the way the prompt template is constructed significantly impacts the results. As in Example 1 above, under such instructions, the model can extract some question-answer pairs as needed. However, based on batch testing results, the format and content of the returned results sometimes have errors. Format refers to the large-scale model outputting the desired results in sets of \nquestion:\nanswer: and then placing them into structured JSON. Content refers to the extracted questions and answers meeting expectations (originating from text paragraphs, with meaningful questions and matching answers). Only slightly over 80% of the format conforms to the standards, and only slightly over 40% of the content meets the meaning of human evaluation (i.e., conforms to the reference question-answer pairs provided by business experts). LORA tuning is a lightweight model tuning method that only requires tuning 2%-3% of the overall model parameters, such as an LLM with 10 billion parameters. Each LORA debugging session only requires updating 200-300 million parameters, which not only saves GPU memory resources but also has low trial and error costs and allows for rapid iterative deployment.

[0088] Therefore, the instruction samples and the main text are input into an open-source pre-trained model for training, resulting in the first GPT large model, which includes:

[0089] Input the instruction samples and the main text into the open-source pre-trained model to obtain pre-labeled question-answer pairs;

[0090] Determine whether the format and content of the pre-marked question-answer pair meet the standards;

[0091] If the format and content of the pre-labeled question-answer pairs meet the standards, then training ends and the first GPT large model is obtained.

[0092] Specifically, as in Example 1 above, inputting the instruction sample prompt1 and the main text into the open-source pre-trained model yields three pre-labeled question-answer pairs, which are:

[0093] Question: "When is the event?"

[0094] The answer states: "The event will run from December 2, 2022 to August 31, 2023."

[0095] Question: "Who are the participants?"

[0096] The answer states: "Participants are Ping An Bank Pocket APP users and eligible invited friends. Referrers can only invite eligible users and friends; they cannot receive referral rewards themselves."

[0097] Question: What conditions must invited friends meet?

[0098] The answer states: "Invited friends must meet regulatory requirements and pilot account opening conditions, and must not have opened a personal pension fund account with Ping An Bank."

[0099] The training process determines whether the format and content of the three pre-labeled question-answer pairs conform to the standard. If they do, training ends, and the first GPT (Generalized Tolerant Model) is obtained. If they do not, training and optimization continue until the output pre-labeled question-answer pairs conform to the standard, resulting in the first GPT model. Then, the text content extracted from the document knowledge is input into the first GPT model. The first GPT model processes the text content according to the corresponding instruction samples, determines the question and its corresponding answer, and forms question-answer pairs.

[0100] The process of determining whether the format and content of the pre-marked question-answer pair conform to the standard includes:

[0101] Obtain artificially constructed reference questions and answers;

[0102] Determine whether the format and content of the pre-marked question-answer pair conform to the standard based on whether they are consistent with or differ from the format and content of the reference question-answer pair.

[0103] In some embodiments, the artificially constructed reference question-and-answer pair may be a standard question-and-answer pair provided by a business expert. By comparing the format and content of the pre-reference question-and-answer pair with the format and content of the reference question-and-answer pair, if the two are consistent or the differences are within the allowable range (e.g., only a few insignificant words or punctuation marks are different), then the format and content of the pre-reference question-and-answer pair are determined to conform to the standard.

[0104] In some embodiments, the principle and implementation process for obtaining question-similar question pairs and determining whether question-similar question pairs conform to the standard are consistent with that for question-answer pairs.

[0105] One question can correspond to multiple similar questions. For example,

[0106] Question: "When is the event?"

[0107] Similar Question 1: "What are the dates of the event?"

[0108] Similar Question 2: "What day is the event?"

[0109] Similar Question 3: "When is the event?"

[0110] Therefore, a tag question-similar question pair contains one tag question and multiple similar questions.

[0111] The instruction sample prompt2 and the main text are input into an open-source pre-trained model to obtain pre-labeled question-similar question pairs. The format and content of the pre-labeled question-similar question pairs are compared with the format and content of reference question-similar question pairs provided by business experts. If they are consistent or the differences are within acceptable limits (e.g., only a few insignificant words or punctuation marks differ), the format and content of the pre-labeled question-similar question pairs are deemed to meet the standard, and training ends, resulting in the second GPT (Greater Point Platform) model. Then, the text content extracted from document knowledge or the questions obtained from the first GPT model are input into the second GPT model. The second GPT model processes the text content or expands the questions with similar questions based on the corresponding instruction sample, determining the questions and their corresponding similar questions, obtaining a list of similar questions corresponding to the questions, and forming question-similar question pairs between the questions and their corresponding similar questions.

[0112] In some embodiments, content conformity to standards is more important than format conformity, whether it is a pre-labeled question-answer pair or a pre-labeled question-similar pair. Therefore, in determining whether the differences in format and content between a pre-labeled question-answer pair and a referenced question-answer pair are within acceptable limits, and in determining whether the differences in format and content between a pre-labeled question-similar pair and a referenced question-similar pair are within acceptable limits, the weight of content can be adjusted to be greater than the weight of format. This can avoid some unnecessary model tuning and improve efficiency.

[0113] Specifically, the difference between the format of the pre-defined question-answer pair and the format of the reference question-answer pair is calculated and denoted as the first difference value D1; the difference between the content of the pre-defined question-answer pair and the content of the reference question-answer pair is calculated and denoted as the second difference value D2; the weight X1 of the first difference value D1 and the weight X2 of the second difference value D2 are obtained; wherein, the weight X1 of the first difference value D1 is less than the weight X2 of the second difference value D2. The total difference value D = D1*X1 + D2*X2 is calculated, and it is determined whether the total difference value D is within the allowable range. If the total difference value D is within the allowable range, then the format and content of the pre-defined question-answer pair conform to the standard.

[0114] Similarly, calculate the difference between the format of the pre-reference question-similar pair and the format of the reference question-similar pair, denoted as the third difference value D3; calculate the difference between the content of the pre-reference question-similar pair and the content of the reference question-similar pair, denoted as the fourth difference value D4; obtain the weights X3 and X4 of the third difference value D3 and the fourth difference value D4, respectively; where the weight X3 of the third difference value D3 is less than the weight X4 of the fourth difference value D4. Calculate the total difference value D = D3 * X3 + D4 * X4, and determine whether the total difference value D is within the allowable range. If the total difference value D is within the allowable range, then the format and content of the pre-reference question-similar pair conform to the standard.

[0115] In some embodiments, the first GPT large model and the second GPT large model can be integrated into one large model, or they can be two independent large models.

[0116] S140: Use the tag question-similar question-answer as structured knowledge output.

[0117] Please refer to Example 1; the final output of structured knowledge will be as follows: Figure 2 As shown. Figure 2 The structured knowledge shown is only a portion of the total, and is presented as an illustration. The output structured knowledge is intended for use by end-users (C-end).

[0118] This application automatically extracts question-and-answer pairs and expands the question-and-similar-question list, ultimately combining them into complete structured knowledge for use by subsequent question-answering engine models. This fully automated process significantly improves the efficiency and effectiveness of knowledge production, providing technical support for cost reduction and efficiency improvement across business lines. The solution can operate 24 / 7 in knowledge production, storing the generated knowledge in a database and integrating it with subsequent business processes through rules or simple manual review to ensure its effective application. This process can save at least 1-2 person-days. Another significant benefit is the greatly improved efficiency of structured knowledge conversion through this automated knowledge generation process. Previously, the purely manual method of reading documents, summarizing questions, and constructing similar questions resulted in low efficiency. Furthermore, the large volume of document knowledge meant that much of the document knowledge could not be converted into structured knowledge in a timely manner, impacting service effectiveness for end-users. Automated knowledge generation improves knowledge conversion efficiency and enhances the end-user experience.

[0119] Secondly, embodiments of this application also provide an apparatus for extracting structured knowledge from documents, comprising:

[0120] The extraction module is used to extract text content from document knowledge;

[0121] The first input module is used to input text content into the first GPT large model to obtain question-answer pairs;

[0122] The second input module is used to input text content or question into the second GPT large model to obtain question-similar question pairs;

[0123] The output module is used to output structured knowledge by taking the question, similar questions, and answers as the output.

[0124] Thirdly, embodiments of this application also provide a computer device, including a memory and a processor. The memory stores a computer program, and when the computer program is executed by the processor, the processor performs the steps of the method for extracting structured knowledge from a document as described in any of the first aspects.

[0125] Figure 3 This is an internal structural diagram of a computer device according to one embodiment of this application. Please refer to... Figure 3In some embodiments, the computer device includes a processor, memory, and a network interface connected via a system bus. The memory includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores an operating system and may also store a computer program that, when executed by the processor, causes the processor to perform the steps of any of the methods described above for extracting structured knowledge from a document. The internal memory may also store a computer program that, when executed by the processor, causes the processor to perform the steps of any of the methods described above for extracting structured knowledge from a document. Those skilled in the art will understand that... Figure 3 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0126] Fourthly, embodiments of this application also provide a computer-readable storage medium storing a computer program, which, when executed by a processor, causes the processor to perform the steps of the method for extracting structured knowledge from a document as described in any of the first aspects.

[0127] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, the program can include the processes of the embodiments of the above methods. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), RAMbus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and RAMbus dynamic RAM (RDRAM), etc.

[0128] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0129] The above embodiments merely illustrate several implementation methods of this application, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this patent application should be determined by the appended claims.

Claims

1. A method for extracting structured knowledge from documents, characterized in that, The method includes: Extract text content from document knowledge; The text content is input into the first GPT large model to obtain question-answer pairs; The text content or the question mark is input into the second GPT large model to obtain question mark-similar question pairs; The question-similar question-answer format is used as the structured knowledge output. Also includes: Instruction samples were constructed using a dataset of natural language tasks within the bank; Different instruction samples and text are input into an open-source pre-trained model for training, resulting in the first GPT large model and the second GPT large model, respectively. Specifically, based on the weights of the open-source pre-trained model, instruction samples are constructed using datasets from the bank's knowledge base, sessions, extraction tasks, and generation scenarios. These samples are then used to train the bank's internal GPT base model, which consists of the first GPT large model and the second GPT large model.

2. The method for extracting structured knowledge from documents according to claim 1, characterized in that, The step of inputting different instruction samples and text into an open-source pre-trained model for training, to obtain the first GPT large model and the second GPT large model respectively, includes: By inputting different instruction samples and text into the open-source pre-trained model, pre-labeled question-answer pairs and pre-labeled question-similar question pairs are obtained. Determine whether the format and content of the pre-marked question-answer pair and the format and content of the pre-marked question-similar question pair conform to the standard; If the format and content of the pre-labeled question-answer pair and the format and content of the pre-labeled question-similar question pair conform to the standard, then the training ends, and the first GPT large model and the second GPT large model are obtained.

3. The method for extracting structured knowledge from documents according to claim 2, characterized in that, The determination of whether the format and content of the pre-marked question-answer pair and the format and content of the pre-marked question-similar question pair conform to the standard includes: Obtain artificially constructed reference question-answer pairs and reference question-similar question pairs; Based on whether the format and content of the pre-marked question-answer pair are consistent with or whether the differences are within the allowable range, determine whether the format and content of the pre-marked question-answer pair conform to the standard; Based on whether the format and content of the pre-labeled question-similar question pair are consistent with or whether the differences are within the allowable range, it is determined whether the format and content of the pre-labeled question-similar question pair conform to the standard.

4. The method for extracting structured knowledge from documents according to claim 3, characterized in that, Whether the differences in format and content between the pre-question-answer pair and the reference question-answer pair are within acceptable limits, including: Calculate the difference between the format of the pre-marked question-answer pair and the format of the referenced question-answer pair, and record it as the first difference value; Calculate the difference between the content of the pre-question-answer pair and the content of the reference question-answer pair, and record it as the second difference value; Obtain the weights of the first difference value and the second difference value; wherein the weight of the first difference value is less than the weight of the second difference value; Calculate the total difference value based on the first difference value, the weight of the first difference value, the second difference value, and the weight of the second difference value; Determine whether the total difference value is within the allowable range.

5. The method for extracting structured knowledge from documents according to claim 3, characterized in that, Whether the differences in format and content between the pre-reference question-similar question pair and the reference question-similar question pair are within the allowable range, including: The difference between the format of the pre-labeled question-similar question pair and the format of the referenced question-similar question pair is calculated and denoted as the third difference value; Calculate the difference between the content of the pre-labeled question-similar question pair and the content of the referenced question-similar question pair, and record it as the fourth difference value; Obtain the weights of the third difference value and the fourth difference value; wherein the weight of the third difference value is less than the weight of the fourth difference value; The total difference value is calculated based on the third difference value, the weight of the third difference value, the fourth difference value, and the weight of the fourth difference value; Determine whether the total difference value is within the allowable range.

6. The method for extracting structured knowledge from documents according to claim 1, characterized in that, The extraction of text content from document knowledge includes: Get at least one of the following: HTML document, PDF document, and Word document; The code extracts text content from HTML documents using Java's built-in HTMLEditorKit.ParserCallback; and / or extracts text content from PDF documents using the open-source spire.pdf.free package; and / or extracts text content from Word documents using the open-source poi package.

7. An apparatus for extracting structured knowledge from documents, applied to the method for extracting structured knowledge from documents as described in claim 1, characterized in that, The device includes: The extraction module is used to extract text content from document knowledge; The first input module is used to input the text content into the first GPT large model to obtain question-answer pairs; The second input module is used to input the text content or the question into the second GPT large model to obtain question-similar question pairs; The output module is used to output structured knowledge by taking the question, similar questions, and answers as the output.

8. A computer device, characterized in that, It includes a memory and a processor, the memory storing a computer program that, when executed by the processor, causes the processor to perform the steps of the method for extracting structured knowledge from a document as described in any one of claims 1 to 6.

9. A computer-readable storage medium, characterized in that, The system stores a computer program that, when executed by a processor, causes the processor to perform the steps of the method for extracting structured knowledge from a document as described in any one of claims 1 to 6.