Document extraction model training method and device and document extraction method and device

By preprocessing and lightweight fine-tuning training on documents, the generated document extraction model solves the problem of accuracy and efficiency of direct document extraction of large models, achieving more efficient and accurate document extraction.

CN120409429APending Publication Date: 2025-08-01BEIJING BAIDU NETCOM SCI & TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510536141.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-25
Publication Date
2025-08-01

AI Technical Summary

Technical Problem

In the prior art, the accuracy and efficiency of extracting abstracts and question-answer pairs directly from documents based on large models is low.

Method used

By preprocessing the sample document, including format conversion and segmentation processing, a second sample document is generated, and the second large model is trained using a lightweight fine-tuning strategy to obtain a document extraction model.

Benefits of technology

It improves the accuracy and efficiency of the document extraction model, adapts to the document processing task requirements in different fields, reduces resource consumption, and improves document extraction performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120409429A_ABST
    Figure CN120409429A_ABST
Patent Text Reader

Abstract

The invention provides a training method and device of a document extraction model and a document extraction method and device, and relates to the field of artificial intelligence, in particular to the technical field of natural language processing, large models and deep learning. Obtaining a first sample document; executing a preprocessing process corresponding to the processing task on the first sample document to obtain a second sample document corresponding to the processing task; executing an information extraction process of the processing task on the second sample document through the first large model to obtain a document extraction result of the first sample document; taking the first sample document and the document extraction result as training samples, performing fine tuning on the second large model based on the training samples to obtain a document extraction model, executing a preprocessing process on the first sample document to avoid the problem that the first sample document is too long and exceeds the context length of the first large model, and performing fine tuning on the second large model to obtain the document extraction model. The resource for obtaining the document extraction model is reduced, and the document extraction performance of the document extraction model is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of artificial intelligence, specifically to the fields of natural language processing, large models, and deep learning technologies, and particularly to a method and device for training a document extraction model, a document extraction method, and a document extraction device. Background Art

[0002] In related technologies, abstracts and question-and-answer pairs are often directly extracted from documents based on a selected large model through prompts (Prompts) and output in a specified format. However, the abstracts and question-and-answer pairs extracted in this way are often inaccurate and the extraction efficiency is low. Summary of the Invention

[0003] The present disclosure provides a method for training a document extraction model, a document extraction method, a device for training a document extraction model, a document extraction device, an electronic device, a storage medium, and a computer program product.

[0004] According to a first aspect of the present disclosure, there is provided a method for training a document extraction model, including: obtaining a first sample document; performing a preprocessing process corresponding to a processing task on the first sample document to obtain a second sample document corresponding to the processing task; performing an information extraction process of the processing task on the second sample document through a first large model to obtain a document extraction result of the first sample document; using the first sample document and the document extraction result as training samples, and fine-tuning a second large model based on the training samples to obtain a document extraction model.

[0005] According to a second aspect of the present disclosure, there is provided a document extraction method, including: obtaining a first document; performing a preprocessing process corresponding to a processing task on the first document to obtain a second document corresponding to the processing task; performing an information extraction process corresponding to the processing task on the second document through a document extraction model to obtain a document extraction result of the first document; wherein the document extraction model is a model trained by using the training method described in the first aspect.

[0006] According to a third aspect of the present disclosure, there is provided a device for training a document extraction model, including: a first acquisition module for obtaining a first sample document; a second acquisition module for performing a preprocessing process corresponding to a processing task on the first sample document to obtain a second sample document corresponding to the processing task; a processing module for performing an information extraction process of the processing task on the second sample document through a first large model to obtain a document extraction result of the first sample document; a fine-tuning module for using the first sample document and the document extraction result as training samples, and fine-tuning a second large model based on the training samples to obtain a document extraction model.

[0007] According to a fourth aspect of the present disclosure, there is provided a document extraction device, including: an acquisition module configured to acquire a first document; a preprocessing module configured to perform a preprocessing process corresponding to a processing task on the first document to obtain a second document corresponding to the processing task; a document extraction module configured to perform an information extraction process corresponding to the processing task on the second document through a document extraction model to obtain a document extraction result of the first document; wherein the document extraction model is a model trained by using the training method described in the first aspect.

[0008] According to a fifth aspect of the present disclosure, there is provided an electronic device, including: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and when the instructions are executed by the at least one processor, the at least one processor is enabled to execute the training method of the document extraction model described in the first aspect of the present disclosure or the document extraction method described in the second aspect.

[0009] According to a sixth aspect of the present disclosure, there is provided a non-transitory computer-readable storage medium storing computer instructions for causing a computer to execute the training method of the document extraction model described in the first aspect of the present disclosure or the document extraction method described in the second aspect.

[0010] According to a seventh aspect of the present disclosure, there is provided a computer program product, including a computer program, characterized in that when the computer program is executed by a processor, it implements the training method of the document extraction model described in the first aspect of the present disclosure or the document extraction method described in the second aspect.

[0011] It should be understood that the content described in this part is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it used to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0012] The drawings are used to better understand the solution and do not constitute a limitation to the present disclosure. Among them:

[0013] Figure 1 is a schematic flowchart of a training method of a document extraction model according to an embodiment of the present disclosure;

[0014] Figure 2 is a schematic flowchart of a training method of a document extraction model according to an embodiment of the present disclosure;

[0015] Figure 3 is a schematic diagram of a guiding example according to an embodiment of the present disclosure;

[0016] Figure 4Schematic diagram of the chain of thought processing logic according to an embodiment of the present disclosure;

[0017] Figure 5 Flow schematic diagram of the training method of the document extraction model according to an embodiment of the present disclosure;

[0018] Figure 6 Flow schematic diagram of the document extraction method according to an embodiment of the present disclosure;

[0019] Figure 7 Schematic structural diagram of the training device of the document extraction model according to an embodiment of the present disclosure;

[0020] Figure 8 Schematic structural diagram of the document extraction device according to an embodiment of the present disclosure;

[0021] Figure 9 Schematic block diagram of an electronic device according to an embodiment of the present disclosure. Detailed implementation manners

[0022] The following describes exemplary embodiments of the present disclosure with reference to the accompanying drawings. Various details of the embodiments of the present disclosure are included to facilitate understanding, and they should be considered merely exemplary. Therefore, those of ordinary skill in the art should recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, for clarity and conciseness, the descriptions of well-known functions and structures are omitted below.

[0023] The following briefly describes the technical fields related to the solutions of the present disclosure:

[0024] Artificial Intelligence (AI) is a discipline that studies how to make computers simulate certain thinking processes and intelligent behaviors of humans (such as learning, reasoning, thinking, planning, etc.). It includes both hardware-level technologies and software-level technologies. Artificial Intelligence hardware technologies generally include several aspects such as computer vision technology, speech recognition technology, natural language processing technology, machine learning / deep learning, big data processing technology, and knowledge graph technology.

[0025] Natural Language Processing (NLP) is an important research direction in the field of artificial intelligence. It integrates knowledge from multiple disciplinary fields such as linguistics, computer science, machine learning, mathematics, and cognitive psychology. It is an interdisciplinary subject that combines computer science, artificial intelligence, and linguistics. It includes two main aspects: natural language understanding and natural language generation. Its research content includes various levels such as characters, words, phrases, sentences, paragraphs, and chapters. It is a bridge for communication between machine language and human language. Its aim is to enable machines to understand, interpret, and generate human language, achieve effective communication between humans and machines, and enable computers to perform tasks such as language translation, sentiment analysis, and text summarization.

[0026] A large model refers to a machine learning model with a huge parameter scale and complexity. It requires a large amount of computing resources and storage space for training and storage, and often requires distributed computing and special hardware acceleration technologies. Large models have stronger generalization ability and expression ability.

