Document question and answer method and device and computer equipment
By slicing multiple documents and generating document memory, and using big models to retrieve and generate prompt words, the problem of context length limitation in large models in long documents is solved, and effective question-and-answer processing for long documents is achieved.
Patent Information
- Application Number
- CN202411537591.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-30
- Publication Date
- 2025-02-18
AI Technical Summary
When large models deal with long document Q&A, due to context length limitations, they cannot answer normally, resulting in the inability to effectively answer user queries for one or more long documents.
By dividing multiple documents into multiple slices and generating document memory for each document, including the overall summary of each document and the slice summary of each slice, the large model is used to search document memory to determine the target in the target document The slice original text of the slice is then generated based on the slice original text and document memory, and entered into the big model for reply.
It effectively breaks through the context length limit of the big model, can process and answer user queries for long documents normally, and improves the processing capability and efficiency of the question-and-answer system.
Smart Images

Figure CN119474308A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of integrated circuits, and in particular to a document question-and-answer method, device, and computer equipment. Background Art
[0002] With the development of artificial intelligence technology, large models are being used more and more widely. Large models can process massive amounts of data and complete various complex tasks. Among them, large language models (LLM) and multimodal large models can both realize natural language question-answering processing.
[0003] For natural language question-answering processing, the current large models have a limited context length, that is, the amount of data that the large model can process at one time (i.e., the number of tokens) is limited. In ordinary natural question-answering scenarios, the amount of data involved is small, and the context length of the large model is sufficient. However, when users need to ask questions about one or more long documents, the context length of the large model may not be enough, which will cause the large model to be unable to answer normally. Therefore, how to break through the limitation of the context length of the large model so that the large model can answer long documents normally is a problem that needs to be solved. Summary of the invention
[0004] In view of this, embodiments of the present application provide a document question and answer method, apparatus, and computer device.
[0005] The technical solution of the embodiment of the present application is implemented as follows:
[0006] An embodiment of the present application provides a document question-and-answer method based on a big model, comprising: in response to receiving a query request from a user, instructing the big model to retrieve the document memory of multiple documents based on the query request, and determine the slice original text of the target slice in the target document; wherein each of the document memories includes: an overall summary of each of the documents and a slice summary of each slice in each of the documents; processing is performed based on at least the slice original text and the document memory of the target document to obtain a prompt word; and the prompt word is input into the big model so that the big model replies to the query request based on the prompt word.
[0007] In some embodiments of the present application, before retrieving the document memory of the plurality of documents based on the query request, the method further includes: instructing the large model to divide each document into a plurality of slices and generate a document memory for each of the documents.
[0008] In some embodiments of the present application, the generating of the document memory for each of the documents includes: generating the slice summary for each of the slices; generating an overall summary for each of the documents based on all of the slice summaries; and determining the document memory based on all of the slice summaries and the overall summary of each of the documents.
[0009] In some embodiments of the present application, the processing is performed at least based on the document memory of the slice original text and the target document to obtain the prompt word, including: combining the slice original text, the associated slice summary and the overall summary to obtain the prompt word; wherein the associated slice summary is the slice summary associated with the target slice in the document memory.
[0010] In some embodiments of the present application, if the target slice includes discontinuous slices, the associated slice digest includes the slice digest located between the discontinuous slices.
[0011] In some embodiments of the present application, the searching of the document memory of the plurality of documents based on the query request to determine the slice original text of the target slice in the target document includes: searching the document memory of the plurality of documents based on the query request to determine the document memory of the target document; searching the slice summary in the document memory of the target document based on the query request to determine the slice summary of the target slice; and determining the slice original text of the target slice based on the slice summary of the target slice.
[0012] In some embodiments of the present application, at least one of the following is included: the number of words contained in each of the slices is less than a word number threshold; the number of the target documents determined each time is less than a document number threshold; in each of the target documents, the number of the target slices determined each time is less than a slice number threshold.
[0013] In some embodiments of the present application, the processing is performed at least based on the slice original text and the document memory of the target document to obtain the prompt word, including: performing combined processing based on the slice original text and the document memory of the target document to obtain the prompt word; or, performing combined processing based on the query request, the slice original text and the document memory of the target document to obtain the prompt word.
[0014] The embodiment of the present application also provides a document question-and-answer device based on a big model, comprising: a data transmission module, a control module and a prompt word generation module; wherein the data transmission module is configured to receive a user's query request; the control module is configured to, in response to receiving the user's query request, instruct the big model to retrieve the document memory of multiple documents based on the query request, and determine the slice original text of the target slice in the target document; wherein each of the document memories includes: an overall summary of each of the documents and a slice summary of each slice in each of the documents; the prompt word generation module is configured to process based on the slice original text and the document memory of the target document to obtain a prompt word; the data transmission module is also configured to input the prompt word into the big model, so that the big model replies to the query request based on the prompt word.
[0015] An embodiment of the present application also provides a computer device, including a memory and a processor; the memory stores a computer program that can be run on the processor; when the processor executes the program, the steps in the method described in the above scheme are implemented. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] Figure 1 Schematic diagram of the implementation process of the document question-and-answer method provided in the embodiment of the present application Figure 1 ;
[0017] Figure 2 Schematic diagram of the implementation process of the document question-and-answer method provided in the embodiment of the present application Figure 2 ;
[0018] Figure 3 Schematic diagram of the implementation process of the document question-and-answer method provided in the embodiment of the present application Figure 3 ;
[0019] Figure 4 Schematic diagram of the implementation process of the document question-and-answer method provided in the embodiment of the present application Figure 4 ;
[0020] Figure 5 Schematic diagram of the implementation process of the document question-and-answer method provided in the embodiment of the present application Figure 5 ;
[0021] Figure 6 A schematic diagram of the slicing and summarization process of the document question-answering method provided in an embodiment of the present application;
[0022] Figure 7 A schematic diagram of the retrieval process of the document question-answering method provided in an embodiment of the present application;
[0023] Figure 8 A schematic diagram of prompt words for the document question-and-answer method provided in an embodiment of the present application;
[0024] Fig. 9 A schematic diagram of the structure of the document question-and-answer device provided in an embodiment of the present application;
[0025] Fig.10 A schematic diagram of the hardware entity of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0026] In order to make the purpose, technical solutions and advantages of the present application clearer, the technical solutions of the present application are further elaborated in detail below in conjunction with the drawings and embodiments. The described embodiments should not be regarded as limiting the present application. All other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present application.
[0027] In the following description, reference is made to "some embodiments", which describe a subset of all possible embodiments, but it is understood that "some embodiments" may be the same subset or different subsets of all possible embodiments, and may be combined with each other without conflict. The terms "first / second / third" involved are merely used to distinguish similar objects and do not represent a specific order for the objects. It is understood that "first / second / third" may be interchanged in a specific order or sequence where permitted, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein.
[0028] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein are only for the purpose of describing this application and are not intended to limit this application.
[0029] Figure 1 FIG. 1 is a schematic diagram of an optional implementation flow of the document question-and-answer method provided in the embodiment of the present application. Figure 1 As shown, the document question-answering method includes steps S101 to S103, which will be described in combination with each step.
[0030] S101. In response to receiving a query request from a user, instruct the large model to retrieve the document memory of multiple documents based on the query request to determine the slice original of the target slice in the target document; wherein each document memory includes: an overall summary of each document and a slice summary of each slice in each document.
[0031] In an embodiment of the present application, after receiving a query request (Query) from a user, the big model can be instructed to retrieve the document memory (Doc Mem) of multiple documents (Doc) based on the query request; that is, the retrieval of the document memory can be completed by calling the big model.
[0032] It should be noted that the large model involved in the embodiments of the present application can be a large language model or a multi-modal large model, which is not limited here.
[0033] In the embodiment of the present application, since the document memory includes the overall summary of the document and the slice summary of each slice (Page), based on the query request, the slice summary (Page Mem) of the target slice can be determined by searching the document memory, and then the slice original (Page Raw) of the target slice can be determined.
[0034] S102, performing processing based on at least the original text of the slice and the document memory of the target document to obtain a prompt word.
[0035] S103: input the prompt word into the big model, so that the big model responds to the query request based on the prompt word.
[0036] In the embodiment of the present application, after the target document and the original text of the target slice in the target document are determined, a prompt word can be generated based on at least the original text of the target slice and the document memory of the target document, and then the prompt word is input into the big model. After the prompt word is input into the big model, the big model will answer based on the prompt word, thereby completing the reply to the query request.
[0037] In some embodiments of the present application, the prompt word can be obtained by processing based on the query request, the original slice text and the document memory of the target document. Figure 8 The prompt words include: query request, slice original text (document i_slice 1 original text, document i_slice 3 original text, document j_slice 1 original text and document j_slice 3 original text), and the overall summary of the target document in the document memory (document i overall summary and document j overall summary).
[0038] In other embodiments of the present application, the prompt word can be obtained based on the document memory of the sliced original text and the target document only, without combining the query request into the prompt word. The large model can contact the query request in the historical instruction (such as the search instruction in step S101) to complete the answer.
[0039] It is understandable that in the embodiment of the present application, the original text of the slice of the target slice in the target document is determined by searching the document memory of multiple documents, and then, the prompt word is obtained based on the original text of the slice and the document memory of the target document. In this way, the large model can answer based on the prompt word, and avoid directly processing the original text of multiple documents for question and answer. Compared with the original text of multiple documents, the amount of data of the prompt word obtained after processing is significantly reduced. Therefore, the prompt word generated by the embodiment of the present application can meet the context length of the large model, that is, it can avoid the large model from being unable to answer normally due to insufficient context length, thereby ensuring the smooth progress of document question and answer.
[0040] At the same time, in the embodiment of the present application, the retrieval of document memory is completed by calling the big model, which utilizes the retrieval function of the big model itself without introducing additional algorithms and models. Thus, the system structure is simplified, resource occupation is reduced, and operation efficiency is improved.
[0041] In some embodiments of the present application, Figure 2 Step S1021 shown is implemented Figure 1 The step S102 is shown. The description will be made in combination with each step.
[0042] S1021. Combine the original slice text, the associated slice summary and the overall summary to obtain a prompt word; wherein the associated slice summary is a slice summary associated with the target slice in the document memory.
[0043] It is understandable that combining the overall summary of the target document into the prompt words is conducive to the big model's understanding of the overall content of the target document, thereby improving the accuracy of the big model's answer. At the same time, combining the associated slice summary associated with the target slice into the prompt words can supplement the slice original of the target slice, so that the big model can understand the content of the target slice more comprehensively, thereby also improving the accuracy of the big model's answer.
[0044] In some embodiments of the present application, if the target slice includes discontinuous slices, the associated slice digest includes a slice digest located between the discontinuous slices.
[0045] refer to Figure 8 In document i, slice 1 and slice 3 are target slices, but slice 1 and slice 3 are discontinuous slices, and slice 2 is also included between slice 1 and slice 3; therefore, while combining the slice original texts of the target slices (document i_slice 1 original text and document i_slice 3 original text) into the prompt words, the summary of document i_slice 2 can be combined into the prompt words as the associated slice summary to connect and supplement the original texts of document i_slice 1 and document i_slice 3.
[0046] Continue to refer Figure 8 Similarly, in document j, slice 1 and slice 3 are target slices, but slice 1 and slice 3 are discontinuous slices, and slice 2 is also included between slice 1 and slice 3; the summary of document j_slice 2 is combined into the prompt word as an associated slice summary to connect and supplement the original text of document j_slice 1 and the original text of document j_slice 3.
[0047] It can be understood that the slice summaries between discontinuous slices are combined into prompt words as associated slice summaries. In this way, the discontinuous slice originals can be effectively connected and supplemented, helping the large model to correctly and comprehensively understand the slice originals, thereby improving the accuracy of the large model's answers.
[0048] In some embodiments of the present application, Figure 3 Steps S1011 to S1013 are shown to achieve Figure 1 The step S101 shown will be described in combination with each step.
[0049] S1011. Based on the query request, the document memory of multiple documents is searched to determine the document memory of the target document.
[0050] In the present application examples, reference Figure 7 Since the document memory includes the overall summary of the document, the large model can be instructed to search in the document memories of multiple documents (document 1 memory to document N memory), and compare and match the query request with the overall summary of each document; thereby, the document memory of the target document (document i memory and document j memory) can be determined.
[0051] In the embodiment of the present application, in the process of determining the document memory of the target document, the number of target documents determined each time needs to be less than the document number threshold Num_doc. In this way, the number of target documents determined each time is limited, which avoids too many target documents, thereby avoiding the generated prompt words containing too much data, that is, avoiding the prompt words exceeding the context length of the large model, ensuring that the large model can answer normally.
[0052] S1012. Based on the query request, the slice summary in the document memory of the target document is retrieved to determine the slice summary of the target slice.
[0053] In the present application, continue to refer to Figure 7Since the document memory also includes the slice summary of each slice in the document, for example, the document i memory includes multiple slice summaries (document i_slice 1 summary, document i_slice 2 summary and document i_slice 3 summary), and the document j memory includes multiple slice summaries (document j_slice 1 summary, document j_slice 2 summary and document j_slice 3 summary); therefore, the large model can be instructed to search in the document memory of the target document (document i memory and document j memory), and compare and match the query request with each slice summary in the document memory of the target document; thereby, the slice summary of the target slice (document i_slice 1 summary, document i_slice 3 summary, document j_slice 1 summary and document j_slice 3 summary) can be determined.
[0054] In the embodiment of the present application, in the process of determining the slice summary of the target slice, the number of target slices determined each time in each target document needs to be less than the slice number threshold Num_page. In this way, the number of target slices in each target document is limited, which avoids an excessive number of target slices, thereby avoiding the generated prompt words containing too much data, that is, avoiding the prompt words exceeding the context length of the large model, ensuring that the large model can answer normally.
[0055] S1013. Determine the slice original of the target slice based on the slice summary of the target slice.
[0056] In the present application, continue to refer to Figure 7 , the big model can be instructed to determine the slice original text of the target slice (document i_slice 1 original text, document i_slice 3 original text, document j_slice 1 original text and document j_slice 3 original text) based on the slice summary of the target slice (document i_slice 1 summary, document i_slice 3 summary, document j_slice 1 summary and document j_slice 3 summary).
[0057] It is understandable that in the embodiment of the present application, the retrieval of document memory is completed by calling the large model, which utilizes the retrieval function of the large model itself without introducing additional algorithms and models. In this way, the system structure is simplified, resource usage is reduced, and thus, the operating efficiency can be improved.
[0058] In the embodiment of the present application, the large model can be instructed to complete the retrieval of the document memory by inputting a retrieval prompt word into the large model. The retrieval prompt word can be input in the following format:
[0059] "Next you will receive a text that will help you answer a question about a long document.
[0060] You can answer this question by reading 1 to {Num_page} paragraphs. Each paragraph represents an overview of the original text to which it corresponds.
[0061] You must answer which paragraphs of text you want to choose to expand on the original text.
[0062] For example: If you are going to choose Page 8 based on the overview, please answer: I want to view the original text of Page 8 because...; if you are going to choose Page[8,9,11,20] based on the overview, please answer: I want to view the original text of Page[8,9,11,20] because...
[0063] Please do not select more than {Num_page} paragraphs of text. You do not need to answer this question about multiple and long documents for now.
[0064] Overview: {Page Mems}
[0065] Questions: {Questions}
[0066] Tips: The prompts for selecting page and doc are similar. ”
[0067] In some embodiments of the present application, Figure 1 Before step S101, the document question-answering method further includes Figure 4 The step S201 shown will be described in combination with each step.
[0068] S201. Instruct the large model to divide each document into multiple slices and generate a document memory for each document.
[0069] In the embodiment of the present application, before calling the big model to retrieve the document memory, the big model can be called to complete the slicing of the document. The big model can slice each of the multiple documents that may be involved, slice each document into multiple slices, and generate a slice summary, and then, based on the slice summary of each document, generate the document memory of each document.
[0070] refer to Figure 6 , the big model can divide document 2 into multiple slices (document 2_slice 1, document 2_slice 2 and document 2_slice 3); further, the big model can process multiple slices of document 2 to generate document memory of document 2 (document 2 memory).
[0071] In the embodiment of the present application, in the process of dividing each document into multiple slices, it is necessary to ensure that the number of tokens contained in each slice is less than the token number threshold Max_Page. In this way, the number of tokens contained in each slice is limited, which avoids too much data in each slice, thereby avoiding the generated prompt words from containing too much data, that is, avoiding the prompt words from exceeding the context length of the large model, ensuring that the large model can answer normally.
[0072] In the embodiment of the present application, in the process of dividing each document into multiple slices, semantic coherence needs to be ensured. Each time, the large model will receive a paragraph of a certain length, and the starting point of the paragraph is the previous segmentation point; then, the large model will select a suitable position in the paragraph as a segmentation point, wherein it needs to be ensured that after segmentation, the context of the segmentation point has coherent semantics, so that the content between the segmentation point and the previous segmentation point constitutes a slice.
[0073] It should be noted that the large model called to implement step S101 and the large model called to implement step S201 can be the same large model or different large models, which is not limited here.
[0074] It is understandable that in the embodiment of the present application, each document is segmented by calling the big model and a document memory of each document is generated. In this way, the slicing function of the big model itself is utilized without introducing additional algorithms and models. Thus, the system structure is simplified, resource usage is reduced, and operation efficiency is improved.
[0075] In the embodiment of the present application, the large model can be instructed to segment each document by inputting segmentation prompt words into the large model. The segmentation prompt words can be input in the following format:
[0076] "You will receive a partial paragraph from a longer document. The partial paragraph contains some serial numbers that divide each small part of the partial paragraph. The serial numbers are enclosed in parentheses. For example, when the serial number is 19, the serial number in the article will be displayed as (19).
[0077] Please choose a number that you think is the best as the segmentation point of this part of the paragraph. The segmentation basis may be: segmentation with this number can make the paragraph before this number the end of a description, the end of a discussion, the end of a concept description, etc.
[0078] Please answer the number you chose and provide an explanation.
[0079] Example: If (11) is a good split point, then answer: Split point (11) because…
[0080] paragraph:
[0081] {…}
[0082] {Paragraph 5text} (5)
[0084] {Paragraph 6text} (6)
[0086] {Paragraph 7text}
[0087] …”
[0088] In some embodiments of the present application, Figure 5 Steps S202 to S204 are shown to achieve Figure 4 The step S201 shown will be described in combination with each step.
[0089] S202: Generate a slice summary for each slice.
[0090] S203: Generate an overall summary of each document based on all the slice summaries.
[0091] S204: Determine document memory based on all slice summaries and the overall summary of each document.
[0092] In the embodiment of the present application, after each document is divided into multiple slices, the large model can generate a slice summary for each slice. Furthermore, the large model can generate an overall summary of each document based on all the slice summaries in each document. Furthermore, the large model can determine the document memory based on all the slice summaries and the overall summary of each document; for example, the slice summary and the overall summary are combined into a document memory; for another example, a logical relationship is added between the slice summary and the overall summary to obtain the document memory.
[0093] refer to Figure 6 After document 2 is segmented into document 2_slice 1, document 2_slice 2, and document 2_slice 3, the big model can generate a slice summary for each slice (document 2_slice 1 summary, document 2_slice 2 summary, and document 2_slice 3 summary). Furthermore, the big model can generate an overall summary of document 2 based on all slice summaries of document 2. Furthermore, the big model can combine all slice summaries of document 2 and the overall summary of document 2 into a document 2 memory.
[0094] It is understandable that since the document memory is generated based on all the slice summaries and the overall summary of each document, the slice summary of the target slice and the slice original text of the target slice can be determined by searching the document memory based on the query request, and then the prompt words that meet the context length of the large model can be obtained after processing. Therefore, it can avoid the large model being unable to answer normally due to insufficient context length, ensuring the smooth progress of document question and answer.
[0095] In the embodiment of the present application, the summary prompt word can be input to the large model to instruct the large model to determine the slice summary of each slice. The summary prompt word can be input in the following format:
[0096] "Please summarize the following paragraphs, only give an overview of the results, do not output other content.
[0097] paragraph:
[0098] {Passage}”
[0099] Fig. 9 A schematic diagram of the structure of a document question-and-answer device based on a large model provided in an embodiment of the present application. Fig. 9 As shown, the document question-and-answer device 800 includes: a data transmission module 810 , a control module 820 and a prompt word generation module 830 .
[0100] The data transmission module 810 is configured to receive a user's query request. The control module 820 is configured to, in response to receiving the user's query request, instruct the large model to retrieve the document memory of multiple documents based on the query request to determine the slice original text of the target slice in the target document; wherein each document memory includes: the overall summary of each document and the slice summary of each slice in each document. The prompt word generation module 830 is configured to process based on the slice original text and the document memory of the target document to obtain the prompt word. The data transmission module 810 is also configured to input the prompt word into the large model so that the large model responds to the query request based on the prompt word.
[0101] In some embodiments of the present application, the control module 820 is further configured to instruct the large model to divide each document into multiple slices and generate a document memory for each document.
[0102] In some embodiments of the present application, the prompt word generation module 830 is also configured to combine the slice original text, the associated slice summary and the overall summary to obtain the prompt word; wherein the associated slice summary is the slice summary associated with the target slice in the document memory.
[0103] In some embodiments of the present application, if the target slice includes discontinuous slices, the associated slice digest includes a slice digest located between the discontinuous slices.
[0104] In some embodiments of the present application, at least one of the following is included: the number of words contained in each slice is less than the word number threshold; the number of target documents determined each time is less than the document number threshold; in each target document, the number of target slices determined each time is less than the slice number threshold.
[0105] The prompt word generation module 830 is also configured to perform combined processing based on the slice original text and the document memory of the target document to obtain the prompt word; or to perform combined processing based on the query request, the slice original text and the document memory of the target document to obtain the prompt word.
[0106] The description of the above device embodiment is similar to the description of the above method embodiment, and has similar beneficial effects as the method embodiment. In some embodiments, the functions or modules included in the device provided in the embodiment of the present application can be used to execute the method described in the above method embodiment. For technical details not disclosed in the device embodiment of the present application, please refer to the description of the method embodiment of the present application for understanding.
[0107] It should be noted that in the embodiment of the present application, if the above-mentioned document question-and-answer method is implemented in the form of a software function module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application can be essentially or partly reflected in the form of a software product that contributes to the relevant technology. The software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the methods described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a U disk, a mobile hard disk, a read-only memory (ROM), a disk or an optical disk. In this way, the embodiment of the present application is not limited to any specific hardware, software or firmware, or any combination of hardware, software, and firmware.
[0108] An embodiment of the present application provides a computer device, including a memory and a processor, wherein the memory stores a computer program that can be run on the processor, and when the processor executes the program, some or all of the steps in the above method are implemented.
[0109] Fig.10 A hardware entity diagram of a computer device provided in an embodiment of the present application is shown in FIG. Fig.10 As shown, the hardware entity of the computer device 1100 includes: a processor 1101 and a memory 1102, wherein the memory 1102 stores a computer program that can be run on the processor 1101, and the processor 1101 implements the steps in the method of any of the above embodiments when executing the program.
[0110] The memory 1102 stores computer programs that can be run on the processor. The memory 1102 is configured to store instructions and applications executable by the processor 1101. It can also cache data to be processed or processed by the processor 1101 and various modules in the computer device 1100 (for example, image data, audio data, voice communication data, and video communication data). This can be achieved through flash memory (FLASH) or random access memory (Random Access Memory, RAM).
[0111] When the processor 1101 executes the program, the steps of any of the above document question-answering methods are implemented. The processor 1101 generally controls the overall operation of the computer device 1100.
[0112] The embodiment of the present application provides a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, some or all of the steps in the above method are implemented. The computer-readable storage medium can be transient or non-transient.
[0113] An embodiment of the present application provides a computer program, including a computer-readable code. When the computer-readable code is run in a computer device, a processor in the computer device executes some or all of the steps for implementing the above method.
[0114] The embodiment of the present application provides a computer program product, which includes a non-transitory computer-readable storage medium storing a computer program, and when the computer program is read and executed by a computer, some or all of the steps in the above method are implemented. The computer program product can be implemented specifically by hardware, software or a combination thereof. In some embodiments, the computer program product is specifically embodied as a computer storage medium, and in other embodiments, the computer program product is specifically embodied as a software product, such as a software development kit (SDK) and the like.
[0115] It should be noted here that the description of the various embodiments above tends to emphasize the differences between the various embodiments, and the same or similar aspects can be referenced to each other. The description of the above device, storage medium, computer program and computer program product embodiments is similar to the description of the above method embodiment, and has similar beneficial effects as the method embodiment. For technical details not disclosed in the embodiments of the device, storage medium, computer program and computer program product of this application, please refer to the description of the method embodiment of this application for understanding.
[0116] The processor may be at least one of an Application Specific Integrated Circuit (ASIC), a Digital Signal Processor (DSP), a Digital Signal Processing Device (DSPD), a Programmable Logic Device (PLD), a Field Programmable Gate Array (FPGA), a Central Processing Unit (CPU), a controller, a microcontroller, and a microprocessor. It is understandable that the electronic device that implements the functions of the processor may also be other, and the embodiments of the present application are not specifically limited.
[0117] The above-mentioned computer storage medium / memory can be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), a magnetic random access memory (FRAM), a flash memory (Flash Memory), a magnetic surface memory, an optical disk, or a compact disc read-only memory (CD-ROM) and the like; it can also be various terminals including one or any combination of the above-mentioned memories, such as mobile phones, computers, tablet devices, personal digital assistants, etc.
[0118] It should be understood that "one embodiment" or "an embodiment" mentioned throughout the specification means that specific features, structures or characteristics related to the embodiment are included in at least one embodiment of the present application. Therefore, "in one embodiment" or "in an embodiment" appearing throughout the specification does not necessarily refer to the same embodiment. In addition, these specific features, structures or characteristics can be combined in one or more embodiments in any suitable manner. It should be understood that in various embodiments of the present application, the size of the serial number of each step / process mentioned above does not mean the order of execution, and the execution order of each step / process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of the present application. The serial numbers of the embodiments of the present application mentioned above are for description only and do not represent the advantages and disadvantages of the embodiments.
[0119] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.
[0120] The above is only an implementation method of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application.
Claims
1. A document question answering method based on a large model, comprising: In response to receiving a query request from a user, instructing the large model to search the document memories of multiple documents based on the query request to determine the slice original of the target slice in the target document; wherein each of the document memories includes: an overall summary of each of the documents and a slice summary of each slice in each of the documents; Processing is performed based at least on the original text of the slice and the document memory of the target document to obtain a prompt word; The prompt word is input into the large model, so that the large model responds to the query request based on the prompt word.
2. The document question-answering method according to claim 1, before searching the document memory of the plurality of documents based on the query request, the method further comprises: Instruct the large model to split each document into multiple slices and generate a document memory for each of the documents.
3. The document question-answering method according to claim 2, wherein generating the document memory for each of the documents comprises: generating said slice summary for each said slice; Based on all the slice summaries, generate an overall summary of each of the documents; The document memory is determined based on all of the slice summaries and the overall summary of each of the documents.
4. The document question-answering method according to claim 1, wherein the processing based on at least the original text of the slice and the document memory of the target document to obtain the prompt word comprises: The slice original text, the associated slice summary and the overall summary are combined to obtain the prompt word; wherein the associated slice summary is the slice summary associated with the target slice in the document memory.
5. The document question-answering method according to claim 4, If the target slice includes discontinuous slices, the associated slice digest includes the slice digest located between the discontinuous slices.
6. The document question-answering method according to claim 1, wherein the step of retrieving the document memory of the plurality of documents based on the query request to determine the slice original text of the target slice in the target document comprises: Based on the query request, searching the document memory of the plurality of documents to determine the document memory of the target document; Based on the query request, the slice summary in the document memory of the target document is retrieved to determine the slice summary of the target slice; Based on the slice digest of the target slice, the slice text of the target slice is determined.
7. The document question-and-answer method according to claim 1, comprising at least one of the following: The number of tokens contained in each of the slices is less than a token number threshold; The number of the target documents determined each time is less than a document number threshold; In each of the target documents, the number of the target slices determined each time is less than a slice number threshold.
8. The document question-answering method according to claim 1, wherein the processing based on at least the original text of the slice and the document memory of the target document to obtain the prompt word comprises: Combining the original text of the slice and the document memory of the target document to obtain the prompt word; or, The prompt word is obtained by combining and processing the query request, the slice original text and the document memory of the target document.
9. A document question-answering device based on a large model, comprising: Data transmission module, control module and prompt word generation module; wherein, The data transmission module is configured to receive a query request from a user; The control module is configured to, in response to receiving the query request from the user, instruct the large model to search the document memory of multiple documents based on the query request to determine the slice original text of the target slice in the target document; wherein each of the document memories includes: an overall summary of each of the documents and a slice summary of each slice in each of the documents; The prompt word generation module is configured to process the sliced original text and the document memory of the target document to obtain the prompt word; The data transmission module is further configured to input the prompt word into the large model, so that the large model responds to the query request based on the prompt word.
10. A computer device comprising a memory and a processor; the memory stores a computer program that can be run on the processor; when the processor executes the program, the steps in the method according to any one of claims 1 to 8 are implemented.