WO2025181561A1 - 问答处理方法、设备、产品及存储介质 - Google Patents
问答处理方法、设备、产品及存储介质Info
- Publication number
- WO2025181561A1 WO2025181561A1 PCT/IB2025/050138 IB2025050138W WO2025181561A1 WO 2025181561 A1 WO2025181561 A1 WO 2025181561A1 IB 2025050138 W IB2025050138 W IB 2025050138W WO 2025181561 A1 WO2025181561 A1 WO 2025181561A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- text
- document
- information
- query instruction
- question
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/30—Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
- G06F16/33—Querying
- G06F16/332—Query formulation
- G06F16/3329—Natural language query formulation
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/30—Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
- G06F16/33—Querying
- G06F16/3331—Query processing
- G06F16/334—Query execution
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F18/00—Pattern recognition
- G06F18/20—Analysing
- G06F18/21—Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
- G06F18/214—Generating training patterns; Bootstrap methods, e.g. bagging or boosting
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F18/00—Pattern recognition
- G06F18/20—Analysing
- G06F18/22—Matching criteria, e.g. proximity measures
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/04—Architecture, e.g. interconnection topology
- G06N3/0475—Generative networks
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/30—Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
- G06F16/31—Indexing; Data structures therefor; Storage structures
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/50—Information retrieval; Database structures therefor; File system structures therefor of still image data
- G06F16/58—Retrieval characterised by using metadata, e.g. metadata not derived from the content or metadata generated manually
- G06F16/583—Retrieval characterised by using metadata, e.g. metadata not derived from the content or metadata generated manually using metadata automatically derived from the content
Definitions
- Various aspects of the present disclosure provide a question-and-answer processing method, device, product, and storage medium to enhance the large language model's ability to process multimodal documents and improve the accuracy of responses to queries.
- An embodiment of the present disclosure provides a question-and-answer processing method, comprising: receiving a query; obtaining target knowledge information matching the query from multiple pieces of knowledge information in a knowledge base; obtaining a content-parsed text corresponding to the target knowledge information, the content-parsed text obtained by performing content parsing on target document elements corresponding to the target knowledge information, the target document elements including document elements in non-text modalities; and inputting the query and the content-parsed text corresponding to the target knowledge information into a large language model, so that the large language model outputs a response that matches the query based on the content-parsed text corresponding to the target knowledge information.
- obtaining target knowledge information that matches the query instruction from multiple knowledge information in the knowledge base includes: obtaining text representation information of each of the multiple knowledge information in the knowledge base; calculating the matching degree between the query instruction and the text representation information of each of the multiple knowledge information to obtain the matching degree score between the query instruction and the multiple knowledge information; and determining the target knowledge information that matches the query instruction from the multiple knowledge information based on the matching degree scores between the query instruction and the multiple knowledge information.
- calculating a match between the query instruction and the text representation information of each of the plurality of knowledge information to obtain a match score between the query instruction and each of the plurality of knowledge information includes: calculating a match between the text representation information of any of the plurality of knowledge information and the query instruction using multiple recall algorithms to obtain multiple match scores; determining weight coefficients corresponding to the multiple recall algorithms based on the modality of the knowledge information and the applicability of the multiple recall algorithms to knowledge information of different modalities; and performing a weighted calculation on the multiple match scores based on the weight coefficients corresponding to the multiple recall algorithms to obtain a match score between the query instruction and the knowledge information.
- the method before obtaining the text representation information of each of the plurality of knowledge information in the knowledge base, the method further includes: obtaining multiple document elements from multiple document samples, the multiple document elements corresponding to multiple different modalities; adding the multiple document elements as knowledge information to the knowledge base; performing representation processing on the multiple document elements to obtain text representation information for each of the multiple document elements, and storing the correspondence between the multiple document elements and their respective text representation information.
- characterization processing is performed on the multiple document elements to obtain text representation information of each of the multiple document elements, including: for any document sample among the multiple document samples, if the document sample includes a text paragraph, obtaining at least one information of the name of the document where the text paragraph is located, the paragraph title, the paragraph content, the document creation time, and the editing time as the text representation information of the text paragraph; if the document sample includes a table in text form, obtaining at least one information of the name of the document where the table is located, the table title, the key content in the table, the document creation time, and the editing time as the text representation information of the table; if the document sample includes a picture, obtaining at least one information of the name of the document where the picture is located, the picture title, the question identified from the picture, the description information of the picture, the document creation time, and the editing time as the text representation information of the picture.
- it also includes: parsing the multiple document elements according to the modalities corresponding to each of the multiple document elements to obtain content parsed texts corresponding to each of the multiple document elements; obtaining multiple question-answer pair samples associated with the multiple document samples; any question-answer pair sample includes a query instruction sample and a corresponding reply result sample; obtaining multiple sample pairs according to the content parsed texts corresponding to each of the multiple document elements and the multiple question-answer pair samples; and training the large language model based on the multiple sample pairs.
- parsing the multiple document elements according to the modalities corresponding to the document elements in the multiple document samples to obtain content parsed text corresponding to the multiple document elements includes at least one of the following: for any document sample among the multiple document samples, if the document sample includes a text paragraph, performing text segmentation on the text paragraph to obtain multiple text blocks as the content parsed text corresponding to the text paragraph; if the document sample includes a table in text form, identifying the text content and the logical relationship between cells in the text-form table, and encoding according to the identified text content and logical relationship to obtain encoding information as the content parsed text corresponding to the text-form table; if the document sample includes a picture, and the picture includes a table in picture form, identifying the text content and the positions of cell vertices in the picture-form table, determining the logical relationship between cells in the picture-form table according to the identified cell vertices, and encoding according to the identified text content and logical relationship to obtain encoding information as the content parsed text
- obtaining multiple question-answer pair samples associated with the multiple document samples includes: inputting the multiple document samples and preset prompt words into a question-answering model, so that the question-answering model, under the guidance of the prompt words, generates the multiple question-answer pair samples based on the text content in the multiple document samples.
- obtaining multiple sample pairs based on the content parsed text corresponding to each of the multiple document elements and the multiple question-answer pair samples includes: using a set recall algorithm for any query instruction sample in the multiple question-answer pair samples to determine a target document sample from the multiple document samples that matches the query instruction sample; determining a document element that matches the query instruction sample based on the document elements contained in the target document sample; using the document element that matches the query instruction sample as the knowledge information corresponding to the query instruction; and obtaining a sample pair corresponding to the query instruction sample based on the content parsed text of the question-answer pair sample to which the query instruction belongs and the knowledge information corresponding to the query instruction.
- the document elements adapted to the query instruction sample include document elements of at least two different modalities.
- the present disclosure also provides an electronic device, comprising: a memory and a processor; the memory is configured to store one or more computer instructions; and the processor is configured to execute the one or more computer instructions to: perform the steps of the method provided in the present disclosure.
- the present disclosure also provides a computer-readable storage medium storing a computer program, which, when executed by the processor, can implement the steps of the method provided in the present disclosure.
- the present disclosure also provides a computer program product, comprising a computer program/instructions, which, when executed by the processor, can implement the steps of the method provided in the present disclosure.
- target knowledge information matching the query instruction can be obtained from multiple pieces of knowledge information in a knowledge base, and the query instruction and the content corresponding to the target knowledge information can be decoded.
- the parsed text is input into a large language model for question-and-answer processing.
- the content parsed text corresponding to the target knowledge information is obtained by performing content parsing on the target document elements corresponding to the target knowledge information.
- the target document elements include document elements in non-text modalities, content parsing of the target document elements is performed before inputting them into the large language model.
- Figure 1 is a flowchart of a question-and-answer processing method provided by an exemplary embodiment of the present disclosure
- Figure 2 is a flowchart of processing document elements in image modality provided by an exemplary embodiment of the present disclosure
- Figure 3 is a schematic diagram of a question-and-answer processing framework and question-and-answer processing flow provided by an exemplary embodiment of the present disclosure
- Figure 4 is a schematic diagram of the structure of an electronic device provided by an exemplary embodiment of the present disclosure.
- a document may contain content and information in multiple modalities, such as text paragraphs, tables in the form of text, tables in the form of images, or other non-tabular images.
- large language models can only accept text sequences as input and cannot process information in other modalities besides text, which in turn leads to an inability to accurately answer some user questions.
- OCR Optical Character Recognition
- Figure 1 is a flowchart of a question-answering processing method provided by an exemplary embodiment of the present disclosure. As shown in Figure 1, the method primarily includes the following steps: Step 101: Receive a query instruction. Step 102: Obtain target knowledge information matching the query instruction from multiple pieces of knowledge information in a knowledge base. Step 103: Obtain the content parsing text corresponding to the target knowledge information.
- the target document elements corresponding to the target knowledge information are obtained by content parsing, and the target document elements include document elements in non-text modalities.
- Step 104 The query instruction and the content parsed text corresponding to the target knowledge information are input into a large language model, so that the large language model outputs a response that is adapted to the query instruction based on the content parsed text corresponding to the target knowledge information.
- the query instruction may be issued by a user or by an application according to predefined processing logic, and this embodiment is not limiting.
- the query instruction may be a selective query instruction, a summary query instruction, or a rejection query instruction.
- a knowledge base is a system or tool for centrally storing, organizing, and managing knowledge.
- the knowledge information in a knowledge base can include various types of knowledge content, such as documents, images, videos, audio, and other data, so that users or other applications can easily retrieve the required knowledge through retrieval.
- Any document may contain document elements of various modalities.
- Document elements refer to the various components that make up a document.
- document element modalities may include: text paragraphs, text-based tables, image-based tables, and images.
- the parsed text of a document element refers to text-based information obtained by parsing the content contained within the document element.
- This text-based information is used to describe the content within the document element and the logical relationships between the contents in text form, enabling the large language model to understand non-textual document elements.
- Documents in the knowledge base may be txt documents, Word documents, PDF documents, Excel documents, etc.
- Tables within these types of documents may be text-based tables or image-based tables.
- a text-based table refers to one created directly in document editing software, such as a table created in a Word document using the table function within Word software.
- a text-based table is a semi-structured data structure containing a large amount of numerical values and text, with cells having certain logical relationships. These logical relationships can be simple or complex.
- the logical relationships between cells may include correspondences between fields and values within different cells, or include-and-be-included relationships between fields within different cells.
- the include-and-be-included relationship can be represented by a merge relationship between cells.
- a table in image format presents a table in image form.
- An image-formatted table can be created in spreadsheet software (such as Excel) or graphic design software, then screenshotted or exported as an image format and inserted into a document.
- individual document elements can also serve as knowledge information for retrieval and matching.
- the knowledge base can be searched based on the query instruction to retrieve target knowledge information matching the query instruction from multiple pieces of knowledge information in the knowledge base.
- the retrieved target knowledge information can include document elements of one or multiple modalities.
- the query instruction is typically in textual modality.
- the knowledge information in the knowledge base can be converted into information in textual modality.
- the target knowledge information can be retrieved by calculating the degree of match between the query instruction in textual modality and the knowledge information in textual modality. This is described below as an example.
- text representation information corresponding to each of the multiple pieces of knowledge information in the knowledge base can be obtained, and a matching degree calculation can be performed between the query instruction and the text representation information of each piece of knowledge information to obtain a matching degree score between the query instruction and each piece of knowledge information.
- the text representation information is used to describe the knowledge information in a textual manner.
- a predetermined information representation method can be used to obtain text representation information for each piece of knowledge information in the knowledge base, and each piece of knowledge information can be stored in association with its corresponding text representation information for subsequent access.
- the knowledge information in the knowledge base has diverse modalities
- the text representation information corresponding to the knowledge information can be obtained. Therefore, when searching the knowledge base based on the query instruction, a matching degree calculation can be performed between the query instruction in the textual modality and the textual representation information in the textual modality. This allows for an accurate understanding of the meaning of the query instruction and the knowledge information in a unified modality, thereby improving the accuracy of the matching degree calculation result.
- the matching degree calculation between the query instruction in the textual modality and the textual representation information in the textual modality can be implemented using a recall algorithm.
- the recall algorithm may be a Vector Recall algorithm
- BM25 Recall algorithms include TF-1DF (Term Frequency-1 Inverse Document Frequency) recall.
- vector recall is a recall method based on vector similarity calculation. Its core concept is to represent the features to be calculated using vectors and then calculate feature similarity based on the vectors.
- the vector recall process can be divided into two steps: feature vectorization and vector similarity calculation. First, the features to be calculated can be converted into vector form using a deep learning model (such as word embedding or the BERT model). Then, the similarity between these vectors is calculated in the vector space.
- a deep learning model such as word embedding or the BERT model
- the text representation information of the knowledge information is vectorized using an encoding model, and the resulting vector is stored in the vector engine.
- the vector corresponding to the query instruction and the vector corresponding to the text representation information are obtained.
- the similarity between the vector corresponding to the query instruction and the vector corresponding to the text representation information is then calculated through vector calculation.
- BM25 is a statistically based ranking function algorithm that achieves recall by weighting each word in a document and then calculating the similarity between the query and the document.
- BM25 The core concept of the BM25 algorithm is to determine the weight of each word based on term frequency (TF) and inverse document frequency (IDF).
- TF term frequency
- IDF inverse document frequency
- Term frequency indicates the number of times a word appears in a document
- inverse document frequency indicates the rarity of a word in the entire document collection.
- BM25 can assess the importance of a word in a specific document and use this to calculate the similarity between the query and the document.
- TF-IDF is an algorithm that calculates term frequency and inverse document frequency and multiplies them together to obtain a score of a word's importance within the entire document collection.
- TF-IDF evaluates the similarity between the query (i.e., the words in the query) and the words in the document to achieve recall.
- Different recall algorithms can be applied to recall knowledge of different modalities. Based on this, in some optional embodiments, when searching a knowledge base based on a query, a multi-way recall approach can be used to retrieve optimal knowledge information from the knowledge base. The following description will use any one of the multiple pieces of knowledge information as an example.
- multiple recall algorithms can be used to calculate the matching degree between the textual representation of the knowledge information and the query, resulting in multiple matching scores.
- the reliability of the matching scores corresponding to different recall algorithms varies, indicating that different recall algorithms are suitable for knowledge information of different modalities.
- weight coefficients corresponding to the multiple recall algorithms can be determined based on their applicability to knowledge information of different modalities. For example, if the knowledge information is a text paragraph, the weights of the aforementioned multiple recall algorithms are w1, w2, and w3, respectively; if the knowledge information is a table in text form, the weights of the aforementioned multiple recall algorithms are w4, w5, and w6, respectively; and if the knowledge information is a table in image form, the weights of the aforementioned multiple recall algorithms are w7, w8, and w9, respectively.
- a weighted calculation can be performed on the multiple matching scores to obtain a matching score between the query instruction and the knowledge information.
- the target knowledge information that matches the query instruction can be determined from the multiple pieces of knowledge information based on the matching scores of the query instruction and the multiple pieces of knowledge information.
- the target knowledge information can be the piece of knowledge information with the highest matching score, or can be multiple pieces of knowledge information with high matching scores, although this embodiment is not limiting.
- the modalities of the multiple pieces of knowledge information can be the same or different.
- the content parsed text corresponding to the target knowledge information can be obtained, and the query instruction and the content parsed text corresponding to the target knowledge information can be input into a large language model.
- a large language model refers to a large language model with a parameter count greater than a set parameter count threshold.
- the content parsed text of the target knowledge information is obtained by performing content parsing on the target document element corresponding to the target knowledge information, which includes document elements in non-textual modalities.
- the training corpus used in the pre-training process of the large language model contains a large amount of text and text-modal encoding information, enabling the large language model to understand the content parsed text of document elements.
- the large language model can output a response that is appropriate for the query instruction based on the learned parameters and the content parsed text corresponding to the target knowledge information.
- target knowledge information matching the query instruction can be retrieved from multiple pieces of knowledge information in the knowledge base.
- the query instruction and the content parsed text corresponding to the target knowledge information are then input into the large language model for question-and-answer processing.
- the content parsed text corresponding to the target knowledge information is obtained by performing content parsing on the target document elements corresponding to the target knowledge information.
- the knowledge base can be constructed or updated based on multiple document samples.
- multiple document elements can be obtained from the multiple document samples, where the multiple document elements correspond to multiple different modalities.
- the multiple document samples may be various documents from multiple different application fields, covering various types of knowledge in various application scenarios of the large language model.
- the multiple document elements may be added to the knowledge base as knowledge information.
- the multiple document elements may be characterized to obtain textual representation information for each of the multiple document elements, and the corresponding relationship between the multiple document elements and their respective textual representation information may be stored.
- the textual representation information of document elements in different modalities may be obtained in different ways. The following will use any of the multiple document samples as an example to illustrate the characterization processing of document elements. If the document sample includes a text paragraph, at least one of the following information is obtained: the name of the document containing the text paragraph, the paragraph title, the paragraph content, the document creation time, and the editing time; the textual representation information of the text paragraph.
- the document sample includes a table in text form, at least one of the following information is obtained: the name of the document containing the table, the table title, key content within the table, the document creation time, and the editing time; the textual representation information of the table.
- the key content of the table may be a portion of the fields within the table.
- the document sample includes an image, at least one of the following information is obtained: the document name containing the image, the image title, the question identified from the image, the image description, the document creation time, and the editing time, as the text representation information of the image.
- the correspondence between the multiple document elements and their respective text representation information may be stored in a knowledge base or in another mapping table, which is not a limitation in this embodiment.
- the text representation information of each document element in the knowledge base may be read based on the above correspondence, and the degree of match between the query instruction and the text representation information of the document element may be calculated.
- the general large language model may be further enhanced and trained to make it more suitable for search-based question-answering services that integrate multimodal information.
- the following provides an exemplary description of the enhanced training process for the large language model.
- a pre-trained general large language model may be used as a base model, and the base model is further pre-trained using document samples from multiple different domains to train the base model's ability to understand the content of document elements and parse text.
- multiple document elements can be obtained from multiple document samples, where the multiple document elements correspond to multiple different modalities.
- the multiple document samples can be documents from multiple different application domains, to train the large language model's ability to understand document elements in a general domain.
- the multiple document elements can be parsed based on the modalities to which they correspond, obtaining content parsed text corresponding to each of the multiple document elements.
- the following uses any document sample as an example to illustrate optional implementations for parsing document elements in the document sample.
- the text paragraph is segmented to obtain multiple text blocks, which serve as the content parsed text corresponding to the text paragraph.
- the text content and logical relationships between cells in the table in text form are identified, and the identified text content and logical relationships are encoded to obtain encoded information, which serves as the content parsed text corresponding to the table in text form.
- the encoding information can be obtained based on the identified text content and logical relationships.
- the text-based table is encoded into at least one of HTML, LaTeX, and Markdown encoding.
- the pre-trained corpus for the large language model typically contains a large amount of HTML and LaTeX code, so the large language model has a good understanding of this type of encoding.
- the document sample includes an image
- the image includes a table in the form of an image
- the text content and the positions of the cell vertices in the table in the form of an image are identified.
- the logical relationships between the cells in the table in the form of an image are determined based on the identified cell vertices.
- Encoding is performed based on the identified text content and logical relationships to obtain encoding information, which is used as the content parsed text corresponding to the table in the form of an image. In some embodiments, as shown in FIG.
- the table in the form of an image can be encoded based on the image model.
- samples can be constructed based on a table in the form of an image and the true encoding value corresponding to the table.
- the constructed samples can then be used to perform supervised training on the image model, enabling the image model to learn to identify text content and logical relationships from the input table in the form of an image and to encode the identified text content and logical relationships.
- text can be extracted from the image or text description information can be generated based on the image as the content parsed text corresponding to the image.
- the image typically refers to an image that does not include a table.
- Extracting text from the image can be accomplished using optical character recognition (OCR) technology, while generating text description information from the image can be accomplished using an image-to-text model.
- OCR optical character recognition
- image-to-text model As shown in Figure 2, when the image does not include an image, text can be extracted from the image using OCR technology, or a text description information corresponding to the image can be generated using an image-to-text model.
- the image can also be displayed to the user, and a text description information input by the user based on the image can be obtained.
- multiple question-answer pair samples associated with the multiple document samples may be obtained, each of which includes a query instruction sample and a corresponding response result sample.
- the query instruction sample simulates a question instruction issued by a user in an actual application scenario
- the response result sample simulates the response result given by the large language model to the query instruction.
- the question-answer pair samples may be constructed by the user based on the content of the document samples, or automatically generated based on the question-answer model.
- the multiple document samples and preset prompt words may be input into the question-answer model, so that the question-answer model, under the guidance of the prompt words, generates multiple query instruction samples and response result samples for each of the multiple query instruction samples based on the text content of the multiple document samples.
- these multiple query instruction samples and corresponding response result samples may be manually reviewed to improve the reliability of the question-answer pair samples, thereby enhancing the enhanced training effect of the large language model.
- multiple sample pairs can be obtained based on the parsed content text corresponding to the multiple document elements and the multiple question-answer pair samples.
- a sample pair can include a question-answer pair sample and the parsed content text corresponding to at least one document element. The parsed content text corresponding to the at least one document element provides the knowledge information required to generate the question-answer pair sample.
- the large language model can learn to generate response samples based on the parsed content text corresponding to the at least one document element and the query instruction sample in the question-answer pair sample.
- sample pairs can be manually constructed based on the matching relationship between the question-answer pair sample and the document element.
- sample pairs can be constructed by a machine model based on the matching relationship between the question-answer pair sample and the document element. The following uses any one of the multiple question-answer pair samples as an example for illustrative purposes.
- the machine model can employ a set recall algorithm to determine a target document sample from the multiple document samples that matches the query instruction sample.
- the recall algorithm may be the vector recall algorithm, BM25 recall algorithm, TF-IDF recall algorithm, etc., as described in the previous embodiments.
- the document elements that match the query instruction sample may be determined based on the document elements contained in the target document sample.
- the machine model may calculate the matching score between each document element in the target document and the query instruction sample, and based on the matching score, determine the document elements that match the query instruction sample from the target document sample.
- the document elements adapted to the instruction sample serve as the knowledge information corresponding to the query instruction.
- the text is parsed based on the sample question-answer pairs associated with the query instruction and the content of the knowledge information corresponding to the query instruction, obtaining a sample pair corresponding to the query instruction sample.
- the document elements adapted to the query instruction sample may include document elements of a single modality to simulate a simple question-and-answer scenario.
- the document elements adapted to the query instruction sample may be a text paragraph, a table in text form, a table in image form, or an image.
- the document elements adapted to the query instruction sample may include document elements of at least two different modalities to simulate a complex question-and-answer scenario.
- the document element adapted to the query instruction sample may be a combination of a text paragraph and an image, or a combination of a text paragraph and an image-based table, or a combination of a text paragraph, a text-based table, and an image, and the list is omitted.
- the large language model can be trained based on these sample pairs. It is worth noting that to simulate different question-answering scenarios, different types of tasks can be constructed for the large language model. These different types of tasks can be constructed by adding prompt words corresponding to the task type to the query instruction sample. These task types may include: selective question-answering tasks, summarizing question-answering tasks, and rejection question-answering tasks.
- Selective question-answering tasks select a reference from multiple input references as a response. Summarizing question-answering tasks integrate and summarize multiple references and use the summary as the response. Rejection question-answering tasks, when determining that the reference information contains errors, refuse to answer or use fallback phrases to answer. This will not be further described.
- the base model converges using the aforementioned training method, the converged model can be fine-tuned using document samples from the vertical domain to improve its performance on question-answering tasks in the vertical domain. It should be understood that during the fine-tuning phase, samples matching specific tasks in the vertical domain can be constructed using the aforementioned implementations based on documents from the vertical domain, and the model can be trained using the aforementioned training methods to achieve fine-tuning.
- the question-answering processing framework primarily includes a knowledge acquisition module, a document parsing module, an information representation module, a multi-way recall module, a large-model question-answering module, and a reinforcement training module.
- the knowledge acquisition module is used to acquire multimodal documents.
- Multimodal documents may include, but are not limited to, Txt, Word, PDF, Excel, images, web pages, and the like.
- the content of a document can be divided into different content forms, such as text paragraphs, text-based tables, image-based tables, and other images. Any document may contain one or more of these different content forms.
- various forms of content can be identified and parsed using different processing steps. Different form recognition methods can be used depending on the document format. For example, for documents in Word format, some Word processing toolkits (such as those based on Python or Java) can be used to extract text paragraphs, tables, images, and the like from Word. The following will provide an exemplary explanation of the parsing steps shown in FIG3 . As shown in FIG3 , the parsing operation for a multimodal document may include the following steps:
- the image model can be used to extract the content in the table and the logical relationship between cells, and one or more encoding methods can be used to encode the content in the table and the logical relationship between cells to obtain the table code. 4.
- images that do not contain tables you can use an image model to extract textual information from the image, or use an image-text generation model to generate textual descriptions corresponding to the image. Alternatively, you can manually edit the textual descriptions corresponding to the image (not shown).
- different representation methods can be used for different forms of content. As shown in Figure 3, the document information representation operation may include the following steps:
- the document name, paragraph title, paragraph content, document creation time, and editing time of the paragraph are used as the text representation information of the text paragraph.
- the document name, table title, key content within the table (such as field names), document creation time, and editing time can be used as the text representation information of the table.
- the document name, image title, text extracted from the image, text description information generated by the image-to-text model, manually edited description, document creation time, and editing time can be used as the text representation information for the image.
- the text representation information matching the user question can be obtained from the information representations obtained in the previous steps. As shown in Figure 3, the multi-way recall operation may include the following steps:
- Multi-way recall methods may include, but are not limited to, vector recall, BM25 recall, and TF-IDF.
- this text representation information can be vectorized using an encoding model, and the resulting vectors can be stored in the vector engine.
- various recall methods can be used based on the user's question to retrieve one or more document elements that are most similar to the user's question as the recall result.
- step 11 can be performed to input the user question and the highest-scoring recall result, or several results with high scores, into the large language model for question-answering.
- step 11 can be performed to input the user question and the highest-scoring recall result, or several results with high scores, into the large language model for question-answering.
- specific samples and tasks can be constructed to perform continued pre-training, fine-tuning, and reinforcement learning based on human feedback on the general large language model to further improve its question-answering performance.
- the enhanced training module performs enhanced training on the large language model by performing the following steps: Step 12: Continue pre-training on the general large language model based on multimodal sample data.
- table encoding information can be used to perform further pre-training on a general large language model to further improve its understanding of table encodings.
- sample pairs and question-answering tasks can be constructed based on the application scenario.
- Training samples that meet the application scenario can be retrieval-based question-answering samples that integrate multimodal information.
- the modalities of the knowledge information in any sample pair can include the following combinations: a simple paragraph, image, or table; a paragraph + table; a paragraph + image; an image + table; or a combination of a paragraph + image + table, not listed here.
- Question-answering tasks can include selective question-answering tasks, summarizing question-answering tasks, or rejection question-answering tasks.
- sample pairs can be manually curated.
- a machine-based approach with manual support can be used to curate sample pairs.
- a question-answering model can be used to generate a batch of question-answer pairs based on the content of the document samples.
- the questions in the question-answer pairs can then be used to retrieve documents from the document library that are most similar to the questions.
- the most similar document can be used as the knowledge information corresponding to the question and answer. Based on the question and the recalled knowledge information in the question and answer pair, a sample pair can be constructed.
- Step 13 Based on the question and answer pair constructed in step 11, fine-tune and improve the large language model.
- Step 14 Perform reinforcement learning operations based on human feedback on the fine-tuned large language model.
- a scoring model is trained based on human feedback data, such as reflux data from real-world question-and-answer scenarios and user rating data. Each time the large language model outputs a response, it is scored using the scoring model. Based on the scoring results, the large model is further fine-tuned using reinforcement learning.
- encoding tables in text and image formats fully preserves the table content and the logical relationships between cells, significantly improving the large language model's understanding of this information.
- text recognition based on OCR technology or the use of an image-to-text model to generate text descriptions of the images fully preserves the information contained in the images, enabling the large language model to understand and fully utilize diverse information to generate responses.
- This implementation allows a larger number of documents with complex modalities to be used in search-based question-and-answer tasks, thereby expanding the scope of knowledge and improving the accuracy of search-based question-and-answer tasks. It should be noted that the execution of each step of the method provided in the above embodiment can be performed by the same device, or the method can be performed by different devices.
- steps 101 to 104 may be performed by device A; another example, steps 101 and 102 may be performed by device A, and step 103 may be performed by device B; and so on.
- steps 101 to 104 may be performed by device A; another example, steps 101 and 102 may be performed by device A, and step 103 may be performed by device B; and so on.
- some of the processes described in the above embodiments and accompanying drawings include multiple operations that appear in a specific order. However, it should be understood that these operations may be performed in a different order or in parallel. Operation numbers, such as 101 and 102, are merely used to distinguish between different operations and do not represent any specific execution order. Furthermore, these processes may include more or fewer operations, and these operations may be performed sequentially or in parallel.
- first and second are used herein to distinguish between different messages, devices, modules, and the like, and do not imply a sequential order or limit “first” and “second” to different types.
- user information including but not limited to user device information, user personal information, etc.
- data including but not limited to data used for analysis, stored data, and displayed data, etc.
- the collection, use, and processing of relevant data must comply with the relevant laws, regulations, and standards of the relevant countries and regions, and corresponding operation portals are provided for users to choose to authorize or reject.
- Figure 4 illustrates a schematic diagram of the structure of an electronic device provided by an exemplary embodiment of the present disclosure.
- the electronic device includes: memory 401, processor 402, and communication component 403.
- Memory 401 is used to store computer programs and can be configured to store various other data to support operations on the electronic device. Examples of such data include instructions for any application or method operating on the electronic device.
- Processor 402 is coupled to memory 401 and is used to execute a computer program in memory 401, so as to: receive a query instruction; obtain target knowledge information matching the query instruction from multiple knowledge information in a knowledge base; obtain content parsed text corresponding to the target knowledge information, wherein the content parsed text is obtained by performing content parsing on target document elements corresponding to the target knowledge information, wherein the target document elements include document elements in non-text mode; and input the query instruction and the content parsed text corresponding to the target knowledge information into a large language model, so that the large language model outputs a response result adapted to the query instruction based on the content parsed text corresponding to the target knowledge information.
- the processor 402 when the processor 402 obtains target knowledge information that matches the query instruction from multiple knowledge information in the knowledge base, it is specifically used to: obtain text representation information of each of the multiple knowledge information in the knowledge base; calculate the matching degree between the query instruction and the text representation information of each of the multiple knowledge information to obtain the matching degree score between the query instruction and the multiple knowledge information; and determine the target knowledge information that matches the query instruction from the multiple knowledge information based on the matching degree scores between the query instruction and the multiple knowledge information.
- the processor 402 when the processor 402 performs a matching calculation on the query instruction and the respective text representation information of the plurality of knowledge information to obtain the respective matching scores of the query instruction and the plurality of knowledge information, it is specifically used to: for any knowledge information among the plurality of knowledge information, use a plurality of recall algorithms to perform a matching calculation on the text representation information of the knowledge information and the query instruction to obtain a plurality of matching scores; determine the weight coefficients corresponding to the plurality of recall algorithms according to the modality of the knowledge information and the applicable relationship between the plurality of recall algorithms and knowledge information of different modalities; perform a weighted calculation on the plurality of matching scores according to the weight coefficients corresponding to the plurality of recall algorithms to obtain The matching score between the query instruction and the knowledge information.
- the processor 402 is further configured to: obtain the multiple document elements from multiple document samples, the multiple document elements corresponding to multiple different modalities; add the multiple document elements as knowledge information to the knowledge base; perform representation processing on the multiple document elements to obtain the text representation information of each of the multiple document elements, and save the corresponding relationship between the multiple document elements and their respective text representation information.
- the processor 402 when the processor 402 performs characterization processing on the multiple document elements and obtains text representation information of each of the multiple document elements, it is specifically used to: for any document sample among the multiple document samples, if the document sample includes a text paragraph, obtain at least one information of the name of the document where the text paragraph is located, the paragraph title, the paragraph content, the document creation time, and the editing time as the text representation information of the text paragraph; if the document sample includes a table in text form, obtain at least one information of the name of the document where the table is located, the table title, the key content in the table, the document creation time, and the editing time as the text representation information of the table; if the document sample includes a picture, obtain at least one information of the name of the document where the picture is located, the picture title, the question identified from the picture, the description information of the picture, the document creation time, and the editing time as the text representation information of the picture.
- the processor 402 is further used to: parse the multiple document elements according to the modalities corresponding to each of the multiple document elements to obtain content parsed texts corresponding to each of the multiple document elements; obtain multiple question-answer pair samples associated with the multiple document samples; any question-answer pair sample includes a query instruction sample and a corresponding reply result sample; obtain multiple sample pairs according to the content parsed texts corresponding to each of the multiple document elements and the multiple question-answer pair samples; and train the large language model based on the multiple sample pairs.
- the processor 402 parses the multiple document elements according to the modalities corresponding to the document elements in the multiple document samples and obtains the content parsed texts corresponding to the multiple document elements, it is specifically configured to perform at least one of the following operations: for any document sample among the multiple document samples, if the document sample includes a text paragraph, performing text segmentation on the text paragraph to obtain multiple text blocks as the content parsed text corresponding to the text paragraph; if the document sample includes a table in text form, identifying the text content and the logical relationship between cells in the text-form table, and encoding according to the identified text content and logical relationship to obtain encoding information as the content parsed text corresponding to the text-form table; if the document sample includes a picture, and the picture includes a table in picture form, identifying the text content and the positions of the cell vertices in the picture-form table, determining the logical relationship between the cells in the picture-form table according to the identified cell vertices, and encoding according to the identified text content and
- processor 402 when obtaining multiple question-answer pair samples associated with the multiple document samples, processor 402 is specifically configured to: input the multiple document samples and preset prompt words into a question-answering model, so that the question-answering model, under the guidance of the prompt words, generates the multiple question-answer pair samples based on the text content in the multiple document samples.
- the processor 402 when parsing the text corresponding to the content of the multiple document elements and the multiple question-answer pair samples to obtain multiple sample pairs, is specifically configured to: for any query instruction sample in the multiple question-answer pair samples, employ a set recall algorithm to determine a target document sample from the multiple document samples that matches the query instruction sample; determine a document element that matches the query instruction sample based on the document elements contained in the target document sample; use the document element that matches the query instruction sample as the knowledge information corresponding to the query instruction, and parse the text based on the content of the question-answer pair sample to which the query instruction belongs and the knowledge information corresponding to the query instruction to obtain a sample pair corresponding to the query instruction sample.
- the document element that matches the query instruction sample includes document elements of at least two different modalities.
- the electronic device further includes other components, such as a power supply component 404, a display component 405, and an audio component 406.
- FIG4 schematically illustrates only some components and does not imply that the electronic device includes only the components shown in FIG4 .
- the memory 401 may be implemented by any type of volatile or non-volatile memory device or a combination thereof, such as static random-access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk.
- SRAM static random-access memory
- EEPROM electrically erasable programmable read-only memory
- EPROM erasable programmable read-only memory
- PROM programmable read-only memory
- ROM read-only memory
- magnetic storage flash memory, magnetic
- the communication component 403 is configured to facilitate wired or wireless communication between the device in which the communication component is located and other devices.
- the device where the communication component is located can access a wireless network based on a communication standard, such as Wi-Fi (wireless network communication technology), 2G (such as Global System for Mobile Communications (GSM)), 3G (such as Wideband Code Division Multiple Access (WCDMA), 4G (such as Long Term Evolution (LTE)), 4G+ (such as upgraded Long Term Evolution (LTE-Advanced, LTE-A)), or 5G (fifth generation mobile communication technology (5th Generation Mobility Communications Technology)), or a combination thereof.
- the communication component receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel.
- the communication component can be based on near field communication (NFC) technology, radio frequency identification (RFID) technology, or a combination thereof.
- RFID RFID
- RFID Infrared Data Association
- UWB Ultra Wide Band
- BT Bluetooth
- the power supply component 404 is used to provide power to various components of the device where the power supply component is located.
- the power supply component may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for the device where the power supply component is located.
- the display component 405 includes a screen, which may include a liquid crystal display (LCD) and a touch panel (TP).
- LCD liquid crystal display
- TP touch panel
- the screen may be implemented as a touch screen to receive input signals from the user.
- the touch panel includes one or more touch sensors to sense touches, slides, and gestures on the touch panel.
- the touch sensors may not only sense the boundaries of a touch or slide action, but also detect the duration and pressure associated with the touch or slide action.
- the audio component 406 may be configured to output and/or input audio signals.
- the audio component includes a microphone (MIC).
- MIC microphone
- the audio component When the device containing the audio component is in an operating mode, such as call mode, recording mode, and voice recognition mode, the microphone is configured to receive external audio signals.
- the received audio signal may be further stored in a memory or transmitted via the communication component.
- the audio component also includes a speaker for outputting the audio signal.
- target knowledge information matching the query instruction may be obtained from multiple pieces of knowledge information in the knowledge base, and the query instruction and the content parsed text corresponding to the target knowledge information may be input into the large language model for question-and-answer processing.
- the content parsed text corresponding to the target knowledge information is obtained by performing content parsing on the target document elements corresponding to the target knowledge information.
- the target document elements include document elements in non-text modalities
- content parsing of the target document elements before inputting them into the large language model allows the large language model to understand the non-textual document elements in the target document elements, thereby providing the large language model with more reliable reference knowledge for question-and-answer processing.
- the embodiment of the present disclosure also provides a computer-readable storage medium storing a computer program, which, when executed, can implement the steps that can be performed by the electronic device in the above-mentioned method embodiment. Accordingly, the embodiment of the present disclosure also provides a computer program product, including a computer program/instruction, which, when executed by a processor, can implement the steps in the method provided by the embodiment of the present disclosure.
- a computer program product including a computer program/instruction, which, when executed by a processor, can implement the steps in the method provided by the embodiment of the present disclosure.
- the present disclosure can take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects.
- the present disclosure can take the form of one or more computer-usable storage media (including but not limited to disk storage, CD-ROM (Compact Disk Read-Only Memory,
- CD-ROM Compact Disk Read-Only Memory
- the present disclosure is described with reference to flowcharts and/or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present disclosure. It should be understood that each process and/or block in the flowcharts and/or block diagrams, as well as combinations of processes and/or blocks in the flowcharts and/or block diagrams, can be implemented by computer program instructions.
- These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, such that the instructions, when executed by the processor of the computer or other programmable data processing device, produce means for implementing the functions specified in one or more processes in the flowcharts and/or one or more blocks in the block diagrams.
- These computer program instructions can also be stored in a computer-readable memory capable of directing the computer or other programmable data processing device to operate in a specific manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means that implement the functions specified in one or more processes in the flowcharts and/or one or more blocks in the block diagrams.
- a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
- Memory may include non-volatile memory in the form of computer-readable media, random access memory (RAM), and/or non-volatile memory, such as read-only memory (ROM) or flash memory. Memory is an example of computer-readable media.
- Computer-readable media including both permanent and non-permanent, removable and non-removable media, can store information using any method or technology.
- Information can be computer-readable instructions, data structures, program modules, or other data.
- Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device.
- PRAM phase-change memory
- SRAM static random access memory
- DRAM dynamic random access memory
- RAM random access memory
- ROM read-only memory
- EEPROM electrically erasable programmable read-only memory
- flash memory or
- computer-readable media does not include transient computer-readable media such as modulated data signals and carrier waves.
- the terms "comprise,””include,” or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, product, or apparatus comprising a list of elements includes not only those elements but also other elements not explicitly listed, or elements inherent to such process, method, product, or apparatus.
- an element specified by the phrase “comprising a" does not preclude the presence of additional identical elements in the process, method, product, or apparatus comprising the recited element.
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- Data Mining & Analysis (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Artificial Intelligence (AREA)
- Life Sciences & Earth Sciences (AREA)
- Mathematical Physics (AREA)
- Evolutionary Computation (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Evolutionary Biology (AREA)
- Bioinformatics & Computational Biology (AREA)
- Bioinformatics & Cheminformatics (AREA)
- Computational Linguistics (AREA)
- Databases & Information Systems (AREA)
- Human Computer Interaction (AREA)
- Health & Medical Sciences (AREA)
- Biomedical Technology (AREA)
- Biophysics (AREA)
- General Health & Medical Sciences (AREA)
- Molecular Biology (AREA)
- Computing Systems (AREA)
- Software Systems (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
本公开实施例提供一种问答处理方法、设备、产品及存储介质。在问答处理方法中,获取到问询指令后,可从知识库的多个知识信息中获取与问询指令匹配的目标知识信息,并将问询指令以及目标知识信息对应的内容解析文本输入大语言模型进行问答处理。其中,目标知识信息对应的内容解析文本是通过对目标知识信息对应的目标文档元素进行内容解析得到的,当目标文档元素包括非文本模态的文档元素时,在将目标文档元素输入大语言模型之前对目标文档元素进行内容解析,可使得目标文档元素中非文本模态的文档元素能够被大语言模型理解,以向大语言模型提供可靠性较高的问答参考知识。从而,可提升大语言模型的对问询指令的回答准确性。
Description
问答处理方法、 设备、 产品及存储介质 本公开要求于 2024年 02月 29 日提交中国专利局、 申请号为 202410232704. 5、 申请 名称为 “问答处理方法、 设备、 产品及存储介质" 的中国专利申请的优先权, 其全部内容 通过引用结合在本公开中。 技术领域 本公开涉及计算机技术领域, 尤其涉及一种问答处理方法、 设备、 产品及存储介质。 背景技术 随着人工智能的发展, 大语言模型 (Large Language Mode I , LLM)逐渐被广泛应用。 在一种典型的应用场景中, 可将大语言模型和传统文档检索方法进行融合, 得到一种检索 问答系统。 这种问答系统通常将文档按一定的方式切分成段落, 并将段落向量化后存入向 量引擎。 在获取到用户的问询指令时, 可根据用户的提问匹配召回相似最高的段落, 再使 得大语言模型参考召回的段落的内容进行回答。 在一 些场景中, 文档可能包含非文本模态的内容和信息。 但是, 大语言模型只能接受 文本序列的输入, 无法处理除文本之外的其他模态的信息, 进而导致无法准确地回答部分 用户问题。 因此, 有待提出一种新的解决方案。 发明内容 本公开的多个方面提供一种问答处理方法、 设备、 产品及存储介质, 用以提升大语言 模型对多模态文档的处理能力, 提升对问询指令的回答准确性。 本公开实施例提供一种问答处理方法, 包括: 接收问询指令; 从知识库的多个知识信 息中, 获取与所述问询指令匹配的目标知识信息; 获取所述目标知识信息对应的内容解析 文本, 所述内容解析文本通过对所述目标知识信息对应的目标文档元素进行内容解析得到, 所述目标文档元素包括非文本模态的文档元素; 将所述问询指令以及所述目标知识信息对 应的内容解析文本输入大语言模型, 以使大语言模型根据所述目标知识信息对应的内容解 析文本输出与所述问询指令适配的答复结果。 可选地, 从知识库的多个知识信息中, 获取与所述问询指令匹配的目标知识信息, 包 括: 获取所述知识库中的多个知识信息各自的文本表征信息; 将所述问询指令与所述多个 知识信息各自的文本表征信息进行匹配度计算, 得到所述问询指令与所述多个知识信息各 自的匹配度分数; 根据所述问询指令与所述多个知识信息各自的匹配度分数, 从所述多个 知识信息中确定与问询指令匹配的所述目标知识信息。 可选地, 将所述问询指令与所述多个知识信息各自的文本表征信息进行匹配度计算, 得到所述问询指令与所述多个知识信息各自的匹配度分数, 包括: 针对所述多个知识信息 中的任一知识信息, 采用多种召回算法对所述知识信息的文本表征信息与所述问询指令进 行匹配度计算, 得到多个匹配度分数; 根据所述知识信息的模态以及所述多种召回算法与 不同模态知识信息的适用关系, 确定所述多种召回算法对应的权重系数; 根据所述多种召 回算法对应的权重系数, 对所述多个匹配度分数进行加权计算, 得到所述问询指令与所述 知识信息的匹配度分数。 可选地, 获取所述知识库中的多个知识信息各自的文本表征信息之前, 还包括: 从多 个文档样本中获取所述多个文档元素, 所述多个文档元素对应多个不同的模态; 将所述多 个文档元素作为知识信息添加到所述知识库中; 对所述多个文档元素进行表征处理, 得到 所述多个文档元素各自的文本表征信息, 并保存所述多个文档元素及其各自的文本表征信 息的对应关系。
可选地 , 对所述多个文档元素进行表征处理, 得到所述多个文档元素各自的文本表征 信息, 包括: 针对所述多个文档样本中的任一文档样本, 若所述文档样本包括文本段落, 则获取所述文本段落的所在的文档的名称、 段落标题、 段落内容、 文档创建时间以及编辑 时间中的至少一种信息, 作为所述文本段落的文本表征信息; 若所述文档样本包括文本形 态的表格, 则获取所述表格所在的文档的名称、 表格标题、 表格内的关键内容、 文档创建 时间以及编辑时间中的至少一种信息, 作为所述表格的文本表征信息; 若所述文档样本包 括图片, 则获取所述图片所在的文档名称、 图片标题、 从所述图片中识别的问题、 图片的 描述信息、文档创建时间以及编辑时间中的至少一种信息,作为所述图片的文本表征信息。 可选地 , 还包括: 根据所述多个文档元素各自对应的模态, 对所述多个文档元素进行 解析, 得到所述多个文档元素各自对应的内容解析文本; 获取与所述多个文档样本关联的 多个问答对样本; 任一问答对样本包括一问询指令样本以及对应的答复结果样本; 根据所 述多个文档元素各自对应的内容解析文本以及所述多个问答对样本, 获取多个样本对; 根 据所述多个样本对, 对所述大语言模型进行训练。 可选地 , 根据所述多个文档样本中的文档元素各自对应的模态, 对所述多个文档元素 进行解析, 得到所述多个文档元素各自对应的内容解析文本, 包括以下至少一种: 针对所 述多个文档样本中的任一文档样本, 若所述文档样本包括文本段落, 则对所述文本段落进 行文本切割, 得到多个文本块, 作为所述文本段落对应的内容解析文本; 若所述文档样本 包括文本形态的表格, 则识别所述文本形态的表格中的文本内容以及单元格之间的逻辑关 系, 并根据识别到的文本内容以及逻辑关系进行编码, 得到编码信息, 作为所述文本形态 的表格对应的内容解析文本;若所述文档样本包括图片,且所述图片包括图片形态的表格, 则识别所述图片形态的表格中的文本内容以及单元格顶点的位置, 根据识别到的单元格顶 点确定所述图片形态的表格中的单元格之间的逻辑关系, 并根据识别到的文本内容和逻辑 关系进行编码, 得到编码信息, 作为所述图片形态的表格对应的内容解析文本; 若所述文 档样本包括图片, 且所述图片不包括表格, 则从所述图片中提取文本或者根据所述图片生 成文本描述信息, 作为所述图片对应的内容解析文本。 可选地 , 获取与所述多个文档样本关联的多个问答对样本, 包括: 将所述多个文档样 本以及预设提示词输入问答模型, 以使所述问答模型在所述提示词的指示下根据所述多个 文档样本中的文本内容生成所述多个问答对样本。 可选地 , 根据所述多个文档元素各自对应的内容解析文本以及所述多个问答对样本, 获取多个样本对, 包括: 针对所述多个问答对样本中的任一问询指令样本, 采用设定召回 算法, 从所述多个文档样本中确定与所述问询指令样本匹配的目标文档样本; 根据所述目 标文档样本包含的文档元素, 确定与所述问询指令样本适配的文档元素; 将与所述问询指 令样本适配的文档元素作为所述问询指令对应的知识信息, 并根据所述问询指令所属的问 答对样本以及所述问询指令对应的知识信息的内容解析文本, 获取所述问询指令样本对应 的样本对。 可选地 , 与所述问询指令样本适配的文档元素包含至少两个不同模态的文档元素。 本公开实施例还提供一种 电子设备, 包括: 存储器和处理器; 所述存储器用于存储一 条或多条计算机指令; 所述处理器用于执行所述一条或多条计算机指令以用于: 执行本公 开实施例提供的方法中的步骤。 本公开实施例还提供一种存储有计算机程序 的计算机可读存储介质, 计算机程序被处 理器执行时能够实现本公开实施例提供的方法中的步骤。 本公开实施例还提供一种计算机程序产品 , 包括计算机程序 /指令, 所述计算机程序 / 指令被处理器执行时能够实现本公开实施例提供的方法中的步骤。 本公开实施例提供 的问答处理方法中, 获取到问询指令后, 可从知识库的多个知识信 息中获取与问询指令匹配的目标知识信息, 并将问询指令以及目标知识信息对应的内容解
析文本输入大语言模型进行问答处理。 其中, 目标知识信息对应的内容解析文本是通过对 目标知识信息对应的目标文档元素进行内容解析得到的, 当目标文档元素包括非文本模态 的文档元素时, 在将目标文档元素输入大语言模型之前对目标文档元素进行内容解析, 可 使得目标文档元素中非文本模态的文档元素能够被大语言模型理解, 以向大语言模型提供 可靠性较高的问答参考知识。从而,可提升大语言模型的知识理解能力以及问答处理能力, 提升大语言模型的对问询指令的回答准确性。 附图说明 此处所说 明的附图用来提供对本公开的进一步理解, 构成本公开的一部分, 本公开的 示意性实施例及其说明用于解释本公开, 并不构成对本公开的不当限定。 在附图中: 图 1为本公开一示例性实施例提供的问答处理方法的流程示意图; 图 2为本公开一示例性实施例提供的对图片模态的文档元素进行处理的流程示意图; 图 3为本公开一示例性实施例提供的问答处理框架以及问答处理流程的示意图; 图 4为本公开一示例性实施例提供的电子设备的结构示意图。 具体实施方式 为使本公开的目的、 技术方案和优点更加清楚, 下面将结合本公开具体实施例及相应 的附图对本公开技术方案进行清楚、 完整地描述。 显然, 所描述的实施例仅是本公开一部 分实施例, 而不是全部的实施例。 基于本公开中的实施例, 本领域普通技术人员在没有做 出创造性劳动前提下所获得的所有其他实施例, 都属于本公开保护的范围。 在本公开实施例 中使用的术语是仅仅出于描述特定实施例的目的, 而非旨在限制本公 开。在本公开实施例和所附权利要求书中所使用的单数形式的“一种” 、 “所述 ”和 “该” 也旨在包括多数形式, 除非上下文清楚地表示其他含义, “多种”一般包含至少两种, 但 是不排除包含至少一种的情况。 应 当理解, 本文中使用的术语 “和 /或 ”仅仅是一种描述关联对象的关联关系, 表示 可以存在三种关系, 例如, A和 /或 B, 可以表示: 单独存在 A, 同时存在 A和 B, 单独存 在 B这三种情况。 另外, 本文中字符 “/”, 一般表示前后关联对象是一种 “或 ”的关系。 还 需要说明的是, 术语 “包括” 、 “包含”或者其任何其他变体意在涵盖非排他性的 包含, 从而使得包括一系列要素的商品或者系统不仅包括那些要素, 而且还包括没有明确 列出的其他要素, 或者是还包括为这种商品或者系统所固有的要素。 在没有更多限制的情 况下, 由语句 “包括一个 …… " 限定的要素, 并不排除在包括所述要素的商品或者系统中 还存在另外的相同要素。 在一些场景 中, 文档可能包含多种模态的内容和信息, 比如文本段落、 文本形态的表 格、 图片形态的表格或者其他非表格的图片等。 但是, 大语言模型只能接受文本序列的输 入, 无法处理除文本之外的其他模态的信息, 进而导致无法准确地回答部分用户问题。 在 一些问答系统中, 若文档中包含图片, 则通常舍弃文档中的图片或者仅基于 OCR (Opt i ca l Character Recogn i t i on, 为光学字符识别) 技术提取图片中的文本信息; 若文档中包含 表格, 则通常将表格强制转换为文本段落。 上述方式会导致大量信息丢失、 文本逻辑关系 错位等后果, 最终导致问答范围大幅减少或者问答准确率下降。 针对上 述技术问题, 在本公开一些实施例中, 提供了一种解决方案, 以下结合附图, 详细说明本公开各实施例提供的技术方案。 图 1为本公开一示例性实施例提供的问答处理方法的流程示意图, 如图 1所示, 该方 法主要包括如下的步骤: 步骤 101、 接收问询指令。 步骤 102、 从知识库的多个知识信息中, 获取与所述问询指令匹配的目标知识信息。 步骤 103、 获取所述目标知识信息对应的内容解析文本, 所述内容解析文本通过对所
述目标知识信息对应的目标文档元素进行内容解析得到, 所述目标文档元素包括非文本模 态的文档元素。 步骤 104、 将所述问询指令以及所述目标知识信息对应的内容解析文本输入大语言模 型, 以使大语言模型根据所述目标知识信息对应的内容解析文本输出与所述问询指令适配 的答复结果。 其 中, 问询指令, 可以是用户发出的, 或者可以是应用程序根据设定的处理逻辑发出 的, 本实施例不做限制。 该问询指令, 可以是选择式的问询指令、 总结式的问询指令或者 拒识式问询指令。 其 中,知识库是一种用于集中存储、组织和管理知识的系统或工具。它通常用于收集、 整理和提供关于特定主题、 领域或行业的知识信息。 知识库中的知识信息, 可以包含多种 不同类型的知识内容, 如文档、 图片、 视频、 音频等数据, 以便用户或者其他应用程序可 以通过检索的方式方便地获取所需的知识。其中,任一文档,可包含多种模态的文档元素。 其中, 文档元素, 是指构成文档的各个组成部分。 在本实施例中, 文档元素的模态可以包 括: 文本段落、 文本形态的表格、 图片形态的表格以及图片等模态。 文档元素的内容解析 文本, 是指对文档元素包含的内容进行解析得到的文本形态的信息。 该文本形态的信息用 于采用文本形态描述文档元素中的内容以及内容之间的逻辑关系, 以便于大语言模型能够 对非文本形态的文档元素进行理解。 其 中, 知识库中的文档可以是 Txt文档、 Word文档、 PDF文档、 Exce l文档等。其中, 上述各类文档中的表格可以是文本形态的表格或者图片形态的表格。 其中, 文本形态的表 格是指在文档编辑软件中直接创建的, 例如利用 Word软件中的表格功能在 Word文档中创 建的表格。 文本形态的表格, 是一种半结构化的数据, 表格中包含了大量数值和文本, 同 时单元格之间具有一定的逻辑关系, 该逻辑关系可以是简单的逻辑关系, 也可以是复杂的 逻辑关系。其中,单元格之间的逻辑关系,可以包括不同单元格中的字段和值的对应关系, 也可包括不同单元格中的字段之间的包含与被包含关系。 其中, 该包含与被包含关系可通 过单元格之间的合并关系进行表示。 其中, 图片形态的表格是一种将表格以图片形式呈现 的方式。 图片形态的表格可以是在电子表格软件 (如 Exce l ) 或图形设计软件中创建的表 格, 然后将其截图或导出为图片格式, 再插入到文档中。 在知识库中, 文档中单个文档元 素也可作为知识信息, 以供检索匹配。 在本实施例 中, 获取问询指令后, 可根据问询指令对知识库进行检索, 以从知识库的 多个知识信息中, 获取与该问询指令匹配的目标知识信息。 其中, 检索出的目标知识信息 可以包括一种模态或者多重模态的文档元素。 其 中, 问询指令通常为文本模态。 在一些可选的实施例中, 可将知识库中的知识信息 转化成文本模态的信息, 进而在根据问询指令对知识库进行检索时, 可通过计算文本模态 的问询指令与文本模态的知识信息的匹配度来检索目标知识信息。 以下将进行示例性说明。 可选地 , 可获取知识库中的多个知识信息各自对应的文本表征信息, 并将该问询指令 与该多个知识信息各自的文本表征信息进行匹配度计算, 得到问询指令与该多个知识信息 各自的匹配度分数。 其中, 文本表征信息, 用于采用文本方式对知识信息进行描述。 在构 建知识库时, 可采用设定的信息表征方式, 获取知识库中的多个知识信息各自的文本表征 信息, 并将每一知识信息与其对应的文本表征信息进行对应存储, 以供后续读取。 在这种实施 方式中, 当知识库中的知识信息的模态具有多样性时, 可获取知识信息对 应的文本表征信息, 从而在根据问询指令对知识库进行检索时, 可将文本模态的问询指令 以及文本模态的文本表征信息进行匹配度计算, 以在统一的模态下, 准确理解问询指令以 及知识信息的含义, 从而提升匹配度计算结果的准确性。 其 中, 对文本模态的问询指令以及文本模态的文本表征信息进行匹配度计算的操作, 可采用召回算法实现。 例如, 该召回算法可以是向量召回 (Vector Reca l I ) 算法, BM25
召回算法, TF- 1 DF (Term Frequency- 1 nverse Document Frequency, 词频-逆文档频率) 召回等方式。 其 中, 向量召回是一种基于向量相似度计算的召回方法。 其核心思想是将待计算的特 征采用向量来表示, 然后基于向量来计算特征的相似度。 向量召回的过程可以分为特征向 量化和向量相似度计算两个步骤。 首先, 可通过深度学习模型 (如词嵌入或 BERT 模型) 将待计算的特征转换为向量形式。 然后, 在向量空间中计算这些向量之间的相似度。 在本 实施例中, 可获取知识库中的知识信息的文本表征信息后, 采用编码模型对知识信息的文 本表征信息进行向量化处理, 并将处理得到的向量存入向量引擎。 在计算问询指令与任一 知识信息的文本表征信息的匹配度时, 可获取问询指令对应的向量以及该文本表征信息对 应的向量, 并通过向量计算获取问询指令对应的向量和该文本表征信息对应的向量之间的 相似度。 其 中, BM25 是一种基于统计的排名函数算法, 该算法通过对文档中的每个词进行加 权, 然后计算问询指令与文档之间的相似度来实现召回。 BM25算法的核心思想是根据词频 (TF)和逆文档频率(I DF) 来确定每个词的权重。 词频表示一个词在文档中出现的次数, 而逆文档频率则表示一个词在整个文档集合中的罕见程度 。 通过将这两个因素结合起来, BM25可以评估一个词在特定文档中的重要性, 并据此计算查询与文档之间的相似度。 其 中, TF- I DF是一种计算词频和逆文档频率, 并将这两个因素相乘以得到一个词在整 个文档集合中的重要性评分的算法。 在召回阶段, TF- I DF通过计算查询词 (即问询指令中 的词) 与文档中的词的 TF- I DF值来评估问询指令与文档之间的相似度, 从而实现召回。 其 中, 不同的召回算法, 可适用于召回不同模态的知识信息。 基于此, 在一些可选的 实施例中, 在根据问询指令对知识库进行检索时, 可采用多路召回的方式, 从知识库中检 索较佳知识信息。 以下将以该多个知识信息中的任一知识信息为例进行示例性说明。 可选地 , 在将问询指令与该知识信息的文本表征信息进行匹配度计算时, 可采用多种 召回算法对该知识信息的文本表征信息与该问询指令进行匹配度计算, 得到多个匹配度分 数。 其中, 当采用多种召回算法计算得到问询指令与同一知识信息的匹配度分数时, 不同 召回算法对应的匹配度分数的可靠性不 同, 即不同召回算法适用于不同模态的知识信息。 因此,在确定知识信息的模态时,可根据该多种召回算法与不同模态知识信息的适用关系, 确定该多种召回算法对应的权重系数。 例如, 若知识信息为文本段落, 则上述多种召回算 法的权重分别是 w1、 w2、 以及 w3 : 若知识信息为文本形态的表格, 则上述多种召回算法 的权重分别是 w4、 w5、 以及 w6; 若知识信息为图片形态的表格, 则上述多种召回算法的 权重分别是 w7、 w8、 以及 w9。 根据该多种召回算法对应的权重系数, 可对该多个匹配度 分数进行加权计算, 得到该问询指令与该知识信息的匹配度分数。 基 于上述实施方式获取该问询指令与知识库中的多个知识信息各自的匹配度分数后, 可根据该问询指令与该多个知识信息各自的匹配度分数, 可从该多个知识信息中确定与问 询指令匹配的目标知识信息。 其中, 目标知识信息, 可以是匹配度分数最高的一个知识信 息或者可以是匹配度分数较高的多个知识信息, 本实施例不做限制。 当目标知识信息包含 多个知识信息时, 该多个知识信息的模态可以相同或者不同。 基 于上述实施方式确定目标知识信息后, 可获取目标知识信息对应的内容解析文本, 并将该问询指令以及该目标知识信息对应的内容解析文本输入大语言模型。 在本实施例中 , 大语言模型, 是指参数量大于设定参数量阈值的大语言模型。 其中, 目标知识信息的内容 解析文本, 通过对该目标知识信息对应的目标文档元素进行内容解析得到, 该目标文档元 素包括非文本模态的文档元素。 在本实施例 中, 大语言模型的预训练过程中使用的训练语料包含大量的文本以及文本 形态的编码信息, 进而大语言模型能够理解文档元素的内容解析文本。 基于此, 将问询指 令以及目标知识信息对应的内容解析文本输入大语言模型之后, 大语言模型可根据学习到 的相关参数, 根据目标知识信息对应的内容解析文本输出与该问询指令适配的答复结果。
在 本实施例中, 获取到问询指令后, 可从知识库的多个知识信息中获取与问询指令匹 配的目标知识信息, 并将问询指令以及目标知识信息对应的内容解析文本输入大语言模型 进行问答处理。 其中, 目标知识信息对应的内容解析文本是通过对目标知识信息对应的目 标文档元素进行内容解析得到的, 当目标文档元素包括非文本模态的文档元素时, 在将目 标文档元素输入大语言模型之前对目标文档元素进行内容解析, 可使得目标文档元素中非 文本模态的文档元素能够被大语言模型理解, 以向大语言模型提供可靠性较高的问答参考 知识。 从而, 可提升大语言模型的知识理解能力以及问答处理能力, 提升大语言模型的对 问询指令的回答准确性。 在一 些可选的实施例中, 可根据多个文档样本, 构建或者更新知识库。 在这种实施方 式中, 可从多个文档样本中获取多个文档元素, 其中, 该多个文档元素对应多个不同的模 态。 其中, 该多个文档样本可以是多个不同应用领域中的各类文档, 以覆盖大语言模型的 多种应用场景中的各类知识。 获取多个文档样本包含的多个文档元素之后, 可将该多个文 档元素作为知识信息添加到知识库中。 可选地, 可对该多个文档元素进行表征处理, 得到 该多个文档元素各自的文本表征信息, 并保存该多个文档元素及其各自的文本表征信息的 对应关系。 其 中, 不同模态的文档元素的文本表征信息的获取方式不同。 以下将以该多个文档样 本中的任一文档样本为例, 对文档元素的表征处理操作进行示例性说明。 若该 文档样本包括文本段落, 则获取该文本段落的所在的文档的名称、 段落标题、 段 落内容、文档创建时间以及编辑时间中的至少一种信息,作为该文本段落的文本表征信息。 若该 文档样本包括文本形态的表格, 则获取该表格所在的文档的名称、 表格标题、 表 格内的关键内容、 文档创建时间以及编辑时间中的至少一种信息, 作为该表格的文本表征 信息。 其中, 表格的关键内容, 可以是表格中的部分字段。 若该 文档样本包括图片, 则获取该图片所在的文档名称、 图片标题、 从该图片中识别 的问题、 图片的描述信息、 文档创建时间以及编辑时间中的至少一种信息, 作为该图片的 文本表征信息。 其 中, 该多个文档元素及其各自的文本表征信息的对应关系, 可保存在知识库中, 或 者可保存在其他映射表中, 本实施例不做限制。 当根据问询指令对知识库进行检索时, 可 基于上述对应关系, 读取知识库中的每一文档元素的文本表征信息, 并计算问询指令和文 档元素的文本表征信息的匹配度。 值得说 明的是,在一些可选的实施例中,可对通用的大语言模型进行进一步增强训练, 以使得大语言模型更加适合多模态信息融合的检索式问答效果服务。 以下将对大语言模型 的增强训练过程进行示例性说明。 在本实施例中, 可将预训练的通用大语言模型作为基座 模型, 并采用多个不同领域中的文档样本对该基座模型进行继续预训练, 以训练基座模型 对文档元素的内容解析文本的理解能力。 在训练 大语言模型时, 可从多个文档样本中获取多个文档元素, 其中, 该多个文档元 素对应多个不同的模态。 其中, 该多个文档样本可以是多个不同应用领域中的文档, 以训 练大语言模型通用领域中的文档元素的理解能力。 获取多个文档元素后, 可根据该多个文 档元素各自对应的模态, 对该多个文档元素进行解析, 得到该多个文档元素各自对应的内 容解析文本。 以下将以任一文档样本为例, 对解析该文档样本中的文档元素的可选实施方 式进行示例性说明。 可选地, 若该文档样本包括文本段落, 则对该文本段落进行文本切割, 得到多个文本 块, 作为该文本段落对应的内容解析文本。 可选地, 若该文档样本包括文本形态的表格, 则识别该文本形态的表格中的文本内容 以及单元格之间的逻辑关系, 并根据识别到的文本内容以及逻辑关系进行编码, 得到编码 信息, 作为该文本形态的表格对应的内容解析文本。 在一些可选的实施例中, 可根据识别
到的文本 内容以及逻辑关系, 将文本形态的表格编码 为 htm l 编码、 l atex 编码以及 markdown编码中的至少一种。 大语言模型的预训练语料中通常包含了大量的 htm l 代码以 及 l atex代码等, 因此, 大语言模型对这类编码具有较佳的理解能力。 基于这种方式, 可 充分利用大语言模型对上述编码的理解能力, 将表格转化为编码, 从而使得大语言模型能 够理解表格数据。 可选地, 若该文档样本包括图片, 且该图片包括图片形态的表格, 则识别该图片形态 的表格中的文本内容以及单元格顶点的位置, 根据识别到的单元格顶点确定该图片形态的 表格中的单元格之间的逻辑关系, 并根据识别到的文本内容和逻辑关系进行编码, 得到编 码信息, 作为该图片形态的表格对应的内容解析文本。 在一些实施例中, 如图 2所示, 当 图片包括图片形态的表格时, 可以基于图像模型, 对该图片形态的表格进行编码。 在这种 实施方式中, 可基于图片形态的表格以及该表格对应的编码真值构造样本, 并根据构造的 样本对图像模型进行有监督训练, 从而使得图像模型学习从输入的图片形态的表格中识别 文本内容和逻辑关系, 并根据识别到的文本内容和逻辑关系进行编码的能力。 可选地, 若该文档样本包括图片, 且该图片不包括表格, 则从该图片中提取文本或者 根据该图片生成文本描述信息, 作为该图片对应的内容解析文本。 其中, 该图片通常是指 不包含表格的图片。 其中, 图片中提取文本的操作可通过 OCR技术实现。 根据图片生成文 本描述信息的操作, 可基于图生文模型实现。 如图 2所示, 当图片不包括图片时, 可通过 OCR 技术提取图片中的文本, 或者, 可通过图生文模型, 生成图片对应的文本描述信息。 当然, 在一些实施例中, 还可向用户展示该图片, 并获取用户根据该图片输入的文本描述 信息。 可选地, 可获取与该多个文档样本关联的多个问答对样本, 任一问答对样本包括一问 询指令样本以及对应的答复结果样本。 其中, 该问询指令样本, 用于模拟用户在实际应用 场景中发出的提问指令, 答复结果样本, 用于模拟大语言模型针对该问询指令给出的答复 结果。 其中, 该问答对样本, 可以由用户根据文档样本中的内容进行构造, 也可基于问答 模型进行自动生成。 在一些可选的实施例中, 可将该多个文档样本以及预设提示词输入问 答模型, 以使问答模型在提示词的指示下根据该多个文档样本中的文本内容生成多个问询 指令样本以及多个问询指令样本各自的答复结果样本。 可选地, 获取问答模型输出的多个 问询指令样本以及对应的答复结果样本后, 可由人工对该多个问询指令样本以及对应的答 复结果样本进行复核, 以提升问问答对样本的可靠性, 从而提升大语言模型的增强训练效 果。 基 于上述实施方式获取多个文档元素各 自对应的内容解析文本以及多个问答对样本 之后, 可根据所述多个文档元素各自对应的内容解析文本以及多个问答对样本, 获取多个 样本对。 其 中, 一个样本对可包括一个问答对样本以及至少一个文档元素对应的内容解析文本, 该至少一个文档元素对应的内容解析文本为生成该问答对样本所需的知识信息。 即, 基于 该样本对, 大语言模型可学习根据该至少一个文档元素对应的内容解析文本以及问答对样 本中的问询指令样本, 生成答复结果样本的能力。 在一 些可选的实施方式中, 可由人工根据问答对样本和文档元素的适配关系构造样本 对。 在另一些可选的实施方式中, 可由机器模型根据问答对样本和文档元素的适配关系构 造样本对。以下将以该多个问答对样本中的任一问答对样本为例进行示例性说明。可选地, 针对该问答对样本中的问询指令样本, 机器模型可采用设定召回算法, 从该多个文档样本 中确定与该问询指令样本匹配的目标文档样本。 其中, 该召回算法可以是前述实施例介绍 的向量召回算法, BM25 召回算法, TF- I DF 召回算法等。 确定目标文档样本后, 可根据该 目标文档样本包含的文档元素, 确定与该问询指令样本适配的文档元素。 在该步骤中, 机 器模型可计算目标文档中的每一文档元素与该问询指令样本的匹配度分数, 并根据匹配度 分数, 从该目标文档样本中确定与该问询指令样本适配的文档元素。 之后, 可将与该问询
指令样本适配的文档元素作为该问询指令对应的知识信息, 并根据该问询指令所属的问答 对样本以及该问询指令对应的知识信息的内容解析文本, 获取该问询指令样本对应的样本 对。 在一些可选的实施例中, 机器模型输出与该问询指令样本适配的文档元素后, 可由人 工进行复核, 以提升样本对的准确性。 在一 些可选的实施例中, 与该问询指令样本适配的文档元素可包含单一模态的文档元 素, 以模拟简单的问答场景。 例如, 与该问询指令样本适配的文档元素可以是文本段落、 文本形态的表格、 图片形态的表格或者图片。 在另一些可选的实施例中, 与该问询指令样 本适配的文档元素可包含至少两个不同模态的文档元素, 以模拟复杂的问答场景。 例如, 与该问询指令样本适配的文档元素可以是文本段落和图片的组合, 或者可以是文本段落和 图片形态的表格的组合, 或者, 可以是文本段落、 文本形态的表格以及图片的组合, 不再 — 列举 。 基 于上述实施方式获取多个样本对之后, 可根据该多个样本对, 对该大语言模型进行 训练。 值得说 明的是,为模拟不同的问答场景,可对大语言模型构造不同类型的任务。其中, 可通过在问询指令样本中添加与任 务类型对应的提示词, 来构造不同类型的任务。 其中, 任务类型可包括: 选择式问答任务、 总结式问答任务以及拒识式问答任务。 其中, 选择式 问答任务用于从输入的多个参考信息中选择一个参考信息作为答复结果。 其中, 总结式问 答任务用于对多个参考信息进行融合总结, 并将总结结果作为答复结果。 其中, 拒识式问 答任务, 用于在确定参考信息存在错误时, 拒绝回答或者使用兜底话术进行回答, 不再赘 述。 基 于上述训练方式使得基座模型收敛后, 可采用垂直领域中的文档样本对收敛后的模 型进行微调, 以使得微调后的模型对垂直领域中的问答任务具有更好的表现能力。 应当理 解, 在微调阶段, 可根据垂直领域中的文档, 采用上述实施方式构造与垂直领域中的特定 任务匹配的样本, 并可采用上述训练方法对模型进行训练, 以达到微调目的。 在微调后的 模型被投入使用之后, 可基于用户对模型输出的答复结果的反馈, 对微调后的模型进一步 强化学习, 以逐渐提升模型性能。 以下将结合图 3所示的架构流程图, 对本公开实施例提供的问答处理方法进行进一步 示例性说明。 如图 3所示, 问答处理框架主要包括: 知识获取模块、 文档解析模块、 信息 表征模块、 多路召回模块、 大模型问答模块以及增强训练模块。 知识获取模块 用于获取多模态文档。 其中, 多模态文档可包括但不限于 Txt, Word、 Pdf , Exce l , 图片、 网页等。 其中, 文档的内容可以分为文本段落、 文本形态的表格、 图 片形态的表格以及其他图片等不同内容形态, 任何一个文档可以包含上述一种或者多种不 同的内容形态。 在 文档解析模块中,可对各种形态的内容进行识别,并采用不同的处理步骤进行解析。 其中, 可根据不同的文档格式, 采用不同的形态识别方法。 比如, 对 Word 格式的文档, 可以使用一些 Word处理的工具包(比如基于 python语言或 java语言的工具包), 从 Word 中提取文本段落、 表格、 图片等。 以下将结合图 3所示的解析步骤进行示例性说明。 如图 3所示, 对多模态文档的解析操作可包括如下步骤:
1、 针对文本段落, 按段落或者固定的长度(比如 512 个字符)对文档进行切分, 得到 文本块。
2、 针对文本形态的表格, 抽取表格中的内容以及单元格之间的逻辑关系, 并采用一 种或者多钟编码方式对表格中的内容以及单元格之间的逻辑关系进行编码, 得到表格编码。
3、 针对图片形态的表格, 可利用图像模型抽取表格中的内容以及单元格之间的逻辑 关系, 并采用一种或者多钟编码方式对表格中的内容以及单元格之间的逻辑关系进行编码 , 得到表格编码。
4、 针对不包含表格的图片, 可利用图像模型提取图片中的文本信息或者采用图文生 成模型生成图片对应的文本描述信息。 或者, 还可采用人工编辑的方式生成图片对应的文 本描述信息 (未进行图示) 。 在信 息表征模块中, 可针对不同形态的内容, 采用不同的表征方式。 如图 3所示, 文 档信息表征操作可包括如下步骤:
5、 对于文本段落, 采用该段落所在的文档名称、 段落标题、 段落内容、 文档创建时 间以及编辑时间等信息作为该文本段落的文本表征信息。
6 和 7、 针对文本形态的表格和图片形态的表格, 可以采用该表格所在的文档名称、 表格标题、 表格内的关键内容(比如字段名称)、 文档创建时间以及编辑时间等信息作为该 表格的文本表征信息。
8、 对于包含表格的其他图片, 可以采用图片所在的文档名称、 图片标题、 图片中提 取到的文本、 图生文模型生成的文本描述信息、 人工编辑的描述、 文档创建时间以及编辑 时间等信息作为该图片的文本表征信息。 在 多路召回部分中, 可根据接收到的用户提问, 从前述步骤得到的信息表征中获取与 用户提问匹配的文本表征信息。 如图 3所示, 多路召回操作可包括如下步骤:
9、 采用多路召回以及融合打分的方式提供检索匹配服务。 其中, 多路召回的方式可 包括但不限于向量召回, BM25 召回, TF- I DF 等方式。 基于信息表征部分获取不同模态的 文档元素对应的文本表征信息后, 可采用编码模型对这些文本表征信息进行向量化计算, 并将计算得到的向量存入向量引擎。 在接收到用户提问后, 可根据用户问题, 分别使用多 种召回方式, 检索到与用户问题最相似的一个或者多个文档元素, 作为召回结果。
10、 对多路召回的结果进行融合打分, 再根据打分结果进行排序。 根据排序的结果从 召回的结果中选择得分最高的一个召回结果或者得分较高的若干个结果。 其中, 融合打分 的方式可以是基于权重公式的打分, 也可以使用排序模型(比如基于 bert 的双塔模型)进 行排序。 在 大模型问答模块中, 如图 3所示, 可执行步骤 11、 将用户提问以及得分最高的一个 召回结果或者得分较高的若干个结果输入到大语言模型, 以使大模型进行问答处理。 在增强训练模块 中, 可通过构造特定的样本和任务, 对通用的大语言模型执行继续预 训练操作、微调操作以及基于人类反馈的强化学习操作, 以进一步提升大模型的问答效果。 如 图 3所示, 增强训练模块通过执行以下步骤对大语言模型进行增强训练: 步骤 12、 基于多模态的样本数据, 对通用的大语言模型执行继续预训练操作。 例如, 可利用表格的编码信息对通用的大语言模型执行继续预训练, 以进一步提升大语言模型对 表格编码的理解能力。 在该 步骤中, 可根据应用场景构造样本对和问答任务。 其中, 符合应用场景的训练样 本,可以是融合了多模态信息的检索式问答样本。其中,任一样本对中的知识信息的模态, 可以是以下几种组合: 单纯的段落或者图片或者表格、 段落+表格、 段落+图片、 图片+表 格或者段落+图片+表格的组合,不再一一列举。其中, 问答任务可包括:选择式问答任务、 总结式问答任务或者拒识式问答任务。 其中, 在构造样本对时, 可采用人工方式整理样本 对。 或者, 可采用机器为主, 人工为辅的方式整理样本对。 在利用机器构造样本对时, 可 采用问答模型根据文档样本的内容生成一批问答对, 并使用问答对中的问题从文档库中召 回与该问题最相似的文档。 该最相似的文档, 可以作为该问答对应的知识信息。 根据该问 答对中的问题和召回的知识信息, 可构建样本对。 其中, 文档库中召回的文档后, 可由人 工辅助审核该问题与召回的文档是否匹配, 以提升生成的样本对的准确性。 步骤 13、 基于步骤 11 中构建的问答对, 对大语言模型进行微调提升。 步骤 14、 对微调后的大语言模型执行基于人类反馈的强化学习操作。 在该步骤中, 可
基于人类反馈数据,例如真实问答场景中的回流数据, 用户打分数据等训练一个打分模型。 在大语言模型每次输出答复结果后, 利用打分模型对该答复结果进行打分, 并根据打分结 果使用强化学习的方式对大模型进一步微调。 在这种实施 方式中, 对文本形态的表格以及图片形态的表格进行编码, 可完整地保留 表格的内容以及单元格的逻辑关系, 大幅提升了大语言模型对这类信息的理解效果。 对于 不包含表格的图片, 基于 OCR技术进行文本识别或者采用图生文模型生成图片的文本描述 信息, 可充分保留图片承载的信息, 使得大语言模型能够理解并充分利用不同的信息生成 答复结果。 基于该实施方式, 可使得数量更多且模态复杂的文档能够被应用在检索式问答 任务中, 从而扩展了知识信息的范围, 提升检索式问答的准确性。 需要说明的是,上述实施例所提供方法的各步骤的执行主体均可以是同一设备,或者, 该方法也由不同设备作为执行主体。比如,步骤 101至步骤 104的执行主体可以为设备 A; 又比如, 步骤 101和 102的执行主体可以为设备 A, 步骤 103的执行主体可以为设备 B; 等等。 另外, 在上述实施例及附图中的描述的一些流程中, 包含了按照特定顺序出现的多个 操作,但是应该清楚了解,这些操作可以不按照其在本文中出现的顺序来执行或并行执行, 操作的序号如 101、 102 等, 仅仅是用于区分开各个不同的操作, 序号本身不代表任何的 执行顺序。 另外, 这些流程可以包括更多或更少的操作, 并且这些操作可以按顺序执行或 并行执行。 需要说明的是, 本文中的 “第一 "、 "第二 "等描述, 是用于区分不同的消息、 设备、 模块等, 不代表先后顺序, 也不限定 “第一 ”和“第二”是不同的类型。 需要说明的是, 本公开所涉及的用户信息 (包括但不限于用户设备信息、 用户个人信 息等) 和数据 (包括但不限于用于分析的数据、 存储的数据、 展示的数据等) , 均为经用 户授权或者经过各方充分授权的信息和数据, 并且相关数据的收集、 使用和处理需要遵守 相关国家和地区的相关法律法规和标准, 并提供有相应的操作入口, 供用户选择授权或者 拒绝。 图 4示意了本公开一示例性实施例提供的电子设备的结构示意图, 如图 4所示, 该电 子设备包括: 存储器 401、 处理器 402以及通信组件 403。 存储器 401 , 用于存储计算机程序, 并可被配置为存储其它各种数据以支持在电子设 备上的操作。 这些数据的示例包括用于在电子设备上操作的任何应用程序或方法的指令。 处理器 402, 与存储器 401耦合, 用于执行存储器 401 中的计算机程序, 以用于: 接 收问询指令; 从知识库的多个知识信息中, 获取与所述问询指令匹配的目标知识信息; 获 取所述目标知识信息对应的内容解析文本, 所述内容解析文本通过对所述目标知识信息对 应的目标文档元素进行内容解析得到, 所述目标文档元素包括非文本模态的文档元素; 将 所述问询指令以及所述目标知识信息对应的内容解析文本输入大语言模型, 以使大语言模 型根据所述目标知识信息对应的内容解析文本输出与所述问询指令适配的答复结果。 可选地 , 处理器 402在从知识库的多个知识信息中, 获取与所述问询指令匹配的目标 知识信息时, 具体用于: 获取所述知识库中的多个知识信息各自的文本表征信息; 将所述 问询指令与所述多个知识信息各自的文本表征信息进行匹配度计算, 得到所述问询指令与 所述多个知识信息各自的匹配度分数; 根据所述问询指令与所述多个知识信息各自的匹配 度分数, 从所述多个知识信息中确定与问询指令匹配的所述目标知识信息。 可选地 , 处理器 402在将所述问询指令与所述多个知识信息各自的文本表征信息进行 匹配度计算, 得到所述问询指令与所述多个知识信息各自的匹配度分数时, 具体用于: 针 对所述多个知识信息中的任一知识信息, 采用多种召回算法对所述知识信息的文本表征信 息与所述问询指令进行匹配度计算, 得到多个匹配度分数; 根据所述知识信息的模态以及 所述多种召回算法与不同模态知识信息的适用关系, 确定所述多种召回算法对应的权重系 数; 根据所述多种召回算法对应的权重系数, 对所述多个匹配度分数进行加权计算, 得到
所述问询指令与所述知识信息的匹配度分数。 可选地 , 处理器 402 在获取所述知识库中的多个知识信息各自的文本表征信息之前, 还用于: 从多个文档样本中获取所述多个文档元素, 所述多个文档元素对应多个不同的模 态; 将所述多个文档元素作为知识信息添加到所述知识库中; 对所述多个文档元素进行表 征处理, 得到所述多个文档元素各自的文本表征信息, 并保存所述多个文档元素及其各自 的文本表征信息的对应关系。 可选地 , 处理器 402在对所述多个文档元素进行表征处理, 得到所述多个文档元素各 自的文本表征信息时, 具体用于: 针对所述多个文档样本中的任一文档样本, 若所述文档 样本包括文本段落, 则获取所述文本段落的所在的文档的名称、 段落标题、 段落内容、 文 档创建时间以及编辑时间中的至少一种信息, 作为所述文本段落的文本表征信息; 若所述 文档样本包括文本形态的表格, 则获取所述表格所在的文档的名称、 表格标题、 表格内的 关键内容、文档创建时间以及编辑时间中的至少一种信息,作为所述表格的文本表征信息; 若所述文档样本包括图片, 则获取所述图片所在的文档名称、 图片标题、 从所述图片中识 别的问题、 图片的描述信息、 文档创建时间以及编辑时间中的至少一种信息, 作为所述图 片的文本表征信息。 可选地 , 处理器 402还用于: 根据所述多个文档元素各自对应的模态, 对所述多个文 档元素进行解析, 得到所述多个文档元素各自对应的内容解析文本; 获取与所述多个文档 样本关联的多个问答对样本; 任一问答对样本包括一问询指令样本以及对应的答复结果样 本; 根据所述多个文档元素各自对应的内容解析文本以及所述多个问答对样本, 获取多个 样本对; 根据所述多个样本对, 对所述大语言模型进行训练。 可选地 , 处理器 402在根据所述多个文档样本中的文档元素各自对应的模态, 对所述 多个文档元素进行解析, 得到所述多个文档元素各自对应的内容解析文本时, 具体用于执 行以下至少一种操作: 针对所述多个文档样本中的任一文档样本, 若所述文档样本包括文 本段落, 则对所述文本段落进行文本切割, 得到多个文本块, 作为所述文本段落对应的内 容解析文本; 若所述文档样本包括文本形态的表格, 则识别所述文本形态的表格中的文本 内容以及单元格之间的逻辑关系, 并根据识别到的文本内容以及逻辑关系进行编码, 得到 编码信息, 作为所述文本形态的表格对应的内容解析文本; 若所述文档样本包括图片, 且 所述图片包括图片形态的表格, 则识别所述图片形态的表格中的文本内容以及单元格顶点 的位置, 根据识别到的单元格顶点确定所述图片形态的表格中的单元格之间的逻辑关系, 并根据识别到的文本内容和逻辑关系进行编码, 得到编码信息, 作为所述图片形态的表格 对应的内容解析文本; 若所述文档样本包括图片, 且所述图片不包括表格, 则从所述图片 中提取文本或者根据所述图片生成文本描述信息, 作为所述图片对应的内容解析文本。 可选地 ,处理器 402在获取与所述多个文档样本关联的多个问答对样本时,具体用于: 将所述多个文档样本以及预设提示词输入问答模型, 以使所述问答模型在所述提示词的指 示下根据所述多个文档样本中的文本内容生成所述多个问答对样本。 可选地 , 处理器 402在根据所述多个文档元素各自对应的内容解析文本以及所述多个 问答对样本, 获取多个样本对时, 具体用于: 针对所述多个问答对样本中的任一问询指令 样本, 采用设定召回算法, 从所述多个文档样本中确定与所述问询指令样本匹配的目标文 档样本; 根据所述目标文档样本包含的文档元素, 确定与所述问询指令样本适配的文档元 素; 将与所述问询指令样本适配的文档元素作为所述问询指令对应的知识信息, 并根据所 述问询指令所属的问答对样本以及所述问询指令对应的知识信息的内容解析文本, 获取所 述问询指令样本对应的样本对。 可选地 , 与所述问询指令样本适配的文档元素包含至少两个不同模态的文档元素。 进一 步, 如图 4所示, 该电子设备还包括: 电源组件 404、 显示组件 405以及音频组 件 406等其它组件。 图 4中仅示意性给出部分组件, 并不意味着电子设备只包括图 4所示 组件。
其 中,存储器 401可以由任何类型的易失性或非易失性存储设备或者它们的组合实现, 如静态随机存取存储器 (Static Random-Access Memory, SRAM) , 电可擦除可编程只读 存储器 (Electrical ly Erasab I e Programmab I e Read-On I y Memory , EEPROM) , 可擦除 可编程只读存储器 (Erasab I e Programmab I e Read-On I y Memory , EPROM) , 可编程只读 存储器 (Programmab I e Read-On I y Memory , PROM) , 只读存储器 (Read-On I y Memory , ROM) , 磁存储器, 快闪存储器, 磁盘或光盘。 其 中, 通信组件 403被配置为便于通信组件所在设备和其他设备之间有线或无线方式 的通信。 通信组件所在设备可以接入基于通信标准的无线网络, 如 Wi-Fi (无线网络通信 技术) , 2G (如全球移动通信系统 (Global System for Mob i I e Commun i cat i ons , GSM) 等) 、 3G (如宽带码分多址 (Wideband Code Division Multiple Access, WCDMA) 、 4G (如长期演进 (Long Term Evo I ut ion, LTE)等)、 4G+ (如升级版长期演进 (LTE-Advanced, LTE-A ) 等) 或 5G (第五代移动通信技术 (5th Generat i on Mob i I e Commun i cat i on Techno I ogy) ) , 或它们的组合。 在一个示例性实施例中, 通信组件经由广播信道接收来 自外部广播管理系统的广播信号或广播相关信息。 在一个示例性实施例中, 通信组件可基 于近场 通信 (Near Field Commun i cat i on , NFC ) 技术、 射频识别 (Radio Frequency I dent i f i cat i on, RFID) 技术、 红外数据协会 ( I rDA) 技术、 超宽带 (Ultra Wide Band, UWB) 技术、 蓝牙 (Bluetooth , BT) 技术和其他技术来实现。 其 中, 电源组件 404, 用于为电源组件所在设备的各种组件提供电力。 电源组件可以 包括电源管理系统, 一个或多个电源, 及其他与为电源组件所在设备生成、 管理和分配电 力相关联的组件。 其 中, 显示组件 405 包括屏幕, 其屏幕可以包括液晶显示器 (Liquid Crysta I Display , LCD) 和触摸面板 (Touch pane I , TP) 。 如果屏幕包括触摸面板, 屏幕可以被 实现为触摸屏, 以接收来自用户的输入信号。 触摸面板包括一个或多个触摸传感器以感测 触摸、 滑动和触摸面板上的手势。 所述触摸传感器可以不仅感测触摸或滑动动作的边界, 而且还检测与所述触摸或滑动操作相关的持续时间和压力。 其 中, 音频组件 406, 可被配置为输出和 /或输入音频信号。 例如, 音频组件包括一个 麦克风 (Microphone , MIC) , 当音频组件所在设备处于操作模式, 如呼叫模式、 记录模 式和语音识别模式时, 麦克风被配置为接收外部音频信号。 所接收的音频信号可以被进一 步存储在存储器或经由通信组件发送。 在一些实施例中, 音频组件还包括一个扬声器, 用 于输出音频信号。 本实施例 中, 获取到问询指令后, 可从知识库的多个知识信息中获取与问询指令匹酉己 的目标知识信息, 并将问询指令以及目标知识信息对应的内容解析文本输入大语言模型进 行问答处理。 其中, 其中, 目标知识信息对应的内容解析文本是通过对目标知识信息对应 的目标文档元素进行内容解析得到的, 当目标文档元素包括非文本模态的文档元素时, 在 将目标文档元素输入大语言模型之前对目标文档元素进行内容解析, 可使得目标文档元素 中非文本模态的文档元素能够被大语言模型理解, 以向大语言模型提供可靠性较高的问答 参考知识。 从而, 可提升大语言模型的知识理解能力以及问答处理能力, 提升大语言模型 的对问询指令的回答准确性。 相应地 , 本公开实施例还提供一种存储有计算机程序的计算机可读存储介质, 计算机 程序被执行时能够实现上述方法实施例中可由电子设备执行的各步骤。 相应地 , 本公开实施例还提供一种计算机程序产品, 包括计算机程序 /指令, 所述计 算机程序 /指令被处理器执行时能够实现本公开实施例提供的方法中的步骤。 本领域 内的技术人员应明白, 本公开的实施例可提供为方法、 系统、 或计算机程序产 品。 因此, 本公开可采用完全硬件实施例、 完全软件实施例、 或结合软件和硬件方面的实 施例的形式。 而且, 本公开可采用在一个或多个其中包含有计算机可用程序代码的计算机 可用存储介质 (包括但不限于磁盘存储器、 CD-ROM (Compact Di sc Read-0n I y Memory,
只读光盘只读存储器) 、 光学存储器等) 上实施的计算机程序产品的形式。 本公开是参照根据本公开实施例 的方法、 设备 (系统) 、 和计算机程序产品的流程图 和/ 或方框图来描述的。 应理解可由计算机程序指令实现流程图和/或方框图中的每一流 程和 /或方框、 以及流程图和 /或方框图中的流程和 /或方框的结合。 可提供这些计算机 程序指令到通用计算机、 专用计算机、 嵌入式处理机或其他可编程数据处理设备的处理器 以产生一个机器, 使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用 于实现在流程 图一个流程或多个流程和 /或方框图一个方框或多个方框中指定的功能的 装置。 这 些计算机程序指令也可存储在能引导计算机或其他 可编程数据处理设备以特定方 式工作的计算机可读存储器中, 使得存储在该计算机可读存储器中的指令产生包括指令装 置的制造品, 该指令装置实现在流程图一个流程或多个流程和 /或方框图一个方框或多个 方框中指定的功能。 这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上 , 使得在计算机 或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理, 从而在计算机或其他 可编程设备上执行 的指令提供用于实现在流程图一个流程或多个流程和 /或方框图一个 方框或多个方框中指定的功能的步骤。 在一个典型 的配置中, 计算设备包括一个或多个处理器 (Cent ra l Process i ng Un i t , CPU)、 输入 /输出接口、 网络接口和内存。 内存可能包括计算机可读介质中的非永久性存储器, 随机存取存储器 (RAM) 和 /或非 易失性内存等形式, 如只读存储器 (ROM) 或闪存(f l ash RAM) O 内存是计算机可读介质的 示例。 计算机可读介质 包括永久性和非永久性、 可移动和非可移动媒体可以由任何方法或技 术来实现信息存储。 信息可以是计算机可读指令、 数据结构、 程序的模块或其他数据。 计 算机的存储介质的例子 包括, 但不限于相变内存 (Para I I e I Random Access Mach i ne , PRAM)、 静态随机存取存储器 (SRAM)、 动态随机存取存储器 (Dynam i c Random Access Memory , DRAM)、 其他类型的随机存取存储器 (RAM)、 只读存储器 (ROM)、 电可擦除可编 程只读存储器 (EEPROM)、 快闪记忆体或其他内存技术、 只读光盘只读存储器 (CD-ROM)、 数字多功能光盘 (D i g i ta l V i deo D i sc , DVD) 或其他光学存储、 磁盒式磁带, 磁盘存储 或其他磁性存储设备或任何其他非传输介质, 可用于存储可以被计算设备访问的信息。 按 照本文中的界定, 计算机可读介质不包括暂存电脑可读媒体 (t rans i tory med i a) , 如调 制的数据信号和载波。 还 需要说明的是, 术语 “包括” 、 “包含”或者其任何其他变体意在涵盖非排他性的 包含, 从而使得包括一系列要素的过程、 方法、 商品或者设备不仅包括那些要素, 而且还 包括没有明确列出的其他要素, 或者是还包括为这种过程、 方法、 商品或者设备所固有的 要素。 在没有更多限制的情况下, 由语句 “包括一个 …… " 限定的要素, 并不排除在包括 所述要素的过程、 方法、 商品或者设备中还存在另外的相同要素。 以上所述仅为本公开的实施例而已,并不用于限制本公开。对于本领域技术人员来说, 本公开可以有各种更改和变化。凡在本公开的精神和原理之内所作的任何修改、等同替换、 改进等, 均应包含在本公开的权利要求范围之内。
Claims
1.一种问答处理方法, 包括: 接收 问询指令; 从知识库 的多个知识信息中, 获取与所述问询指令匹配的目标知识信息; 获取所述 目标知识信息对应的内容解析文本, 所述内容解析文本通过对所述目标知识 信息对应的目标文档元素进行内容解析得到, 所述目标文档元素包括非文本模态的文档元 素; 将所述 问询指令以及所述目标知识信息对应的内容解析文本输入大语言模型, 以使大 语言模型根据所述 目标知识信息对应的内容解析文本输出与所述问询指令适配 的答复结 果。
2.根据权利要求 1所述的方法, 其中, 从知识库的多个知识信息中, 获取与所述问询 指令匹配的目标知识信息, 包括: 获取所述知识库 中的多个知识信息各自的文本表征信息; 将所述 问询指令与所述多个知识信息各自的文本表征信息进行匹配度计算, 得到所述 问询指令与所述多个知识信息各自的匹配度分数; 根据所述 问询指令与所述多个知识信息各自的匹配度分数, 从所述多个知识信息中确 定与问询指令匹配的所述目标知识信息。
3. 根据权利要求 2 所述的方法, 其中, 将所述问询指令与所述多个知识信息各自的 文本表征信息进行匹配度计算, 得到所述问询指令与所述多个知识信息各自的匹配度分数, 包括: 针对所述 多个知识信息中的任一知识信息, 采用多种召回算法对所述知识信息的文本 表征信息与所述问询指令进行匹配度计算, 得到多个匹配度分数; 根据所述知识信 息的模态以及所述多种召回算法与不同模态知识信息的适用关系, 确 定所述多种召回算法对应的权重系数; 根据所述 多种召回算法对应的权重系数, 对所述多个匹配度分数进行加权计算, 得到 所述问询指令与所述知识信息的匹配度分数。
4.根据权利要求 2或 3所述的方法, 其中, 获取所述知识库中的多个知识信息各自的 文本表征信息之前, 还包括: 从 多个文档样本中获取所述多个文档元素, 所述多个文档元素对应多个不同的模态; 将所述 多个文档元素作为知识信息添加到所述知识库中; 对所述 多个文档元素进行表征处理, 得到所述多个文档元素各自的文本表征信息, 并 保存所述多个文档元素及其各自的文本表征信息的对应关系。
5.根据权利要求 4所述的方法, 其中, 对所述多个文档元素进行表征处理, 得到所述 多个文档元素各自的文本表征信息, 包括: 针对所述 多个文档样本中的任一文档样本, 若所述文档样本包括文本段落, 则获取所 述文本段落的所在的文档的名称、 段落标题、 段落内容、 文档创建时间以及编辑时间中的 至少一种信息, 作为所述文本段落的文本表征信息; 若所述文档样本包括文本形态的表格,则获取所述表格所在的文档的名称、表格标题、 表格内的关键内容、 文档创建时间以及编辑时间中的至少一种信息, 作为所述表格的文本 表征信息; 若所述文档样本包括 图片, 则获取所述图片所在的文档名称、 图片标题、 从所述图片 中识别的问题、 图片的描述信息、 文档创建时间以及编辑时间中的至少一种信息, 作为所
述图片的文本表征信息。
6.根据权利要求 4或 5所述的方法, 还包括: 根据所述 多个文档元素各自对应的模态, 对所述多个文档元素进行解析, 得到所述多 个文档元素各自对应的内容解析文本; 获取 与所述多个文档样本关联的多个问答对样本; 任一问答对样本包括一问询指令样 本以及对应的答复结果样本; 根据所述 多个文档元素各自对应的内容解析文本以及所述多个问答对样本, 获取多个 样本对; 根据所述 多个样本对, 对所述大语言模型进行训练。
7.根据权利要求 6所述的方法, 其中, 根据所述多个文档样本中的文档元素各自对应 的模态,对所述多个文档元素进行解析,得到所述多个文档元素各自对应的内容解析文本, 包括以下至少一种: 针对所述 多个文档样本中的任一文档样本, 若所述文档样本包括文本段落, 则对所述 文本段落进行文本切割, 得到多个文本块, 作为所述文本段落对应的内容解析文本; 若所述 文档样本包括文本形态的表格, 则识别所述文本形态的表格中的文本内容以及 单元格之间的逻辑关系,并根据识别到的文本内容以及逻辑关系进行编码,得到编码信息 , 作为所述文本形态的表格对应的内容解析文本; 若所述 文档样本包括图片, 且所述图片包括图片形态的表格, 则识别所述图片形态的 表格中的文本内容以及单元格顶点的位置, 根据识别到的单元格顶点确定所述图片形态的 表格中的单元格之间的逻辑关系, 并根据识别到的文本内容和逻辑关系进行编码, 得到编 码信息, 作为所述图片形态的表格对应的内容解析文本; 若所述 文档样本包括图片, 且所述图片不包括表格, 则从所述图片中提取文本或者根 据所述图片生成文本描述信息, 作为所述图片对应的内容解析文本。
8.根据权利要求 6或 7所述的方法, 其中, 获取与所述多个文档样本关联的多个问答 对样本, 包括: 将所述 多个文档样本以及预设提示词输入问答模型, 以使所述问答模型在所述提示词 的指示下根据所述多个文档样本中的文本内容生成所述多个问答对样本。
9.根据权利要求 6-8任一项所述的方法, 其中, 根据所述多个文档元素各自对应的内 容解析文本以及所述多个问答对样本, 获取多个样本对, 包括: 针对所述 多个问答对样本中的任一问询指令样本, 采用设定召回算法, 从所述多个文 档样本中确定与所述问询指令样本匹配的目标文档样本; 根据 所述目标文档样本包含的文档元素, 确定与所述问询指令样本适配的文档元素; 将 与所述问询指令样本适配的文档元素作为所述问询指令对应的知识信息, 并根据所 述问询指令所属的问答对样本以及所述问询指令对应的知识信息的内容解析文本, 获取所 述问询指令样本对应的样本对。
10.根据权利要求 9 所述的方法, 其中, 与所述问询指令样本适配的文档元素包含至 少两个不同模态的文档元素。
11. -种电子设备, 其中, 包括: 存储器和处理器; 所述存储 器用于存储一条或多条计算机指令; 所述处理 器用于执行所述一条或多条计算机指令以用于: 执行权利要求 1-10 任一项 所述的方法中的步骤。
12. -种存储有计算机程序的计算机可读存储介质, 其中, 计算机程序被处理器执行 时能够实现权利要求 1-10任一项所述的问答处理方法。
13. —种计算机程序产品, 包括计算机程序 /指令, 其中, 所述计算机程序 /指令被处 理器执行时能够实现权利要求 1-10任一项所述的问答处理方法。
16
Applications Claiming Priority (2)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202410232704.5 | 2024-02-29 | ||
| CN202410232704.5A CN120611008A (zh) | 2024-02-29 | 2024-02-29 | 问答处理方法、设备、产品及存储介质 |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| WO2025181561A1 true WO2025181561A1 (zh) | 2025-09-04 |
Family
ID=96920051
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| PCT/IB2025/050138 Pending WO2025181561A1 (zh) | 2024-02-29 | 2025-01-07 | 问答处理方法、设备、产品及存储介质 |
Country Status (2)
| Country | Link |
|---|---|
| CN (1) | CN120611008A (zh) |
| WO (1) | WO2025181561A1 (zh) |
Cited By (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN120804234A (zh) * | 2025-09-12 | 2025-10-17 | 浙江大华技术股份有限公司 | 知识库构建方法、装置、计算机设备和存储介质 |
| CN120910223A (zh) * | 2025-09-30 | 2025-11-07 | 浙江阿里商旅旅行社有限公司 | 一种基于llm的商旅服务管理方法和计算机设备 |
| CN120929580A (zh) * | 2025-10-14 | 2025-11-11 | 支付宝(杭州)数字服务技术有限公司 | 一种通过大语言模型获取问题答复的方法和装置 |
| CN121350183A (zh) * | 2025-12-19 | 2026-01-16 | 中信建投证券股份有限公司 | 一种支持使用跨模态信息的检索方法及系统 |
Citations (6)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20220382805A1 (en) * | 2021-05-24 | 2022-12-01 | Samsung Electronics Co., Ltd. | Information retrieval system and method of information retrieval |
| CN117009113A (zh) * | 2023-09-04 | 2023-11-07 | 平安银行股份有限公司 | 人工智能模型的调用方法、装置、计算机设备及存储介质 |
| WO2023242540A1 (en) * | 2022-06-13 | 2023-12-21 | Eigen Technologies Ltd. | Methods and systems for transforming and retrieving information from document data using machine learning |
| CN117556038A (zh) * | 2023-11-30 | 2024-02-13 | 新奥新智科技有限公司 | 一种图表的描述文本生成方法、装置、设备及介质 |
| CN117573842A (zh) * | 2024-01-12 | 2024-02-20 | 阿里云计算有限公司 | 文档检索方法以及自动问答方法 |
| CN117609477A (zh) * | 2024-01-22 | 2024-02-27 | 亚信科技(中国)有限公司 | 一种基于领域知识的大模型问答方法和装置 |
-
2024
- 2024-02-29 CN CN202410232704.5A patent/CN120611008A/zh active Pending
-
2025
- 2025-01-07 WO PCT/IB2025/050138 patent/WO2025181561A1/zh active Pending
Patent Citations (6)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20220382805A1 (en) * | 2021-05-24 | 2022-12-01 | Samsung Electronics Co., Ltd. | Information retrieval system and method of information retrieval |
| WO2023242540A1 (en) * | 2022-06-13 | 2023-12-21 | Eigen Technologies Ltd. | Methods and systems for transforming and retrieving information from document data using machine learning |
| CN117009113A (zh) * | 2023-09-04 | 2023-11-07 | 平安银行股份有限公司 | 人工智能模型的调用方法、装置、计算机设备及存储介质 |
| CN117556038A (zh) * | 2023-11-30 | 2024-02-13 | 新奥新智科技有限公司 | 一种图表的描述文本生成方法、装置、设备及介质 |
| CN117573842A (zh) * | 2024-01-12 | 2024-02-20 | 阿里云计算有限公司 | 文档检索方法以及自动问答方法 |
| CN117609477A (zh) * | 2024-01-22 | 2024-02-27 | 亚信科技(中国)有限公司 | 一种基于领域知识的大模型问答方法和装置 |
Cited By (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN120804234A (zh) * | 2025-09-12 | 2025-10-17 | 浙江大华技术股份有限公司 | 知识库构建方法、装置、计算机设备和存储介质 |
| CN120910223A (zh) * | 2025-09-30 | 2025-11-07 | 浙江阿里商旅旅行社有限公司 | 一种基于llm的商旅服务管理方法和计算机设备 |
| CN120929580A (zh) * | 2025-10-14 | 2025-11-11 | 支付宝(杭州)数字服务技术有限公司 | 一种通过大语言模型获取问题答复的方法和装置 |
| CN121350183A (zh) * | 2025-12-19 | 2026-01-16 | 中信建投证券股份有限公司 | 一种支持使用跨模态信息的检索方法及系统 |
Also Published As
| Publication number | Publication date |
|---|---|
| CN120611008A (zh) | 2025-09-09 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN113807098B (zh) | 模型训练方法和装置、电子设备以及存储介质 | |
| CN110765247B (zh) | 一种用于问答机器人的输入提示方法及装置 | |
| CN112287069B (zh) | 基于语音语义的信息检索方法、装置及计算机设备 | |
| CN111524593B (zh) | 基于上下文语言模型和知识嵌入的医疗问答方法及系统 | |
| CN107220352A (zh) | 基于人工智能构建评论图谱的方法和装置 | |
| CN114861640B (zh) | 文本摘要模型的训练方法及装置 | |
| CN116881425A (zh) | 一种通用型文档问答实现方法、系统、设备及存储介质 | |
| CN120611008A (zh) | 问答处理方法、设备、产品及存储介质 | |
| CN119829764A (zh) | 文本划分方法、装置、电子设备 | |
| CN119886332A (zh) | 基于大语言模型的问答方法、装置及电子设备、计算机程序产品 | |
| CN118070072A (zh) | 基于人工智能的问题处理方法、装置、设备及存储介质 | |
| CN114003693A (zh) | 题目解答方法、模型训练方法及其设备、程序产品 | |
| US20250252320A1 (en) | Improvement of ai predictions using context localization | |
| CN118093796B (zh) | 一种多轮对话方法、装置、设备及存储介质 | |
| CN120508609A (zh) | 答复文本生成方法、装置、计算机设备及存储介质 | |
| KR20260017461A (ko) | 문서 요약 방법 및 문서 요약 장치 | |
| CN116932727A (zh) | 一种文档应答方法、装置、设备和存储介质 | |
| CN119739874A (zh) | 一种环保监测评价领域垂直大模型的本地构建方法及装置 | |
| WO2024245081A1 (zh) | 模型的训练方法、文本处理方法及相关设备 | |
| CN118606450A (zh) | 问答处理方法、表单数据的输入方法及对应装置 | |
| CN114153947B (zh) | 一种文档处理方法、装置、设备及存储介质 | |
| WO2026056656A1 (zh) | 任务处理方法、文档对话方法以及文档处理方法 | |
| WO2025236899A1 (zh) | 数据处理方法及装置、文档数据处理方法及装置 | |
| Karthick et al. | Interactive Legal Assistance System using Large Language Models | |
| Zhang et al. | Improving multilingual temporal answering grounding in single video via LLM-based translation and OCR enhancement |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| 121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 25761747 Country of ref document: EP Kind code of ref document: A1 |