[0027] Deep Learning (DL) is a new research direction in the field of Machine Learning (ML). It is introduced into machine learning to make it closer to the original goal - artificial intelligence. Deep learning is to learn the internal laws and representation levels of sample data, and the information obtained in these learning processes is very helpful for the interpretation of data such as text, images, and sounds. Its ultimate goal is to enable machines to have the ability of analysis and learning like humans, and be able to recognize data such as text, images, and sounds. Deep learning is a complex machine learning algorithm, and the effects achieved in speech and image recognition far exceed previous related technologies.

[0028] The following describes a training method and a document extraction method of a document extraction model according to an embodiment of the present disclosure with reference to the accompanying drawings.

[0029] Figure 1 It is a schematic flowchart of a training method of a document extraction model according to an embodiment of the present disclosure. It should be noted that the execution subject of the training method of the document extraction model in this embodiment is a training device of the document extraction model. The training device of the document extraction model can specifically be a hardware device, or software in a hardware device, etc. Among them, the hardware device is, for example, a terminal device, a server, etc.

[0030] As Figure 1 shown, the training method of the document extraction model proposed in this embodiment includes the following steps:

[0031] S101. Obtain a first sample document.

[0032] It should be noted that the present disclosure does not limit the specific manner of obtaining the first sample document, which can be selected according to the actual situation.

[0033] Optionally, a sample audio file can be obtained, and through Automatic Speech Recognition (ASR) technology, the sample audio file is converted into text form to obtain the first sample document.

[0034] It should be noted that the present disclosure does not limit the type of the sample audio file.

[0035] For example, it can be an audio file in professional scenarios such as finance, law, and finance; for another example: it can be an audio file in a dialogue scenario or a question-and-answer scenario; for yet another example: it can be an audio file in a meeting record scenario or an interview scenario.

[0036] S102. Perform a preprocessing process corresponding to the processing task on the first sample document to obtain a second sample document corresponding to the processing task.

[0037] It should be noted that if the length of the first sample document is too long, if the first sample document is directly passed into the first large model for processing, there may be a problem of exceeding the context length of the first large model and reporting an error. Moreover, when the length of the first sample document processed at one time is too long, it is often impossible to effectively perform the processing task, resulting in inaccurate document extraction results.

[0038] In the embodiments of the present disclosure, after obtaining the first sample document, a preprocessing process corresponding to the processing task can be performed on the first sample document to obtain a second sample document corresponding to the processing task.

[0039] It should be noted that the present disclosure does not limit the type of the processing task. Optionally, the processing task at least includes an extraction of question-and-answer pairs task and an extraction of abstract task.

[0040] In the embodiments of the present disclosure, for the extraction of abstract task, the preprocessing process can be: converting the format of the timestamps in the first sample document to obtain time information in the target format, where the basic unit amount occupied by the time information in the target format is less than the basic unit amount occupied by the timestamps, merging multiple lines of text belonging to the same semantic content in the first sample document according to the set number of lines, and deleting redundant timestamps in the multiple lines of text to obtain the second sample document.

[0041] In the embodiments of the present disclosure, for the extraction of question-and-answer pairs task, the preprocessing process can be: starting from the starting position of the first sample document, identifying the speakers in the first sample document, tracking the same speaker, and in response to identifying a speaker switch, merging the document content between two adjacent switches to obtain the second sample document.

[0042] S103. The information extraction process of performing a processing task on the second sample document through the first large model to obtain the document extraction result of the first sample document.

[0043] In the embodiments of the present disclosure, the second sample document is understood through the first large model, and the second sample document is segmented according to the understanding result to obtain a paragraph set. The information extraction process of performing a processing task on the paragraphs in the paragraph set through the first large model is used to obtain the document extraction result of the first sample document.

[0044] It should be noted that if the first sample document is directly input into the first large model for processing, there may be an error due to exceeding the context length of the first large model. The second sample document can be understood through the first large model, and the second sample document can be segmented according to the understanding result, that is, rough segmentation processing, to obtain a paragraph set. The information extraction process of performing a processing task on each paragraph in the paragraph set is used to obtain the document extraction result of the first sample document.

[0045] Optionally, a prompt word corresponding to the processing task can be obtained, and the information extraction process of performing the processing task on the paragraphs in the paragraph set through the first large model according to the prompt word is used to obtain the document extraction result of the first sample document.

[0046] For example, for the task of extracting an abstract, if the corresponding prompt word is prompt1, the first large model performs the task of extracting an abstract on the paragraphs in the paragraph set according to the prompt word prompt1 to obtain the abstract extraction result of each paragraph. By summarizing the abstract extraction results of each paragraph, the document extraction result of the first sample document is obtained.

[0047] For example, for the task of extracting question-answer pairs, if the corresponding prompt word is prompt2, the first large model performs the task of extracting question-answer pairs on the paragraphs in the paragraph set according to the prompt word prompt2 to obtain the question-answer pair extraction result of each paragraph. By summarizing the question-answer pair extraction results of each paragraph, the document extraction result of the first sample document is obtained.

[0048] S104. Using the first sample document and the document extraction result as training samples, fine-tuning the second large model based on the training samples to obtain a document extraction model.

[0049] Optionally, after obtaining the training samples, in order to improve the quality of the training samples, a screening process corresponding to the processing task is performed on the training samples to screen out high-quality training samples from the training samples. The screened high-quality training samples are used as the final training samples, and the second large model is fine-tuned based on the final training samples to obtain a document extraction model.

[0050] For example, for the task of extracting abstracts, the extraction results of each paragraph often use sentence patterns such as "firstly", "then", "finally", etc., resulting in a poor user experience. In addition, the extraction results of each paragraph may use paraphrasing sentence patterns such as "this paragraph describes", which does not conform to the direct description language style of the abstract. To address the above problems, after obtaining the training samples, the training samples with the above problems can be removed, and the word count requirement can be increased, that is, the word count of the output abstract must reach 80% of the required output word count and the required word count must be more than 200 words, so as to retain high-quality training samples as the final training samples for fine-tuning.

[0051] In the embodiment of the present disclosure, after obtaining the document extraction results, the first sample document and the document extraction results are used as training samples, and a lightweight supervised fine-tuning (SFT) strategy is adopted to fine-tune the second large model based on the training samples, so that the fine-tuned document extraction model has stronger instruction-following ability and adaptability in processing tasks.

[0052] Optionally, based on the training samples and by using the SFT strategy to fine-tune the second large model, the curve change trend of the loss function during the fine-tuning process of the second large model can be obtained, and it can be determined whether the second large model meets the fine-tuning end condition. In response to the second large model meeting the fine-tuning end condition, a document extraction model is obtained.

[0053] It should be noted that compared with the un-fine-tuned general large model, the SFT strategy improves the performance of the document extraction model, that is, the document extraction model performs better in processing tasks, enhances the instruction-following ability of the document extraction model, and through lightweight optimization, reduces resource consumption. That is, compared with fully training a large model, the SFT strategy only needs to perform targeted adjustments on specific tasks, reduces the computing cost, improves the deployability of the model in the production environment, and based on the SFT strategy, the document extraction model can be adapted to documents in different scenarios, that is, it can quickly adapt to the processing task requirements in different fields (such as finance, law, academic, etc.), improving the wide applicability of the document extraction model.

[0054] The training method of the document extraction model according to an embodiment of the present disclosure includes: obtaining a first sample document, performing a preprocessing process corresponding to a processing task on the first sample document to obtain a second sample document corresponding to the processing task, performing an information extraction process of the processing task on the second sample document through a first large model to obtain a document extraction result of the first sample document, using the first sample document and the document extraction result as training samples, and fine-tuning a second large model based on the training samples to obtain a document extraction model. Thus, the present disclosure avoids the problem that the first sample document is too long and exceeds the context length of the first large model by performing a preprocessing process on the first sample document. After obtaining the training samples, a screening process corresponding to the processing task is performed on the training samples to ensure the quality of the training samples. Fine-tuning the second large model based on the training samples improves the accuracy and efficiency in the fine-tuning process of the second large model, reduces the resources for obtaining the document extraction model, and enhances the performance of the document extraction model for document extraction.

[0055] Figure 2 It is a schematic flowchart of the training method of the document extraction model according to an embodiment of the present disclosure.

[0056] As Figure 2 shown, the training method of the document extraction model proposed in this embodiment includes the following steps:

[0057] S201. Obtain a first sample document.

[0058] S202. Perform a preprocessing process corresponding to the processing task on the first sample document to obtain a second sample document corresponding to the processing task.

[0059] For the relevant content of steps S201 - S202, reference can be made to the above embodiment, and details are not elaborated here.

[0060] The above-mentioned S103 in the above embodiment, "performing an information extraction process of the processing task on the second sample document through a first large model to obtain a document extraction result of the first sample document", specifically includes S203 and S204.

[0061] S203. Understand the second sample document through the first large model, and perform segmentation processing on the second sample document according to the understanding result to obtain a paragraph set.

[0062] It should be noted that when the number of words in the second sample document is too large, for example, when the number of words in the second sample document is greater than 10,000 words, or even close to or greater than 20,000 words, it may exceed the context limit of the first large model and cause an error. Therefore, a first large model that supports a larger context length can be selected, and segmentation processing is performed on the second sample document according to the understanding result to obtain a paragraph set.

[0063] It should be noted that in the related art, the second sample document is directly segmented according to the preset segmented word count to obtain a paragraph set, and the length of each paragraph can be kept within the same range. However, the above method may separate the same content into different paragraphs, that is, the upper part of the content is in the previous paragraph and the lower part is in the subsequent paragraph, resulting in inaccurate document extraction results.

[0064] In the embodiments of the present disclosure, the second sample document can be understood based on the first large model, and segmented processing can be performed according to the understanding result to output the segmentation points of the second sample document. According to the segmentation points and the word count threshold corresponding to the processing task, the second sample document is segmented to obtain a paragraph set.

[0065] It should be noted that segmenting the second sample document according to the segmentation points and the word count threshold corresponding to the processing task can not only ensure the continuity of the same content but also avoid the problem of exceeding the context limit of the first large model. It is possible to obtain the word count threshold corresponding to the processing task while not exceeding the context limit of the first large model and improving the inference efficiency of the first large model. Optionally, the word count threshold corresponding to the processing task can be set to 4000 words, 4500 words, etc.

[0066] Optionally, the first sample document can be segmented based on the segmentation points to obtain multiple text blocks. For the i-th text block, determine the first word count of the i-th text block, determine the j-th paragraph where the (i - 1)-th text block is located and the second word count of the j-th paragraph, obtain the total word count of the first word count and the second word count. In response to the total word count being less than the word count threshold, merge the i-th text block into the j-th paragraph. In response to the total word count being greater than the word count threshold, use the i-th text block as the first text block of the (j + 1)-th paragraph. After traversing all the text blocks, a paragraph set is obtained, where i and j are integers greater than or equal to 1.

[0067] In the embodiments of the present disclosure, determine the number of characters in different languages in the i-th text block, determine the compensation coefficient for each language, and determine the first word count of the i-th text block according to the number of characters in different languages and the compensation coefficient corresponding to the language.

[0068] Among them, when the language is Chinese, the character is used as the minimum unit, and when the language is English, the word is used as the minimum unit.

[0069] For example, when the language is English, since there are many abbreviations in English, the English features can be statistically analyzed in advance, and the compensation coefficient of English is determined to be 1.6.

[0070] For example, if the i-th text block only contains Chinese and English, the first word count of the i-th text block can be determined according to the following formula:

[0071] Ntot = N chn + 1.6×N eng

[0072] Wherein, N chn is the number of Chinese characters in the i-th text block, N eng is the number of English characters in the i-th text block, 1.6 is the compensation coefficient for English, N tot is the first word count of the i-th text block.

[0073] S204. An information extraction process for performing a processing task on the paragraphs in the paragraph set through a first large model to obtain a document extraction result of the first sample document.

[0074] In the embodiments of the present disclosure, global constraint information corresponding to the processing task is obtained, the system prompt of the first large model is determined, a prompt word corresponding to the processing task is generated based on the system prompt and the global constraint information, and an information extraction process for performing the processing task on the paragraphs in the paragraph set through the first large model according to the prompt word is carried out to obtain a document extraction result of the first sample document.

[0075] Optionally, if the processing task is an abstract extraction task, the abstract composition elements of the abstract extraction task are determined, and global constraint information corresponding to the abstract extraction task is obtained according to the abstract composition elements and the constraint information of the abstract composition elements. Among them, the abstract composition elements include time information, and the constraint information of the time information is to output the paragraph numbers associated with the time information.

[0076] It should be noted that if the first sample document is obtained by converting an audio file, in the abstract extraction task, the time information can locate the position of the document extraction result in the audio file. However, the first large model will frequently output non-existent time information, resulting in inaccurate positioning in the end, and will introduce the content of the next paragraph in the description of the current paragraph, causing the content to appear repeatedly. Then, when requiring the first large model to output content, the constraint information of the time information is to output the paragraph numbers associated with the time information.

[0077] In the embodiments of the present disclosure, after generating a prompt word corresponding to the processing task based on the system prompt and the global constraint information, it further includes: determining at least one of the guiding examples of the set scenario corresponding to the processing task and the output constraint information of the document extraction result, and optimizing the prompt word corresponding to the processing task according to at least one of the guiding examples and the output constraint information.

[0078] It should be noted that since the content to be output for the abstract extraction task is relatively large, it is often necessary to understand and summarize it in combination with the context. If the document extraction result is required to be output in JSON format, some capabilities of the first large model need to be allocated to handle the JSON format problem, resulting in less content output for the abstract extraction task and being insufficiently comprehensive. Therefore, for the abstract extraction task, the output constraint information can be in plain text format.

[0079] It should be noted that since the content output for the question-and-answer pair extraction task is relatively small, it is often only necessary to summarize the questions and answers from the paragraphs. Therefore, when the document extraction result is required to be output in JSON format, it will not cause the first large model to focus too much on the format problem and ignore the task. Therefore, for the question-and-answer pair extraction task, the output constraint information can be in JSON format.

[0080] Optionally, for the question-and-answer pair extraction task, the first large model may extract non-existent question-and-answer pairs from the declarative sentences in the first document and output them, and it is unable to merge questions with similar content, resulting in short and scattered question-and-answer pairs. In the current problem scenario, since the number of tokens occupied by the finally output question-and-answer pairs is small, after trying to increase the constraints on the question-and-answer pairs and finding that the effect is not ideal after attempting to increase the definition of the question-and-answer pairs and how to merge similar questions, the guiding examples for the corresponding set scenario of the processing task are determined. By adding guiding examples, such as Figure 3 shown, by adding guiding examples, it is told to the first large model that it is a declarative sentence and questions are not allowed to be extracted from it to avoid this situation, as well as the question-and-answer pairs that can and cannot be merged.

[0081] It should be noted that when directly adding the few-shot guiding examples to the system prompt, the output of the first large model is relatively unstable: it can merge similar questions but will also extract non-existent question-and-answer pairs, will not extract non-existent question-and-answer pairs but cannot merge similar questions, and will also affect the effect of the remaining constraint information in the prompt to a certain extent. After adding the guiding examples to a part of the user input, it is found that the output effect of the first large model is more stable, and it can not only avoid extracting question-and-answer pairs from declarative sentences, but also merge as many similar question-and-answer pairs into one as possible.

[0082] In the embodiments of the present disclosure, if the processing task is the question-and-answer pair extraction task, the processing logic of the Chain Of Thought (COT) corresponding to the question-and-answer pair extraction task is determined, and according to the COT processing logic, the optimized prompt is adjusted to obtain the final prompt for the question-and-answer pair extraction task.

[0083] It should be noted that in order to further enhance the processing ability of the first large model to merge similar questions, the optimized prompt words can be adjusted according to the COT processing logic to guide the first large model to complete the task of merging similar questions step by step. Essentially, the COT processing logic can be understood as a detailed task processing flow for the first large model, which usually details the entire task from start to finish in the form of sub-steps, such as Figure 4 shown, to complete the task of extracting question-answer pairs.

[0084] In the embodiments of the present disclosure, for the task of extracting abstracts, the first large model performs an abstract extraction process on the paragraph according to the prompt words corresponding to the task of extracting abstracts, obtains the abstract information of the paragraph, and determines the document extraction result of the first sample document according to the abstract information of the paragraph.

[0085] In the embodiments of the present disclosure, for the task of extracting question-answer pairs, the first large model performs question-answer pair extraction on the paragraph according to the prompt words corresponding to the task of extracting question-answer pairs, using the COT processing logic, obtains the question-answer pairs of the paragraph, and obtains the document extraction result of the first sample document according to the question-answer pairs of the paragraph.

[0086] S205: Use the first sample document and the document extraction result as training samples, and fine-tune the second large model based on the training samples to obtain a document extraction model.

[0087] According to the training method of the document extraction model in the embodiments of the present disclosure, by obtaining the first sample document, performing a preprocessing process corresponding to the processing task on the first sample document to obtain a second sample document corresponding to the processing task, understanding the second sample document by the first large model, and performing segmentation processing on the second sample document according to the understanding result to obtain a paragraph set, performing an information extraction process of the processing task on the paragraphs in the paragraph set by the first large model to obtain the document extraction result of the first sample document, using the first sample document and the document extraction result as training samples, and fine-tuning the second large model based on the training samples to obtain a document extraction model. Thus, the present disclosure performs segmentation processing on the second sample document according to the understanding result to obtain a paragraph set, which can not only ensure the continuity of the same content but also avoid the problem of exceeding the context limit of the first large model, and can obtain the document extraction result of the first sample document more accurately and efficiently, improving the accuracy and reliability in the fine-tuning process of the second large model.

[0088] Figure 5 is a schematic flowchart of the training method of the document extraction model according to an embodiment of the present disclosure.

[0089] As Figure 5 shown, the training method of the document extraction model proposed in this embodiment includes the following steps:

[0090] S501. Obtain the first sample document.

[0091] For the relevant content of step S501, reference can be made to the above embodiments and will not be elaborated here.

[0092] Optionally, if the processing task is an abstract extraction task, S102 in the above embodiments, "Perform the preprocessing process corresponding to the processing task on the first sample document to obtain the second sample document corresponding to the processing task", may specifically include S502 and S503.

[0093] S502. Convert the format of the timestamps in the first sample document to obtain time information in the target format, and the basic unit amount occupied by the time information in the target format is less than the basic unit amount occupied by the timestamps.

[0094] It should be noted that the timestamps in the first sample document often are displayed in the format of hours, minutes, and seconds. For example, the format of the timestamp is hh:mm:ss. In this case, if the preprocessing process is not performed on the first sample document and the first sample document is directly passed as input to the first large model, during the process of converting the text in the first sample document into basic unit amounts of tokens, each timestamp occupies 8 tokens. Therefore, it is necessary to save the number of tokens occupied by the input as much as possible to increase the output space of the first large model as much as possible.

[0095] Optionally, the format of the timestamps in the first sample document can be converted to obtain time information in the format of seconds (target format), for example: xxxx. In this case, each timestamp occupies at most 4 tokens, saving the number of tokens occupied by the input.

[0096] S503. Merge multiple lines of text belonging to the same semantic content in the first sample document according to the set number of lines, and delete the redundant timestamps in the multiple lines of text to obtain the second sample document.

[0097] It should be noted that the first sample document may split the same semantic content into multiple lines of text, and each line of text has a timestamp. Even after obtaining the time information in the target format, the basic unit amount occupied by the timestamps is still particularly large. To further save the basic unit amount occupied by the timestamps, multiple lines of text belonging to the same semantic content can be merged according to the set number of lines, and the redundant timestamps in the multiple lines of text can be deleted to obtain the second sample document.

[0098] It should be noted that since the task of extracting the abstract only requires obtaining the key information of the first sample document, the importance of the speaker identification is relatively low. Therefore, when merging according to the set number of lines, whether the speaker is changed will not be considered, and the merging will be directly performed according to the set number of lines, and the redundant timestamps in multiple lines of text will be deleted to save the basic unit amount occupied by the timestamps.

[0099] Optionally, the set number of lines can be 3 lines, that is, multiple lines of text belonging to the same semantic content are merged according to 3 lines. When the set number of lines is too large, the positioning deviation of the first sample document based on the document extraction result will increase in the subsequent process. For example, if the first sample document is obtained by converting an audio file and the real timestamp is 50 seconds, but because it is merged with the content with a timestamp of 0 seconds in front, it will be located at the 0 second of the audio file, and the user will need to spend an additional 50 seconds when reviewing.

[0100] Optionally, if the processing task is the task of extracting question-and-answer pairs, step S102 in the above embodiments, "performing the preprocessing process corresponding to the processing task on the first sample document to obtain the second sample document corresponding to the processing task", may specifically include S504 and S505.

[0101] S504. Starting from the starting position of the first sample document, identify the speakers in the first sample document.

[0102] It should be noted that for the task of extracting question-and-answer pairs, the question-and-answer pairs need to come from different speakers respectively. In the first sample document obtained through ASR technology, it cannot be guaranteed that the words of the same speaker are completely left in one line, and there may even be multiple consecutive lines of content from the same speaker. In order to ensure that the first large model can extract effective question-and-answer pairs, the speakers in the first sample document can be identified starting from the starting position of the first sample document.

[0103] S505. Track the same speaker, and in response to identifying a speaker switch, merge the document content between two adjacent switches to obtain the second sample document.

[0104] In the embodiments of the present disclosure, the same speaker can be tracked, and in response to identifying a speaker switch, the document content between two adjacent switches is merged to obtain the second sample document.

[0105] It should be noted that since the document content between two adjacent switches is merged, that is, a new line indicates a speaker switch, and the task of extracting question-and-answer pairs does not need to output the timestamp to locate the specific position of the audio file. In the embodiments of the present disclosure, after obtaining the second sample document, the timestamps and speaker identifications in the second sample document can be deleted to save the basic unit amount occupied by the input to the greatest extent.

[0106] In the above embodiments, S103, "the information extraction process of performing a processing task on the second sample document through the first large model to obtain the document extraction result of the first sample document", may specifically include S506.

[0107] S506. Understand the second sample document through the first large model, and perform paragraph segmentation processing on the second sample document according to the understanding result to obtain a set of paragraphs.

[0108] Optionally, if the processing task is an abstract extraction task, S103, "the information extraction process of performing a processing task on the second sample document through the first large model to obtain the document extraction result of the first sample document" in the above embodiments, may specifically include S507 and S508.

[0109] S507. Perform an abstract extraction process on the paragraphs through the first large model according to the prompt words corresponding to the abstract extraction task to obtain the abstract information of the paragraphs.

[0110] S508. Determine the document extraction result of the first sample document according to the abstract information of the paragraphs.

[0111] Among them, the document extraction result includes the abstract information of the paragraphs and the paragraph numbers of the paragraphs.

[0112] In the embodiments of the present disclosure, in order to make the document extraction result more comprehensive, detailed, and accurate, after obtaining the paragraph numbers, the time information mapped by the paragraph numbers associated with the abstract information can be determined, and the paragraph numbers in the abstract information are replaced based on the time information to obtain the target abstract information of the paragraphs. Based on the target abstract information, the document extraction result of the first sample document is determined.

[0113] Optionally, a mapping relationship between the paragraph numbers and the time information can be constructed, and by querying the mapping relationship, the time information mapped by the paragraph numbers associated with the abstract information is determined, and the paragraph numbers in the abstract information are replaced with the time information to obtain the target abstract information of the paragraphs. Based on the target abstract information, the document extraction result of the first sample document is determined.

[0114] S509. Use the first sample document and the document extraction result as training samples to fine-tune the second large model based on the training samples to obtain a document extraction model for performing the abstract extraction task.

[0115] Optionally, if the processing task is a question-and-answer pair extraction task, S103, "the information extraction process of performing a processing task on the second sample document through the first large model to obtain the document extraction result of the first sample document" in the above embodiments, may specifically include S5010 and S5011.

[0116] S5010. Use the first large model to extract the prompt words corresponding to the task of extracting Q&A pairs, and use the COT processing logic to perform Q&A pair extraction on the paragraph to obtain the Q&A pairs of the paragraph.

[0117] S5011. Obtain the document extraction result of the first sample document according to the Q&A pairs of the paragraph.

[0118] S5012. Use the first sample document and the document extraction result as training samples, and fine-tune the second large model based on the training samples to obtain a document extraction model for performing the task of extracting Q&A pairs.

[0119] A training method for a document extraction model according to an embodiment of the present disclosure. By obtaining a first sample document, if the processing task is an abstract extraction task, the time stamps in the first sample document are format-converted to obtain time information in a target format, and the basic unit amount occupied by the time information in the target format is less than the basic unit amount occupied by the time stamp. Multiple lines of text belonging to the same semantic content in the first sample document are merged according to a set number of lines, and redundant time stamps in the multiple lines of text are deleted to obtain a second sample document. The first large model performs an abstract extraction process on the paragraph according to the prompt words corresponding to the abstract extraction task to obtain the abstract information of the paragraph. According to the abstract information of the paragraph, the document extraction result of the first sample document is determined. Using the first sample document and the document extraction result as training samples, the second large model is fine-tuned to obtain a document extraction model for performing the abstract extraction task. If the processing task is an extraction of question-answer pairs task, starting from the starting position of the first sample document, the speakers in the first sample document are identified, and the same speaker is tracked. In response to identifying a speaker switch, the document content between two adjacent switches is merged to obtain a second sample document. The first large model performs question-answer pair extraction on the paragraph according to the prompt words corresponding to the extraction of question-answer pairs task using the COT processing logic to obtain the question-answer pairs of the paragraph. According to the question-answer pairs of the paragraph, the document extraction result of the first sample document is obtained. Using the first sample document and the document extraction result as training samples, the second large model is fine-tuned to obtain a document extraction model for performing the extraction of question-answer pairs task. Thus, the present disclosure performs a preprocessing process corresponding to the processing task on the first sample document to obtain a second sample document corresponding to the processing task, which can save the basic unit amount occupied by the input to the greatest extent. Based on the target abstract information, the document extraction result of the first sample document is determined, and the abstract of the first sample document can be obtained more detailedly and accurately. By using the first large model to perform question-answer pair extraction on the paragraph according to the prompt words corresponding to the extraction of question-answer pairs task using the COT processing logic, the question-answer pairs can be obtained more effectively and comprehensively. And the second large model is fine-tuned based on the training samples, reducing the resources for obtaining the document extraction model, improving the accuracy and efficiency in the fine-tuning process of the second large model, enhancing the performance of the document extraction model for document extraction, and ensuring the accuracy of the document extraction result.

[0120] Figure 6 It is a schematic flowchart of a document extraction method according to an embodiment of the present disclosure. It should be noted that the execution subject of the document extraction method in this embodiment is a document extraction device, and the document extraction device can specifically be a hardware device or software in a hardware device, etc. The hardware device can be, for example, a terminal device, a server, etc.

[0121] As Figure 6 shown, the document extraction method proposed in this embodiment includes the following steps:

[0122] S601. Obtain a first document.

[0123] Wherein, the first document is any document that needs to be extracted.

[0124] It should be noted that the present disclosure does not limit the specific manner of obtaining the first document, and it can be selected according to the actual situation.

[0125] Optionally, an audio file can be obtained, and the audio file can be converted into a text form through ASR technology to obtain the first document.

[0126] It should be noted that the present disclosure does not limit the type of the audio file. For example, it can be an audio file in professional scenarios such as finance, law, and finance; for another example, it can be an audio file in a dialogue scenario or a question-and-answer scenario; for still another example, it can be an audio file in a meeting record scenario or a news interview scenario.

[0127] Optionally, a document to be processed can be obtained, and at least one document can be selected from the document to be processed as the first document.

[0128] It should be noted that the present disclosure does not limit the type of the document to be processed. For example, it can be a document in professional scenarios such as finance, law, and finance; for another example, it can be a document in a dialogue scenario or a question-and-answer scenario; for still another example, it can be a document in a meeting record scenario or a news interview scenario.

[0129] S602. Execute a preprocessing process corresponding to the processing task on the first document to obtain a second document corresponding to the processing task.

[0130] In the embodiments of the present disclosure, if the processing task is an abstract extraction task, the time stamps in the first document can be format-converted to obtain time information in a target format, and the basic unit amount occupied by the time information in the target format is less than the basic unit amount occupied by the time stamp. Multiple lines of text belonging to the same semantic content in the first document are merged according to a set number of lines, and redundant time stamps in the multiple lines of text are deleted to obtain a second document corresponding to the abstract extraction task.

[0131] In the embodiments of the present disclosure, if the processing task is a question-and-answer pair extraction task, starting from the starting position of the first document, the speakers in the first document are identified, the same speaker is tracked, and in response to identifying a speaker switch, the document content between two adjacent switches is merged to obtain a second document corresponding to the question-and-answer pair extraction task, and the time stamps and speaker identifiers in the second document are deleted to obtain the final second document corresponding to the question-and-answer pair extraction task.

[0132] S603. Perform the information extraction process corresponding to the processing task on the second document through the document extraction model to obtain the document extraction result of the first document.

[0133] In the embodiments of the present disclosure, if the processing task is an abstract extraction task, the document extraction model for performing the abstract extraction task is used to understand the second document, and the second document is segmented according to the understanding result to obtain a paragraph set. The document extraction model for performing the abstract extraction task extracts the abstract of the paragraphs in the paragraph set according to the prompt words corresponding to the abstract extraction task to obtain the abstract information of the paragraphs. According to the abstract information of the paragraphs, the document extraction result of the first document is determined.

[0134] Optionally, the time information mapped by the paragraph number associated with the abstract information of the paragraphs can be determined based on the paragraph numbers of the paragraphs in the document extraction result, and the paragraph numbers in the abstract information are replaced based on the time information to obtain the target abstract information of the paragraphs. Based on the target abstract information, the document extraction result of the first document is determined, and it is possible to locate back to the first sample document from the document extraction result.

[0135] For example, if the first document is obtained by converting an audio file and includes a total of 4 paragraphs, for paragraph 2, if the time information mapped by paragraph 2 is 06:31, the paragraph numbers in the abstract information can be replaced based on the time information to obtain the target abstract information of paragraph 2. By clicking on the time information in the target abstract information, the position of the target abstract information in the audio file can be quickly located, which is beneficial for the user to quickly trace back and improves the user experience.

[0136] In the embodiments of the present disclosure, if the processing task is a question-and-answer pair extraction task, the document extraction model for performing the question-and-answer pair extraction task is used to understand the second document, and the second document is segmented according to the understanding result to obtain a paragraph set. The document extraction model for performing the question-and-answer pair extraction task extracts the question-and-answer pairs of the paragraphs according to the prompt words corresponding to the question-and-answer pair extraction task by using the COT processing logic to obtain the question-and-answer pairs of the paragraphs. According to the question-and-answer pairs of the paragraphs, the document extraction result of the first document is obtained.

[0137] For example, for paragraph a, which is not shown here, if the processing task is to extract question-and-answer pairs, after obtaining the final prompt for the task of extracting question-and-answer pairs according to the guiding example and the Chain of Thought (COT) processing logic, the document extraction model for the task of extracting question-and-answer pairs executes the extraction of question-and-answer pairs for paragraph a according to the corresponding prompt for the task of extracting question-and-answer pairs, using the COT processing logic, and obtains the question-and-answer pairs S1 of paragraph a: "Q": "What is the approximate scale of your network?", "A": "There are a total of 150 people in the network, including about 60 couriers, 27 or 8 sorters, and 16 cars for delivering goods in the urban area." In the related art, the prompt is not optimized and adjusted, and the model executes the extraction of question-and-answer pairs according to the corresponding prompt for the task of extracting question-and-answer pairs, and obtains the question-and-answer pairs S2 of paragraph a: "Q": "What is the approximate scale of your network?", "A": "There are approximately 150 people, and there are 16 cars for delivering goods in the urban area."; "Q": "Among your 150 people, approximately what proportion are couriers?", "A": "There are more than 50 couriers, about 60."; "Q": "How many sorters are there in your network?", "A": "There are more than 20 sorters, twenty-seven or eight." Analyzing the question-and-answer pairs S1 of paragraph a shows that similar question-and-answer pairs can be merged into one, making the question-and-answer pairs more concentrated. Analyzing the question-and-answer pairs S2 of paragraph a shows that many questions are short and their contents are very similar, resulting in short and scattered question-and-answer pairs.

[0138] Among them, the document extraction model is a model obtained by using the training method of the first aspect, and can be a document extraction model for executing the task of extracting question-and-answer pairs or a document extraction model for executing the task of extracting abstracts.

[0139] According to the document extraction method of the present disclosure, by obtaining the first document, performing the preprocessing process corresponding to the processing task on the first document to obtain the second document corresponding to the processing task, and performing the information extraction process corresponding to the processing task on the second document through the document extraction model to obtain the document extraction result of the first document. Thus, the present disclosure performs the information extraction process corresponding to the processing task on the second document through the document extraction model to obtain the document extraction result of the first document, which can obtain the document extraction result more accurately and efficiently. Based on the document extraction model for executing the task of extracting abstracts, the obtained document extraction result can quickly achieve positioning and backtracking, better meet the user's needs, improve the user experience, be applicable to documents in different scenarios, and have wide applicability.

[0140] In the technical solution of the present disclosure, the acquisition, storage, and application of the user's personal information involved all comply with the provisions of relevant laws and regulations and do not violate public order and good customs.

[0141] Corresponding to the training methods of the document extraction models provided in the above several embodiments, an embodiment of the present disclosure also provides a training device for a document extraction model. Since the training device for the document extraction model provided in the embodiments of the present disclosure corresponds to the training methods of the document extraction models provided in the above several embodiments, the implementation manners of the training methods of the document extraction models are also applicable to the training device for the document extraction model provided in this embodiment, and will not be described in detail in this embodiment.

[0142] Figure 7 It is a schematic structural diagram of a training device for a document extraction model according to an embodiment of the present disclosure.

[0143] As Figure 7 shown, the training device 700 for the document extraction model includes: a first acquisition module 710, a second acquisition module 720, a processing module 730, and a fine-tuning module 740.

[0144] The first acquisition module 710 is configured to acquire a first sample document;

[0145] The second acquisition module 720 is configured to perform a preprocessing process corresponding to the processing task on the first sample document to obtain a second sample document corresponding to the processing task;

[0146] The processing module 730 is configured to perform an information extraction process of the processing task on the second sample document through a first large model to obtain a document extraction result of the first sample document;

[0147] The fine-tuning module 740 is configured to use the first sample document and the document extraction result as training samples, and fine-tune a second large model based on the training samples to obtain a document extraction model. Wherein, the second acquisition module 720 is further configured to: acquire time information of the sample document segment; sort the sample document segments from earliest to latest according to the time information of the sample document segment; and determine the serial number of the sample document segment according to the sorting result.

[0148] Wherein, the processing module 730 is further configured to: understand the second sample document through the first large model, and perform segmentation processing on the second sample document according to the understanding result to obtain a paragraph set; and perform an information extraction process of the processing task on the paragraphs in the paragraph set through the first large model to obtain a document extraction result of the first sample document.

[0149] Among them, the processing module 730 is further configured to: obtain the global constraint information corresponding to the processing task; determine the system prompt of the first large model; generate a prompt word corresponding to the processing task based on the system prompt and the global constraint information; and perform an information extraction process of the processing task on the paragraphs in the paragraph set according to the prompt word by the first large model to obtain the document extraction result of the first sample document.

[0150] Among them, after generating the prompt word corresponding to the processing task based on the system prompt and the global constraint information, the apparatus 700 is further configured to: determine at least one of the guiding example of the set scenario corresponding to the processing task and the output constraint information of the document extraction result; and optimize the prompt word corresponding to the processing task according to at least one of the guiding example and the output constraint information.

[0151] Among them, when the processing task is a question-answer pair extraction task, the apparatus 700 is further configured to: determine the chain of thought COT processing logic corresponding to the question-answer pair extraction task; and adjust the optimized prompt word according to the COT processing logic to obtain the final prompt word for the question-answer pair extraction task.

[0152] Among them, when the processing task is a summary extraction task, the processing module 730 is further configured to: determine the summary composition elements of the summary extraction task; and obtain the global constraint information corresponding to the processing task according to the summary composition elements and the constraint information of the summary composition elements.

[0153] Among them, the processing module 730 is further configured to: perform a summary extraction process on the paragraph according to the prompt word corresponding to the summary extraction task by the first large model to obtain the summary information of the paragraph; and determine the document extraction result of the first sample document according to the summary information of the paragraph.

[0154] Among them, the summary composition elements include time information, the constraint information of the time information is to output the paragraph number associated with the time information, and the document extraction result includes the summary information of the paragraph and the paragraph number of the paragraph.

[0155] Among them, after determining the document extraction result of the first sample document according to the summary information of the paragraph, the apparatus 700 is further configured to: determine the time information mapped by the paragraph number associated with the summary information; replace the paragraph number in the summary information based on the time information to obtain the target summary information of the paragraph; and determine the document extraction result of the first sample document based on the target summary information.

[0156] Among them, the processing task is the task of extracting question-answer pairs. The processing module 730 is further configured to: use the first large model to execute question-answer pair extraction on the paragraph according to the prompt words corresponding to the task of extracting question-answer pairs by adopting the COT processing logic, so as to obtain the question-answer pairs of the paragraph; and obtain the document extraction result of the first sample document according to the question-answer pairs of the paragraph.

[0157] Among them, the processing module 730 is further configured to: understand the second sample document based on the first large model, perform segmentation processing according to the understanding result, and output the segmentation points of the second sample document; and segment the second sample document according to the segmentation points and the word count threshold corresponding to the processing task, so as to obtain the paragraph set.

[0158] Among them, the processing module 730 is further configured to: segment the first sample document based on the segmentation points to obtain a plurality of text blocks; for the i-th text block, determine the first word count of the i-th text block; determine the j-th paragraph where the (i - 1)-th text block is located and the second word count of the j-th paragraph; obtain the total word count of the first word count and the second word count; in response to the total word count being less than the word count threshold, merge the i-th text block into the j-th paragraph; in response to the total word count being greater than the word count threshold, use the i-th text block as the first text block of the (j + 1)-th paragraph; and in response to all the text blocks being traversed, obtain the paragraph set; where i and j are integers greater than or equal to 1.

[0159] Among them, the processing module 730 is further configured to: determine the number of characters in different languages in the i-th text block; determine the compensation coefficient for each language; and determine the first word count of the i-th text block according to the number of characters in different languages and the compensation coefficient corresponding to the language.

[0160] Among them, the second acquisition module 720 is further configured to: perform format conversion on the timestamps in the first sample document to obtain time information in a target format, and the basic unit amount occupied by the time information in the target format is less than the basic unit amount occupied by the timestamp; merge multiple lines of text belonging to the same semantic content in the first sample document according to the set number of lines, and delete the redundant timestamps in the multiple lines of text, so as to obtain the second sample document.

[0161] Among them, the second acquisition module 720 is further configured to: start from the starting position of the first sample document, identify the speakers in the first sample document; track the same speaker, and in response to identifying a speaker switch, merge the document content between two adjacent switches to obtain the second sample document.

[0162] Among them, the second acquisition module 720 is further configured to: delete the timestamps and speaker identifiers in the second sample document.

[0163] According to the training device of the document extraction model in the embodiments of the present disclosure, by obtaining a first sample document, performing a preprocessing process corresponding to the processing task on the first sample document to obtain a second sample document corresponding to the processing task, performing an information extraction process of the processing task on the second sample document through a first large model to obtain a document extraction result of the first sample document, using the first sample document and the document extraction result as training samples, and fine-tuning a second large model based on the training samples to obtain a document extraction model. Thus, the present disclosure avoids the problem that the first sample document is too long and exceeds the context length of the first large model by performing a preprocessing process on the first sample document. After obtaining the training samples, a screening process corresponding to the processing task is performed on the training samples to ensure the quality of the training samples. Fine-tuning the second large model based on the training samples improves the accuracy and efficiency in the fine-tuning process of the second large model, reduces the resources for obtaining the document extraction model, and improves the performance of the document extraction model for document extraction.

[0164] Corresponding to the document extraction methods provided in the above several embodiments, an embodiment of the present disclosure further provides a document extraction device. Since the document extraction device provided in the embodiments of the present disclosure corresponds to the document extraction methods provided in the above several embodiments, the implementation manners of the document extraction methods are also applicable to the document extraction device provided in this embodiment and will not be described in detail in this embodiment.

[0165] Figure 8 is a schematic structural diagram of a document extraction device according to an embodiment of the present disclosure.

[0166] As Figure 8 shown, the document extraction device 800 includes: an acquisition module 810, a preprocessing module 820, and a document extraction module 830. Among them:

[0167] The acquisition module 810 is configured to acquire a first document;

[0168] The preprocessing module 820 is configured to perform a preprocessing process corresponding to the processing task on the first document to obtain a second document corresponding to the processing task;

[0169] The document extraction module 830 is configured to perform an information extraction process corresponding to the processing task on the second document through a document extraction model to obtain a document extraction result of the first document; where the document processing model is a model trained by using the training method described in the first aspect.

[0170] According to the document extraction device of an embodiment of the present disclosure, by obtaining a first document, performing a preprocessing process corresponding to a processing task on the first document to obtain a second document corresponding to the processing task, and performing an information extraction process corresponding to the processing task on the second document through a document extraction model to obtain a document extraction result of the first document. Thus, the present disclosure performs an information extraction process corresponding to the processing task on the second document through the document extraction model to obtain a document extraction result of the first document, which can obtain the document extraction result more accurately and efficiently. Based on the document extraction model for performing the abstract extraction task, the obtained document extraction result can quickly achieve positioning and backtracking, better meet the user's needs, improve the user experience, be applicable to documents in different scenarios, and has wide applicability.

[0171] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium, and a computer program product.

[0172] Figure 9 A schematic block diagram of an exemplary electronic device 900 that can be used to implement embodiments of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as, a laptop computer, a desktop computer, a workbench, a personal digital assistant, a server, a blade server, a mainframe computer, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as, a personal digital processor, a cellular phone, a smart phone, a wearable device, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or claimed herein.

[0173] As Figure 9 shown, the device 900 includes a computing unit 901, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 902 or a computer program loaded from a storage unit 908 into a random access memory (RAM) 903. In the RAM 903, various programs and data required for the operation of the device 900 can also be stored. The computing unit 901, the ROM 902, and the RAM 903 are connected to each other through a bus 904. An input / output (I / O) interface 905 is also connected to the bus 904.

[0174] Multiple components in the device 900 are connected to the I / O interface 905, including: an input unit 906, such as a keyboard, a mouse, etc.; an output unit 907, such as various types of displays, speakers, etc.; a storage unit 908, such as a disk, an optical disc, etc.; and a communication unit 909, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 909 allows the device 900 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0175] The computing unit 901 can be various general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 901 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 901 executes the various methods and processes described above, such as the training method or the document extraction method of the document extraction model. For example, in some embodiments, the training of the document extraction model or the document extraction method can be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as the storage unit 908. In some embodiments, part or all of the computer program can be loaded and / or installed onto the device 900 via the ROM 902 and / or the communication unit 909. When the computer program is loaded into the RAM 903 and executed by the computing unit 901, one or more steps of the training of the document extraction model or the document extraction method described above can be executed. Alternatively, in other embodiments, the computing unit 901 can be configured to execute the training method of the document extraction model or the document extraction method by any other suitable means (e.g., by means of firmware).

[0176] The various embodiments of the systems and techniques described above in this document can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on a chip (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments can include: being implemented in one or more computer programs, which can be executed and / or interpreted on a programmable system including at least one programmable processor, the programmable processor can be a dedicated or general programmable processor, can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit the data and instructions to the storage system, the at least one input device, and the at least one output device.

[0177] The program code for implementing the methods of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general purpose computer, a special purpose computer, or other programmable data processing device, such that the program codes, when executed by the processor or controller, cause the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code may execute entirely on the machine, partly on the machine, as a stand-alone software package partly on the machine and partly on a remote machine, or entirely on the remote machine or server.

[0178] In the context of the present disclosure, a machine-readable medium may be a tangible medium that can contain or store a program for use by or in connection with an instruction execution system, apparatus, or device. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0179] In order to provide interaction with a user, the systems and techniques described herein may be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or a trackball) by which the user can provide input to the computer. Other kinds of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).

[0180] The systems and techniques described herein can be implemented in a computing system including backend components (e.g., as a data server), or a computing system including middleware components (e.g., an application server), or a computing system including frontend components (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described herein), or a computing system including any combination of such backend components, middleware components, or frontend components. The components of the system can be interconnected with each other by digital data communication in any form or medium (e.g., a communication network). Examples of communication networks include: local area network (LAN), wide area network (WAN), the Internet, and blockchain networks.

[0181] A computer system can include a client and a server. The client and the server are generally far from each other and typically interact through a communication network. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, a server of a distributed system, or a server incorporating blockchain.

[0182] The present disclosure also provides a computer program product including a computer program which, when executed by a processor, implements the training method or the document extraction method of the document extraction model as described above.

[0183] It should be understood that various forms of the processes shown above can be used, with steps reordered, added, or deleted. For example, the steps recited in the present disclosure can be executed in parallel, sequentially, or in a different order, as long as the desired results of the technical solutions disclosed in the present disclosure can be achieved, and no limitation is made herein.

[0184] The above specific embodiments do not constitute a limitation on the protection scope of the present disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present disclosure shall be included within the protection scope of the present disclosure.

Claims

1. A training method for a document extraction model, wherein, The method includes: Obtain a first sample document; Perform a preprocessing process corresponding to the processing task on the first sample document to obtain a second sample document corresponding to the processing task; Perform an information extraction process of the processing task on the second sample document through a first large model to obtain a document extraction result of the first sample document; Use the first sample document and the document extraction result as training samples, and fine-tune a second large model based on the training samples to obtain a document extraction model.

2. The method according to claim 1, wherein, The performing an information extraction process of the processing task on the second sample document through the first large model to obtain a document extraction result of the first sample document includes: Understand the second sample document through the first large model, and perform paragraph segmentation on the second sample document according to the understanding result to obtain a set of paragraphs; Perform an information extraction process of the processing task on the paragraphs in the set of paragraphs through the first large model to obtain a document extraction result of the first sample document.

3. The method according to claim 2, wherein: The performing an information extraction process of the processing task on the paragraphs in the set of paragraphs through the first large model to obtain a document extraction result of the first sample document includes: Obtain global constraint information corresponding to the processing task; Determine the system prompt of the first large model; Generate a prompt word corresponding to the processing task based on the system prompt and the global constraint information; Perform an information extraction process of the processing task on the paragraphs in the set of paragraphs through the first large model according to the prompt word to obtain a document extraction result of the first sample document.

4. The method according to claim 3, wherein After generating the prompt word corresponding to the processing task based on the system prompt and the global constraint information, it further includes: Determine at least one of a guiding example of a set scenario corresponding to the processing task and output constraint information of the document extraction result; Optimize the prompt word corresponding to the processing task according to at least one of the guiding example and the output constraint information.

5. The method according to claim 4, wherein When the processing task is an extraction of question-answer pairs task, after optimizing the prompt word corresponding to the processing task according to at least one of the guiding example and the output constraint information, it further includes: Determine the chain of thought COT processing logic corresponding to the extraction of question-answer pairs task; Adjust the optimized prompt word according to the COT processing logic to obtain the final prompt word for the extraction of question-answer pairs task.

6. The method according to any one of claims 2 - 4, wherein, When the processing task is an extraction of abstracts task, the obtaining global constraint information corresponding to the processing task includes: Determine the abstract composition elements of the extraction of abstracts task; Obtain global constraint information corresponding to the processing task according to the abstract composition elements and the constraint information of the abstract composition elements.

7. The method according to claim 6, wherein The performing an information extraction process of the processing task on the paragraphs in the set of paragraphs through the first large model to obtain a document extraction result of the first sample document includes: Perform an abstract extraction process on the paragraph through the first large model according to the prompt word corresponding to the extraction of abstracts task to obtain abstract information of the paragraph; Determine the document extraction result of the first sample document according to the abstract information of the paragraph.

8. The method according to claim 7, wherein The composition elements of the abstract include time information, and the constraint information of the time information is to output the paragraph number associated with the time information. The document extraction result includes the abstract information of the paragraph and the paragraph number of the paragraph.

9. The method according to claim 7, wherein, After determining the document extraction result of the first sample document according to the abstract information of the paragraph, it further includes: Determine the time information mapped by the paragraph number associated with the abstract information; Based on the time information, replace the paragraph numbers in the abstract information to obtain the target abstract information of the paragraph; Based on the target abstract information, determine the document extraction result of the first sample document.

10. The method according to any one of claims 2-4, wherein, The processing task is a question-and-answer pair extraction task. The information extraction process of performing the processing task on the second sample document through the first large model to obtain the document extraction result of the first sample document includes: Through the first large model, according to the prompt words corresponding to the question-and-answer pair extraction task, use the COT processing logic to perform question-and-answer pair extraction on the paragraph to obtain the question-and-answer pairs of the paragraph; According to the question-and-answer pairs of the paragraph, obtain the document extraction result of the first sample document.

11. The method according to claim 2, wherein, The process of understanding the second sample document through the first large model and segmenting the second sample document according to the understanding result to obtain a paragraph set includes: Based on the first large model, understand the second sample document, and perform segmentation processing according to the understanding result to output the segmentation points of the second sample document; According to the segmentation points and the word count threshold corresponding to the processing task, segment the second sample document to obtain the paragraph set.

12. The method according to claim 11, wherein, The process of segmenting the second sample document according to the segmentation points and the word count threshold corresponding to the processing task to obtain the paragraph set includes: Based on the segmentation points, segment the first sample document to obtain multiple text blocks; For the i-th text block, determine the first word count of the i-th text block; Determine the j-th paragraph where the (i - 1)-th text block is located and the second word count of the j-th paragraph; Obtain the total word count of the first word count and the second word count; In response to the total word count being less than the word count threshold, merge the i-th text block into the j-th paragraph; In response to the total word count being greater than the word count threshold, use the i-th text block as the first text block of the (j + 1)-th paragraph; In response to all the multiple text blocks being traversed, obtain the paragraph set; Wherein, i and j are integers greater than or equal to 1.

13. The method according to claim 1, wherein, The determination of the first word count of the i-th text block includes: Determine the number of characters in different languages in the i-th text block; Determine the compensation coefficient for each language; According to the number of characters in different languages and the compensation coefficient corresponding to the language, determine the first word count of the i-th text block.

14. The method according to claim 6, wherein Performing the preprocessing process corresponding to the processing task on the first sample document to obtain the second sample document corresponding to the processing task includes: Convert the timestamps in the first sample document to obtain time information in the target format, where the amount of basic units occupied by the time information in the target format is less than the amount of basic units occupied by the timestamps. Merge multiple lines of text belonging to the same semantic content in the first sample document according to the set number of lines, and delete redundant timestamps in the multiple lines of text to obtain the second sample document.

15. The method according to claim 10, wherein The preprocessing process corresponding to the processing task performed on the first sample document to obtain the second sample document corresponding to the processing task includes: Starting from the starting position of the first sample document, identify the speakers in the first sample document; Track the same speaker, and in response to identifying a speaker switch, merge the document content between two adjacent switches to obtain the second sample document.

16. The method according to claim 15, wherein, After obtaining the second sample document, it further includes: Delete the timestamps and speaker identifiers in the second sample document.

17. A document extraction method, wherein, The method includes: Obtain a first document; Perform the preprocessing process corresponding to the processing task on the first document to obtain the second document corresponding to the processing task; Perform the information extraction process corresponding to the processing task on the second document through a document extraction model to obtain the document extraction result of the first document; Wherein the document extraction model is a model trained by using the method described in any one of claims 1-16.

18. A training device for a document extraction model, wherein, The device includes: A first acquisition module for acquiring a first sample document; A second acquisition module for performing the preprocessing process corresponding to the processing task on the first sample document to obtain the second sample document corresponding to the processing task; A processing module for performing the information extraction process of the processing task on the second sample document through a first large model to obtain the document extraction result of the first sample document; A fine-tuning module for using the first sample document and the document extraction result as training samples to fine-tune a second large model based on the training samples to obtain a document extraction model.

19. A document extraction device, wherein, The device includes: An acquisition module for acquiring a first document; A preprocessing module for performing the preprocessing process corresponding to the processing task on the first document to obtain the second document corresponding to the processing task; A document extraction module for performing the information extraction process corresponding to the processing task on the second document through a document extraction model to obtain the document extraction result of the first document; Wherein the document extraction model is a model trained by using the method described in any one of claims 1-16.

20. An electronic device, characterized in that, Includes a processor and a memory; Wherein, the processor runs a program corresponding to the executable program code by reading the executable program code stored in the memory for implementing the method described in any one of claims 1-16 or claim 17.

21. A computer-readable storage medium having a computer program stored thereon, characterized in that, The program, when executed by the processor, implements the method described in any one of claims 1-16 or claim 17.

22. A computer program product, including a computer program, which, when executed by a processor, implements the method described in any one of claims 1-16 or claim 17.